language stringclasses 1
value | code stringlengths 407 33.3k | instruction stringclasses 1
value | flaws listlengths 1 17 | flaw_count int64 1 17 |
|---|---|---|---|---|
python | import mitsuba
import pytest
import os
import enoki as ek
def test01_construct(variant_scalar_rgb):
from mitsuba.core.xml import load_string
# With default reconstruction filter
film = load_string("""<film version="2.0.0" type="hdrfilm"></film>""")
assert film is not None
assert film.reconstructi... | Review this code and list any quality issues. | [
{
"issue": "Function 'test02_crops' is 32 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 35
},
{
"issue": "Function 'test03_develop' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "ma... | 3 |
python | import json
from re import match
from django.contrib.auth.decorators import login_required
from django.views.decorators.http import require_POST
from django.shortcuts import redirect, render
from gui.mon.forms import BaseAlertFilterForm
from gui.utils import collect_view_data
from gui.decorators import ajax_required,... | Review this code and list any quality issues. | [
{
"issue": "Function 'alert_list' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 59
}
] | 1 |
python | import logging
from . import common_functions as c_f
import os
import torch
from collections import defaultdict
import sqlite3
# You can write your own hooks for logging.
# But if you'd like something that just works, then use this HookContainer.
# You'll need to install record-keeper and tensorboard.
# pip install 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": 15
},
{
"issue": "Function 'end_of_epoch_hook' has 7 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 43
},
... | 12 |
python | # Copyright 2018 Amazon.com, Inc. or its affiliates. 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.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in th... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 27
},
{
"issue": "Function '__init__' is 32 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
... | 6 |
python | '''
A: suffix solution
1. subproblems: define dp(i, j) = is_match(s[i:], p[j:]), suffix
2. guess,
2.1 the current char in p is a '*'
- use '*', repeat the char before it
- do not use '*', skip to next char after '*'
2.2 current char in s and p are match, s[i] == p[j] or ... | Review this code and list any quality issues. | [
{
"issue": "Function 'dfs_suffix' has cyclomatic complexity 12 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 51
},
{
"issue": "Function 'dfs_suffix' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"... | 6 |
python | import argparse
import imp
import importlib
import random
from opentamp.src.policy_hooks.vae.vae_main import MultiProcessMain
def load_config(args, reload_module=None):
config_file = args.config
if config_file != '':
if reload_module is not None:
config_module = reload_module
... | Review this code and list any quality issues. | [
{
"issue": "Function 'load_config' has cyclomatic complexity 13 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 9
},
{
"issue": "Function 'load_config' is 40 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major"... | 3 |
python | from django.shortcuts import render, HttpResponseRedirect
from django.urls import reverse
from urllib.parse import urlencode, unquote
import requests
from bs4 import BeautifulSoup
from django.utils.crypto import get_random_string
from django.contrib import messages
from urllib.parse import urlparse, urljoin
from django... | Review this code and list any quality issues. | [
{
"issue": "Function 'login' has cyclomatic complexity 19 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 23
},
{
"issue": "Function 'login' is 57 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical",
... | 4 |
python | import argparse
# from AnnotatorCore import *
import sys
import csv
import requests
import os.path
import logging
import re
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
from datetime import date
import logging
logging.basicConfig(level=logging.INFO)
log = logging.getLogger('CnaAnnotator')
d... | Review this code and list any quality issues. | [
{
"issue": "Function 'main' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 18
},
{
"issue": "Function 'main' is 29 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": ... | 2 |
python | import numpy as np
import scipy
from scipy.spatial.distance import cdist
import lap # 0.4.0
from cython_bbox import bbox_overlaps as bbox_ious
from . import kalman_filter
def merge_matches(m1, m2, shape):
O,P,Q = shape
m1 = np.asarray(m1)
m2 = np.asarray(m2)
M1 = scipy.sparse.coo_matrix... | Review this code and list any quality issues. | [
{
"issue": "Function 'iou_distance' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 60
},
{
"issue": "Function 'fuse_motion' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
... | 2 |
python | ################################################################
# System's dependencies
################################################################
import os
import sys
import time
import argparse
################################################################
# Local dependencies
##############################... | Review this code and list any quality issues. | [
{
"issue": "Function 'run' is 28 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 25
},
{
"issue": "Function 'run' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 25
}
] | 2 |
python | import json
import sys
from . import app
from . import bdev
from . import iscsi
from . import log
from . import lvol
from . import nbd
from . import net
from . import nvmf
from . import pmem
from . import subsystem
from . import vhost
def start_subsystem_init(client):
return client.call('start_subsystem_init')
... | Review this code and list any quality issues. | [
{
"issue": "Function 'save_config' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 30
},
{
"issue": "Function 'load_config' has cyclomatic complexity 14 (threshold: 5). Consider breaking it into smaller functions.",
"sev... | 3 |
python | import pytest
from dagster import DagsterInvalidConfigDefinitionError, Noneable, Selector, execute_solid, solid
def test_kitchen_sink():
@solid(
config_schema={
'str_field': str,
'int_field': int,
'list_int': [int],
'list_list_int': [[int]],
'di... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_kitchen_sink' is 48 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 6
}
] | 1 |
python | # !/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Define the siamese network for one-shot learning,
for french short labels
02/06/2021
@author: milena-git, from jeremylhour courtesy
"""
import torch
import torch.nn as nn
def _createEmbeddingLayer(weights_matrix, non_trainable=False):
"""
_createEmbeddingLay... | Review this code and list any quality issues. | [
{
"issue": "Function 'forward' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 65
}
] | 1 |
python | # Copyright 2020 The Kubernetes 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_tests' is 31 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 66
}
] | 1 |
python | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
#~ The MIT License (MIT)
#~ Copyright 2018 ©klo86min
#~ 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 with... | Review this code and list any quality issues. | [
{
"issue": "Function 'score_inferences' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 199
},
{
"issue": "Function 'score_inferences' is 37 lines long. Functions over 25 lines are harder to test and maintain.",
"severit... | 5 |
python | # Copyright 2015 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 '_VariableRankTest' is 27 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 49
},
{
"issue": "Function '_VariableRankTest' has 7 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"l... | 2 |
python | """Edge weights.
"""
__author__ = "Rémi Barat"
__version__ = "1.0"
import math
import random
from crack.models.weights import condition_models, format_crit
#####################################################
### Format the models for init_EWeights functions ###
##################################################... | Review this code and list any quality issues. | [
{
"issue": "Function '_init_EWeights.wrapper' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 21
},
{
"issue": "Function 'init_EWeights_from_args' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
... | 7 |
python | # Copyright 2020 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | Review this code and list any quality issues. | [
{
"issue": "Function 'run_diagnose_me' has cyclomatic complexity 18 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 18
},
{
"issue": "Function 'run_diagnose_me' is 149 lines long. Functions over 25 lines are harder to test and maintain.",
"sever... | 3 |
python | from sympy import Rational, Symbol, latex, UnevaluatedExpr
import sympy as sp
import numpy as np
u = lambda x : UnevaluatedExpr(x)
# Helper functions
def explain_add(a, b):
assert(np.shape(a) == np.shape(b))
rows, columns = np.shape(a)
return sp.Matrix([[Symbol(f"({latex(u(a[i,j]))} + {latex(u(b[i,j]))})"... | Review this code and list any quality issues. | [
{
"issue": "Function 'symbolic_matrix' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 13
}
] | 1 |
python | import logging
from numpy import degrees, pi, radians
from beyond.frames import get_frame, create_station
from beyond.errors import UnknownFrameError
from .wspace import ws
from .utils import dms2deg, deg2dms
log = logging.getLogger(__name__)
class StationDb:
def __new__(cls):
if not hasattr(cls, "_i... | Review this code and list any quality issues. | [
{
"issue": "Function 'list' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 24
},
{
"issue": "Function 'space_station' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity"... | 3 |
python | # -*- coding: utf-8 -*-
import requests
from urllib.parse import urljoin
from os import getenv
import types
class Fieldbook(object):
"""
Client for Fieldbook API: https://github.com/fieldbook/api-docs
Initialize with a fieldbook_id and optionally the api key (name) and secret.
"""
BASE_UR... | Review this code and list any quality issues. | [
{
"issue": "Function '_get' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 44
}
] | 1 |
python | from babel import localedata
from grow.pods import errors
from grow.pods import messages
import pickle
import os
import babel
import re
class Locales(object):
def __init__(self, pod):
self.pod = pod
def list_groups(self):
if 'locales' not in self.pod.yaml:
return []
retur... | Review this code and list any quality issues. | [
{
"issue": "Function 'fuzzy_load' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 144
},
{
"issue": "Function 'fuzzy_load' is 30 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor"... | 2 |
python | from assembler import ASM
from roomEditor import RoomEditor
import entityData
def addMultiworldShop(rom):
# Make a copy of the shop into GrandpaUlrira house
shop_room = RoomEditor(rom, 0x2A1)
re = RoomEditor(rom, 0x2A9)
re.objects = [obj for obj in shop_room.objects if obj.x is not None and obj.type_i... | Review this code and list any quality issues. | [
{
"issue": "Function 'addMultiworldShop' is 278 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 6
}
] | 1 |
python | from . import PrioritizationTechnique
from collections import Counter
class UniqueSearch(PrioritizationTechnique):
def __init__(self, binary, target_os, target_arch, similarity_func=None):
super(UniqueSearch, self).__init__(binary=binary, target_os=target_os, target_arch=target_arch)
self... | 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": 6
},
{
"issue": "Function 'update' has cyclomatic complexity 11 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": ... | 2 |
python | # Synthesis of multifractal random walk and derived processes.
#
# Roberto Fabio Leonarduzzi
# January, 2019
import numpy as np
from .fbm import fgn
from .pzutils import gaussian_cme, gaussian_chol
from numpy.fft import fft, ifft
# import math
# import matplotlib.pyplot as plt
def mrw(shape, H, lam, L, sigma=1, meth... | Review this code and list any quality issues. | [
{
"issue": "Function 'mrw' has 8 parameters. Consider using a parameter object to reduce arity.",
"severity": "critical",
"line": 14
},
{
"issue": "Function 'mrw_cumul' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 75
},
{
"is... | 9 |
python | """Helper functions for validating LFOM.
Created on September 18, 2020
@author: jcs528@cornell.edu
"""
from aguaclara.core.units import u
import aguaclara.core.physchem as pc
import aguaclara.core.constants as con
def flow_lfom_vert(height, d_ori, h_ori, n_oris):
"""Returns the flow through the LFOM as a functi... | Review this code and list any quality issues. | [
{
"issue": "Function 'check_flow_lfom_vert' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 31
}
] | 1 |
python | # -*- coding: utf-8 -*-
import datetime
import warnings
import pandas as pd
import numpy as np
from rqdatac.utils import to_datetime, to_date
from rqdatac.validators import (
ensure_date_range,
ensure_date_or_today_int,
ensure_list_of_string,
check_items_in_container,
ensure_order,
ensure_orde... | Review this code and list any quality issues. | [
{
"issue": "Function 'get_stock_connect' has cyclomatic complexity 11 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 118
},
{
"issue": "Function 'get_stock_connect' is 31 lines long. Functions over 25 lines are harder to test and maintain.",
"seve... | 9 |
python | # Copyright 2013-2018 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)
from spack import *
class Phist(CMakePackage):
"""The Pipelined, Hybrid-parallel Iterative Solver Toolkit provides
... | Review this code and list any quality issues. | [
{
"issue": "Function 'cmake_args' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 78
}
] | 1 |
python | # -*- coding: utf-8 -*-
from .processor import QueryProcessor
class MySqlQueryProcessor(QueryProcessor):
def process_insert_get_id(self, query, sql, values, sequence=None):
"""
Process an "insert get ID" query.
:param query: A QueryBuilder instance
:type query: QueryBuilder
... | Review this code and list any quality issues. | [
{
"issue": "Function 'process_insert_get_id' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 8
},
{
"issue": "Function 'process_insert_get_id' has 5 parameters. Consider using a parameter object to reduce arity.",
"sever... | 2 |
python | import json
class Configuration():
# class to organize Netlogo simulation parameters
def __init__(self):
# costants
self.constants={
'strategy?' : 3,
'drone.radius': 0.2,
'drone.speedMax': 8.5,
'drone.cruisingSpeed': 2,
'drone.acceleration... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' is 69 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 5
},
{
"issue": "Function 'addParameter' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 96
}
] | 2 |
python |
#Weather
#Functions TODO
# precip accumilation works well hourly
# sign up for storm alert per IKON or EPIC resort
# timer to check the 3 day for storms
# highest winter in state
from datetime import datetime, timedelta
from dateutil import tz
import discord
import googlemaps
import aiohttp
import as... | Review this code and list any quality issues. | [
{
"issue": "Function 'currentWeather' has cyclomatic complexity 15 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 94
},
{
"issue": "Function 'currentWeather' is 98 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": ... | 6 |
python | from CmdBase import *
from PersistentModules import *
# Cmd
# turn left deg
# turn right deg
# turn to deg
# turn rate deg
class CmdRotate(CmdBase):
def __init__(self, controller, line, engage_object = None):
super().__init__(controller, line, engage_object)
def start(self):
self.mystate_mo... | Review this code and list any quality issues. | [
{
"issue": "Function 'start' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 12
},
{
"issue": "Function 'start' is 33 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line... | 3 |
python |
from torch.autograd import Variable
from models.proposal_target_layer_cascade import *
import torchvision.models as models
from models.proposal import *
#bocknet
class ResNet(nn.Module):
def __init__(self, block, layers, num_classes=1000,dropout_prob=0.2):
self.inplanes = 64
super(ResNet, self).__i... | 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": 8
},
{
"issue": "Function '_make_layer' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 32
},
{
... | 10 |
python | # Copyright 2019 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_rgb_hsv_pipeline' is 26 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 134
}
] | 1 |
python | import numpy as np
import scipy.signal
from ray.rllib.policy.sample_batch import SampleBatch
from ray.rllib.evaluation.postprocessing import Postprocessing
from algorithms.curiosity import INTRINSIC_REWARD
INTRINSIC_VALUE_TARGETS = "intrinsic_value_targets"
INTRINSIC_VF_PREDS = "intrinsic_vf_preds"
def discount(x, ... | Review this code and list any quality issues. | [
{
"issue": "Function 'compute_advantages_intrinsic' has 7 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 16
}
] | 1 |
python | """
Based on the implementation of https://github.com/jadore801120/attention-is-all-you-need-pytorch
"""
import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
from maskrcnn_benchmark.modeling.utils import cat
from .utils_motifs import obj_edge_vectors, to_onehot, nms_overlaps, encode_box... | Review this code and list any quality issues. | [
{
"issue": "Function 'forward' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 19
},
{
"issue": "Function '__init__' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 45
},
{
"is... | 9 |
python | import torch.nn as nn
from .base import BaseLM
class IpaLM(BaseLM):
name = 'lstm'
def __init__(self, vocab_size, hidden_size, nlayers=1, dropout=0.1, embedding_size=None, **kwargs):
super().__init__(
vocab_size, hidden_size, nlayers=nlayers, dropout=dropout, embedding_size=embedding_size... | 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": 9
}
] | 1 |
python | # -*- coding:utf-8 -*-
"""
@author: Alden
@email: sunzhenhy@gmail.com
@date: 2018/4/5
@version: 1.0.0.0
"""
class Solution(object):
def fourSum(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: List[List[int]]
"""
nums = sorted(nums)
s... | Review this code and list any quality issues. | [
{
"issue": "Function 'fourSum' has cyclomatic complexity 15 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 11
}
] | 1 |
python | import os, logging, sys, subprocess, argparse, time
from mininet.net import Mininet
from mininet.topo import Topo
from mininet.log import setLogLevel, info
from mininet.cli import CLI
from mininet.node import CPULimitedHost
from mininet.link import TCLink
from p4_mininet import P4Switch, P4Host
from nc_config import ... | 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": 19
},
{
"issue": "Function 'config_mininet' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
... | 3 |
python | # Copyright 2017 Battelle Energy Alliance, 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed t... | Review this code and list any quality issues. | [
{
"issue": "Function 'findInps' has cyclomatic complexity 16 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 47
},
{
"issue": "Function 'findInps' is 38 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical... | 6 |
python |
from database import (
fix_ids,
ImageModel,
CategoryModel,
AnnotationModel,
DatasetModel,
TaskModel,
ExportModel
)
# import pycocotools.mask as mask
import numpy as np
import time
import json
import os
from celery import shared_task
from ..socket import create_socket
from mongoengine impo... | Review this code and list any quality issues. | [
{
"issue": "Function 'export_annotations' has cyclomatic complexity 15 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 30
},
{
"issue": "Function 'export_annotations' is 81 lines long. Functions over 25 lines are harder to test and maintain.",
"sev... | 4 |
python | """
Contains I/O functions
"""
import numpy
import theano
import logging
import sys
import tempfile
from collections import defaultdict
def build_character_dictionary(path, chars = {}):
with open(path, 'r') as fin:
lineno = 0
for line in fin:
lineno += 1
line = line.str... | Review this code and list any quality issues. | [
{
"issue": "Function 'build_character_dictionary' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 15
},
{
"issue": "Function 'load_pos_tagged_data' has cyclomatic complexity 16 (threshold: 5). Consider breaking it into small... | 7 |
python | # Copyright Contributors to the Packit project.
# SPDX-License-Identifier: MIT
import logging
import re
import subprocess
import tempfile
from pathlib import Path
from typing import Tuple, Optional, Union, List
import git
import yaml
from ogr.parsing import RepoUrl, parse_git_repo
from packit.exceptions import Packi... | Review this code and list any quality issues. | [
{
"issue": "Function 'get_repo' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 50
},
{
"issue": "Function 'get_repo' is 28 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
... | 2 |
python | # coding: utf-8
"""
UltraCart Rest API V2
UltraCart REST API Version 2 # noqa: E501
OpenAPI spec version: 2.0.0
Contact: support@ultracart.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
class ItemRevguard(object):
... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 53
},
{
"issue": "Function '__init__' has 8 parameters. Consider using a parameter object to reduce arity.",
"severity": "critical",
... | 3 |
python | """
Membrane test routines for voltage clamp experiments.
creates abf.MTs[sweep]={} #with keys like Ih, Ra, Rm, etc
Example usage:
abf=swhlab.ABF('../abfs/group/16701010.abf')
swhlab.memtest.memtest(abf) #performs memtest on all sweeps
swhlab.memtest.checkSweep(abf) #lets you eyeball check how it did
p... | Review this code and list any quality issues. | [
{
"issue": "Function 'memtestSweepVC' is 33 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 22
},
{
"issue": "Function 'memtest' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",... | 4 |
python | import numpy as np
from lenstronomy.Cosmo.background import Background
from lenstronomy.LensModel.profile_list_base import ProfileListBase
import lenstronomy.Util.constants as const
__all__ = ['MultiPlaneBase']
class MultiPlaneBase(ProfileListBase):
"""
Multi-plane lensing class
The lens model deflecti... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 18
},
{
"issue": "Function '__init__' is 42 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical"... | 14 |
python | # Copyright (c) 2020 Julian Bernhard, Klemens Esterle, Patrick Hart and
# Tobias Kessler
#
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.
from bark.world.opendrive import *
from bark.world import *
from bark.geometry import *
from bark.runtime 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": 14
}
] | 1 |
python | from gym.envs.mujoco import HalfCheetahEnv
import rlkit.torch.pytorch_util as ptu
from rlkit.data_management.env_replay_buffer import EnvReplayBuffer
from rlkit.envs.wrappers import NormalizedBoxEnv
from rlkit.launchers.launcher_util import setup_logger
from rlkit.samplers.data_collector import MdpPathCollector
from r... | Review this code and list any quality issues. | [
{
"issue": "Function 'experiment' is 64 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 14
}
] | 1 |
python | """A module for the websockets-based Client for Jina."""
from typing import Callable, Optional
from contextlib import nullcontext, AsyncExitStack
from ..helper import callback_exec
from .helper import WebsocketClientlet
from ...importer import ImportExtensions
from ..base import BaseClient, InputType
from ...logging.p... | Review this code and list any quality issues. | [
{
"issue": "Function '_get_results' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 16
},
{
"issue": "Function '_get_results' is 42 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "majo... | 3 |
python | # -*- coding: utf-8 -*-
# --------------------------------------
# @Time : 2020/11/01
# @Author : Oscar Chen
# @Email : 530824679@qq.com
# @File : ops.py
# Description :base operators.
# --------------------------------------
import tensorflow as tf
def leaky_relu(x):
return tf.nn.leaky_relu(x, alpha=0.1... | Review this code and list any quality issues. | [
{
"issue": "Function 'conv2d' has 10 parameters. Consider using a parameter object to reduce arity.",
"severity": "critical",
"line": 15
}
] | 1 |
python |
import argparse
from xml.etree import ElementTree as ET
import os
from pickle import dump
from tqdm import tqdm
parser = argparse.ArgumentParser()
parser.add_argument("dir")
parser.add_argument("save")
args = parser.parse_args()
path = os.path.join(args.dir)
classes_nums = {"cat" : 0 , "dog" : 1}
keys = list(classe... | Review this code and list any quality issues. | [
{
"issue": "Function 'ToMidPoint' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 22
}
] | 1 |
python | #!/home/zhuqingjie/env/py3_tf_low/bin/python
'''
@Time : 07.26 0026 下午 01:19
@Author : zhuqingjie
@User : zhu
@FileName: control.py
@Software: PyCharm
'''
'''
总的控制逻辑
1,control只向外部暴露一个端口,外部向control发请求,control根据mode来去调用其他server模块
2,同时还解决了外部不能直接访问ai节点的问题。主服务跑在ai节点,control服务跑在登陆节点,这样外部就能访问了
'''
import json, os, r... | Review this code and list any quality issues. | [
{
"issue": "Function 'handle' has cyclomatic complexity 12 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 45
},
{
"issue": "Function 'handle' is 44 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"li... | 2 |
python | from __future__ import print_function
from builtins import str
from builtins import object
from lib.common import helpers
import threading
class Module(object):
def __init__(self, mainMenu, params=[]):
self.info = {
'Name': 'Invoke-Mimikatz extract kerberos tickets.',
'Author': [... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' is 30 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 9
},
{
"issue": "Function 'generate' is 26 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 72
}
... | 2 |
python | #
# Copyright (C) 2013-2015 eNovance SAS <licensing@enovance.com>
#
# Author: Frederic Lepied <frederic.lepied@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://ww... | Review this code and list any quality issues. | [
{
"issue": "Function 'match_spec' has cyclomatic complexity 23 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 129
},
{
"issue": "Function 'match_spec' is 50 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "cri... | 5 |
python | import sys
import tensorflow as tf
import numpy as np
import pydicom
from PIL import Image
import weights
#takes the root folder path and returns a list of pictures
def collect_pictures(path):
pic_list = []
full_path_list = []
for dirName, subdirList, fileList in os.walk(path):
# print('test')
for... | Review this code and list any quality issues. | [
{
"issue": "Function 'collect_pictures' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 9
}
] | 1 |
python | from django.shortcuts import redirect
from django.shortcuts import render
from django.core.paginator import Paginator
from django.contrib.auth.decorators import login_required
from article.forms import ArticleForm
from article.models import Article
from block.models import Block
from comment.models import Comment
de... | Review this code and list any quality issues. | [
{
"issue": "Function 'paginate_queryset' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 24
}
] | 1 |
python | #!/usr/bin/env python
# import cte_calculator
from geometry_msgs.msg import PoseStamped
import rospy
from std_msgs.msg import Bool
from styx_msgs.msg import Lane
from dbw_mkz_msgs.msg import ThrottleCmd, SteeringCmd, BrakeCmd, SteeringReport
from geometry_msgs.msg import TwistStamped
import math
from twist_controller i... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' is 43 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 28
}
] | 1 |
python | from kivy.lang import Observable
import gettext
from constants import LOCALE_DIR
class Lang(Observable):
observers = []
lang = None
def __init__(self, defaultlang, transalte=None):
super(Lang, self).__init__()
self.ugettext = None
self.lang = defaultlang
self._translate =... | Review this code and list any quality issues. | [
{
"issue": "Function 'fbind' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 21
},
{
"issue": "Function 'funbind' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 27
}
] | 2 |
python | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' is 37 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 67
},
{
"issue": "Function '__init__' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 67
}
] | 2 |
python | import os, sys
sys.path.append("C:\\BERTVision\\code\\torch")
import torch
import models.args
def get_args():
# retreive the general models.args and attach them here
parser = models.args.get_args()
# set search specific args
parser.add_argument('--model',
type=str,
... | Review this code and list any quality issues. | [
{
"issue": "Function 'get_args' is 46 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 6
}
] | 1 |
python | from hipchat import HipChatManager
import time
import configparser
_MAX_SLEEP_TIME = 5
_MIN_SLEEP_TIME = 2
_SPAM_EODBOT_URL = 3500
class HipChatMonitor:
def __init__(self, eodBotParser):
print("Initializing HipChatMonitor with eodBotParser: ",eodBotParser)
self.sleepTime = _MIN_SLEEP_TIME
self.lastIdChecked = ... | Review this code and list any quality issues. | [
{
"issue": "Function 'start' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 32
}
] | 1 |
python | import numpy as np
from pymoo.core.survival import Survival
from pymoo.util.nds.non_dominated_sorting import NonDominatedSorting
from pymoo.util.randomized_argsort import randomized_argsort
# ---------------------------------------------------------------------------------------------------------
# Survival Selection... | Review this code and list any quality issues. | [
{
"issue": "Function '_do' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 18
}
] | 1 |
python | from typing import Optional
import gym
import pytest
from ray.rllib.env.wrappers.moab_wrapper import _MoabBaseWrapper
from ray.tune.registry import ENV_CREATOR, _global_registry
@pytest.mark.parametrize("env_name, iterations",
[
("MoabMoveToCenterSim-v0", 10),
... | Review this code and list any quality issues. | [
{
"issue": "Function 'moab_env' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 41
}
] | 1 |
python | import logging
log = logging.getLogger(__name__)
import threading
import numpy as np
from atom.api import (Unicode, Float, Bool, observe, Property, Int, Typed,
Long, Value)
from enaml.core.api import Declarative, d_
from psi.core.enaml.api import PSIContribution
from ..util import copy_declara... | Review this code and list any quality issues. | [
{
"issue": "Function 'get_channels' has cyclomatic complexity 30 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 90
},
{
"issue": "Function 'get_channels' is 29 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "... | 3 |
python | # -*- coding: utf-8 -*-
"""Scan service.
This module implements uploading a scan file to XNAT and adding a scan to the database.
Todo: Maybe the public method should be called add, and that should kick off an upload procedure, rather than the
other way around.
Todo: do we want to infer file type from extension? Or ... | Review this code and list any quality issues. | [
{
"issue": "Function '_update_database_objects' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 141
}
] | 1 |
python | #!/usr/bin/env python3
import sys
import argparse
from requests import get
from transip_rest_client import TransipRestClient
def getOptions(args=sys.argv[1:]):
parser = argparse.ArgumentParser(description="DynDNS: Updates a DNS record for a dynamic IP address.")
parser.add_argument("-u", "--user", help="Your ... | 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": 24
},
{
"issue": "Function 'main' is 27 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": ... | 3 |
python | import time
import sys
import random
import datetime
import rq
import rq.job
import rq.compat
import rq.worker
from rq.defaults import (DEFAULT_LOGGING_FORMAT, DEFAULT_LOGGING_DATE_FORMAT)
class NonForkWorker(rq.Worker):
def __init__(self, *args, **kwargs):
if kwargs.get('default_worker_ttl', None) is N... | Review this code and list any quality issues. | [
{
"issue": "Function 'work' has 7 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 20
},
{
"issue": "Function 'perform_job' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line":... | 3 |
python | import threading
import socket
import sys
import getopt
from log import logger
from Codecs.AdcpCodec import AdcpCodec
from Comm.AdcpSerialPortServer import AdcpSerialPortServer
class DecodeSerialData:
def __init__(self, tcp_port, comm_port, baud):
"""
Initialize the thread to read the data from ... | Review this code and list any quality issues. | [
{
"issue": "Function 'main' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 102
},
{
"issue": "Function 'main' is 36 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line":... | 2 |
python | r"""Setup fixtures for testing :py:class:`lmp.model.LSTMModel`."""
import pytest
import torch
from lmp.model import LSTMModel
from lmp.tknzr import BaseTknzr
@pytest.fixture
def lstm_model(
tknzr: BaseTknzr,
d_emb: int,
d_hid: int,
n_hid_lyr: int,
n_pre_hid_lyr: int,
... | Review this code and list any quality issues. | [
{
"issue": "Function 'lstm_model' has 8 parameters. Consider using a parameter object to reduce arity.",
"severity": "critical",
"line": 11
}
] | 1 |
python | #!/usr/bin/env python3
"""Main function for the DOVPN project."""
import argparse
import logging
import os
import yaml
import vpnorchestrator
def main():
"""Main function that sets up script to run.
Handles arguments, logging, and configuration before passing of control
to the orchestrator object."""
... | 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 42 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": ... | 2 |
python | from argparse import Namespace
import csv
from logging import Logger
import os
from pprint import pformat
from typing import List
import numpy as np
from tensorboardX import SummaryWriter
import torch
from tqdm import trange
import pickle
from torch.optim.lr_scheduler import ExponentialLR
from .evaluate import evalua... | Review this code and list any quality issues. | [
{
"issue": "Function 'run_training' has cyclomatic complexity 43 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 26
},
{
"issue": "Function 'run_training' is 201 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": ... | 2 |
python | """ Pooling-based Vision Transformer (PiT) in PyTorch
A PyTorch implement of Pooling-based Vision Transformers as described in
'Rethinking Spatial Dimensions of Vision Transformers' - https://arxiv.org/abs/2103.16302
This code was adapted from the original version at https://github.com/naver-ai/pit, original copyrigh... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has 9 parameters. Consider using a parameter object to reduce arity.",
"severity": "critical",
"line": 78
},
{
"issue": "Function '__init__' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line": 119
},
{
... | 6 |
python | '''
This code is based on pytorch_ssd and RFBNet.
Details about the modules:
TUM - Thinned U-shaped Module
MLFPN - Multi-Level Feature Pyramid Network
M2Det - Multi-level Multi-scale single-shot object Detector
Author: Qijie Zhao (zhaoqijie@pku.edu.cn)
Finished Date: 01/1... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 22
},
{
"issue": "Function '__init__' is 40 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical"... | 8 |
python | import torch
import numpy as np
import argparse
import pandas as pd
import sys
import os
from torch import nn
from torch.nn import functional as F
import tqdm
import pprint
from src import utils as ut
import torchvision
from haven import haven_utils as hu
from haven import haven_chk as hc
from src import datasets, mod... | Review this code and list any quality issues. | [
{
"issue": "Function 'trainval' is 62 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 24
},
{
"issue": "Function 'trainval' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 24
}
] | 2 |
python | # Copyright (c) 2021 PaddlePaddle 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 appli... | Review this code and list any quality issues. | [
{
"issue": "Function 'adaptive_spect_augment' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 66
},
{
"issue": "Function 'adaptive_spect_augment' is 27 lines long. Functions over 25 lines are harder to test and maintain.",
... | 5 |
python | import ast
import importlib
import os
import logging
import logging.config
import sys
from flask import Flask, Blueprint
from flask_restful import Api
from flask_cors import CORS
from typing import Dict, Any # noqa: F401
from flasgger import Swagger
from search_service.api.dashboard import SearchDashboardAPI
from se... | Review this code and list any quality issues. | [
{
"issue": "Function 'create_app' has cyclomatic complexity 8 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 30
},
{
"issue": "Function 'create_app' is 44 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
... | 2 |
python | ##############################################################################
# Copyright by The HDF Group. #
# All rights reserved. #
# #
# Th... | Review this code and list any quality issues. | [
{
"issue": "Function 'testGetHyperslabSelection' is 31 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 25
},
{
"issue": "Function 'testItemIterator' is 33 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "m... | 2 |
python | from datetime import timedelta
from functools import partial
import numpy as np
from hyperopt import fmin, space_eval, tpe
from fedot.core.data.data_split import train_test_data_setup
from fedot.core.log import Log
from fedot.core.pipelines.tuning.hyperparams import convert_params, get_node_params
from fedot.core.pip... | 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
},
{
"issue": "Function 'tune_pipeline' is 31 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 25
},... | 3 |
python | # Copyright (c) 2017-2021, Lawrence Livermore National Security, LLC and
# other Shroud Project Developers.
# See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (BSD-3-Clause)
# #######################################################################
#
# Test Python API generated from references.... | Review this code and list any quality issues. | [
{
"issue": "Function 'test_ArrayWrapper' is 74 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 31
}
] | 1 |
python | from datetime import datetime, timedelta
from bisect import bisect_left
import numpy.ma as ma
from cdippy.cdippy import CDIPnc, Archive, Realtime, RealtimeXY, Historic
import cdippy.timestamp_utils as tsu
import cdippy.utils as cu
class StnData(CDIPnc):
"""
Returns data and metadata for the specified s... | Review this code and list any quality issues. | [
{
"issue": "Function 'get_parameters' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 57
},
{
"issue": "Function 'get_spectra' has 6 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line": 75
},
... | 8 |
python | # Copyright (c) 2012 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless ... | Review this code and list any quality issues. | [
{
"issue": "Function 'new_websocket_client' has cyclomatic complexity 21 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 64
},
{
"issue": "Function 'new_websocket_client' is 71 lines long. Functions over 25 lines are harder to test and maintain.",
... | 2 |
python | import torch
import torch.nn
from torch.nn.parallel import DistributedDataParallel as DDP
from collections import OrderedDict
import os.path as osp
import wandb
from utils.utils import DotDict
class Model:
def __init__(self, hp, net_arch, loss_f, rank=0, world_size=1):
self.hp = hp
self.device =... | 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": 13
},
{
"issue": "Function 'save_network' has cyclomatic complexity 7 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"l... | 3 |
python | # -*- coding: utf-8 -*-
from __future__ import print_function
import os
import re
import pickle
import numpy as np
from collections import Counter
from functools import lru_cache
from . import constants
from .data_utils import tokenize
word_detector = re.compile('\w')
class VocabModel(object):
def __init__(self,... | Review this code and list any quality issues. | [
{
"issue": "Function '_trim' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 89
}
] | 1 |
python | import sys,os
sys.path.append(os.path.dirname(__file__) + os.sep + '../')
from FINDER import FINDER
import numpy as np
from tqdm import tqdm
import time
import networkx as nx
import pandas as pd
import pickle as cp
import random
def mkdir(path):
if not os.path.exists(path):
os.mkdir(path)
g_type = "barab... | Review this code and list any quality issues. | [
{
"issue": "Function 'GetSolution' has cyclomatic complexity 9 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 19
},
{
"issue": "Function 'GetSolution' is 35 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor"... | 4 |
python | import logging
from cached_property import threaded_cached_property
from .credentials import BaseCredentials
from .protocol import RetryPolicy, FailFast
from .transport import AUTH_TYPE_MAP
from .util import split_url
from .version import Version
log = logging.getLogger(__name__)
class Configuration:
"""
A... | 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": 37
},
{
"issue": "Function '__init__' has 7 parameters. Consider using a parameter object to reduce arity.",
"severity": "major",
"line... | 2 |
python | import torch.nn as nn
import torch
class TransHeadNet(nn.Module):
def __init__(self, in_channels, num_layers=3, num_filters=256, kernel_size=3, output_dim=3, freeze=False,
with_bias_end=True):
super(TransHeadNet, self).__init__()
self.freeze = freeze
if kernel_size == 3:
... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has cyclomatic complexity 12 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 5
},
{
"issue": "Function '__init__' is 32 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical"... | 4 |
python | #!/usr/bin/env python
#
# File: cont_pipeline.py
#
# Created: Friday, July 15 2016 by rejuvyesh <mail@rejuvyesh.com>
#
import argparse
import os
import yaml
import shutil
import rltools
from pipelines import pipeline
# Fix python 2.x
try:
input = raw_input
except NameError:
pass
def phase_train(spec, spec_f... | Review this code and list any quality issues. | [
{
"issue": "Function 'phase_train' has cyclomatic complexity 15 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 22
},
{
"issue": "Function 'phase_train' is 55 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major... | 2 |
python | import pygame
import psutil
import cpuinfo
import socket
import time
import nmap
from cpuinfo import get_cpu_info
red = (200,0,0)
white = (210,214,217)
blue = (0,0,200)
grey = (105,105,105)
black = (0,0,0)
largura_tela, altura_tela = 1024,760
pygame.init()
pygame.font.init()
font = pygame.font.Font(None, 32)
uso = ps... | Review this code and list any quality issues. | [
{
"issue": "Function 'pc_infos' is 31 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 38
},
{
"issue": "Function 'infos' is 53 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
"line": 134
},
... | 3 |
python | from dataclasses import dataclass
from moxom.compiler.lexer import OperatorToken, IdentifierToken, AtomTokens
from typing import Union, Optional
from .cstparser import CstNode, Expr
import ast
from moxom.compiler.operators import operator_dict, AssignOperator, AndOperator, ThenOperator
@dataclass
class AtomNode:
... | Review this code and list any quality issues. | [
{
"issue": "Function 'parse' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 39
},
{
"issue": "Function 'parse' is 26 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line... | 2 |
python | import numpy
from sklearn.metrics import confusion_matrix
def load_data():
train_labels = []
with open('digitdata/traininglabels', 'rb') as f:
for i, line in enumerate(f):
train_labels.append(int(line))
train_labels = numpy.array(train_labels, dtype=int)
train_x = numpy.zeros((trai... | Review this code and list any quality issues. | [
{
"issue": "Function 'load_data' has cyclomatic complexity 11 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "major",
"line": 4
},
{
"issue": "Function 'load_data' is 30 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "major",
... | 2 |
python | #!/usr/bin/env python
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, so... | Review this code and list any quality issues. | [
{
"issue": "Function 'logparse_parse_args' is 34 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 48
},
{
"issue": "Function 'logparse' has cyclomatic complexity 13 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "... | 3 |
python | import math
from typing import List, Union, Tuple
import torch
import torch.nn as nn
from astro_dynamo.snap import SnapShot
from .snaptools import align_bar
def _symmetrize_matrix(x, dim):
"""Symmetrize a tensor along dimension dim"""
return (x + x.flip(dims=[dim])) / 2
class DynamicalModel(nn.Module):
... | 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": 49
},
{
"issue": "Function '__init__' has 15 parameters. Consider using a parameter object to reduce arity.",
"severity": "critical",
"line": 130
}
] | 2 |
python | import torch
from node2vec import Node2Vec as Node2Vec_
from .brain_data import BrainData
from torch_geometric.data import Data
from networkx.convert_matrix import from_numpy_matrix
from .utils import binning, LDP
import networkx as nx
from .base_transform import BaseTransform
from numpy import linalg as LA
import nump... | Review this code and list any quality issues. | [
{
"issue": "Function '__init__' has 8 parameters. Consider using a parameter object to reduce arity.",
"severity": "critical",
"line": 148
}
] | 1 |
python | #!/usr/bin/env python
# encoding: utf-8
#
# Copyright (c) 2016 Dean Jackson <deanishe@deanishe.net>
#
# MIT Licence. See http://opensource.org/licenses/MIT
#
# Created on 2016-03-13
#
"""searchio <command> [<options>] [<args>...]
Alfred 3 workflow to provide search completion suggestions
from various search engines i... | Review this code and list any quality issues. | [
{
"issue": "Function 'cli' has cyclomatic complexity 16 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "critical",
"line": 51
},
{
"issue": "Function 'cli' is 52 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "critical",
"li... | 2 |
python |
def extractWriterupdatesCom(item):
'''
Parser for 'writerupdates.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('PRC', 'PRC', 'translated'),
('Loiterous', 'Loi... | Review this code and list any quality issues. | [
{
"issue": "Function 'extractWriterupdatesCom' has cyclomatic complexity 6 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 2
}
] | 1 |
python | # -*- coding: utf-8 -*-
from zvt.contract import IntervalLevel
from zvt.factors.target_selector import TargetSelector
from zvt.factors.ma.ma_factor import CrossMaFactor
from zvt.factors import BullFactor
from ..context import init_test_context
init_test_context()
class TechnicalSelector(TargetSelector):
def init... | Review this code and list any quality issues. | [
{
"issue": "Function 'init_factors' has 9 parameters. Consider using a parameter object to reduce arity.",
"severity": "critical",
"line": 12
}
] | 1 |
python |
from hashlib import sha256
from os import urandom
from btcpy.structs.crypto import PublicKey, PrivateKey
from btcpy.structs.transaction import MutableTransaction, TxOut
from btcpy.structs.sig import P2pkhSolver
from pypeerassets.networks import net_query
class Kutil:
def __init__(self, network: str, privkey: ... | 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": 14
},
{
"issue": "Function '__init__' has 5 parameters. Consider using a parameter object to reduce arity.",
"severity": "minor",
"line"... | 2 |
python | # MIT License
#
# Copyright (c) 2022 Ferhat Geçdoğan All Rights Reserved.
# Distributed under the terms of the MIT License.
#
#
# evalie - a toy evaluator using
# shunting-yard algorithm.
# ------
# github.com/ferhatgec/evalie
#
import math
class evalie:
def __init__(self):
self.precedence = {
... | Review this code and list any quality issues. | [
{
"issue": "Function 'perform' has cyclomatic complexity 10 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "minor",
"line": 51
},
{
"issue": "Function 'eval' has cyclomatic complexity 24 (threshold: 5). Consider breaking it into smaller functions.",
"severity": "c... | 3 |
python | # Copyright 2020 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | Review this code and list any quality issues. | [
{
"issue": "Function 'testRunExecutor_with_InprocessExecutor' is 26 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 91
},
{
"issue": "Function 'testRunExecutor_with_NotInprocessExecutor' is 26 lines long. Functions over 25 lines are harder to t... | 3 |
python | import tkinter as tk
import threading
from tkinter import scrolledtext
from tkinter import messagebox
ENCODING = 'utf-8'
class GUI(threading.Thread):
def __init__(self, client):
super().__init__(daemon=False, target=self.run)
self.font = ('Helvetica', 13)
self.client = client
self... | Review this code and list any quality issues. | [
{
"issue": "Function 'build_window' is 39 lines long. Functions over 25 lines are harder to test and maintain.",
"severity": "minor",
"line": 125
}
] | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.