language stringclasses 1
value | code stringlengths 407 33.3k | instruction stringclasses 1
value | flaws listlengths 1 17 | flaw_count int64 1 17 |
|---|---|---|---|---|
python | import json
import requests
from utils import get_secret
from utils import is_pro
def send_slack(text="", channel="test", blocks=None):
assert channel in ["test", "events", "general"]
webhook = get_secret(f"SLACK_WEBHOOK_{channel.upper()}")
data = {"text": text}
if blocks:
data["blocks"] ... | Review this code and list any quality issues. | [
{
"issue": "Function 'slack_state_handler' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 26
}
] | 1 |
python | import torch
import torch.nn.functional as F
from torch.nn import Module
from torch_geometric.nn.conv import *
gnn_list = [
"gat_8", # GAT with 8 heads
"gat_6", # GAT with 6 heads
"gat_4", # GAT with 4 heads
"gat_2", # GAT with 2 heads
"gat_1", # GAT with 1 heads
"gcn", # GCN
"cheb", ... | Review this code and list any quality issues. | [
{
"issue": "Function 'act_map' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 27
},
{
"issue": "Function 'gnn_map' has cyclomatic complexity 14 (threshold: 5). Consider breaking it into smaller functions.",
"severity": ... | 4 |
python | from archspee.presenters import PresenterBase
from archspee.listeners import ListenerStatus
_LOG_LEVEL = None
class LogPresenter(PresenterBase):
def __init__(self, action_callback, **kwargs):
self.__log_level = _LOG_LEVEL
super(LogPresenter, self).__init__(action_callback)
self.status = Li... | Review this code and list any quality issues. | [
{
"issue": "Function 'on_intent_handled' has 8 parameters. Consider using a parameter object to reduce arity.",
"severity": "critical",
"line": 22
},
{
"issue": "Function 'on_error_handled' has 7 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line"... | 2 |
python | """
Copyright 2020 The OneFlow 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 applicable law or agr... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 30
},
{
"issue": "Function 'load_state_dict.cast' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
... | 6 |
python | # -*- coding: utf-8 -*-
# *****************************************************************************
# NICOS, the Networked Instrument Control System of the MLZ
# Copyright (c) 2009-2022 by the NICOS contributors (see AUTHORS)
#
# This program is free software; you can redistribute it and/or modify it under
# the t... | Review this code and list any quality issues. | [
{
"issue": "Function 'doIsAllowed' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 102
}
] | 1 |
python | #!/usr/bin/env python
from csvitself import csv2csv
from fixed import fixed2csv
from js import json2csv
from xls import xls2csv
SUPPORTED_FORMATS = ['fixed', 'xls', 'csv']
def convert(f, format, schema=None, key=None, **kwargs):
"""
Convert a file of a specified format to CSV.
"""
if not f:
r... | Review this code and list any quality issues. | [
{
"issue": "Function 'convert' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 10
},
{
"issue": "Function 'convert' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": ... | 3 |
python | # coding=utf-8
from geoist.snoopy.algorithms.correlator_algorithms import CorrelatorAlgorithm
from geoist.snoopy.modules.correlation_result import CorrelationResult
from geoist.snoopy.constants import (DEFAULT_SHIFT_IMPACT,
DEFAULT_ALLOWED_SHIFT_SECONDS)
class CrossCorrelator(Correlato... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 15
},
{
"issue": "Function '_detect_correlation' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",... | 4 |
python | # ======================================================================
# Amplification Circuit
# Advent of Code 2019 Day 07 -- Eric Wastl -- https://adventofcode.com
#
# Computer simulation by Dr. Dean Earl Wright III
# ======================================================================
# ======================... | 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": 37
},
{
"issue": "Function 'find_best' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line... | 4 |
python | import os
import copy
def is_similar(s1, s2):
count = 0.0
for token in s1.split(' '):
if token in s2:
count += 1
# if count / len(s1.split(' ')) >= 0.7 and abs(len(s1.split(' '))-len(s2.split(' '))<5):
if count / len(s1.split(' ')) >= 0.7 and count / len(s2.split(' ')) >= 0.7:
... | Review this code and list any quality issues. | [
{
"issue": "Function 'refactor_chinese_dataset' has cyclomatic complexity 11 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 103
},
{
"issue": "Function 'refactor_chinese_dataset' is 42 lines long. Functions over 25 lines are harder to test and maintai... | 2 |
python | # Lint as: python3
r"""Code example for a custom model, using PyTorch.
This demo shows how to use a custom model with LIT, in just a few lines of code.
We'll use a transformers model, with a minimal amount of code to implement the
LIT API. Compared to models/glue_models.py, this has fewer features, but the
code is mor... | Review this code and list any quality issues. | [
{
"issue": "Function 'predict_minibatch' has cyclomatic complexity 11 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 91
},
{
"issue": "Function 'predict_minibatch' is 45 lines long. Functions over 25 lines are harder to test and maintain.",
"sever... | 2 |
python | # coding=utf8
import os
from threading import Thread
try:
from queue import Queue, Empty as QueueEmpty
except ImportError:
from Queue import Queue, Empty as QueueEmpty
import requests
import logging
import traceback
error_logger = logging.getLogger('error')
error_logger.setLevel(logging.ERROR)
ERROR_STATU... | Review this code and list any quality issues. | [
{
"issue": "Function 'start_crawl' has cyclomatic complexity 13 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 142
}
] | 1 |
python | import sys
import math
import pathlib
import bpy
import mathutils
from PIL import Image
modelDir = pathlib.Path(__file__).parent.absolute()
scn = bpy.context.scene
images_created = 0
def update_camera(camera, focus_point=mathutils.Vector((0.0, 0.0, 0.0)), distance=10.0):
"""
Focus the camera to a focus point... | Review this code and list any quality issues. | [
{
"issue": "Function 'renderDuck' is 77 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 74
}
] | 1 |
python | # -*- coding: utf-8 -*-
import scrapy
import json
import re
from locations.items import GeojsonPointItem
class McDonaldsHUSpider(scrapy.Spider):
name = "mcdonalds_hu"
allowed_domains = ["www.mcdonalds.hu"]
start_urls = (
'https://www.mcdonalds.hu/ettermeink',
)
def store_hours(self, data... | Review this code and list any quality issues. | [
{
"issue": "Function 'store_hours' has cyclomatic complexity 13 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 16
},
{
"issue": "Function 'store_hours' is 48 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major... | 2 |
python | # flake8: noqa
# pylint: disable
from __future__ import annotations
import dataclasses
import io
import pprint
import sys
from enum import Enum
from typing import Any, BinaryIO, Dict, List, Tuple, Type, Callable, Optional, Iterator
from blspy import G1Element, G2Element, PrivateKey
from wheat.types.blockchain_format... | Review this code and list any quality issues. | [
{
"issue": "Function 'dataclass_from_dict' has cyclomatic complexity 12 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 52
},
{
"issue": "Function 'recurse_jsonify' has cyclomatic complexity 21 (threshold: 5). Consider breaking it into smaller function... | 7 |
python | from os import path
from shutil import make_archive
import os
from json import load, dump
PLUGINEXTENSION = '.epf'
DESCRIPTIONNAME = 'description'
def packPluginFromFolder(folderPath):
folderPath = path.abspath(folderPath)
if not path.exists(folderPath):
raise FileNotFoundError('the folder does not ... | 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": 30
}
] | 1 |
python | #!/usr/bin/env python3
# This code greatly inspires itself from http://aosabook.org/en/500L/a-web-crawler-with-asyncio-coroutines.html
import cgi
from collections import namedtuple
import os
import re
import logging
import urllib
import asyncio
import aiohttp
from asyncio import Queue
import time
LOGGER = logging.get... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 35
},
{
"issue": "Function '__init__' is 36 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical"... | 8 |
python | # Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use th... | Review this code and list any quality issues. | [
{
"issue": "Function 'transform' has cyclomatic complexity 14 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 40
},
{
"issue": "Function 'transform' is 34 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
... | 2 |
python | # coding=utf-8
"""
Send metrics to a [graphite](http://graphite.wikidot.com/) using the default
interface.
Graphite is an enterprise-scale monitoring tool that runs well on cheap
hardware. It was originally designed and written by Chris Davis at Orbitz in
2006 as side project that ultimately grew to be a foundational... | Review this code and list any quality issues. | [
{
"issue": "Function '_send' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 138
},
{
"issue": "Function '_send' is 26 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line... | 4 |
python |
import calendar
import datetime
import json
import os
import os.path
import shutil
import tqdm
import traceback
from concurrent.futures import ThreadPoolExecutor
import urllib.error
import urllib.parse
from sqlalchemy import and_
from sqlalchemy import or_
import sqlalchemy.exc
if __name__ == "__main__":
import lo... | Review this code and list any quality issues. | [
{
"issue": "Function 'exposed_fix_nu_duplicate_url_segments' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 102
},
{
"issue": "Function 'exposed_fix_nu_duplicate_url_segments' is 33 lines long. Functions over 25 lines are h... | 2 |
python | # coding: utf-8
import re
import six
from huaweicloudsdkcore.sdk_response import SdkResponse
from huaweicloudsdkcore.utils.http_utils import sanitize_for_serialization
class ListCaseLabelsResponse(SdkResponse):
"""
Attributes:
openapi_types (dict): The key is attribute name
... | Review this code and list any quality issues. | [
{
"issue": "Function 'to_dict' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 65
}
] | 1 |
python | import arrow
from config.app import celery_app, app
from models.container_image_registry import RegistryCredential
from models.scheduler import Scheduler
from models.setting import Setting
from croniter import croniter
from utils import constants
import time
from datetime import datetime
from utils.helper import websoc... | Review this code and list any quality issues. | [
{
"issue": "Function 'run_node_task' has cyclomatic complexity 66 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 37
},
{
"issue": "Function 'run_node_task' is 297 lines long. Functions over 25 lines are harder to test and maintain.",
"severity"... | 2 |
python | '''
Created on 08.04.2019
@author: mort
ipywidget interface to the GEE for IR-MAD
'''
import ee, time, warnings, math
import ipywidgets as widgets
from IPython.display import display
from ipyleaflet import (Map,DrawControl,TileLayer,
basemaps,basemap_to_tiles,
LayersCo... | Review this code and list any quality issues. | [
{
"issue": "Function 'on_collect_button_clicked' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 160
},
{
"issue": "Function 'on_collect_button_clicked' is 86 lines long. Functions over 25 lines are harder to test and maint... | 4 |
python | #!/usr/bin/python
# Copyright 2001 Dave Abrahams
# Copyright 2011 Steven Watanabe
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE.txt or copy at
# https://www.bfgroup.xyz/b2/LICENSE.txt)
import BoostBuild
def simple_args(start, finish):
return " : ".join("%d" % x fo... | Review this code and list any quality issues. | [
{
"issue": "Function 'test' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 16
}
] | 1 |
python | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import time
import argparse
import sys
import numpy as np
import torch
import torch.optim as optim
from tqdm import tqdm
from network.BEV_Unet import BEV_Unet
from network.ptBEV import ptBEVnet
from dataloader.dataset import collate_fn_BEV,collate_fn_BEV_test,Se... | Review this code and list any quality issues. | [
{
"issue": "Function 'main' has cyclomatic complexity 19 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 54
},
{
"issue": "Function 'main' is 105 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical",
... | 2 |
python | # -*- coding: utf-8 -*-
#
# Copyright 2018-2020 Data61, CSIRO
#
# 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 '__init__' has cyclomatic complexity 16 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 63
},
{
"issue": "Function '__init__' is 64 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical... | 8 |
python | import requests as req
from bs4 import BeautifulSoup as bs
import os
def clearConsole():
command = 'clear'
if os.name in ('nt', 'dos'): # If Machine is running on Windows, use cls
command = 'cls'
os.system(command)
def soup_recover(url):
request = req.get(url)
return bs(request.text,featu... | Review this code and list any quality issues. | [
{
"issue": "Function 'export_csv' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 49
}
] | 1 |
python | from state.machine import BaseState
from helper import *
import state
class GoHomeState(BaseState):
def action(self, game_state):
my_pos = game_state_helper.get_my_position(game_state)
poids, next_move = game_state_helper.get_home(game_state)
if not next_move:
vector = game_... | Review this code and list any quality issues. | [
{
"issue": "Function 'action' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 7
}
] | 1 |
python | #!/usr/bin/python
# -*- coding: utf-8 -*-
# __author__ : stray_camel
# __description__ : trans_0_1
# __REFERENCES__ : https://blog.csdn.net/qq_42544196/article/details/106468658;https://docs.python.org/3/library/logging.html
# __date__: 2020/12/11 15
import datetime
import logging
from pathlib import Path
import random... | Review this code and list any quality issues. | [
{
"issue": "Function '_fanyi_word' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 114
}
] | 1 |
python | # coding=utf-8
# Copyright 2019 The TensorFlow Datasets 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 appl... | Review this code and list any quality issues. | [
{
"issue": "Function '_generate_random_array' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 130
}
] | 1 |
python | # -*- coding: utf-8 -*-
#
# Copyright © Spyder Project Contributors
# Licensed under the terms of the MIT License
#
"""Tests for autosave.py"""
# Standard library imports
import ast
import os.path as osp
# Third party imports
import pytest
# Local imports
from spyder.plugins.editor.utils.autosave import (AutosaveFor... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_autosave_file_renamed' is 30 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 285
}
] | 1 |
python | from rocon_client_sdk_py.virtual_core.actions.base import Action
import asyncio
import pydash
from rocon_client_sdk_py.virtual_core.path_planner import PathPlanner
class Dock(Action):
def __init__(self):
self.name = 'Dock'
self.func_name = 'dock'
async def on_define(self, context):
pr... | Review this code and list any quality issues. | [
{
"issue": "Function 'on_perform' is 31 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 37
}
] | 1 |
python | import cv2
import numpy as np
import os
subjects = ["","Mama","Samin","Delwar"]
def detect_faces(colored_img, scaleFactor=1.06):
img_copy = colored_img.copy()
gray = cv2.cvtColor(img_copy, cv2.COLOR_BGR2GRAY)
f_cascade = cv2.CascadeClassifier('data/lbpcascade_frontalface.xml')
faces = f_cascade.dete... | Review this code and list any quality issues. | [
{
"issue": "Function 'prepare_training_data' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 20
},
{
"issue": "Function 'prepare_training_data' is 27 lines long. Functions over 25 lines are harder to test and maintain.",
... | 3 |
python | import os
import torch
import torch.nn.functional as F
import glob
import numpy as np
from torch.optim import Adam
from utils.utils import soft_update, hard_update
from utils.model import GaussianPolicy, QNetwork, DeterministicPolicy
from keras.models import Sequential, Model
from keras.layers import Dense, Dropout, In... | 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": 84
},
{
"issue": "Function '__init__' is 45 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
... | 6 |
python | import operator
from importlib import resources
from typing import List, Tuple, Generator
from pyswip import Prolog # type: ignore
from mockdown.constraint import ConstraintKind
from mockdown.constraint.factory import ConstraintFactory
from mockdown.model import Attribute, IView, IAnchor, AnchorID
from mockdown.cons... | Review this code and list any quality issues. | [
{
"issue": "Function 'valid_constraints' has cyclomatic complexity 21 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 14
},
{
"issue": "Function 'valid_constraints' is 62 lines long. Functions over 25 lines are harder to test and maintain.",
"se... | 2 |
python | """
Code to support database helper scripts (create_db.py, manage_db.py, etc...).
"""
import argparse
import logging
import os
import sys
from migrate.versioning.shell import main as migrate_main
from galaxy.util.path import get_ext
from galaxy.util.properties import find_config_file, get_data_dir, load_app_propertie... | Review this code and list any quality issues. | [
{
"issue": "Function '_read_model_arguments' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 61
},
{
"issue": "Function '_read_model_arguments' is 27 lines long. Functions over 25 lines are harder to test and maintain.",
... | 3 |
python | import csv
import time
from collections import defaultdict
from scapy.sessions import DefaultSession
from scapy.all import wrpcap
from .features.context.packet_direction import PacketDirection
from .features.context.packet_flow_key import get_packet_flow_key
from .flow import Flow
EXPIRED_UPDATE = 40
MACHINE_LEARNIN... | Review this code and list any quality issues. | [
{
"issue": "Function 'on_packet_received' has cyclomatic complexity 16 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 41
},
{
"issue": "Function 'on_packet_received' is 45 lines long. Functions over 25 lines are harder to test and maintain.",
"... | 3 |
python | # -*- coding: utf-8 -*-
import argparse
import torch
import torch.nn.functional as F
from torch.utils.data import DataLoader
from torch.autograd import Variable
from tqdm import tqdm
from models.protonet_embedding import ProtoNetEmbedding
from models.R2D2_embedding import R2D2Embedding
from models.ResNet12_embeddin... | Review this code and list any quality issues. | [
{
"issue": "Function 'get_model' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 25
},
{
"issue": "Function 'get_model' is 27 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
... | 3 |
python |
import torch
from tqdm import tqdm
from transformers import AutoTokenizer, AutoModel
import logging
from torch.nn import ConstantPad3d, ConstantPad2d
from layers.utils import set_model_device, set_tensor_device
'''
tutorial4 tokenization
https://mccormickml.com/2019/07/22/BERT-fine-tuning/
how to use clinical ... | Review this code and list any quality issues. | [
{
"issue": "Function 'tokenize_documents' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 35
},
{
"issue": "Function 'tokenize_documents' is 52 lines long. Functions over 25 lines are harder to test and maintain.",
"s... | 6 |
python | import os
import re
from django import forms
from django.conf import settings
from django.core.files.storage import default_storage as storage
from django.utils.translation import ugettext as _, ugettext_lazy as _lazy
import commonware.log
from olympia import amo
from olympia.accounts.views import fxa_error_message
... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has cyclomatic complexity 12 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 84
},
{
"issue": "Function '__init__' is 31 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
... | 3 |
python | #!/usr/bin/env python
import rospy
from scipy.spatial import KDTree
from std_msgs.msg import Int32
from geometry_msgs.msg import PoseStamped, Pose
from styx_msgs.msg import TrafficLightArray, TrafficLight
from styx_msgs.msg import Lane
from sensor_msgs.msg import Image
from cv_bridge import CvBridge
from light_classifi... | Review this code and list any quality issues. | [
{
"issue": "Function 'process_traffic_lights' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 135
}
] | 1 |
python | ##############################################################################
# Copyright (c) 2016 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.... | 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": 23
}
] | 1 |
python | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_get_conn_uri' is 31 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 27
},
{
"issue": "Function 'test_get_conn_uri_engine_version_1' is 27 lines long. Functions over 25 lines are harder to test and maintain.",
"sev... | 6 |
python | """Gosper's algorithm for hypergeometric summation. """
from sympy.core import S, Dummy, symbols
from sympy.core.compatibility import is_sequence
from sympy.polys import Poly, parallel_poly_from_expr, factor
from sympy.solvers import solve
from sympy.simplify import hypersimp
def gosper_normal(f, g, n, polys=True):
... | Review this code and list any quality issues. | [
{
"issue": "Function 'gosper_normal' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 10
},
{
"issue": "Function 'gosper_term' has cyclomatic complexity 13 (threshold: 5). Consider breaking it into smaller functions.",
"s... | 4 |
python | # -*- coding: utf-8 -*-
# Copyright (c) 2014, 2020, Oracle and/or its affiliates.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License, version 2.0, as
# published by the Free Software Foundation.
#
# This program is also distributed with certa... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_get_auth_plugin' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 56
},
{
"issue": "Function 'test_auth_response' is 68 lines long. Functions over 25 lines are harder to test and maintain.",
"se... | 3 |
python | from pymclevel import alphaMaterials, MCSchematic, MCLevel, BoundingBox
from pymclevel.box import Vector
from mcplatform import *
from tqdm import tqdm
inputs = (
("Selection Material Counter", "label"),
("Creator: Colan Biemer", "label")
)
DATA_DIRECTORY = "/home/colanbiemer/work/projects/mcedit_data/extract... | Review this code and list any quality issues. | [
{
"issue": "Function 'build_data' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 32
},
{
"issue": "Function 'perform' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.",
"severity... | 3 |
python | import os
import sys
import json
import numpy as np
import threading
import time
import copy
import random
import glob
import shutil
import pickle
from termcolor import colored
from sacred import Ingredient, Experiment
from alfred.env.thor_env import ThorEnv
from alfred.gen import constants
from alfred.gen.utils impo... | Review this code and list any quality issues. | [
{
"issue": "Function 'augment_traj' has cyclomatic complexity 13 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 84
},
{
"issue": "Function 'augment_traj' is 56 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "maj... | 7 |
python | import pyshopee
import re
import pandas as pd
from pprint import pprint
def _builder_attributes(attributes_resp, brand_option = None, default_brand_option = "自有品牌"):
'''select mandatory attr.
attributes = [
{
'attributes_id': 1365,
'va... | Review this code and list any quality issues. | [
{
"issue": "Function '_builder_attributes' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 7
},
{
"issue": "Function '_builder_variations' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functio... | 2 |
python | #!/usr/bin/python
# coding=utf-8
"""
@version:
@author: Dong Linhao
@license: Apache Licence
@contact: donglinhao2015@ia.ac.cn
@site:
@software: PyCharm Community Edition
@file: batchmk.py
@time: 09/04/17 21:10
"""
import src.io.fea as fea
import tensorflow as tf
import numpy as np
import time
LON... | Review this code and list any quality issues. | [
{
"issue": "Function 'make_batch' has cyclomatic complexity 12 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 63
},
{
"issue": "Function 'make_batch' is 38 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",... | 3 |
python | '''
Copyright (c) 2012-2015, Matthieu Nué
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the fol... | Review this code and list any quality issues. | [
{
"issue": "Function 'update' has cyclomatic complexity 15 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 86
},
{
"issue": "Function 'update' is 48 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"li... | 2 |
python | #!/usr/bin/env python
import codecs
import os
import re
import sys
from setuptools import setup
DESCRIPTION = 'UI-level acceptance test framework'
def load_requirements(*requirements_paths):
"""
Load all requirements from the specified requirements files.
Requirements will include any constraints fro... | Review this code and list any quality issues. | [
{
"issue": "Function 'load_requirements.add_version_constraint_or_raise' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 31
},
{
"issue": "Function 'load_requirements' has cyclomatic complexity 11 (threshold: 5). Consider br... | 2 |
python | import os
from time import time
import pathlib
from typing import Dict, Union
import glob
import numpy as np
import xarray as xr
from pyschism.mesh.base import Gr3
def combine(var, shape, l2g, name):
values = np.full(tuple(shape), np.nan)
local_ids = list(l2g.keys())
for i, data in enumerate(var):
... | Review this code and list any quality issues. | [
{
"issue": "Function 'combine_' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 29
},
{
"issue": "Function '__init__' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line... | 5 |
python | #!/usr/bin/env python
__doc__ = '''Merge lookup and feature aliases into TypeTuner feature file'''
__url__ = 'http://github.com/silnrsi/pysilfont'
__copyright__ = 'Copyright (c) 2019 SIL International (http://www.sil.org)'
__license__ = 'Released under the MIT License (http://opensource.org/licenses/MIT)'
__author__ =... | Review this code and list any quality issues. | [
{
"issue": "Function 'doit.dotable' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 69
},
{
"issue": "Function 'doit' has cyclomatic complexity 15 (threshold: 5). Consider breaking it into smaller functions.",
"severity"... | 3 |
python | """ Train RelBERT model. """
import argparse
import logging
import relbert
def config(parser):
# optimization
parser.add_argument('-s', '--softmax-loss', help='softmax loss', action='store_true')
parser.add_argument('-n', '--in-batch-negative', help='in batch negative', action='store_true')
parser.add... | Review this code and list any quality issues. | [
{
"issue": "Function 'config' is 28 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 7
},
{
"issue": "Function 'main' is 35 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 41
}
] | 2 |
python | import os
import sys
from datetime import datetime
class GenerateStructure:
def __init__(self, number_of_lectures, number_of_labs, number_of_homework, number_of_sections,
number_of_advanced_sections, folders,
default_directory, default_directory_lectures, default_directory_lectur... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has 17 parameters. Consider using a parameter object to reduce arity.",
"severity": "critical",
"line": 7
},
{
"issue": "Function 'create_index' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 38
}
] | 2 |
python | import vtk
from numpy import random
import numpy as np
import vtk.util.numpy_support as converter
import time
import cv2
import itertools
class VtkText:
def __init__(self, text, pos):
self.text = text
self.pos = pos
def get_vtk_text(self):
txt = vtk.vtkTextActor()
txt.SetInput... | Review this code and list any quality issues. | [
{
"issue": "Function 'get_vtk_plane' is 27 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 53
}
] | 1 |
python | #
# Copyright 2020 NVIDIA 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 in w... | 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": 49
},
{
"issue": "Function 'run' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 61
... | 4 |
python | # coding: utf-8
import requests
from urllib.parse import urlencode
class APIClient(object):
def __init__(self):
self.status = 0
self.reason = ''
self.HEADERS = {}
def urlencode(self, **kwargs):
return urlencode(kwargs)
def request(self, method, url, params=None, headers=None):
if not headers:
heade... | Review this code and list any quality issues. | [
{
"issue": "Function 'request' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 15
}
] | 1 |
python | from mirage.libs import io
import sys
class ArgParser:
'''
This class allows to easily parse parameters from command line.
'''
def __init__(self,appInstance=None):
'''
This constructor allows to keep a pointer on the main Application instance.
:param appInstance: instance of the main Application (core.app... | Review this code and list any quality issues. | [
{
"issue": "Function 'verbosity' has cyclomatic complexity 12 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 37
},
{
"issue": "Function 'launcher' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity... | 2 |
python | from flask import Flask,render_template,request,redirect
import socket
app = Flask(__name__)
cedula=""
ip='192.168.1.130'
# persona1[cedula][nombre] ="jorge"
# persona1[cedula][nombre] = valor_del_form
persona1 ={
"5591945": {
"nombre":"Mauricio",
"apellido":"Acosta",
... | Review this code and list any quality issues. | [
{
"issue": "Function 'formulario' is 29 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 198
}
] | 1 |
python |
import pygame
from Buttons import Button
import os
import menu
pygame.font.init()
pygame.mixer.init()
pygame.init()
# constants
FONT = pygame.font.SysFont('comicsans', 30)
SEC_FONT = pygame.font.SysFont('comicsans', 22)
TEXT_COLOR = (255, 255, 255)
WIDTH, HEIGHT = 600, 750
WIN = pygame.display.set_m... | Review this code and list any quality issues. | [
{
"issue": "Function 'Main' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 64
}
] | 1 |
python | # -*- coding: utf-8 -*- #
"""*********************************************************************************************"""
# FileName [ runner_mockingjay.py ]
# Synopsis [ runner for the mockingjay model ]
# Author [ Andy T. Liu (Andi611) ]
# Copyright [ Copyleft(c), Speech Lab, NTU, Taiwan ... | Review this code and list any quality issues. | [
{
"issue": "Function 'get_mockingjay_args' is 33 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 24
},
{
"issue": "Function 'main' has cyclomatic complexity 22 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "crit... | 3 |
python | from app import celery
from celery.result import AsyncResult
from app.libs import utils
from app.helpers import command
from app.models import model
from app.helpers import cluster_master, cluster_slave
from app import cs_storage
@celery.task(bind=True)
def get_cluster_data_master(self, id_master):
res_master = A... | Review this code and list any quality issues. | [
{
"issue": "Function 'cluster_task_master' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 32
},
{
"issue": "Function 'cluster_task_master' is 46 lines long. Functions over 25 lines are harder to test and maintain.",
"se... | 3 |
python | """
Cisco Intersight
Cisco Intersight is a management platform delivered as a service with embedded analytics for your Cisco and 3rd party IT infrastructure. This platform offers an intelligent level of management that enables IT organizations to analyze, simplify, and automate their environments in more advan... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 114
},
{
"issue": "Function '__init__' is 32 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
... | 2 |
python | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' is 37 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 68
},
{
"issue": "Function '__init__' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 68
}
] | 2 |
python | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.FileItem import FileItem
from alipay.aop.api.constant.ParamConstants import *
from alipay.aop.api.domain.AlipayCommerceEducateCampusBiztaskFinishModel import AlipayCommerceEducateCampusBiztaskFinishModel
class AlipayCommerceEducateCampus... | Review this code and list any quality issues. | [
{
"issue": "Function 'get_params' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 117
}
] | 1 |
python | # Copyright (c) 2016 IBM
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 36
},
{
"issue": "Function '_process_dns_floatingip_create_precommit' is 26 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "... | 6 |
python | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 1999-2021 Alibaba Group Holding Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-... | 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": 27
}
] | 1 |
python | # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 70
},
{
"issue": "Function '__init__' is 46 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical"... | 4 |
python | __all__ = ["simulate_model",
"simulate_grid",
"simulate_orig"]
import neuralnetsim
import networkx as nx
import numpy as np
from distributed import Client
from pathlib import Path
from typing import Type
from typing import Dict
from typing import Any
from typing import List
from typing import Un... | Review this code and list any quality issues. | [
{
"issue": "Function 'simulation_worker' has 7 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 18
},
{
"issue": "Function 'simulate_model' is 39 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical",
"l... | 12 |
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.
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import *
from tes... | Review this code and list any quality issues. | [
{
"issue": "Function 'setup_contracts' is 31 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 25
},
{
"issue": "Function 'run_test' is 59 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line":... | 2 |
python | # -*- coding: utf-8 -*-
"""
meraki
This file was automatically generated for meraki by APIMATIC v2.0 ( https://apimatic.io ).
"""
from meraki.api_helper import APIHelper
from meraki.configuration import Configuration
from meraki.controllers.base_controller import BaseController
from meraki.http.au... | Review this code and list any quality issues. | [
{
"issue": "Function 'get_organization_api_requests' is 32 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 19
}
] | 1 |
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 'get_device_details' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 98
},
{
"issue": "Function 'get_devices_details_list' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
... | 5 |
python | from __future__ import division
import numpy as np
from rl.util import *
class Policy(object):
def _set_agent(self, agent):
self.agent = agent
@property
def metrics_names(self):
return []
@property
def metrics(self):
return []
def select_action(self, **kwargs):
... | 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": 27
}
] | 1 |
python | #-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2022, Anaconda, Inc., and Bokeh Contributors.
# All rights reserved.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#-------------------------------------------------------------------... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_select' is 30 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 214
}
] | 1 |
python | from flask import Flask, render_template
from flask_json import FlaskJSON, JsonError, json_response, as_json
from flask_cors import CORS
import os
import sys
from modules.db import DB
from modules.redis import REDIS
from config import APP_CONFIG
dbconn = DB()
dbconn.create_table()
redisConn = REDIS()
app = Flask(__... | Review this code and list any quality issues. | [
{
"issue": "Function 'get_title' is 62 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 34
}
] | 1 |
python | from flask import Flask, request, jsonify, render_template, session
import os
import pickle
import datetime
import time
import pandas as pd
import numpy as np
import random
import logging
##__________________________________ GPT-3 code __________________________________________##
from colorama import Fore, Back, Styl... | Review this code and list any quality issues. | [
{
"issue": "Function 'convert_belief' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 100
},
{
"issue": "Function 'get_action_new' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
... | 4 |
python | import ast
import hashlib
from urllib.parse import urljoin
from ..schema.site_base import Work, SignState, NetworkState
from ..schema.xbt import XBT
class MainClass(XBT):
URL = 'https://abtorrents.me/'
USER_CLASSES = {
'uploaded': [536870912000],
'share_ratio': [1.5],
'days': [90],
... | Review this code and list any quality issues. | [
{
"issue": "Function 'sign_in_by_password' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 39
}
] | 1 |
python | r"""
This file implements the version_info class.
"""
from __future__ import absolute_import
from . import version_breakdown
import sys
if sys.version_info[:3] < tuple(
[int(_) for _ in version_breakdown.MIN_PYTHON_VERSION.split('.')]):
raise RuntimeError("""This version of VICE requires python >= %s. \
Current vers... | Review this code and list any quality issues. | [
{
"issue": "Function '__repr__' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 71
}
] | 1 |
python | from typing import Union, Optional, List, Any, Tuple
import os
import torch
import logging
from functools import partial
from tensorboardX import SummaryWriter
from ding.envs import get_vec_env_setting, create_env_manager
from ding.worker import BaseLearner, InteractionSerialEvaluator, BaseSerialCommander, create_buff... | Review this code and list any quality issues. | [
{
"issue": "Function 'serial_pipeline_reward_model' has cyclomatic complexity 15 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 17
},
{
"issue": "Function 'serial_pipeline_reward_model' is 80 lines long. Functions over 25 lines are harder to test and ... | 3 |
python | #!/usr/bin/env python3
#
# Copyright 2015 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unl... | Review this code and list any quality issues. | [
{
"issue": "Function '_get_existing_version' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 58
}
] | 1 |
python | import numpy as np
import tensorflow as tf
import random as rn
np.random.seed(123)
rn.seed(123)
#single thread
session_conf = tf.ConfigProto(
intra_op_parallelism_threads=1,
inter_op_parallelism_threads=1)
from keras import backend as K
tf.set_random_seed(123)
sess = tf.Session(graph=tf.get_default_graph(), config=sess... | Review this code and list any quality issues. | [
{
"issue": "Function 'make_plots' has 8 parameters. Consider using a parameter object to reduce arity.",
"severity": "critical",
"line": 49
},
{
"issue": "Function 'get_predictions' has 10 parameters. Consider using a parameter object to reduce arity.",
"severity": "critical",
"line": 71... | 3 |
python | from datetime import datetime
from typing import List, Union
import pandas as pd
from pyportlib.services.cash_change import CashChange
from pyportlib.utils import df_utils, files_utils
from pyportlib.utils import logger
class CashManager:
NAME = "Cash Account"
ACCOUNTS_DIRECTORY = files_utils.get_accounts_di... | Review this code and list any quality issues. | [
{
"issue": "Function 'load' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 25
}
] | 1 |
python | from contextlib import ExitStack as does_not_raise # noqa: N813
import numpy as np
import pandas as pd
import pytest
from sid.config import DEFAULT_VIRUS_STRAINS
from sid.config import INITIAL_CONDITIONS
from sid.parse_model import parse_duration
from sid.parse_model import parse_initial_conditions
from sid.parse_mod... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_parse_initial_conditions' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 126
}
] | 1 |
python | import csv
import calendar
import datetime
from django.core.management.base import BaseCommand, CommandError
from api_mihai.models import CollectedData
class Command(BaseCommand):
help = 'Imports the CSV file from the collected data to the database'
def add_arguments(self, parser):
parser.add_argument('file_nam... | Review this code and list any quality issues. | [
{
"issue": "Function 'handle' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 29
}
] | 1 |
python | #rule_functions.py
#Copyright (c) 2020 Rachel Lea Ballantyne Draelos
#MIT License
#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
#... | Review this code and list any quality issues. | [
{
"issue": "Function 'delete_part_until' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 42
},
{
"issue": "Function 'delete_part_until' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": ... | 4 |
python | from tornado.options import options
from tortik.page import RequestHandler
try:
import urlparse # py2
except ImportError:
import urllib.parse as urlparse # py3
class PageHandler(RequestHandler):
"""Base handler"""
preprocessors = []
postprocessors = []
def make_request(self, *args, **kwarg... | Review this code and list any quality issues. | [
{
"issue": "Function 'handle_redirects' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 81
}
] | 1 |
python | import asyncio
import logging
from collections import defaultdict
from timeit import default_timer
from tlz import groupby, valmap
from dask.utils import stringify
from ..utils import key_split, key_split_group, log_errors
from .plugin import SchedulerPlugin
logger = logging.getLogger(__name__)
def dependent_keys... | Review this code and list any quality issues. | [
{
"issue": "Function 'dependent_keys' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 16
},
{
"issue": "Function '__init__' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
... | 13 |
python | #!/usr/bin/env python
# =====================================================================
# MODULE DOCSTRING
# =====================================================================
"""
Tests for callback utility classes and functions.
"""
# =====================================================================
#... | Review this code and list any quality issues. | [
{
"issue": "Function 'instance_callback' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 51
},
{
"issue": "Function 'class_callback' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 56
... | 5 |
python | from vnpy.app.cta_strategy import (
CtaTemplate,
StopOrder,
)
from vnpy.trader.object import (
TickData,
BarData,
TradeData,
OrderData,
)
from vnpy.trader.utility import (
BarGenerator,
ArrayManager,
)
class DoubleMaStrategy(CtaTemplate):
author = "中科云集"
fast_window = 10
s... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 32
},
{
"issue": "Function 'on_bar' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line":... | 3 |
python | # Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from typing import Tuple
from pants.option.scope import GLOBAL_SCOPE
class OptionsError(Exception):
"""An options system-related error."""
# --------------------------------------... | 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": 150
}
] | 1 |
python | from types import MethodType
import onnx
import torch
from torch.onnx import OperatorExportTypes
from onnxsim import simplify
import argparse
import io
import sys
import torch.nn as nn
sys.path.insert(0, '.')
from configs import add_centernet_config
from detectron2.config import get_cfg
from inference.centernet import... | Review this code and list any quality issues. | [
{
"issue": "Function 'get_parser' is 35 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 43
}
] | 1 |
python | from paraview import simple
from vtk.web import camera
def update_camera(viewProxy, cameraData):
viewProxy.CameraFocalPoint = cameraData['focalPoint']
viewProxy.CameraPosition = cameraData['position']
viewProxy.CameraViewUp = cameraData['viewUp']
simple.Render(viewProxy)
def create_spherical_camera(v... | Review this code and list any quality issues. | [
{
"issue": "Function 'create_cube_camera' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 16
},
{
"issue": "Function 'create_stereo_cube_camera' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
... | 2 |
python | import sys
import os
import torch
import random
import numpy as np
from tqdm import tqdm
import torch.nn as nn
import torch.optim as optim
import math
from network import GUNet
from mlp_dropout import MLPClassifier
from sklearn import metrics
from util import cmd_args, load_data
sys.path.append(
'%s/pytorch_struc... | Review this code and list any quality issues. | [
{
"issue": "Function 'PrepareFeatureLabel' has cyclomatic complexity 15 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 39
},
{
"issue": "Function 'PrepareFeatureLabel' is 40 lines long. Functions over 25 lines are harder to test and maintain.",
"s... | 5 |
python | import torch
import torch.nn as nn
import torchvision
class ResNeXtBlock(nn.Module):
def __init__(self,in_places,places, stride=1,downsampling=False, expansion = 2, cardinality=32):
super(ResNeXtBlock,self).__init__()
self.expansion = expansion
self.downsampling = downsampling
sel... | 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": 7
}
] | 1 |
python | from itertools import chain
from pathlib import Path
from typing import Tuple
import torch
from accelerate import Accelerator
from torch.utils.data import DataLoader
from saticl.config import Configuration, SSLConfiguration
from saticl.datasets.icl import ICLDataset
from saticl.datasets.transforms import invariance_t... | Review this code and list any quality issues. | [
{
"issue": "Function 'init_from_previous_step' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 29
},
{
"issue": "Function 'train' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major"... | 5 |
python | import dash
from dash import dcc
from dash import html
from dash.dependencies import Input, Output
import plotly.express as px
import pandas as pd
from dash import callback_context
df = px.data.election()
geojson = px.data.election_geojson()
candidates = df.winner.unique()
external_stylesheets = ['https://codepen.io/... | Review this code and list any quality issues. | [
{
"issue": "Function 'display_arrest_fy' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 115
}
] | 1 |
python | import requests
class Books(object):
BASE_URL = \
'https://www.googleapis.com/books/v1/volumes?' \
'q="{}"&projection={}&printType={}&langRestrict={}&maxResults={}'
MAX_RESULTS = 1
PRINT_TYPE = 'books'
PROJECTION = 'full'
LANGUAGE = 'en'
# SEARCH_FIELDS = {
# "title":... | Review this code and list any quality issues. | [
{
"issue": "Function 'process_search' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 37
}
] | 1 |
python | # This code is part of Qiskit.
#
# (C) Copyright IBM 2020.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivative wo... | Review this code and list any quality issues. | [
{
"issue": "Function 'draw' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 87
},
{
"issue": "Function 'draw' is 35 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": ... | 2 |
python | # Copyright 2020 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_compose' is 38 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 31
},
{
"issue": "Function 'test_py_vision_with_c_transforms' is 27 lines long. Functions over 25 lines are harder to test and maintain.",
"severity":... | 2 |
python | # Copyright 2020 Toyota Research Institute. All rights reserved.
import torch
from packnet_sfm.models.SelfSupModel_fisheye import SfmModel, SelfSupModel_fisheye
from packnet_sfm.losses.supervised_loss_valeo import SupervisedLoss
from packnet_sfm.models.model_utils import merge_outputs
from packnet_sfm.utils.depth im... | Review this code and list any quality issues. | [
{
"issue": "Function 'supervised_loss' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 45
}
] | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.