language stringclasses 1
value | code stringlengths 407 33.3k | instruction stringclasses 1
value | flaws listlengths 1 17 | flaw_count int64 1 17 |
|---|---|---|---|---|
python | from great_expectations.render.renderer.content_block.content_block import (
ContentBlockRenderer,
)
from great_expectations.render.types import (
RenderedBulletListContent,
RenderedStringTemplateContent,
)
class ExceptionListContentBlockRenderer(ContentBlockRenderer):
"""Render a bullet list of excep... | Review this code and list any quality issues. | [
{
"issue": "Function '_missing_content_block_fn' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 57
},
{
"issue": "Function '_missing_content_block_fn' is 40 lines long. Functions over 25 lines are harder to test and maintai... | 3 |
python | #!/usr/bin/env python
#
# Electrum - Lightweight Bitcoin Client
# Copyright (C) 2015 Thomas Voegtlin
#
# 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... | 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": 53
},
{
"issue": "Function 'poll' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 61... | 3 |
python | """
Computes putative binding pockets on protein.
"""
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
__author__ = "Bharath Ramsundar"
__copyright__ = "Copyright 2017, Stanford University"
__license__ = "MIT"
import os
import tempfile
import numpy as np
fr... | Review this code and list any quality issues. | [
{
"issue": "Function 'extract_active_site' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 23
},
{
"issue": "Function 'extract_active_site' is 29 lines long. Functions over 25 lines are harder to test and maintain.",
"se... | 5 |
python | import os
import click
from yoda.ssh.shell import Shell
from yoda.ssh.config import importHost
# Context obj
class Cmd():
def __init__(self):
self.verbose = False
self.shell = None
self.host = None
pass_cmd = click.make_pass_decorator(Cmd, ensure=True)
class CmdsLoader(click.MultiCommand):
_cmdFolder... | Review this code and list any quality issues. | [
{
"issue": "Function 'yoda' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 40
}
] | 1 |
python | # File to hold all objects to ease construction of JSON payload.
# Non-PEP8 property declaration used as JSON serializing is 1:1, eg. "clientId = clientId", not "client_id = clientId"
class Client(object):
clientId = ""
clientVersion = "0.0.1"
def __init__(self, client_id, client_version="0.0.1"):
... | 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": 20
}
] | 1 |
python | #
# Tic Tac Toe
#
import numpy as np
from gym import spaces
WinMasks = [
[
[1,0,0],
[1,0,0],
[1,0,0],
],
[
[0,1,0],
[0,1,0],
[0,1,0],
],
[
[0,0,1],
[0,0,1],
[0,0,1],
],
[
[1,1,1],
[0,0,0],
... | Review this code and list any quality issues. | [
{
"issue": "Function 'step' is 26 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 78
},
{
"issue": "Function 'render' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line"... | 2 |
python | # -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
__version__ = '1.18.1333'
# -----------------------------------------------------------------------------
import asyncio
import concurrent
import socket
import time
import math
import random
import certifi
import... | Review this code and list any quality issues. | [
{
"issue": "Function 'fetch2' has 7 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 111
},
{
"issue": "Function 'fetch' has cyclomatic complexity 12 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 1... | 6 |
python | #!python
# coding=utf-8
import cfg, cmn, vqw
import cookielib, urllib, urllib2, sys, argparse, re, string
import simplem3u8 as sm3u8
import simplejson as json
from urllib2 import Request, urlopen, URLError
from random import random
cmnHandler = cmn.cmnHandler()
_url_re = re.compile(r"""
http(s)?://(\w+.)?wasd\.tv/... | Review this code and list any quality issues. | [
{
"issue": "Function 'main' has cyclomatic complexity 24 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 172
},
{
"issue": "Function 'main' is 81 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical",
... | 2 |
python | import glob
import cv2
import os
def extract_frame(movie_files_dir, out_dir):
movie_files = glob.glob(movie_files_dir)
if not movie_files:
print('movie files are not found.')
return
for movie_file in movie_files:
ext = movie_file.split('.')[-1]
if not ext == 'mp4' or not ... | Review this code and list any quality issues. | [
{
"issue": "Function 'extract_frame' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 6
},
{
"issue": "Function 'extract_frame' is 27 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "min... | 2 |
python | #!/usr/bin/env python
from ping360_sonar.sensor import Ping360
from numpy import pi, sqrt, tan, cos, sign
from brping import definitions
class SonarInterface:
samplePeriodTickDuration = 25e-9
firmwareMinTransmitDuration = 5
firmwareMaxTransmitDuration = 500
firmwareMaxSamples = 1200
firmwareM... | Review this code and list any quality issues. | [
{
"issue": "Function 'configureAngles' has cyclomatic complexity 11 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 31
},
{
"issue": "Function 'configureTransducer' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": ... | 3 |
python | """Basic PDFs are provided here.
Gauss, exponential... that can be used together with Functors to build larger models.
"""
# Copyright (c) 2021 zfit
import contextlib
import numpy as np
import tensorflow as tf
import zfit.z.numpy as znp
from zfit import z
from ..core.basepdf import BasePDF
from ..core.space impor... | 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": 26
}
] | 1 |
python | # Imports
import torch
from labml_nn.transformers.switch import SwitchTransformer, SwitchTransformerLayer, SwitchFeedForward
from labml_nn.transformers import MultiHeadAttention
from labml_nn.transformers.feed_forward import FeedForward
import numpy as np
from transformers import AutoConfig, AutoModel
import torch.nn a... | Review this code and list any quality issues. | [
{
"issue": "Function 'load_student' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 149
},
{
"issue": "Function 'predict' has cyclomatic complexity 12 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
... | 4 |
python | #!/usr/bin/python
import argparse
import subprocess
import sys
from aslc.Semantic import compileString
from aslc.GLSLBackend import GLSLBackend
Backend = GLSLBackend
# Parse the command line
argParser = argparse.ArgumentParser(description="AbstractGPU Shading Language Compiler")
argParser.add_argument('inputFiles',... | Review this code and list any quality issues. | [
{
"issue": "Function 'preprocessInput' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 24
}
] | 1 |
python | from marshmallow import fields
from .field_set import FieldSet, FieldSetSchema
class Destination(FieldSet):
def __init__(self,
address: str = None,
bytes: int = None,
domain: str = None,
ip: str = None,
mac: str = None,
... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has 10 parameters. Consider using a parameter object to reduce arity.",
"severity": "critical",
"line": 8
}
] | 1 |
python | import nltk.corpus
import nltk.tokenize.punkt
import nltk.stem.snowball
from nltk.corpus import wordnet
import string
paths = nltk.data.path
#if '/var/nltk_data' not in paths:
# nltk.data.path.append("/var/nltk_data");
# if '/mnt/vol1/nltk_data' not in paths:
# nltk.data.path.append("/mnt/vol1/nltk_data");
#nltk.d... | Review this code and list any quality issues. | [
{
"issue": "Function 'get_proximity_match_ratio' has cyclomatic complexity 13 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 38
}
] | 1 |
python | import logging
import os
import re
import xml.etree.ElementTree as ET
from pathlib import Path
from typing import Any, Tuple, Optional
import pandas as pd
from python import TOPIC_ID, SUBTOPIC, DOCUMENT_NUMBER, DOCUMENT_ID, SENTENCE_IDX, TOKEN_IDX, TOKEN_IDX_TO, \
TOKEN_IDX_FROM, TOKEN, MENTION_ID, EVENT, MENTION... | Review this code and list any quality issues. | [
{
"issue": "Function 'read_xml' has cyclomatic complexity 13 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 16
},
{
"issue": "Function 'read_xml' is 79 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
... | 3 |
python | # mypy: allow-untyped-defs
from unittest import mock
import pytest
from tools.ci.tc import decision
@pytest.mark.parametrize("run_jobs,tasks,expected", [
([], {"task-no-schedule-if": {}}, ["task-no-schedule-if"]),
([], {"task-schedule-if-no-run-job": {"schedule-if": {}}}, []),
(["job"],
{"job-pres... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_extra_jobs_pr.sub' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 43
}
] | 1 |
python | from lib.utils.util import *
from timm.models.efficientnet_blocks import *
# ChildNet Builder definition.
class ChildNetBuilder:
def __init__(
self,
channel_multiplier=1.0,
channel_divisor=8,
channel_min=None,
output_stride=32,
pad_type='',
... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' is 31 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical",
"line": 7
},
{
"issue": "Function '__init__' has 14 parameters. Consider using a parameter object to reduce arity.",
"severity": "critical",
"line": 7
},... | 6 |
python | # coding: utf-8
# Copyright 2015 Eezee-It
import json
import logging
from hashlib import sha256
import urlparse
from odoo import models, fields, api
from odoo.tools.float_utils import float_compare
from odoo.tools.translate import _
from odoo.addons.payment.models.payment_acquirer import ValidationError
from odoo.ad... | Review this code and list any quality issues. | [
{
"issue": "Function 'sips_form_generate_values' is 34 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 72
},
{
"issue": "Function '_sips_form_get_tx_from_data' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functi... | 5 |
python | # Copyright 2018 The TensorFlow Probability Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | Review this code and list any quality issues. | [
{
"issue": "Function '_kstest' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 196
}
] | 1 |
python | #-*- coding:utf-8 -*-
import json
import copy
import requests
import json
from flask import render_template, abort, request, url_for, redirect, g
import time
import datetime
from rrd import app
from rrd.model.screen import DashboardScreen
from rrd.model.graph import DashboardGraph
from rrd import consts
from rrd.utils... | Review this code and list any quality issues. | [
{
"issue": "Function 'dash_screen_clone' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 47
},
{
"issue": "Function 'dash_graph_add' has cyclomatic complexity 15 (threshold: 5). Consider breaking it into smaller functions.",... | 7 |
python | # This code is part of Qiskit.
#
# (C) Copyright IBM 2018, 2021.
#
# 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 derivat... | 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": 23
},
{
"issue": "Function '__init__' has 7 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 56
},
{
"i... | 5 |
python | #####################################################
# Copyright (c) Xuanyi Dong [GitHub D-X-Y], 2021.04 #
#####################################################
# python exps/LFNA/basic-same.py --srange 1-999 --env_version v1 --hidden_dim 16
# python exps/LFNA/basic-same.py --srange 1-999 --env_version v2 --hidden_dim... | Review this code and list any quality issues. | [
{
"issue": "Function 'main' is 92 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 38
}
] | 1 |
python | '''
Given a collection of intervals, merge all overlapping intervals.
Example 1:
Input: intervals = [[1,3],[2,6],[8,10],[15,18]]
Output: [[1,6],[8,10],[15,18]]
Explanation: Since intervals [1,3] and [2,6] overlaps, merge them into [1,6].
Example 2:
Input: intervals = [[1,4],[4,5]]
Output: [[1,5]]
Explanation: Interv... | Review this code and list any quality issues. | [
{
"issue": "Function 'merge' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 23
}
] | 1 |
python | #!/usr/bin/python3
# coding: utf-8
from network.group import Group
import paho.mqtt.client as mqtt
from threading import Thread
import time
from log import logger
import paho.mqtt.subscribe as subscribe
import json
import random
import string
class Switch(Thread):
def __init__(self, broker_ip):
Thread._... | Review this code and list any quality issues. | [
{
"issue": "Function 'create_group' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 62
},
{
"issue": "Function 'add_driver_to_group' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "min... | 4 |
python | #!/usr/bin/env python3
# -*- coding:utf-8 -*-
import yaml
class HexahueMap():
def __init__(self, space_color):
pink = (255, 0, 255)
red = (255, 0, 0)
green = (0, 255, 0)
yellow = (255, 255, 0)
blue = (0, 0, 255)
sky = (0, 255, 255)
white = (255, 255, 255)
gray = (128, 128, 128)
blac... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' is 58 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 8
}
] | 1 |
python | import pyperclip
import math
class Affine_Cipher:
def __init__(self):
self.SYMBOLS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890 !?.'
def check_key(self, key):
keyA = key // len(self.SYMBOLS)
keyB = key % len(self.SYMBOLS)
# Weak Key Checks
if keyA... | Review this code and list any quality issues. | [
{
"issue": "Function 'check_key' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 9
}
] | 1 |
python | # Name: Breno Maurício de Freitas Viana
# NUSP: 11920060
# Course Code: SCC5830
# Year/Semester: 2021/1
# Assignment 5: Image Descriptors
import math
import numpy as np
import imageio
from scipy import ndimage
np.seterr(divide='ignore', invalid='ignore')
LEVELS = 256
# ----- (1) Read Parameters
# Get the locatio... | Review this code and list any quality issues. | [
{
"issue": "Function 'ht_descriptor' is 33 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 71
}
] | 1 |
python | #!/usr/bin/python
# -*- coding:utf-8 -*-
import RPi.GPIO as GPIO
import time
CS = 5
Clock = 25
Address = 24
DataOut = 23
Button = 7
class TRSensor(object):
def __init__(self,numSensors = 5):
self.numSensors = numSensors
self.calibratedMin = [0] * self.numSensors
self.calibratedMax = [1023] * self.numSensors
... | Review this code and list any quality issues. | [
{
"issue": "Function 'AnalogRead' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 36
},
{
"issue": "Function 'calibrate' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.",
"severi... | 3 |
python | #-*- encoding: utf-8 -*-
import sys
import Tkinter as tk
import service
import keycode
if sys.platform == 'win32':
from ctypes import wintypes, byref, windll
import win32con
def handle_hotkey(root, callback):
msg = wintypes.MSG()
if windll.user32.GetMessageA(byref(msg), None, 0, 0) != 0:... | Review this code and list any quality issues. | [
{
"issue": "Function 'main.send' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 58
}
] | 1 |
python | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import torch
import logging
from .lr_scheduler import WarmupMultiStepLR
def make_optimizer(cfg, model):
logger = logging.getLogger("fcos_core.trainer")
params = []
for key, value in model.named_parameters():
if not value.requi... | Review this code and list any quality issues. | [
{
"issue": "Function 'make_optimizer' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 7
}
] | 1 |
python | import logging
from datetime import datetime
import botocore.loaders
import botocore.regions
from boto3 import Session as Boto3Session
from botocore.exceptions import ClientError
from .exceptions import CLIMisconfiguredError, DownstreamError
LOG = logging.getLogger(__name__)
BOTO_CRED_KEYS = ("aws_access_key_id", "... | Review this code and list any quality issues. | [
{
"issue": "Function 'get_temporary_credentials' is 40 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 35
}
] | 1 |
python | #!/usr/bin/env python3
# Very basic bitstream to SVF converter
# This file is Copyright (c) 2018 David Shah <dave@ds0.me>
import sys
import textwrap
max_row_size = 100000
def bitreverse(x):
y = 0
for i in range(8):
if (x >> (7 - i)) & 1 == 1:
y |= (1 << i)
return y
def bit_to_svf(bi... | Review this code and list any quality issues. | [
{
"issue": "Function 'bit_to_svf' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 18
},
{
"issue": "Function 'bit_to_svf' is 86 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
... | 2 |
python | #!/usr/bin/env python2
# -*-: coding utf-8 -*-
import ConfigParser
from coffeehack.coffeehack import CoffeeHack
from hermes_python.hermes import Hermes
import io
import Queue
CONFIGURATION_ENCODING_FORMAT = "utf-8"
CONFIG_INI = "config.ini"
MQTT_IP_ADDR = "localhost"
MQTT_PORT = 1883
MQTT_ADDR = "{}:{}".format(MQTT_... | Review this code and list any quality issues. | [
{
"issue": "Function 'callback' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 56
}
] | 1 |
python | # -*- coding: utf-8 -*-
#
# Copyright (C) 2007-2011 Edgewall Software
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://babel.edgewall.org/wiki/License.
#
# This software consists... | Review this code and list any quality issues. | [
{
"issue": "Function 'read_mo' has cyclomatic complexity 17 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 33
},
{
"issue": "Function 'read_mo' is 57 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical",... | 4 |
python | from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType
import copy as _copy
class Caps(_BaseTraceHierarchyType):
# class properties
# --------------------
_parent_path_str = "volume"
_path_str = "volume.caps"
_valid_props = {"x", "y", "z"}
# x
# -
@propert... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has cyclomatic complexity 11 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 140
},
{
"issue": "Function '__init__' is 34 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
... | 3 |
python | import json
import logging
import sys
from redash.query_runner import *
from redash.utils import JSONEncoder
logger = logging.getLogger(__name__)
try:
from pyhive import hive
enabled = True
except ImportError, e:
enabled = False
COLUMN_NAME = 0
COLUMN_TYPE = 1
types_map = {
'BIGINT': TYPE_INTEGER,
... | Review this code and list any quality issues. | [
{
"issue": "Function 'run_query' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 90
},
{
"issue": "Function 'run_query' is 32 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
... | 2 |
python | import os
import subprocess
import numpy as np
from tqdm import tqdm
from typing import Dict
MAX_FREQ = 7999
def to_str(v):
if isinstance(v, tuple):
s = " ".join(str(x) for x in v)
elif isinstance(v, float) or isinstance(v, int):
s = str(v)
else:
assert False
return s
def ... | Review this code and list any quality issues. | [
{
"issue": "Function 'build_sox_noise' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 28
},
{
"issue": "Function 'augment_with_sox' is 40 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line... | 2 |
python | import argparse, subprocess, os, re
from jinja2 import Environment, FileSystemLoader
def GetBaseName(full_path):
return os.path.basename(full_path)
class PlantUMLCodeGeneration():
class StateType():
def __init__(self):
self.entry = None
self.during = None
self.exit... | Review this code and list any quality issues. | [
{
"issue": "Function 'ParseStateMachineAsDict' has cyclomatic complexity 11 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 107
},
{
"issue": "Function 'ParseStateMachineAsDict' is 35 lines long. Functions over 25 lines are harder to test and maintain.... | 5 |
python | from torch.utils.data import Dataset, DataLoader
import glob
import os
import numpy as np
import cv2
import torch
from torchvision import transforms, utils
from skimage.transform import resize
class SegDataset(Dataset):
"""Segmentation Dataset"""
def __init__(self, root_dir, imageFolder, maskFolder, transfor... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' is 36 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical",
"line": 14
},
{
"issue": "Function '__init__' has 10 parameters. Consider using a parameter object to reduce arity.",
"severity": "critical",
"line": 14
... | 3 |
python | # -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
import pytest
import vtk
import numpy as np
import sksurgeryvtk.utils.polydata_utils as pdu
import sksurgeryvtk.models.vtk_surface_model as vbs
def test_overlapping_bounds():
radius_0=10.0
radius_1=7.0
centre_1=5.0
radius_2=4.0
centre_2=15.0
rad... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_overlapping_bounds' is 42 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 11
},
{
"issue": "Function 'test_dice_overlap' is 28 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "mi... | 2 |
python | # type: ignore
import json
import uuid
from json import JSONDecodeError
from typing import Tuple, Dict, List
import boto3
from melange.drivers.interfaces import Queue, Topic, MessagingDriver, Message
class AWSDriver(MessagingDriver):
def __init__(self, **kwargs):
super().__init__()
self.max_num... | Review this code and list any quality issues. | [
{
"issue": "Function 'declare_queue' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 30
},
{
"issue": "Function 'declare_queue' is 59 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "ma... | 7 |
python | '''
Created on 23.08.2017
@author: falensaa
'''
import logging
import sys
import imsnpars.nparser.features
import imsnpars.nparser.network
import imsnpars.nparser.graph.features as gfeatures
from imsnpars.nparser.graph import task, decoder
from imsnpars.nparser.graph.mst import cle
from imsnpars.nparser.labels impor... | Review this code and list any quality issues. | [
{
"issue": "Function 'buildGraphFeatureExtractors' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 29
},
{
"issue": "Function 'buildGraphFeatureExtractors' is 36 lines long. Functions over 25 lines are harder to test and mai... | 2 |
python | # coding: utf-8
"""
Kubernetes
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
The version of the OpenAPI document: release-1.22
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import si... | 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 'to_dict' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line":... | 2 |
python | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Bout (read bank-out) extracts transactions from pdf bank statements.
_ _
(_) (_)
(_) _ _ _ _ _ _ _ _ _ (_) _ _
(_)(_)(_)(_)_ _ (_)(_)(_) _ (_) (_)(_)(_)(... | Review this code and list any quality issues. | [
{
"issue": "Function '_filter_csv_header' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 105
},
{
"issue": "Function 'start' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"se... | 2 |
python | # copyright 2022 @Ansaku
# Telegram @AnkiSatya
# Instagram @satya_ask
import telebot
import requests
from telebot.types import InlineKeyboardButton
# Fillout Here The BotToken it gets from botfather further queries @AnkiSatya 0n telegram
bot = telebot.TeleBot('**********************')
while True:
try:
... | Review this code and list any quality issues. | [
{
"issue": "Function 'send_text' has cyclomatic complexity 11 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 28
},
{
"issue": "Function 'send_text' is 57 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
... | 2 |
python | """Tests for the :mod:`~polymatheia.data.writer` package."""
import json
import os
from shutil import rmtree
from polymatheia.data import NavigableDict
from polymatheia.data.writer import JSONWriter
DOCUMENTS = [NavigableDict(r) for r in [
{
'id': '1',
'name': {
'first': 'A',
... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_local_json_writing' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 40
},
{
"issue": "Function 'test_local_json_writing_pre_split_id_path' has cyclomatic complexity 6 (threshold: 5). Consider break... | 2 |
python | # -*- coding: utf-8; -*-
from __future__ import unicode_literals, absolute_import
import json
import requests
import six
from tests import unittest, mock
from freight_forwarder.registry import Registry, V1, V2
from freight_forwarder.registry.registry_base import RegistryBase, RegistryException
from ..fa... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_v1_tags' is 27 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 89
}
] | 1 |
python | import copy
import json
import logging
import pytest
import burn_lock_functions
import test_utilities
from integration_env_credentials import sifchain_cli_credentials_for_test
from pytest_utilities import generate_minimal_test_account
from test_utilities import EthereumToSifchainTransferRequest, SifchaincliCredential... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_bulk_transfers' is 91 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 29
},
{
"issue": "Function 'test_bulk_transfers' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
... | 2 |
python | """Build Environment used for isolation during sdist building
"""
import logging
import os
import sys
import textwrap
from distutils.sysconfig import get_python_lib
from sysconfig import get_paths
from pip._vendor.pkg_resources import Requirement, VersionConflict, WorkingSet
from pip import __file__ as pip_location
... | Review this code and list any quality issues. | [
{
"issue": "Function '__enter__' is 34 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 33
},
{
"issue": "Function 'install_requirements' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.",
"severity":... | 3 |
python | import logging
from random import randint
import traceback
from typing import cast, Dict, List, Set, Collection
from geniusweb.actions.Accept import Accept
from geniusweb.actions.Action import Action
from geniusweb.actions.LearningDone import LearningDone
from geniusweb.actions.Offer import Offer
from geniusweb.action... | Review this code and list any quality issues. | [
{
"issue": "Function 'notifyChange' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 47
},
{
"issue": "Function 'notifyChange' is 31 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "min... | 2 |
python | '''
Native support for Multitouch devices on Linux, using libmtdev.
===============================================================
The Mtdev project is a part of the Ubuntu Maverick multitouch architecture.
You can read more on http://wiki.ubuntu.com/Multitouch
To configure MTDev, it's preferable to use probesysfs p... | Review this code and list any quality issues. | [
{
"issue": "Function 'depack' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 48
},
{
"issue": "Function '__init__' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "... | 7 |
python | import logging
from django.core.mail import EmailMultiAlternatives, EmailMessage
from django.utils.encoding import smart_text
from django.core.urlresolvers import reverse
from django.conf import settings
from disturbance.components.emails.emails import TemplateEmailBase
from ledger.accounts.models import EmailUser
l... | Review this code and list any quality issues. | [
{
"issue": "Function 'send_approval_renewal_email_notification' is 29 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 154
},
{
"issue": "Function '_log_approval_email' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smalle... | 5 |
python | # -*- coding: utf-8 -
from iso8601 import parse_date
from datetime import datetime, date, time, timedelta
import dateutil.parser
from pytz import timezone
import os
from decimal import Decimal
import re
TZ = timezone(os.environ['TZ'] if 'TZ' in os.environ else 'Europe/Kiev')
def get_all_etender_dates(initial_tender... | Review this code and list any quality issues. | [
{
"issue": "Function 'get_helper_dictionary' is 48 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 245
}
] | 1 |
python | # coding: utf-8
import math
import numpy as np
import torch
import torch.nn as nn
from torch.autograd import Variable
import torch.nn.functional as F
def conv3x3(in_planes, out_planes, stride=1):
return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride,
padding=1, bias=False)
... | 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": 24
},
{
"issue": "Function '_make_layer' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 91
},
{
... | 4 |
python | import os
import argparse
import json
import pandas as pd
import bilby
from bilby_pipe.create_injections import InjectionCreator
def main():
parser = argparse.ArgumentParser(description="Slurm files from nmma injection file")
parser.add_argument(
"--prior-file",
type=str,
required=Tr... | Review this code and list any quality issues. | [
{
"issue": "Function 'main' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 10
},
{
"issue": "Function 'main' is 68 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": ... | 2 |
python | # -*-coding:Utf-8 -*
# Copyright (c) 2010 LE GOFF Vincent
# 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
# l... | Review this code and list any quality issues. | [
{
"issue": "Function 'accueil' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 53
},
{
"issue": "Function 'accueil' is 30 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"l... | 7 |
python | from __future__ import absolute_import, division, print_function
import numbers
import warnings
import torch
from torch.autograd import Variable
import pyro
import pyro.poutine as poutine
from pyro.distributions.util import is_identically_zero
from pyro.infer.elbo import ELBO
from pyro.infer.enum import iter_discret... | Review this code and list any quality issues. | [
{
"issue": "Function 'check_enum_discrete_can_run' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 19
},
{
"issue": "Function '_get_traces' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity... | 7 |
python | """Platform for sensor integration."""
from __future__ import annotations
import homeassistant.helpers.config_validation as cv
import requests
import voluptuous as vol
from homeassistant.components.sensor import SensorEntity, PLATFORM_SCHEMA, SensorStateClass, SensorDeviceClass
from homeassistant.const import CONF_USE... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 47
}
] | 1 |
python | import torch
import numpy as np
def get_sigmas(config):
if config.model.sigma_dist == 'geometric':
sigmas = torch.tensor(
np.exp(np.linspace(np.log(config.model.sigma_begin), np.log(config.model.sigma_end),
config.model.num_classes))).float().to(config.device)
... | Review this code and list any quality issues. | [
{
"issue": "Function 'anneal_Langevin_dynamics' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 20
},
{
"issue": "Function 'anneal_Langevin_dynamics' is 34 lines long. Functions over 25 lines are harder to test and mainta... | 13 |
python | class Option:
def __init__(self, option_info):
self.option_info = option_info
self.flag = option_info['flag']
def mkdir(self):
if self.flag == False:
return False
return self.option_info['mkdir']
def dir_name(self, problem):
if self.flag == False:
... | Review this code and list any quality issues. | [
{
"issue": "Function 'get_ext' is 67 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 29
}
] | 1 |
python |
import copy
import torch.nn as nn
from torch.quantization.fuser_method_mappings import get_fuser_method
# for backward compatiblity
from torch.quantization.fuser_method_mappings import fuse_conv_bn # noqa: F401
from torch.quantization.fuser_method_mappings import fuse_conv_bn_relu # noqa: F401
from typing import ... | Review this code and list any quality issues. | [
{
"issue": "Function 'fuse_known_modules' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 31
},
{
"issue": "Function 'fuse_modules' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "mino... | 2 |
python | from PIL import Image as im
import numpy as np
from io import BytesIO
import csv
class outputResponse():
def __init__(self,reponse):
self.response = reponse
def retrieveResult(response, returntype):
if (returntype == "image/png" or returntype == "image/jpeg"):
img_arr = np.array(i... | Review this code and list any quality issues. | [
{
"issue": "Function 'retrieveResult' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 10
}
] | 1 |
python | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Business Applications
# Copyright (C) 2004-2012 OpenERP S.A. (<http://openerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms o... | Review this code and list any quality issues. | [
{
"issue": "Function 'default_get' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 63
},
{
"issue": "Function 'get_default_sale_config' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": ... | 4 |
python | import pytest
import io
from cite_seq_count import preprocessing
@pytest.fixture
def data():
from collections import OrderedDict
from itertools import islice
# Test file paths
pytest.correct_whitelist_path = 'tests/test_data/whitelists/correct.csv'
pytest.correct_tags_path = 'tests/test_data/... | Review this code and list any quality issues. | [
{
"issue": "Function 'data' is 33 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 7
}
] | 1 |
python | # Pydifact - a python edifact library
#
# Copyright (c) 2019 Christian González
#
# 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 'create_segment' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 123
},
{
"issue": "Function 'create_segment' is 31 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": ... | 2 |
python |
import os, json
import shutil, logging
import click
from pyspark.sql.functions import lit, udf, explode, array, to_json
from pyspark.sql.types import ArrayType, StringType, IntegerType, MapType, StructType, StructField
from luna.common.CodeTimer import CodeTimer
from luna.common.config import ConfigSet
from luna.com... | Review this code and list any quality issues. | [
{
"issue": "Function 'create_proxy_table' is 33 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 113
}
] | 1 |
python | # Copyright 2021 Supun Nakandala. 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... | Review this code and list any quality issues. | [
{
"issue": "Function 'get_train_ops' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 33
}
] | 1 |
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, overload
from .. import _utilities
from... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has cyclomatic complexity 13 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 22
},
{
"issue": "Function '__init__' has 7 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line... | 2 |
python | """Hermes MQTT service for Rhasspy wakeword with snowboy"""
import argparse
import asyncio
import dataclasses
import itertools
import json
import logging
import os
import sys
import typing
from pathlib import Path
import paho.mqtt.client as mqtt
import rhasspyhermes.cli as hermes_cli
from . import SnowboyModel, Wake... | Review this code and list any quality issues. | [
{
"issue": "Function 'main' has cyclomatic complexity 21 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 25
},
{
"issue": "Function 'main' is 100 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical",
... | 2 |
python | import os
from django.conf import settings
from main.tests.test_base import MainTestCase
from odk_viewer.models import ParsedInstance
from odk_viewer.management.commands.remongo import Command
from django.core.management import call_command
from common_tags import USERFORM_ID
class TestRemongo(MainTestCase):
def... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_sync_mongo_with_all_option_deletes_existing_records' is 26 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 68
}
] | 1 |
python | import pytest
import numpy as np
import sklearn.linear_model
import sklearn.model_selection
import scipy.linalg
from himalaya.backend import set_backend
from himalaya.backend import ALL_BACKENDS
from himalaya.utils import assert_array_almost_equal
from himalaya.scoring import r2_score
from himalaya.kernel_ridge impo... | Review this code and list any quality issues. | [
{
"issue": "Function '_test_solve_multiple_kernel_ridge_random_search' has cyclomatic complexity 13 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 81
},
{
"issue": "Function '_test_solve_multiple_kernel_ridge_random_search' is 58 lines long. Functions... | 3 |
python | # -*- coding: utf-8 -*-
"""Helper functions for getting resources."""
import logging
import os
from dataclasses import dataclass
from typing import List, Optional
from urllib.request import urlretrieve
logger = logging.getLogger(__name__)
HERE = os.path.abspath(os.path.dirname(__file__))
DEFAULT_DIRECTORY = os.pat... | Review this code and list any quality issues. | [
{
"issue": "Function 'get_data_paths' has cyclomatic complexity 11 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 56
},
{
"issue": "Function 'get_data_paths' is 54 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": ... | 2 |
python | # (c) Copyright 2013 Hewlett-Packard Development Company, L.P.
#
# 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 re... | 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_multipath_device' has cyclomatic complexity 11 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "majo... | 3 |
python | """Deals with making images (np arrays). It provides drawing
methods that are difficult to do with the existing Python libraries.
"""
import numpy as np
def blit(im1, im2, pos=None, mask=None):
"""Blit an image over another.
Blits ``im1`` on ``im2`` as position ``pos=(x,y)``, using the
``mask`` if provi... | Review this code and list any quality issues. | [
{
"issue": "Function 'color_gradient' has cyclomatic complexity 15 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 23
},
{
"issue": "Function 'color_gradient' is 64 lines long. Functions over 25 lines are harder to test and maintain.",
"severity... | 7 |
python | #!/usr/bin/python
import json
import sys
from collections import defaultdict
from unidecode import unidecode
from HTMLParser import HTMLParser
h = HTMLParser()
_schema_keys_to_yml = {
'description' : 'notes',
'image' : 'photo',
'recipeCuisine' : 'notes',
... | Review this code and list any quality issues. | [
{
"issue": "Function 'handle_key' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 79
}
] | 1 |
python | # Copyright (c) 2018, DjaoDjin inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and t... | Review this code and list any quality issues. | [
{
"issue": "Function 'handle' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 78
},
{
"issue": "Function 'handle' is 30 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"li... | 2 |
python | from __future__ import print_function
import datetime
import pickle
import os.path
from googleapiclient.discovery import build
from google_auth_oauthlib.flow import InstalledAppFlow
from google.auth.transport.requests import Request
# If modifying these scopes, delete the file token.pickle.
SCOPES = ['https://www.goog... | Review this code and list any quality issues. | [
{
"issue": "Function 'main' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 12
},
{
"issue": "Function 'main' is 46 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": ... | 2 |
python | #!/usr/bin/env python3
#
# Copyright (c) 2016, The OpenThread Authors.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright
# ... | Review this code and list any quality issues. | [
{
"issue": "Function 'verify' is 54 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 99
}
] | 1 |
python | #!/usr/bin/env python3
#
# Araboly 2000 Advanced Server SP4 -- everyone's favourite board game... with IRC support and fancy colours!
# Copyright (c) 2018 Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de>
# This project is licensed under the terms of the MIT licence.
#
from ArabolyGenerals import ArabolyGenerals
f... | Review this code and list any quality issues. | [
{
"issue": "Function 'dispatch_board' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 21
},
{
"issue": "Function 'dispatch_board' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major"... | 14 |
python | import numpy as np
from numpy.linalg import norm
from ._jit import jit
@jit
def J2_perturbation(t0, state, k, J2, R):
r"""Calculates J2_perturbation acceleration (km/s2)
.. math::
\vec{p} = \frac{3}{2}\frac{J_{2}\mu R^{2}}{r^{4}}\left [\frac{x}{r}\left ( 5\frac{z^{2}}{r^{2}}-1 \right )\vec{i} + \fr... | Review this code and list any quality issues. | [
{
"issue": "Function 'J2_perturbation' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 8
},
{
"issue": "Function 'J3_perturbation' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 48
... | 5 |
python | from typing import TypeVar, AsyncIterator, Sequence
from chris.common.types import PluginUrl
from chris.common.client import AuthenticatedClient
from chris.common.search import get_paginated, to_sequence
import chris.common.decorator as http
from chris.cube.types import ComputeResourceName, PfconUrl
from chris.cube.des... | Review this code and list any quality issues. | [
{
"issue": "Function 'create_compute_resource' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 20
}
] | 1 |
python | # Copyright 2015 Hewlett-Packard
# 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 ... | Review this code and list any quality issues. | [
{
"issue": "Function '_build_scope_info' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 48
},
{
"issue": "Function '_build_scope_info' is 29 lines long. Functions over 25 lines are harder to test and maintain.",
"severi... | 4 |
python | # coding=utf-8
from common.BNFParser import *
from common.Grammar import Grammar
# 求文法G的可空变量集
# 该算法只跟G的P有关系
def algo_6_3(P):
"""
测试数据来源于第6章习题12(2)
>>> from common.production import Production
>>> p1 = Production(['S'], [['A', 'B', 'D', 'C']])
>>> p2 = Production(['A'], [['B', 'D'], ['\\"a\\"', '\... | Review this code and list any quality issues. | [
{
"issue": "Function 'algo_6_3' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 7
}
] | 1 |
python | import numpy as np
import tensorflow as tf
from common.shared_functions import dot_or_lookup, glorot_variance, make_tf_variable, make_tf_bias
from encoders.message_gcns.message_gcn import MessageGcn
class BasisGcn(MessageGcn):
def parse_settings(self):
self.dropout_keep_probability = float(self.settings... | Review this code and list any quality issues. | [
{
"issue": "Function 'combine_messages' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 74
}
] | 1 |
python | import hashlib
import datetime
import json
import uuid
from hashlib import sha256
from sys import version_info as pyVersion
from binascii import hexlify, unhexlify
from wallet import *
from func.send_message import send_message
from func.send_coin import send_coin
from func.node_connection import *
from lib... | Review this code and list any quality issues. | [
{
"issue": "Function 'menu' has cyclomatic complexity 19 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 73
},
{
"issue": "Function 'menu' is 38 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical",
"... | 2 |
python | import numpy as np
import cv2
def make_colorwheel():
'''
Generates a color wheel for optical flow visualization as presented in:
Baker et al. "A Database and Evaluation Methodology for Optical Flow" (ICCV, 2007)
URL: http://vision.middlebury.edu/flow/flowEval-iccv07.pdf
According to the C... | Review this code and list any quality issues. | [
{
"issue": "Function 'make_colorwheel' is 28 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 5
},
{
"issue": "Function 'get_warp_label' is 28 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"l... | 3 |
python | r"""
`torch.distributed.launch` is a module that spawns up multiple distributed
training processes on each of the training nodes.
The utility can be used for single-node distributed training, in which one or
more processes per node will be spawned. The utility can be used for either
CPU training or GPU training. If th... | Review this code and list any quality issues. | [
{
"issue": "Function 'parse_args' is 36 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 146
},
{
"issue": "Function 'main' is 27 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 194
}... | 2 |
python | from flask import jsonify, request, url_for, abort
from app import db
from app.api import bp
from app.api.auth import token_auth
from app.api.errors import bad_request
from app.models import User
@bp.route('/users/<int:id>', methods=['GET'])
@token_auth.login_required
def get_user(id):
return jsonify(User.query.ge... | Review this code and list any quality issues. | [
{
"issue": "Function 'create_user' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 42
},
{
"issue": "Function 'update_user' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"seve... | 2 |
python | #!/usr/bin/env python
from __future__ import print_function
from optparse import OptionParser
import os
import sys
class ReadsSplitter:
def __init__(self):
self.options = None
self.files_to_split = []
self.getOptions()
def go(self):
for fn in self.files_to_split:
... | Review this code and list any quality issues. | [
{
"issue": "Function 'splitFile' is 38 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 34
}
] | 1 |
python | # -*- coding: utf-8 -*-
'''
Copyright (c) 2019 Colin Curtain
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, mer... | 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": 64
}
] | 1 |
python | # coding: utf-8
"""
LUSID API
FINBOURNE Technology # noqa: E501
The version of the OpenAPI document: 0.11.2342
Contact: info@finbourne.com
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import six
class ResourceListOfPortfolio(object):
"""NOTE: Thi... | Review this code and list any quality issues. | [
{
"issue": "Function 'to_dict' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 140
}
] | 1 |
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
__a... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has cyclomatic complexity 15 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 22
},
{
"issue": "Function '__init__' has 8 parameters. Consider using a parameter object to reduce arity.",
"severity": "critical",
... | 2 |
python | from sys import maxsize
class Contact:
def __init__(self, first_name=None, middle_name=None, last_name=None, nickname=None,
photo_path=None, photo_delete=False, title=None, company=None, address=None,
telephones_all=None, telephone_home=None,
telephone_mobile=No... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' is 38 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical",
"line": 6
},
{
"issue": "Function '__init__' has 31 parameters. Consider using a parameter object to reduce arity.",
"severity": "critical",
"line": 6
},... | 3 |
python | from decimal import Decimal
from urllib.parse import urlparse
from django import forms
from django.conf import settings
from django.core.exceptions import ValidationError
from django.db.models import Q
from django.utils.safestring import mark_safe
from django.utils.translation import gettext_lazy as _, pgettext_lazy
f... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 68
},
{
"issue": "Function 'save' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "mi... | 2 |
python | #
# Loop transformation submodule that enables pragma directive insertions.
#
import sys
import module.loop.submodule.submodule, transformator
#---------------------------------------------------------------------
class Pragma(module.loop.submodule.submodule.SubModule):
'''The pragma directive insertion submodul... | Review this code and list any quality issues. | [
{
"issue": "Function 'checkTransfArgs' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 57
}
] | 1 |
python | import numpy as np
import matplotlib.pyplot as plt
import matplotlib.colors as colors
from mpl_toolkits.axes_grid1 import make_axes_locatable
#Key:
# 1=sandstone 2=c_siltstone 3=f_siltstone
# 4=marine_silt_shale 5=mudstone 6=wackestone 7=dolomite
# 8=packstone 9=bafflestone
facies_labels = ['SS', 'CSiS', 'FSiS',... | Review this code and list any quality issues. | [
{
"issue": "Function 'make_facies_log_plot' is 41 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 30
},
{
"issue": "Function 'compare_facies_plot' is 46 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "min... | 2 |
python | import wx
import numpy as np
from imagepy.core.engine import Tool, Filter
import scipy.ndimage as nimg
class ScaleTool(Tool):
def __init__(self, plg):
self.plg = plg
self.para = plg.para
self.moving = False
def snap(self, x, y, lim):
plg = self.plg
if abs(x-plg.... | Review this code and list any quality issues. | [
{
"issue": "Function 'snap' has cyclomatic complexity 19 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 12
},
{
"issue": "Function 'mouse_down' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"lin... | 7 |
python |
class std_logic():
"""
class to represent a digital bit allowing for the same 9 values of a bit supported by IEEE 1164.
====== ===============
Value Interpreatation
------ ---------------
U Unitialized
X Unknown
0 Strong 0
1 ... | Review this code and list any quality issues. | [
{
"issue": "Function '__and__' has cyclomatic complexity 21 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 46
},
{
"issue": "Function '__and__' is 29 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical",... | 9 |
python | #!/usr/bin/env python
"""
Predefined bluesky scan plans
"""
import numpy as np
import bluesky.plans as bp
import bluesky.preprocessors as bpp
import bluesky.plan_stubs as bps
from .utility import load_config
#@bpp.run_decorator()
def collect_white_field(experiment, cfg_tomo, at... | Review this code and list any quality issues. | [
{
"issue": "Function 'tomo_scan.scan_closure' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 178
},
{
"issue": "Function 'tomo_scan.scan_closure' is 34 lines long. Functions over 25 lines are harder to test and maintain.",
... | 3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.