language stringclasses 1
value | code stringlengths 407 33.3k | instruction stringclasses 1
value | flaws listlengths 1 17 | flaw_count int64 1 17 |
|---|---|---|---|---|
python | import base64
import json
import re
import requests
import psutil
from pysys.basetest import BaseTest
from pysys.constants import FAILED
from cumulocity import Cumulocity
from environment_tedge import TedgeEnvironment
"""
Environment to manage automated connects and disconnects to c8y
"""
class EnvironmentC8y(Ted... | Review this code and list any quality issues. | [
{
"issue": "Function 'setup' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 30
},
{
"issue": "Function 'setup' is 54 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line"... | 2 |
python | # Copyright 2019 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | Review this code and list any quality issues. | [
{
"issue": "Function 'train_squad' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 48
},
{
"issue": "Function 'main' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line":... | 3 |
python | #!/usr/bin/python
from mininet.net import Mininet
from mininet.node import Controller, RemoteController, OVSController
from mininet.node import CPULimitedHost, Host, Node
from mininet.node import OVSKernelSwitch, UserSwitch
from mininet.node import IVSSwitch
from mininet.cli import CLI
from mininet.log import setLogL... | Review this code and list any quality issues. | [
{
"issue": "Function 'myNetwork' is 35 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 14
}
] | 1 |
python | # -*- coding: utf-8 -*-
#
# Copyright © Spyder Project Contributors
# Licensed under the terms of the MIT License
# (see spyder/__init__.py for details)
"""
Contains the text debugger manager.
"""
import os.path as osp
from qtpy.QtWidgets import QInputDialog, QLineEdit
from spyder.config.main import CONF
from spyder... | Review this code and list any quality issues. | [
{
"issue": "Function 'toogle_breakpoint' has cyclomatic complexity 12 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 79
},
{
"issue": "Function 'toogle_breakpoint' is 35 lines long. Functions over 25 lines are harder to test and maintain.",
"sever... | 2 |
python | # -*- coding: utf-8 -*-
"""
configfile.py - Human-readable text configuration file library
Copyright 2010 Luke Campagnola
Distributed under MIT/X11 license. See license.txt for more infomation.
Used for reading and writing dictionary objects to a python-like configuration
file format. Data structures may be nested a... | 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": 19
},
{
"issue": "Function 'genString' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line... | 4 |
python | # Copyright 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 requ... | Review this code and list any quality issues. | [
{
"issue": "Function 'resource_setup' is 26 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 45
}
] | 1 |
python | import json
from re import split
import shutil
import os
import sys
import numpy as np
from PIL import Image, ImageDraw, ImageFont
from skimage import io
from shapely.geometry import Polygon
Image.MAX_IMAGE_PIXELS = None
def make_dir(path):
if not os.path.exists(path):
os.makedirs(path)
else:
... | Review this code and list any quality issues. | [
{
"issue": "Function 'find_diff' has cyclomatic complexity 35 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 34
},
{
"issue": "Function 'find_diff' is 143 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "criti... | 2 |
python | # ---------------------------------------------------------------
# imp_head.py
# Set-up time: 2020/5/21 下午11:22
# Copyright (c) 2020 ICT
# Licensed under The MIT License [see LICENSE for details]
# Written by Kenneth-Wong (Wenbin-Wang) @ VIPL.ICT
# Contact: wenbin.wang@vipl.ict.ac.cn [OR] nkwangwenbin@gmail.com
... | Review this code and list any quality issues. | [
{
"issue": "Function 'forward' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 24
},
{
"issue": "Function 'forward' is 31 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"l... | 3 |
python | # -*- coding: utf-8 -*-
# @Time : 6/10/21 5:04 PM
# @Author : Yuan Gong
# @Affiliation : Massachusetts Institute of Technology
# @Email : yuangong@mit.edu
# @File : ast_models.py
import os
os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID"
os.environ["CUDA_VISIBLE_DEVICES"] = "0,1,2,3"
import torch
import torch... | 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": 24
},
{
"issue": "Function '__init__' has cyclomatic complexity 20 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"l... | 5 |
python | # Copyright 2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wri... | Review this code and list any quality issues. | [
{
"issue": "Function 'parse_args' is 29 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 92
},
{
"issue": "Function 'load_config' has cyclomatic complexity 24 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critic... | 3 |
python | import time
import pytest
import jwt
from cryptography.hazmat.primitives.asymmetric import rsa
from cryptography.hazmat.primitives import serialization
from authlib.jose import jwk
from util.security.jwtutil import (
decode,
exp_max_s_option,
jwk_dict_to_public_key,
InvalidTokenError,
InvalidAlgo... | Review this code and list any quality issues. | [
{
"issue": "Function '_token_data' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 44
},
{
"issue": "Function 'test_decode_jwt_validation' is 28 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical",
... | 3 |
python | # -*- coding: utf-8 -*-
# Define here the models for your spider middleware
#
# See documentation in:
# https://docs.scrapy.org/en/latest/topics/spider-middleware.html
from typing import Iterable
from scrapy import signals
from .items import TransportInfo, SeatInfo
from .settings import MOCKED_DATA_PATH
class Tic... | Review this code and list any quality issues. | [
{
"issue": "Function 'process_spider_output' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 122
}
] | 1 |
python | from marshmallow import INCLUDE, Schema, fields, post_load, pre_load
class Dates:
def __init__(self, on_sale=None, foc=None, unlimited=None, **kwargs):
self.on_sale = on_sale
self.foc = foc
self.unlimited = unlimited
self.unknown = kwargs
class DatesSchema(Schema):
onsaleDate... | 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": 5
}
] | 1 |
python | # Save the geometry (triangles, verticies) of a FESOM grid to a gdal dataset
# Author: R. Rietbroek
# Date 17 May 2019
# Currently this save the surface nodes only
# Improvements are possible
# * Optionally store the 3D surfaces
# * add info on e.g. bathymetry the nodes
# *
import osgeo,ogr as ogr
import osgeo.osr as... | Review this code and list any quality issues. | [
{
"issue": "Function 'fesom2gdal' is 48 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 12
}
] | 1 |
python | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# flake8: noqa
"""
Unit tests for Morse Code: Bits
Students should not modify this file.
"""
__author__ = 'madarp'
import sys
import unittest
import importlib
import subprocess
# suppress __pycache__ and .pyc files
sys.dont_write_bytecode = True
# Kenzie devs: change t... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_long_message_5x' is 29 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 137
}
] | 1 |
python | # Copyright 2019 Objectif Libre
#
# 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 '__new__' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 52
},
{
"issue": "Function '__init__' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line":... | 2 |
python | from .scf_base import SiriusBaseCalculation, make_sirius_json
from aiida.plugins import DataFactory
from aiida.common import datastructures
import tempfile
import json
import yaml
import six
SiriusMDParameters = DataFactory('sirius.md')
SinglefileData = DataFactory('singlefile')
ArrayData = DataFactory('array')
List =... | Review this code and list any quality issues. | [
{
"issue": "Function 'prepare_for_submission' is 30 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 24
}
] | 1 |
python | #!/usr/bin/env python3
import sys
def get_next_one(wint):
"""
returns next generation as list of rows where each row contain string of 0|1 characters
:param wint array of integers 0|1 older generation
:retval next_one list of rows next generation
"""
ne... | Review this code and list any quality issues. | [
{
"issue": "Function 'get_next_one' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 6
},
{
"issue": "Function 'validated_world' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"... | 2 |
python | # Copyright (C) 2014-2017 New York University
# This file is part of ReproZip which is released under the Revised BSD License
# See file LICENSE for full license details.
"""Utility functions dealing with package managers.
"""
from __future__ import division, print_function, unicode_literals
import logging
import pl... | Review this code and list any quality issues. | [
{
"issue": "Function 'install' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 38
},
{
"issue": "Function 'get_packages_info' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"se... | 6 |
python | from multiprocessing import Value
from random import choice
from chillow.service.ai.pathfinding_ai import PathfindingAI
from chillow.service.ai.search_tree_ai import SearchTreeAI
from chillow.model.action import Action
from chillow.model.game import Game
from chillow.model.player import Player
from chillow.service.gam... | 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": 22
}
] | 1 |
python | # encoding: utf-8
"""
protocol.py
Created by Thomas Mangin on 2009-08-25.
Copyright (c) 2009-2015 Exa Networks. All rights reserved.
"""
import os
import traceback
# ================================================================ Registration
#
from exabgp.reactor.network.outgoing import Outgoing
# from exabgp.re... | Review this code and list any quality issues. | [
{
"issue": "Function 'connect' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 93
},
{
"issue": "Function 'read_message' has cyclomatic complexity 21 (threshold: 5). Consider breaking it into smaller functions.",
"severi... | 4 |
python | import glob
import os
import sys
import random
import time
import numpy as np
import cv2
import math
from collections import deque
from keras.applications.xception import Xception
from keras.layers import Dense, GlobalAveragePooling2D
from keras.optimizers import Adam
from keras.models import Model
'''
Carla 패키지가 사용하는... | Review this code and list any quality issues. | [
{
"issue": "Function 'step' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 151
},
{
"issue": "Function 'train' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "min... | 3 |
python | from rest_framework import serializers
from bumblebee.buzzes.api.serializers.interaction_serializers import (
BuzzInteractionsSerializer,
)
from bumblebee.buzzes.models import Buzz, BuzzImage
from bumblebee.core.exceptions import UnknownModelFieldsError
from .user_serializers import BuzzUserSerializer
##########... | Review this code and list any quality issues. | [
{
"issue": "Function 'update_buzz' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 116
}
] | 1 |
python | # coding: utf-8
"""
barcodeapi
Barcode APIs let you generate barcode images, and recognize values from images of barcodes. # noqa: E501
OpenAPI spec version: v1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import copy
import logg... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' is 28 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 35
},
{
"issue": "Function 'logger_file' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
... | 2 |
python | from ...utils import DataDump, logger
from ..node import Node
class GenerationNode(Node):
def __init__(self, inputs, trigger_time, idx, dag, parent=None):
"""
Node for data generation jobs
Parameters:
-----------
inputs: bilby_pipe.main.MainInput
The user-defin... | 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": 6
}
] | 1 |
python | from msdsl.expr.expr import ModelExpr
from msdsl.expr.signals import Signal, DigitalSignal, AnalogSignal
from msdsl.expr.format import RealFormat
from msdsl.expr.table import Table
class Assignment:
def __init__(self, signal: Signal, expr: ModelExpr, check_format=True):
self.signal = signal
... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 19
},
{
"issue": "Function '__init__' has 7 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 26
},
{
"i... | 3 |
python | import contextlib
import errno
import socket
import unittest
import sys
from .. import support
HOST = "localhost"
HOSTv4 = "127.0.0.1"
HOSTv6 = "::1"
def find_unused_port(family=socket.AF_INET, socktype=socket.SOCK_STREAM):
"""Returns an unused port that should be suitable for binding. This is
achieved by... | Review this code and list any quality issues. | [
{
"issue": "Function 'bind_port' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 76
},
{
"issue": "Function 'skip_unless_bind_unix_socket' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functio... | 5 |
python | # Copyright 2013-present Barefoot Networks, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' is 28 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 32
},
{
"issue": "Function 'build' has cyclomatic complexity 13 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"l... | 3 |
python | # test_malquery.py
# This class tests the malquery service class
import os
import sys
import pytest
# Authentication via test_authorization.py
from tests import test_authorization as Authorization
# Import our sibling src folder into the path
sys.path.append(os.path.abspath('src'))
# Classes to test - manually imported... | Review this code and list any quality issues. | [
{
"issue": "Function 'mq_test_all_paths' is 56 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 27
}
] | 1 |
python | # Copyright 2013-2022 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os
from spack import *
class Sparskit(MakefilePackage):
"""SPARSKIT: A basic tool-kit for sparse matrix comp... | Review this code and list any quality issues. | [
{
"issue": "Function 'flag_handler' has cyclomatic complexity 11 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 35
}
] | 1 |
python | from sys import path
from os.path import dirname as dir
import webbrowser
import os
path.append(dir(path[0]))
from tkinter import ttk
import tkinter as tk
from tkinter import *
from ui.Pantalla_TS import *
from ui.Pantalla_AST import *
from ui.Pantalla_Error import *
import tkinter.messagebox
from analizer import inter... | Review this code and list any quality issues. | [
{
"issue": "Function 'inicializarScreen' is 39 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 25
},
{
"issue": "Function 'show_result' is 28 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"l... | 6 |
python | # Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.
# Configuration file for JupyterHub
import os
# pre-spawn settings
NB_UID = 65534
NB_GID = 65534
CUDA = 'cuda' in os.environ['HOSTNODE']
c = get_config()
# read users/teams & images
import os, yaml
with open('... | Review this code and list any quality issues. | [
{
"issue": "Function 'get_options_form' has cyclomatic complexity 17 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 34
},
{
"issue": "Function 'get_options_form' is 36 lines long. Functions over 25 lines are harder to test and maintain.",
"seve... | 2 |
python | # -*- coding: utf-8 -*-
# Copyright 2017 IBM RESEARCH. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 79
},
{
"issue": "Function 'plot_qsphere' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"l... | 5 |
python | #!/usr/bin/env python2
# Copyright (c) 2014-2015 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
# Exercise the getchaintips API. We introduce a network split, work
# on chains of different lengths, an... | Review this code and list any quality issues. | [
{
"issue": "Function 'run_test' is 32 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 15
}
] | 1 |
python | import json
import os
from mininet.topo import Topo
import subprocess
class Mapper(object):
def __init__(self, topo, physical_network_file, mapper):
self.topo = topo
self.physical_network_file = physical_network_file
self.mapper = mapper
self.topo_file = self.create_topo_file(topo... | Review this code and list any quality issues. | [
{
"issue": "Function '_run_python3_distriopt' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 55
}
] | 1 |
python | """
Time Series API For Digital Portals
Time series data, end-of-day or intraday, tick-by-tick or subsampled. Additional vendor-specific endpoints provide a modified interface for seamless integration with the ChartIQ chart library. # noqa: E501
The version of the OpenAPI document: 2
Generated by: ht... | Review this code and list any quality issues. | [
{
"issue": "Function '_from_openapi_data' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 113
},
{
"issue": "Function '_from_openapi_data' is 30 lines long. Functions over 25 lines are harder to test and maintain.",
"sev... | 4 |
python | import sys
from copy import deepcopy
from random import SystemRandom
from .aggregation_info import AggregationInfo
from .ec import (AffinePoint, JacobianPoint, default_ec, generator_Fq,
hash_to_point_Fq2, hash_to_point_prehashed_Fq2, y_for_x)
from .fields import Fq
from .signature import Signature
fro... | 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": 171
},
{
"issue": "Function '__init__' has 7 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 256
}
] | 2 |
python | import inspect
from typing import Iterable, Optional
from tqdm import tqdm
from ..utils.translations import trans
_tqdm_kwargs = {
p.name
for p in inspect.signature(tqdm.__init__).parameters.values()
if p.kind is not inspect.Parameter.VAR_KEYWORD and p.name != "self"
}
class progress(tqdm):
"""This... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 61
},
{
"issue": "Function '__init__' is 33 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
... | 4 |
python | import torch.nn as nn
from ..registry import HEADS
from ..utils import ConvModule
from mmdetection.core import auto_fp16
@HEADS.register_module
class MGANHead(nn.Module):
def __init__(self,
num_convs=2,
roi_feat_size=7,
in_channels=512,
conv_ou... | 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": "major",
"line": 11
},
{
"issue": "Function '__init__' has 7 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 11
}
] | 2 |
python | from PIL import Image, ImageTk
import random as rand
import turtle as trtl
# import required module
from playsound import playsound
import tkinter.messagebox
from pynput.keyboard import Key, Listener
import glob
#import prgm_image
# prgm_image_list = []
# for filename in glob.glob('/Users/khaase/Desktop/VroomFold/prgm_... | Review this code and list any quality issues. | [
{
"issue": "Function 'callerSoundOs' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 204
},
{
"issue": "Function 'whilePoint' is 26 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "mino... | 2 |
python | # Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | 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": 45
},
{
"issue": "Function '_create_netcdf_dataset_for_variable' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"sev... | 2 |
python | # ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
from __future__ import print_function
import functools
import hashlib
import os
from azure.core.exceptions import ResourceNotFoundError
from devtools_testutils import R... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_example_key_crud_operations' is 46 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 40
},
{
"issue": "Function 'test_example_key_list_operations' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into sm... | 2 |
python | import json, base64, requests
from jinja2 import Environment, FileSystemLoader
from pathlib import Path
import webbrowser
import tweepy
import sys
class Twitter:
def __init__(self, auth, Bearer_Token=None):
self.auth = auth
self.Bearer_Token = Bearer_Token
if self.auth is None:
... | Review this code and list any quality issues. | [
{
"issue": "Function 'GET_Favourites' is 26 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 47
},
{
"issue": "Function 'GET_Media' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor... | 3 |
python | from zipline.pipeline import Pipeline
from zipline.api import attach_pipeline, pipeline_output
from zipline.pipeline.data.equity_pricing import USEquityPricing
from zipline.pipeline.data import morningstar
from zipline.pipeline.factors import SimpleMovingAverage, AverageDollarVolume
from zipline.pipeline.filters.mornin... | Review this code and list any quality issues. | [
{
"issue": "Function 'initialize' is 40 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 14
},
{
"issue": "Function 'make_pipeline' is 59 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line":... | 5 |
python | from time import sleep
import pytest
from ...utils import assert_finished, assert_send, receive_json
class TestPeripheralSPI:
def test_start(self, obniz):
obniz.spi0.start(
{"clk": 0, "frequency": 1000000, "miso": 2, "mode": "master", "mosi": 1}
)
assert_send(obniz, [{"io0":... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_start_with_gnd' is 33 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 36
},
{
"issue": "Function 'test_end' is 28 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"li... | 2 |
python | # -*- coding: utf-8 -*-
'''
Auther: cytopia
License: MIT
Transformer for kubernetes-incubator/metrics-server from json
into Prometheus readable format.
'''
import os
import json
import re
import time
import requests
import subprocess
from flask import Flask
from flask import Response
'''
Globals that specify at wh... | Review this code and list any quality issues. | [
{
"issue": "Function 'val2base' has cyclomatic complexity 16 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 72
},
{
"issue": "Function 'trans_pod_metrics' is 40 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": ... | 2 |
python | import requests
from allauth.socialaccount.helpers import render_authentication_error
from allauth.socialaccount.models import SocialLogin, SocialAccount
from allauth.socialaccount.providers.base import ProviderException
from allauth.socialaccount.providers.google.views import GoogleOAuth2Adapter
from allauth.socialac... | Review this code and list any quality issues. | [
{
"issue": "Function 'dispatch' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 102
},
{
"issue": "Function 'dispatch' is 45 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
... | 3 |
python | import socket # Networking support
import time # Current time
from library import id_generate
host = None
port = None
log_th = None
conf_th = None
header_th = None
command_w_th = None
data_w_th = None
class HTTPServer:
def __init__(self):
global host, port, log_th, conf_th, header_th, command_w_th, da... | Review this code and list any quality issues. | [
{
"issue": "Function '_wait_for_connections' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 69
},
{
"issue": "Function '_wait_for_connections' is 45 lines long. Functions over 25 lines are harder to test and maintain.",
... | 3 |
python | #!/usr/bin/env python
#
# Use the raw transactions API to spend bitcoins received on particular addresses,
# and send any change back to that same address.
#
# Example usage:
# spendfrom.py # Lists available funds
# spendfrom.py --from=ADDRESS --to=ADDRESS --amount=11.00
#
# Assumes it will talk to a bitcoind or Bit... | Review this code and list any quality issues. | [
{
"issue": "Function 'list_available' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 99
},
{
"issue": "Function 'create_tx' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"sev... | 7 |
python | # -*- coding: utf-8 -*-
u"""pytest for `pykern.pkplatform`
:copyright: Copyright (c) 2015 Bivio Software, Inc. All Rights Reserved.
:license: http://www.apache.org/licenses/LICENSE-2.0.html
"""
from __future__ import absolute_import, division, print_function
import pytest
def test_conformance1():
"""Verify the p... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_conformance1' is 29 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 10
}
] | 1 |
python | # Definition for singly-linked list.
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
class Solution:
def rotateRight(self, head: ListNode, k: int) -> ListNode:
if not (head and head.next and k) :
return head
fast = head
cnt = 1
whi... | Review this code and list any quality issues. | [
{
"issue": "Function 'rotateRight' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 7
}
] | 1 |
python | # 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-2.0
#
# Unless required by applicable law or a... | Review this code and list any quality issues. | [
{
"issue": "Function '_watch_supervisors_from_backend' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 70
}
] | 1 |
python | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import paste
import subprocess
from multiprocessing import Process
from pathlib import Path
import tkinter.messagebox as messagebox
from shutil import copy
from appdirs import user_config_dir
import logging as log
from globe import Globe as globe
from util impo... | Review this code and list any quality issues. | [
{
"issue": "Function 'inkscape' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 39
}
] | 1 |
python | from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
from compas.utilities import flatten
import compas_rhino
from compas_rv2.rhino import get_scene
from compas_rv2.rhino import rv2_undo
from compas_rv2.rhino import rv2_error
# from compas_rv2.rhino import Modif... | Review this code and list any quality issues. | [
{
"issue": "Function 'RunCommand' has cyclomatic complexity 13 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 19
},
{
"issue": "Function 'RunCommand' is 26 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",... | 2 |
python | '''
Parse the FST of the current disk and list the files
Example:
MountIso c:/isos/ac.gcm (mount existing GCM)
% DvdListFiles
'''
def do_command(dolwin, args):
# Check if any DVD is mounted (real GCM image or DolphinSDK virtual disk)
mounted = False
res = dolwin.ExecuteWi... | Review this code and list any quality issues. | [
{
"issue": "Function 'do_command' has cyclomatic complexity 13 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 8
},
{
"issue": "Function 'do_command' is 56 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
... | 3 |
python | def mergeSort(arr):
n= len(arr)
if n > 1:
mid = int(n/2)
left = arr[0:mid]
right = arr[mid:n]
mergeSort(left)
mergeSort(right)
Merge(left, right, arr)
def Merge(left, right, arr):
i = 0
j = 0
k = 0
while i < len(left) and j < len(right):
if... | 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": 10
}
] | 1 |
python | from parserT28.models.instructions.Expression.type_enum import DATA_TYPE
from parserT28.controllers.three_address_code import ThreeAddressCode
from parserT28.controllers.error_controller import ErrorController
from parserT28.models.instructions.Expression.expression import Expression, Identifiers, PrimitiveData
from pa... | 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": 14
},
{
"issue": "Function 'process' has cyclomatic complexity 72 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"li... | 5 |
python | import genanki
import glob
from pathlib import Path
import random
def generateAnki():
random.seed(42)
title = 'Deutschland - Stadt, Land, Fluss'
aDeck = genanki.Deck(
2059400110,
title)
# location to name
aModel = genanki.Model(
1607392319,
title,
fields=[... | Review this code and list any quality issues. | [
{
"issue": "Function 'generateAnki' has cyclomatic complexity 11 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 6
},
{
"issue": "Function 'generateAnki' is 288 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "maj... | 2 |
python | import unittest
from sqlglot import transpile
from sqlglot.errors import ErrorLevel, UnsupportedError
class TestDialects(unittest.TestCase):
def test_mysql(self):
sql = transpile('SELECT CAST(`a`.`b` AS INT) FROM foo', read='mysql', write='mysql')[0]
self.assertEqual(sql, 'SELECT CAST(`a`.`b` AS I... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_presto' is 31 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 15
}
] | 1 |
python | """
@brief test log(time=2s)
"""
import unittest
import warnings
from pyquickhelper.loghelper import fLOG
class TestLONGScriptInstall(unittest.TestCase):
def test_pypi(self):
fLOG(
__file__,
self._testMethodName,
OutputPrint=__name__ == "__main__")
import... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_pypi' is 26 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 11
}
] | 1 |
python | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# Usage:
#
# $ python -m fixit.cli.run_rules --help
# $ python -m fixit.cli.run_rules
# $ python -m fixit.cli.run_rules --rules AvoidOrI... | Review this code and list any quality issues. | [
{
"issue": "Function 'get_formatted_reports_for_path' is 26 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 58
},
{
"issue": "Function 'main' is 62 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
... | 2 |
python | #!/usr/bin/env python
"""Tests for grr.parsers.windows_persistence."""
from grr.lib import flags
from grr.lib import rdfvalue
from grr.lib import test_lib
from grr.lib.rdfvalues import client as rdf_client
from grr.lib.rdfvalues import paths as rdf_paths
from grr.lib.rdfvalues import protodict as rdf_protodict
from gr... | Review this code and list any quality issues. | [
{
"issue": "Function 'testParse' is 41 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 15
}
] | 1 |
python | # -*- coding: utf-8 -*
import numpy as np
from loguru import logger
import torch
import torch.nn as nn
import torch.nn.functional as F
from videoanalyst.model.common_opr.common_block import (conv_bn_relu,
xcorr_depthwise)
from videoanalyst.model.module_base imp... | Review this code and list any quality issues. | [
{
"issue": "Function 'forward' has cyclomatic complexity 12 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 62
},
{
"issue": "Function 'forward' is 69 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"... | 2 |
python | from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..compat import compat_str
from ..utils import (
ExtractorError,
int_or_none,
str_to_int,
unified_strdate,
)
class RedTubeIE(InfoExtractor):
_VALID_URL = r'https?://(?:(?:www\.)?redtube\.com/|embed\.redtube\... | Review this code and list any quality issues. | [
{
"issue": "Function '_real_extract' has cyclomatic complexity 13 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 40
},
{
"issue": "Function '_real_extract' is 65 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "m... | 2 |
python | # -*- coding: utf-8 -*-
# *****************************************************************************
# NICOS, the Networked Instrument Control System of the MLZ
# Copyright (c) 2009-2021 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 '__init__' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 39
},
{
"issue": "Function '__init__' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line"... | 3 |
python | """
Tests for functions in class SolveDiffusion2D
"""
import numpy as np
#import pytest
from diffusion2d import SolveDiffusion2D
from unittest import TestCase
class TestOperations(TestCase):
"""
Test suite for mathematical operations functions.
"""
def setUp(self):
# Fixture
self.w = ... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_get_initial_condition' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 54
}
] | 1 |
python | from moto.ec2.utils import add_tag_specification
from ._base_response import EC2BaseResponse
class ElasticIPAddresses(EC2BaseResponse):
def allocate_address(self):
domain = self._get_param("Domain", if_none="standard")
reallocate_address = self._get_param("Address", if_none=None)
tags = se... | Review this code and list any quality issues. | [
{
"issue": "Function 'associate_address' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 22
},
{
"issue": "Function 'associate_address' is 44 lines long. Functions over 25 lines are harder to test and maintain.",
"severi... | 2 |
python | from time import sleep
import numpy as np
import matplotlib.pyplot as plt
def get_initial_state(size):
return np.random.choice([0, 1], size)
def compute_next_state(state):
new_state = np.zeros(state.shape, dtype=int)
for i in range(state.shape[0]):
for j in range(state.shape[1]):
low... | Review this code and list any quality issues. | [
{
"issue": "Function 'compute_next_state' has cyclomatic complexity 11 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 10
}
] | 1 |
python | import torch
import argparse
# ----- Parser -----
def parser():
PARSER = argparse.ArgumentParser(description='Training parameters.')
# Dataset
PARSER.add_argument('--dataset', default='CIFAR10', type=str,
choices=['CIFAR10', 'CelebA', 'Imagenette', 'ImageNet32', 'ImageNet64'],
... | Review this code and list any quality issues. | [
{
"issue": "Function 'parser' is 46 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 6
}
] | 1 |
python | # Copyright 2017 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import json
import sys
from dashboard.common import testing_common
from dashboard.common import utils
from dashboard.models import histogram
from tracing.va... | Review this code and list any quality issues. | [
{
"issue": "Function '_AddMockData' is 48 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 21
},
{
"issue": "Function 'testFixupDiagnostics_DifferentTestPath_NoChange' is 27 lines long. Functions over 25 lines are harder to test and maintain.",
... | 4 |
python | import pandas as pd
import numpy as np
from sklearn.preprocessing import StandardScaler
from DataUtility import get_column_names
class LiPolymerDataScaler:
"""
a special class to scale the lithium polymer database
"""
def __init__(self):
self.scaling_dict = {}
self.main_val_params = [... | Review this code and list any quality issues. | [
{
"issue": "Function 'fit_transform' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 38
},
{
"issue": "Function 'transform' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"seve... | 2 |
python | """
Format String 2D array
2d array for compositing term-formated strings
-autoexpanding vertically
-interesting get_item behavior (renders fmtstrs)
-caching behavior eventually
>>> a = FSArray(10, 14)
>>> a.shape
(10, 14)
>>> a[1] = 'i'
>>> a[3:4, :] = ['i' * 14]
>>> a[16:17, :] = ['j' * 14]
>>> a.shape, a[16, 0]
... | Review this code and list any quality issues. | [
{
"issue": "Function 'fsarray' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 54
},
{
"issue": "Function '__init__' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line"... | 7 |
python | # Copyright 2020 - 2021 MONAI Consortium
# 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 wri... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 43
},
{
"issue": "Function 'compute_average_surface_distance' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severi... | 4 |
python | # -*- coding: utf-
"""
wsgi.py
:Created: 12 Jun 2014
:Author: tim
"""
from spyne.server.wsgi import WsgiApplication as _SpyneWsgiApplication
from spyne_smev.server import _AllYourInterfaceDocuments
class WsgiApplication(_SpyneWsgiApplication):
def __init__(self, app, c... | 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": 18
}
] | 1 |
python | # coding: utf-8
from __future__ import unicode_literals
import re
from ..compat import compat_str
from ..utils import int_or_none, str_or_none, try_get
from .common import InfoExtractor
class PalcoMP3BaseIE(InfoExtractor):
_GQL_QUERY_TMPL = """{
artist(slug: "%s") {
%s
}
}"""
_ARTIST_FIELDS_TMPL = "... | Review this code and list any quality issues. | [
{
"issue": "Function '_parse_music' is 27 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 36
}
] | 1 |
python | # Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
Data and labels file for various datasets.
"""
import json
import logging
import os
from typing import List
import numpy as np
from fvcor... | Review this code and list any quality issues. | [
{
"issue": "Function 'get_local_path' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 126
},
{
"issue": "Function 'get_data_files' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.",
... | 3 |
python | #!/usr/bin/env python3
"""
Generates Pulr "pull" config section from JSON, created with fetch-tags.py
"""
import sys
import argparse
from textwrap import dedent
try:
import rapidjson as json
except:
import json
import yaml
DEFAULT_FREQ = 1
DEFAULT_PATH = '1,0'
DEFAULT_CPU = 'LGX'
DEFAULT_TIMEOUT = 2
def ... | Review this code and list any quality issues. | [
{
"issue": "Function 'generate.find_tag' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 51
},
{
"issue": "Function 'generate.add_tag_info' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller funct... | 7 |
python | #!/usr/bin/python
# -*- coding: utf-8 -*-
import json
import os
import sys
import os.path
import re
from pprint import pprint
from subprocess import Popen, PIPE
readme = open('README.md', 'w')
readme.write("# Free Hack Quest 2016\n")
def getListOfDirsWithTasks():
result = []
dirs = os.listdir('./');
for d in di... | Review this code and list any quality issues. | [
{
"issue": "Function 'getListOfDirsWithTasks' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 17
},
{
"issue": "Function 'getDescriptionFromTask' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller ... | 5 |
python | import os
from xua import helpers
from xua.constants import CLI, BUILD
from xua.exceptions import UserError
from xua.builders.doc import htmlOld
def getBuildEngine(project, config):
if project == CLI.PROJECT_SERVER_PHP:
# @TODO
return None
elif project == CLI.PROJECT_MARSHAL_DART:
# @T... | Review this code and list any quality issues. | [
{
"issue": "Function 'buildRecursive' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 25
}
] | 1 |
python | from functools import partial
import click
from odc import dscache
from odc.dscache.tools.tiling import (
bin_by_native_tile,
web_gs,
extract_native_albers_tile,
parse_gridspec)
from odc.dscache._dscache import mk_group_name
from odc.index import bin_dataset_stream
@click.command('dstiler')
@click.op... | Review this code and list any quality issues. | [
{
"issue": "Function 'cli' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 22
},
{
"issue": "Function 'cli' is 30 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 22... | 3 |
python | # --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
"""The data layer used during training to train a DA Fast R-CNN network... | Review this code and list any quality issues. | [
{
"issue": "Function 'setup' is 41 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 87
}
] | 1 |
python | #!/usr/bin/env python
__all__ = ['universal_download']
from ..common import *
from .embed import *
def universal_download(url, output_dir='.', merge=True, info_only=False, **kwargs):
try:
content_type = get_head(url, headers=fake_headers)['Content-Type']
except:
content_type = get_head(url, h... | Review this code and list any quality issues. | [
{
"issue": "Function 'universal_download' has cyclomatic complexity 21 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 8
},
{
"issue": "Function 'universal_download' is 89 lines long. Functions over 25 lines are harder to test and maintain.",
"s... | 3 |
python | # Copyright The PyTorch Lightning team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... | Review this code and list any quality issues. | [
{
"issue": "Function 'on_train_start' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 96
},
{
"issue": "Function '_add_suffix' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
... | 4 |
python |
import http.client
import urllib.request, urllib.parse, urllib.error
import urllib.request, urllib.error, urllib.parse
import re
import csv
from http.cookiejar import CookieJar
class pyGTrends(object):
"""
Google Trends API
Recommended usage:
from csv import DictReader
r = pyGTrends(us... | Review this code and list any quality issues. | [
{
"issue": "Function 'download_report' has 9 parameters. Consider using a parameter object to reduce arity.",
"severity": "critical",
"line": 63
},
{
"issue": "Function 'csv' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"... | 2 |
python | #AUTOGENERATED! DO NOT EDIT! File to edit: dev/07_data.block.ipynb (unless otherwise specified).
__all__ = ['TransformBlock', 'CategoryBlock', 'MultiCategoryBlock', 'DataBlock']
#Cell
from ..torch_basics import *
from ..test import *
from .core import *
from .load import *
from .external import *
from .transforms imp... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 16
},
{
"issue": "Function '__init__' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line"... | 5 |
python | #!/usr/bin/env python3
"""
Synopsis: utilities/generate_schema.py > lib/schema.py
This routine pulls the current table definitions from the csv2 database and writes the
schema to stdout. To use the schema definitions:
from lib.schema import <view_or_table_name_1>, <view_or_table_name_2>, ...
"""
from sub... | Review this code and list any quality issues. | [
{
"issue": "Function 'main' has cyclomatic complexity 32 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 20
},
{
"issue": "Function 'main' is 151 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical",
... | 2 |
python | import string
import torch
from torch.nn import CrossEntropyLoss
from torch.nn import CTCLoss
import torch.optim as optim
from torch.utils.tensorboard import SummaryWriter
from torchsummary import summary
from tqdm import tqdm
from cnn_seq2seq import ConvSeq2Seq
from cnn_seq2seq import Decoder
from cnn_seq2seq import... | Review this code and list any quality issues. | [
{
"issue": "Function 'train' is 39 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 21
},
{
"issue": "Function 'train_cs2s' is 56 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 88
},... | 3 |
python | ## code simplified from the dca package
import os
import numpy as np
import scanpy.api as sc
import keras
from keras.layers import Input, Dense, Dropout, Activation, BatchNormalization
from keras.models import Model
from keras.objectives import mean_squared_error
from keras import backend as K
import tensorflow as t... | 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 'build' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 6... | 4 |
python | from collections import namedtuple
from .api import APIItems
# Represents a CIE 1931 XY coordinate pair.
XYPoint = namedtuple("XYPoint", ["x", "y"])
# Represents the Gamut of a light.
GamutType = namedtuple("GamutType", ["red", "green", "blue"])
class Lights(APIItems):
"""Represents Hue Lights.
https://d... | 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": 19
},
{
"issue": "Function '__init__' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 28
},
{
"i... | 4 |
python | # Copyright 2019-2020 The Lux Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed... | 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
},
{
"issue": "Function '__repr__' has cyclomatic complexity 16 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"l... | 7 |
python | #!/usr/bin/env python
# coding=utf-8
import logging
from typing import NamedTuple, List
from dataclasses import dataclass
from collections import OrderedDict as odict, defaultdict
import numpy as np
from ioos_qc.qartod import QartodFlags
L = logging.getLogger(__name__) # noqa
class CallResult(NamedTuple):
pack... | Review this code and list any quality issues. | [
{
"issue": "Function 'collect_results_list' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 69
},
{
"issue": "Function 'collect_results_list' is 44 lines long. Functions over 25 lines are harder to test and maintain.",
"... | 2 |
python | from bs4 import BeautifulSoup as bs
import requests
from urllib.request import urlopen
from urllib.parse import quote
import re
import time
def getProductInfo(productNameIndex):
headers = {"User-Agent": "Mozilla/5.0"}
color = []
size = []
price = ""
instruction = ""
sizeGuide = ""
category... | Review this code and list any quality issues. | [
{
"issue": "Function 'getProductInfo' has cyclomatic complexity 30 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 9
},
{
"issue": "Function 'getProductInfo' is 146 lines long. Functions over 25 lines are harder to test and maintain.",
"severity... | 2 |
python | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import git
import os
import re
import sys
import toml
from pathlib import Path
from alchemist_py.brokergen import createProject
from alchemist_py.deviceinfo import searchDevice
from alchemist_py.plugin_manager import PluginManager
class Manager(object):
def __init_... | Review this code and list any quality issues. | [
{
"issue": "Function 'updateNode' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 37
},
{
"issue": "Function 'updateNode' is 26 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
... | 6 |
python | ###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013-2019, John McNamara, jmcnamara@cpan.org
#
from ..excel_comparsion_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompareXLSXFiles(ExcelComparisonTest):
"""... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_create_file' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 23
},
{
"issue": "Function 'test_create_file' is 28 lines long. Functions over 25 lines are harder to test and maintain.",
"severity... | 2 |
python | """ Summary
"""
class Solution(object):
"""
Problem:
https://leetcode.com/problems/combination-sum/
Example:
given candidate set [2, 3, 6, 7] and target 7,
A solution set is:
[
[7],
[2, 2, 3]
]
"""
def combinationSum(self, candidates, t... | Review this code and list any quality issues. | [
{
"issue": "Function 'combinationSum' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 19
}
] | 1 |
python | import logging
import random
from typing import List, Tuple
import numpy as np
from skimage.transform import resize
from scipy.ndimage import zoom
from toolbox import images
from toolbox.images import crop, mask_bbox
from .poisson_disk import sample_poisson_uniform
logger = logging.getLogger(__name__)
class PatchT... | Review this code and list any quality issues. | [
{
"issue": "Function 'generate_dense_bboxes' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 35
},
{
"issue": "Function 'bboxes_to_patches' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functi... | 3 |
python | #Tests proper handling of Verifications with Transactions which don't exist.
from typing import Dict, List, Any
import json
from pytest import raises
from e2e.Libs.Minisketch import Sketch
from e2e.Classes.Merit.Block import Block
from e2e.Classes.Merit.Merit import Merit
from e2e.Classes.Consensus.VerificationPack... | Review this code and list any quality issues. | [
{
"issue": "Function 'VUnknownInBlockTest.checkFail' has cyclomatic complexity 17 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 31
},
{
"issue": "Function 'VUnknownInBlockTest.checkFail' is 45 lines long. Functions over 25 lines are harder to test... | 2 |
python | import json
import os
import sys
from datetime import datetime
import numpy as np
import pandas as pd
from objects.task import Task
from objects.workflow import Workflow
from objects.workload import Workload
pd.set_option('display.max_columns', None)
USAGE = 'Usage: python(3) ./galaxy_to_parquet.py galaxy_folder'
N... | Review this code and list any quality issues. | [
{
"issue": "Function 'read_files' is 86 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 30
},
{
"issue": "Function 'compute_children' has cyclomatic complexity 11 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "m... | 5 |
python | import seaborn as sns
import matplotlib.pyplot as plt
import torch
import numpy as np
import cv2
from .cam import GradCAM
# def load_gradcam(images, labels, model, device, target_layers):
def load_gradcam(test, model, device, target_layers,size = 25,classified = True):
_images = []
_target = []
_pred = [... | Review this code and list any quality issues. | [
{
"issue": "Function 'load_gradcam' is 34 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 10
},
{
"issue": "Function 'load_gradcam' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 10
... | 4 |
python | import torch
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
LAMBDA_COORD = 5
LAMBDA_NOOBJ = 0.5
def calc_loss(inp , target, opt):
if inp.size(0) != target.size(0):
raise Exception("Batch size does not match")
total_loss = torch.tensor(0.0)
#total_loss = total_loss.dtype(te... | Review this code and list any quality issues. | [
{
"issue": "Function 'predict_one_bbox' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 22
},
{
"issue": "Function 'predict_one_bbox' is 28 lines long. Functions over 25 lines are harder to test and maintain.",
"severit... | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.