language stringclasses 1
value | code stringlengths 407 33.3k | instruction stringclasses 1
value | flaws listlengths 1 17 | flaw_count int64 1 17 |
|---|---|---|---|---|
python | import asyncio
import re
import sys
import traceback
import toga
from toga import Key
from .keys import toga_to_winforms_key
from .libs import Threading, WinForms, shcore, user32, win_version
from .libs.proactor import WinformsProactorEventLoop
from .window import Window
class MainWindow(Window):
def winforms_F... | Review this code and list any quality issues. | [
{
"issue": "Function 'create' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 41
},
{
"issue": "Function 'create' is 39 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"lin... | 6 |
python | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
# vim: set et sw=4 ts=4 sts=4 ff=unix fenc=utf8:
# Author: Binux<i@binux.me>
# http://binux.me
# Created on 2012-11-14 17:09:50
from __future__ import unicode_literals, division, absolute_import
import time
import logging
from collections import deque
try:
f... | Review this code and list any quality issues. | [
{
"issue": "Function '_trim_window' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 141
},
{
"issue": "Function '__getitem__' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"se... | 3 |
python | import functools
import random
from math import cos, pi
import cv2
import kornia
import numpy as np
import torch
from kornia.augmentation import ColorJitter
from data.util import read_img
from PIL import Image
from io import BytesIO
# Get a rough visualization of the above distribution. (Y-axis is meaningless, just... | 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": 41
},
{
"issue": "Function 'corrupt_images' has cyclomatic complexity 12 (threshold: 5). Consider breaking it into smaller functions.",
"sev... | 6 |
python | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | Review this code and list any quality issues. | [
{
"issue": "Function '_configure' has cyclomatic complexity 11 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 53
}
] | 1 |
python | """
Platformer Game
"""
import arcade
# Constants
SCREEN_WIDTH = 1000
SCREEN_HEIGHT = 650
SCREEN_TITLE = "Platformer"
# Constants used to scale our sprites from their original size
CHARACTER_SCALING = 1
TILE_SCALING = 0.5
COIN_SCALING = 0.5
SPRITE_PIXEL_SIZE = 128
GRID_PIXEL_SIZE = SPRITE_PIXEL_SIZE * TILE_SCALING
#... | Review this code and list any quality issues. | [
{
"issue": "Function 'on_key_press' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 132
}
] | 1 |
python | #!/usr/bin/env python
import serial
import sys
import struct
import pprint
import argparse
import code
pp = pprint.PrettyPrinter()
class ConsoleUI:
def opStart(self, name):
sys.stdout.write(name.ljust(40))
def opProgress(self, progress, total=-1):
if (total >= 0):
prstr = "0x%04x... | Review this code and list any quality issues. | [
{
"issue": "Function 'main' has cyclomatic complexity 13 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 126
},
{
"issue": "Function 'main' is 66 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line"... | 2 |
python | """Mypy style test cases for SQLAlchemy stubs and plugin."""
import os
import os.path
import sys
import pytest # type: ignore # no pytest in typeshed
from mypy.test.config import test_temp_dir
from mypy.test.data import DataDrivenTestCase, DataSuite
from mypy.test.helpers import assert_string_arrays_equal
from myp... | Review this code and list any quality issues. | [
{
"issue": "Function 'run_case' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 33
},
{
"issue": "Function 'run_case' is 33 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
... | 2 |
python | #!/usr/bin/env python
# Copyright (C) 2017 The Android Open Source Project
#
# 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 b... | Review this code and list any quality issues. | [
{
"issue": "Function '_main' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 85
},
{
"issue": "Function '_main' is 60 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line"... | 2 |
python | # coding: utf-8
"""
An API to insert and retrieve metadata on cloud artifacts.
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: v1alpha1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
... | 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
},
{
"issue": "Function 'to_dict' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line":... | 2 |
python | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, unicode_literals, print_function
import re
import os
import tempfile
import six
from .. import environment
from ..console import log
from .. import util
WIN = (os.name == "nt")... | Review this code and list any quality issues. | [
{
"issue": "Function '_setup' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 118
},
{
"issue": "Function '_setup' is 31 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"li... | 3 |
python |
from .single_stage import SingleStageDetector
from ..registry import DETECTORS
from mmdet.core import bbox2result
import torch.nn as nn
import torch
from .. import builder
import numpy as np
import cv2
from mmdet.core import bbox2roi, bbox2result, build_assigner, build_sampler
@DETECTORS.register_module
class CSP(Sin... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has 11 parameters. Consider using a parameter object to reduce arity.",
"severity": "critical",
"line": 15
},
{
"issue": "Function 'show_input_debug' is 33 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": ... | 15 |
python | # Copyright (C) 2013 eNovance SAS <licensing@enovance.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_notification_report_interval' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 131
},
{
"issue": "Function 'test_notification_report_interval' is 30 lines long. Functions over 25 lines are harder to... | 2 |
python | #
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 47
},
{
"issue": "Function '__init__' is 41 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
... | 2 |
python | """Support for ICS Calendar."""
import copy
import logging
from datetime import datetime, timedelta
from urllib.error import ContentTooShortError, HTTPError, URLError
from urllib.request import (
HTTPPasswordMgrWithDefaultRealm,
HTTPBasicAuthHandler,
HTTPDigestAuthHandler,
build_opener,
install_open... | Review this code and list any quality issues. | [
{
"issue": "Function '_download_calendar' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 170
}
] | 1 |
python | import logging
import os
from pathlib import Path
from typing import Any, Callable, Optional
from torch.utils.data import Dataset
from torchvision import transforms
from PIL import Image
import cv2
import numpy as np
class URISC(Dataset):
def __init__(
self,
dir: str,
mode: str = 'trai... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 15
}
] | 1 |
python | import os
import subprocess
from unittest import mock
import pytest
from pre_commit.constants import VERSION as PRE_COMMIT_VERSION
import testing.git
from all_repos import autofix_lib
from all_repos import clone
from all_repos import git
from all_repos.config import load_config
@pytest.mark.parametrize(
('cli_r... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_autofix_makes_commits' is 34 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 267
}
] | 1 |
python | #
# Copyright 2018 Analytics Zoo Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | Review this code and list any quality issues. | [
{
"issue": "Function '_build_train' is 31 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 42
},
{
"issue": "Function 'fit_eval' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 207
}
... | 2 |
python | from src.layers.LayerHelper import *
from settings import LayerSettings as layerSettings
import tensorflow as tf
import os
CUDA_VISIBLE_DEVICES=0
os.environ["CUDA_VISIBLE_DEVICES"] = "0" # set gpu number
def LSTM(name_, inputTensor_, numberOfOutputs_, isTraining_, dropoutProb_=None):
with tf.name_scope(name_):
cell... | Review this code and list any quality issues. | [
{
"issue": "Function 'LSTM' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 8
},
{
"issue": "Function 'LSTM' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 8
}
] | 2 |
python | #------------------------------------------------------------------------------
# Copyright (c) 2005, Enthought, Inc.
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in enthought/LICENSE.txt and may be redistributed only
# under the conditions describe... | 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": 79
},
{
"issue": "Function 'parse' has cyclomatic complexity 23 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line... | 3 |
python | from keras.preprocessing.image import ImageDataGenerator
from keras.models import Sequential
from keras.layers import Convolution2D, MaxPooling2D
from keras.layers import Activation, Dropout, Flatten, Dense, Lambda, ELU
from keras.optimizers import Adam
from sklearn.model_selection import train_test_split
from keras.mo... | Review this code and list any quality issues. | [
{
"issue": "Function 'make_parallel' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 20
},
{
"issue": "Function 'train' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"lin... | 2 |
python | """
This module patches a few core functions to add compression capabilities,
since gevent-websocket does not appear to be maintained anymore.
"""
from socket import error
from zlib import (
decompressobj,
MAX_WBITS,
Z_FULL_FLUSH,
)
from geventwebsocket.exceptions import (
ProtocolError,
WebSocketE... | Review this code and list any quality issues. | [
{
"issue": "Function 'read_frame' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 82
},
{
"issue": "Function 'read_frame' is 26 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
... | 2 |
python | import sys
class SortableArray():
def __init__(self, arr):
self.arr = arr
def partition(self, left, right):
# choose right most as pivot
pivot_index = right
# get pivot value for compares
pivot = self.arr[pivot_index]
right -= 1
print(f'left orig: {left} right orig: {right}')
while True:
# move... | Review this code and list any quality issues. | [
{
"issue": "Function 'partition' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 7
}
] | 1 |
python | #!/usr/bin/env python
"""
Example script to register two volumes with VoxelMorph models.
Please make sure to use trained models appropriately. Let's say we have a model trained to register
a scan (moving) to an atlas (fixed). To register a scan to the atlas and save the warp field, run:
register.py --moving mov... | Review this code and list any quality issues. | [
{
"issue": "Function 'interpolate' is 34 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 131
},
{
"issue": "Function 'save4image' is 28 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical",
"line... | 3 |
python | # This file is part of the pyMOR project (https://www.pymor.org).
# Copyright 2013-2021 pyMOR developers and contributors. All rights reserved.
# License: BSD 2-Clause License (https://opensource.org/licenses/BSD-2-Clause)
import numpy as np
from pymor.algorithms.image import estimate_image_hierarchical
from pymor.al... | 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": 62
},
{
"issue": "Function '__init__' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 143
},
{
"... | 5 |
python | import logging
import hmac
from hashlib import sha256
import os
import urllib
from datetime import datetime
log = logging.getLogger(__name__)
# This warning is stupid
# pylint: disable=logging-fstring-interpolation
def prepend_bucketname(name):
prefix = os.getenv('BUCKETNAME_PREFIX', "gsfc-ngap-{}-".format(os.g... | Review this code and list any quality issues. | [
{
"issue": "Function 'get_presigned_url' is 27 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 24
},
{
"issue": "Function 'get_presigned_url' has 7 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"l... | 4 |
python | class optimType:
REACTION_KO = 1
REACTION_UO = 2
GENE_KO = 3
GENE_UO = 4
MEDIUM = 5
MEDIUM_LEVELS = 6
MEDIUM_REACTION_KO = 7
MEDIUM_REACTION_UO = 8
COMPOSITION = 9
PROTEIN_KO = 10
PROTEIN_UO = 11
types = {1:"Reaction Knockouts",2:"Reaction Under/Over expression", 3:"Gene... | Review this code and list any quality issues. | [
{
"issue": "Function 'get_status_str' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 62
}
] | 1 |
python | import json
from datetime import datetime, timedelta
from bittrex.bittrex import Bittrex
def TradingAlorythm(command, market, amount, coinname, step, stoploss, key, secret):
TestTrading = Bittrex(key, secret)
period = timedelta(seconds=20)
next_tick = datetime.now() + period
seconds = 20
firstCycl... | Review this code and list any quality issues. | [
{
"issue": "Function 'TradingAlorythm' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 6
},
{
"issue": "Function 'TradingAlorythm' is 42 lines long. Functions over 25 lines are harder to test and maintain.",
"severity... | 3 |
python | from nltk.util import ngrams
from nltk.corpus import stopwords
from collections import Counter
from .common import get_pp_pipeline
def or_list(booleans):
return True in booleans
def get_ngrams(D):
'''
Returns all ngrams (aka a token containing a dollar sign ($)) from a set of topics or documents
:par... | Review this code and list any quality issues. | [
{
"issue": "Function 'get_dataset_ngrams' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 56
},
{
"issue": "Function 'insert_ngrams_flat' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line"... | 3 |
python | import collections
import copy
import logging
import time
from abc import abstractmethod
from ...scheduler import HyperbandScheduler, RLScheduler, FIFOScheduler
from ...scheduler.seq_scheduler import LocalSequentialScheduler
from ...utils import in_ipynb, try_import_mxnet
from ...utils.utils import setup_compute
__al... | Review this code and list any quality issues. | [
{
"issue": "Function 'run_fit' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 52
},
{
"issue": "Function 'run_fit' is 33 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"l... | 9 |
python | """Rule generation utilities."""
load("@org_tensorflow//tensorflow:tensorflow.bzl", "if_not_windows", "tf_binary_additional_srcs", "tf_cc_binary", "tf_copts")
load("//tensorflow_decision_forests/tensorflow:utils.bzl", "rpath_linkopts_to_tensorflow")
def py_wrap_yggdrasil_learners(
name = None,
learner... | Review this code and list any quality issues. | [
{
"issue": "Function 'py_wrap_yggdrasil_learners' is 42 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 6
}
] | 1 |
python | """
Input: tsv file in the form
Input Video filename | topic | subtopic | title greek | title english | start time | end time | delete segments
input.mp4 | 1 | 1 | έξοδος | output | 00:10:05 | 00:30:10 | 00:11:15-00:12:30,00:20:35-00:22:10
"""
import os
import subprocess
import sys... | Review this code and list any quality issues. | [
{
"issue": "Function 'manage_timestamps' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 55
}
] | 1 |
End of preview. Expand in Data Studio
README.md exists but content is empty.
- Downloads last month
- 76