source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
import copy
import numpy as np
import uuid
from functools import reduce
from operator import mul
class Suggestion(object):
"""A structure that defines an experiment hyperparam suggestion."""
def __init__(self, params):
self.params = params
def __eq__(self, other):
if self.params.keys() ... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a ty... | 3 | polyaxon/hpsearch/search_managers/utils.py | elyase/polyaxon |
from winning.lattice_copula import gaussian_copula_margin_0
from winning.lattice import skew_normal_density
from winning.lattice_plot import densitiesPlot
from pprint import pprint
def test_ensure_scipy():
from winning.scipyinclusion import using_scipy
from scipy.integrate import quad_vec
assert using_sc... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"ans... | 3 | tests/test_lattice_five_margin.py | microprediction/winning |
import bottle, logging, argparse, json, sys
from beaker.middleware import SessionMiddleware
from . import database, processing, routing
logger = logging.getLogger("snuggle.api.server")
def load_config(filename):
try:
f = open(filename)
return json.load(f)
except Exception as e:
raise Exception("Could not loa... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excludi... | 3 | snuggle/api/server.py | wikimedia/analytics-snuggle |
import unittest
import io
import sys
import random
from unittest.mock import MagicMock, Mock, patch
from snap.grid import Grid
from snap.hand import Hand
from snap.card import Card
class TestGrid(unittest.TestCase):
def test__get__origin__returns_correct_cards(self):
random.seed(1)
expected_card =... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": ... | 3 | test/test_grid.py | gabrielbarker/snap |
# -*- coding: utf-8 -*-
#
# 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
#... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?"... | 3 | tests/ti_deps/deps/fake_models.py | FlyrInc/airflow-1 |
"""Add dataset count table.
Revision ID: 37f902020273
Revises: e7c69542157f
Create Date: 2020-03-26 14:06:54.782026
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "37f902020273"
down_revision = "e7c69542157f"
branch_labels = None
depends_on = None
def upgrad... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"... | 3 | alembic/versions/37f902020273_add_table_dataset_count.py | oslokommune/dataplatform-batch-jobs |
from pathlib import Path
from .utils import hrule, fmt
class SourceFile:
def __init__(self, name='', contents=[], includes=[]):
self.contents = []
self.includes = []
self.name = name
self.add_contents(contents)
self.add_includes(includes)
def add_includes(self, include... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false... | 3 | cogscripts/codegen/source.py | DaelonSuzuka/XC8-Toolchain |
from functools import wraps
from flask import redirect, session as login_session
def logged_in(function):
@wraps(function)
def wrapper(*a, **kw):
# If not logged in redirect to login page
if 'username' not in login_session:
return redirect('/login')
return function(*a, **kw... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": fals... | 3 | decorators.py | caseyr003/catalog |
from django import forms
from .models import Profile
class ProfileForm(forms.ModelForm):
"""
A form for editing user profiles.
Assumes that the Profile instance passed in has an associated User
object. The view (see views.py) takes care of that.
"""
name = forms.CharField(
required=F... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true... | 3 | accounts/forms.py | sreekanth1990/djangoproject.com |
from ...Structure import Clause
class HavingBuilder :
"""Builder component for HAVING clause query
"""
def __init__(self) :
self.__having = ()
def getHaving(self) -> tuple :
"""Get list of having clause"""
return self.__having
def lastHaving(self) -> Clause :
"""G... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",... | 3 | pySQLBuilder/Builder/Component/HavingBuilder.py | chandrawi/SQLBuilder |
import re
def quote_ifstr(s):
return f"'{s}'" if isinstance(s, str) else s
def make_str_valid_varname(s):
# remove invalid characters (except spaces in-between)
s = re.sub(r"[^0-9a-zA-Z_\s]", " ", s).strip()
# replace spaces by underscores (instead of dropping spaces) for readability
s = re.sub... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written ... | 3 | spyql/utils.py | alin23/spyql |
#!/usr/bin/env python
import argparse
import sys
import subprocess
RESERVED = {
"update": 'CuralateUpdate'
}
class CuralateExecution:
def __init__(self, service, subcommand, options):
self._service = service
self._subcommand = subcommand
self._options = options
def process(self)... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?... | 3 | curalate.py | cundohubs/homebrew-cmd |
from ray import workflow
@workflow.step
def hello(name: str) -> str:
return format_name.step(name)
@workflow.step
def format_name(name: str) -> str:
return "hello, {}".format(name)
@workflow.step
def report(msg: str) -> None:
print(msg)
if __name__ == "__main__":
workflow.init()
r1 = hello.s... | [
{
"point_num": 1,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (exc... | 3 | python/ray/workflow/examples/comparisons/google_cloud_workflows/sub_workflows_workflow.py | linyiyue/ray |
import torch
from torch import Tensor, log
from ..neko_module import NekoModule
class Log(NekoModule):
"""
The module version of :func:`torch.log` operation.
Args:
eps (``float``, optional): A bias applied to the input to avoid ``-inf``. Default ``0``.
Examples::
>>> log = Log()
... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
... | 3 | src/tensorneko/layer/log.py | ControlNet/tensorneko |
######################################################################
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
# SPDX-License-Identifier: MIT-0 #
######################################################################
import json
import base64
def utf_... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than... | 3 | Container-Root/src/python/lib/util/encode_decode_json.py | aws-samples/aws-do-pm |
class Car(object):
def __ini__(self, name, model, car_doors, car_wheels, speed = 0):
if not name:
self.name = "General"
else:
self.name = name
if not model:
self.model = "Gm"
else:
self.mo... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding... | 3 | day1/car.py | Flevian/andelabootcamp16 |
import os
from flask import Flask
def create_app(test_config=None):
app = Flask(__name__, instance_relative_config=True)
app.config.from_mapping(
SECRET_KEY = "DEVELOPMENT",
DATABASE=os.path.join(app.instance_path, "portal.sqlite3"),
)
if test_config is None:
#load instance conf... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": fal... | 3 | portal/__init__.py | alexarirok/county-portal |
from direct.task import Task
from otp.otpbase import OTPLocalizer
from direct.gui.DirectGui import *
from panda3d.core import *
from direct.showbase.DirectObject import DirectObject
class DownloadWatcher(DirectObject):
def __init__(self, phaseNames):
self.phaseNames = phaseNames
self.text = Direct... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding se... | 3 | otp/launcher/DownloadWatcher.py | SuperM0use24/TT-CL-Edition |
'''
ein Class for login und logout session
'''
class SessionHelper:
def __init__(self, app):
self.app = app
def login(self, username, password):
wd = self.app.wd # Zugang zu Driver wird benötigt
self.app.open_home_page()
wd.find_element_by_name("user").cl... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written... | 3 | fixture/session.py | Oliebert/Testing_training |
from django.db import models
from subjects.models import StudentClass
from students.models import Student
from django.urls import reverse
from django.contrib.postgres.fields import JSONField
# Create your models here.
class DeclareResult(models.Model):
select_class = models.ForeignKey(StudentClass, on_delete=mode... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
}... | 3 | results/models.py | ankitsihag/first |
#!/usr/bin/env python3
import glob
def katparser(katfile):
"""Trivial parser for KAT files
"""
length = msg = md = None
with open(katfile) as f:
for line in f:
line = line.strip()
if not line or line.startswith("#"):
continue
key, value = lin... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"ans... | 3 | vectors/katparser.py | imachug/pysha3 |
import pytest
import numpy as np
from numpy.testing import assert_allclose
from sklearn.exceptions import NotFittedError
from proglearn.transformers import TreeClassificationTransformer
class TestTreeClassificationTransformer:
def test_init(self):
TreeClassificationTransformer()
assert True
... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true... | 3 | proglearn/tests/test_transformer.py | ypeng22/ProgLearn |
#!/usr/bin/env python
# compatibility with python 2/3:
from __future__ import print_function
from __future__ import division
import numpy as np
def init():
# Accepted file types
global ftypes
ftypes = {}
ftypes['1d'] = ['S1D',
's1d',
'ADP',
... | [
{
"point_num": 1,
"id": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 lines?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false... | 3 | actin/actin_files/ac_settings.py | j-faria/ACTIN |
import warnings
from . import codegen, SchemaBase, Undefined
def schemaclass(*args, init_func=True, docstring=True, property_map=True):
"""A decorator to add boilerplate to a schema class
This will read the _json_schema attribute of a SchemaBase class, and add
one or all of three attributes/methods, base... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fe... | 3 | tools/schemapi/decorator.py | joseph-d-p/altair |
import time
from torch.utils.tensorboard import SummaryWriter
import numpy as np
class LossWriter(SummaryWriter):
def __init__(self, log_dir=None, comment=''):
if log_dir == None:
log_dir = './logs/tensorboard/' + time.strftime('%Y-%m-%d--%H-%M-%S', time.localtime(time.time()))
super(... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answ... | 3 | src/util/summary_logging.py | wooseoklee4/AP-BSN |
'''
Copyright (c) The Dojo Foundation 2011. All Rights Reserved.
Copyright (c) IBM Corporation 2008, 2011. All Rights Reserved.
'''
from .base import AuthBase
class PublicAuth(AuthBase):
cookieName = 'coweb.auth.public.username'
_userId = 0
def requires_login(self):
'''Does not require login. Usern... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true... | 3 | servers/python/coweb/auth/public.py | opencoweb/coweb |
import os
from conans import ConanFile, tools
required_conan_version = ">=1.33.0"
class VisitStructConan(ConanFile):
name = "visit_struct"
description = "A miniature library for struct-field reflection in C++"
topics = ("reflection", "introspection", "visitor", "struct-field-visitor",)
homepage = "htt... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answ... | 3 | recipes/visit_struct/all/conanfile.py | dpronin/conan-center-index |
# -*- coding: utf-8 -*-
import os
import pickle
import numpy as np
from PIL import Image
import pypytorch as ppt
from pypytorch.data import Dataset
import pypytorch.data.transform as transform
def load_data(filename):
with open(filename, 'rb') as f:
data = pickle.load(f, encoding='latin1')
X = da... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/... | 3 | examples/pypytorchscripts/cifar10/dataset/cifar10.py | dark-ai/pypytorch |
#!/usr/bin/env python
"""lldb-repro
lldb-repro is a utility to transparently capture and replay debugger sessions
through the command line driver. Its used to test the reproducers by running
the test suite twice.
During the first run, with 'capture' as its first argument, it captures a
reproducer for every lldb invoc... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": fal... | 3 | lldb/utils/lldb-repro/lldb-repro.py | hamishknight/llvm-project |
#!/usr/bin/env python3
import unittest
from mock import MagicMock
from tests_functional import DoozerRunnerTestCase
from doozerlib import metadata
class TestMetadata(DoozerRunnerTestCase):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
def setUp(self):
super().setU... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},... | 3 | tests_functional/test_metadata.py | locriandev/doozer |
import pygame
from pygame.locals import *
from OpenGL.GL import *
from OpenGL.GLU import *
import numpy as np
from curvas import *
from utils import rgb
class Heroe:
def __init__(self, p):
self.p = np.array(p) # posicion
self.vive = True # marca para poder eliminar ...
self.r = 30
def... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 lines?",
"answer": true
... | 3 | aux 6/heroe.py | ppizarror/CC3501-2018-2 |
"""
provide global explanation methods
author: Xiaoqi
date: 2019.10.29
"""
from .feature_importance import *
from .shap_explainer import ShapExplainer
class GlobalExplainer(object):
def __init__(self, x_train, y_train, model):
"""
Initialize a feature global explainer
:param x_train: inpu... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer":... | 3 | shapSD/feature_explainer/global_explainer.py | XiaoqiMa/shapSD |
"""Query and retrieve the various plugins in Cosmic Ray.
"""
from stevedore import driver, ExtensionManager
def get_operator(name):
"""Get an operator class from a plugin.
Attrs:
name: The name of the plugin containing the operator class.
Returns: The operator *class object* (i.e. not an instan... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excludi... | 3 | cosmic_ray/plugins.py | rob-smallshire/cosmic-ray |
from functools import wraps
from flask import request, g, jsonify
from itsdangerous import (
TimedJSONWebSignatureSerializer as Serializer,
SignatureExpired,
BadSignature,
)
from index import app
TWO_WEEKS = 1209600
def generate_token(user, expiration=TWO_WEEKS):
s = Serializer(app.config["SECRET_KEY... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (exclu... | 3 | application/utils/auth.py | MilitaryCheese/Cryptojacking-Attack-Detection-System |
import six
import threading
import logging
import pickle
from coopy import fileutils as fu
from os import path
if six.PY3:
from pickle import Pickler, Unpickler
else:
from cPickle import Pickler, Unpickler
logger = logging.getLogger("coopy")
class SnapshotManager(object):
def __init__(self, basedir):
... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},... | 3 | coopy/snapshot.py | felipecruz/coopy |
from conans import ConanFile, CMake
class TypeLiteConan(ConanFile):
version = "0.1.0"
name = "type-lite"
description = "Strong types for C++98, C++11 and later in a single-file header-only library"
license = "Boost Software License - Version 1.0. http://www.boost.org/LICENSE_1_0.txt"
url = "https:/... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true... | 3 | conanfile.py | martinmoene/type |
#!/usr/bin/env python3
import math
import plotly.graph_objects as go
def plot(coordinates):
fig = go.Figure(go.Scattermapbox(
mode="lines+markers",
lon=coordinates[0],
lat=coordinates[1],
marker={'size': 10}))
fig.update_layout(
margin={'l': 0, 't': 0, 'b': 0, 'r': 0},... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"ans... | 3 | Small Apps/distance.py | Gerile3/My_Python |
class ListNode(object):
def __init__(self, x):
self.val = x
self.next = None
'''
回溯法
'''
class Solution1(object):
def swapPairs(self, head):
"""
:type head: ListNode
:rtype: ListNode
"""
if head is None or head.next is None:
return head
... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer"... | 3 | LeetCodeSolutions/python/24_Swap_Nodes_in_Pairs.py | ChuanleiGuo/AlgorithmsPlayground |
from RestrictionTypeDetector import RestrictionTypeDetector
from RestrictionTypeDetector import TYPE_INT
from RestrictionTypeDetector import MEASURE_OCCURRENCE
class IrreflexiveObjectPropertiesDetector(RestrictionTypeDetector):
"""
This class serves as interface for all Restriction Type Statistics of irreflex... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},... | 3 | src/utils/IrreflexiveObjectPropertiesDetector.py | IDLabResearch/lovstats |
# -*- coding: utf-8 -*-
# @Time : 2020/10/22
# @Author : Lart Pang
# @GitHub : https://github.com/lartpang
def cal_mse_loss(seg_logits, seg_gts):
assert seg_logits.shape == seg_gts.shape, (seg_logits.shape, seg_gts.shape)
seg_probs = seg_logits.sigmoid()
loss_map = (seg_probs - seg_gts).pow(2)
r... | [
{
"point_num": 1,
"id": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 lines?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
... | 3 | loss/LPs/L12Loss.py | lartpang/CoSaliencyProj |
from dbmodules.base import BaseDBServer
from dbmodules.user import UserTable
class Server():
@staticmethod
def base_tips(reason, tips_type='info', *args, **kwargs):
""" return response with code.
if you want to use custom code,you can use code parameters
"""
if 'info' == tips_... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excludi... | 3 | modules/server.py | JoeEmp/performanc_testing_field |
import pytest
from autogluon.core.space import Categorical
from autogluon.vision._gluoncv import ObjectDetection
def get_dataset(path):
return ObjectDetection.Dataset.from_voc(path)
@pytest.mark.skip(reason="ObjectDetector is not stable to test, and fails due to transient errors occasionally.")
def test_object... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": fals... | 3 | vision/tests/unittests/test_gluoncv_object_detection.py | huibinshen/autogluon |
import telegram
from sqlalchemy import Column, Integer, String, Boolean
from sqlalchemy.orm import relationship
from . import Base
class Chat(Base):
__tablename__ = 'chats'
db_id = Column(Integer, primary_key=True)
type = Column(String)
title = Column(String)
username = Column(String, unique=True)
first_name ... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": ... | 3 | src/sauce_bot/schemas/chat.py | asmello/feed-tracker-bot |
from django.db import models
from django.contrib.auth.models import AbstractBaseUser, PermissionsMixin, BaseUserManager
from django.conf import settings
class UserProfileManager(BaseUserManager):
"""Manager for user profiles"""
def create_user(self, email, name, password=None):
""" Create a new user p... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written... | 3 | profiles_api/models.py | Amit0430/RESTFULL_API |
"""Check behaviors of ``Line2D``.
"""
import numpy as np
import matplotlib.pyplot as plt
from figpptx.comparer import Comparer
class Line2DCheck:
"""Line2DCheck.
"""
@classmethod
def run(cls, ax):
cls.various_line2d(ax)
Comparer().compare(ax.figure)
@classmethod
def various_l... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
}... | 3 | gallery/line2d.py | Sillte/figpptx |
class ManagedTool(object):
def __init__(self, response):
self.__dict__ = response
self.name = response['name']
self.last_release_version = response['lastReleaseVersion']
self.download_url = response['downloadUrl']
self.package_binary_path = response['packageBinaryPath']
... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/... | 3 | devtc_client/managed_tool.py | CasaSky/devtc_project |
#!/usr/bin/env python
# coding=utf-8
# Stan 2018-08-04
import sys
if sys.version_info >= (3,):
class aStr():
def __str__(self):
return self.__unicode__()
def cmp(a, b):
return (a > b) - (a < b)
# range = range
def b(s):
return s.encode('utf-8')
def u(s):
... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": ... | 3 | index_flask_qr/core/types23.py | lishnih/index_flask_qr |
from __future__ import print_function
import sys
from setuptools import dist, setup, find_packages
from setuptools.command.build_py import build_py
from setuptools.command.develop import develop
from setuptools.command.test import test as test_command
# # force cython to use setuptools dist
# # see also:
# # https... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},... | 3 | setup.py | szmark001/orbit |
import os
from apistar.frameworks.wsgi import WSGIApp as App
from apistar.http import Response, Request
from apistar import Route
from psutil import cpu_percent
class CORSApp(App):
"""
Wraps an app, so that it injects CORS headers.
"""
def finalize_response(self, response: Response) -> Response:
... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answ... | 3 | api/app.py | tech-teach/load-balancing-example |
#!/usr/bin/env python3
# Copyright (c) 2015-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
# Exercise API with -disablewallet.
#
from test_framework.test_framework import BTSTestFramework
from ... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answ... | 3 | qa/rpc-tests/disablewallet.py | diablax2/bts |
# Copyright 2012 Managed I.T.
#
# Author: Kiall Mac Innes <kiall@managedit.ie>
#
# 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 r... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
... | 3 | designate/tests/test_notification_handler/__init__.py | NeCTAR-RC/designate |
from unittest import mock
import pytest
from ..models import Route
from model_bakery import baker
@pytest.mark.django_db
def test_delete_route(seller, client_seller, send_task):
route = baker.make(Route, user=seller)
response = client_seller.delete(f'/routes/{route.id}')
response.status_code == 201
... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than ... | 3 | routes/tests/test_delete_route.py | stanwood/traidoo-api |
#!/usr/bin/env python
# coding: utf-8
# In[ ]:
import numpy as np
import tensorflow as tf
tf.enable_eager_execution()
def eval_model(interpreter, coco_ds):
total_seen = 0
num_correct = 0
for img, label in coco_ds:
total_seen += 1
interpreter.set_tensor(input_index, img)
interpr... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than... | 3 | EvalTFLiteModel.py | amitmate/visualwakeword |
from typing import List
class Solution:
def firstPalindrome(self, words: List[str]) -> str:
answer: str = ""
def isPalindrome(word: str) -> bool:
answer: bool = True
len_word: int = len(word)
for i in range(len_word//2):
if word[i] !... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"an... | 3 | src/my_project/easy_problems/from201to250/find_first_palindromic_string_in_array.py | ivan1016017/LeetCodeAlgorithmProblems |
from typing import List
from fastapi import Depends, FastAPI, HTTPException, Request, Response
from sqlalchemy.orm import Session
from . import crud, models, schemas
from .database import SessionLocal, engine
models.Base.metadata.create_all(bind=engine)
app = FastAPI()
@app.middleware("http")
async def db_session... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fe... | 3 | docs_src/sql_databases/sql_app/alt_main.py | Aryabhata-Rootspring/fastapi |
class UnpackException(Exception):
pass
class BufferFull(UnpackException):
pass
class OutOfData(UnpackException):
pass
class UnpackValueError(UnpackException, ValueError):
pass
class ExtraData(ValueError):
def __init__(self, unpacked, extra):
self.unpacked = unpacked
self.extr... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
... | 3 | utils/exporters/blender/modules/msgpack/exceptions.py | wenluzhizhi/threeEx |
import os
from os import path
from executor import execute
ALL_SERVICES = 'all'
# env definition
class ENV:
DEV = 'dev'
PROD = 'prod'
@staticmethod
def allEnvs():
return [ENV.DEV, ENV.PROD]
@staticmethod
def valid(env):
return env in ENV.allEnvs()
# action definition
class... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer"... | 3 | devops/constants.py | linlycode/olcode |
import socket
Buffer_Size = 4096
class TcpNet:
def __init__(self):
self.com_socket =socket.socket()
self.Connection=self.com_socket
def Accept(self, IP, Port):
self.com_socket.bind((IP,Port))
self.com_socket.listen(10);
self.Connection, self.address = self.com_socket.acce... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
... | 3 | data_transfer_system/dts_client/TcpNet.py | wkddnfls/dsem_iot_ms |
from spinnman.messages.eieio.eieio_type import EIEIOType
from spinnman.messages.eieio.data_messages.eieio_without_payload_data_message\
import EIEIOWithoutPayloadDataMessage
from spinnman.messages.eieio.data_messages.eieio_data_header\
import EIEIODataHeader
from spinnman.messages.eieio.data_messages.eieio_data... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inherita... | 3 | src/spinnaker_ros_lsm/venv/lib/python2.7/site-packages/spinnman/messages/eieio/data_messages/eieio_32bit/eieio_32bit_payload_prefix_lower_key_prefix_data_message.py | Roboy/LSM_SpiNNaker_MyoArm |
import unittest
import os
import tweepy
import datetime
import seadaIngest
from seadaIngest import config_twitter_api
from twitterAccount import TwitterAccount
class TestConfigTwitter(unittest.TestCase):
def setUp(self):
self.consumer_key = os.environ['CONSUMER_KEY']
self.consumer_secret = os.en... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},... | 3 | seada/seadaIngest/test/test.py | javierguzmanporras/seada |
from ..Distance import Distance
from ..CloudCoverage import CloudCoverage
from ..Constant import Constant
from .BaseComponent import BaseComponent
class SkyCoverComponent(BaseComponent):
''' handle GA1..GA8 sky component types '''
CLOUD_TYPES = {
"00": "Cirrus (Ci)",
"01": "Cirrocumulus (Cc)",
"02": "... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false... | 3 | ish_parser/Components/SkyCoverComponent.py | vtoupet/ish_parser |
from flask import Flask, request, jsonify
from flask_graphql import GraphQLView
from extensions import bcrypt, auth, jwt
from schema import auth_required_schema, schema
from dotenv import load_dotenv
from flask_jwt_extended import (
create_access_token,
create_refresh_token, get_jwt_identity,
jwt_required
)... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer"... | 3 | infrastructure/__init__.py | python-programmer/flask-graphql-postgresql-jwt-todo |
"""
1165. Single-Row Keyboard
Easy
There is a special keyboard with all keys in a single row.
Given a string keyboard of length 26 indicating the layout of the keyboard (indexed from 0 to 25), initially your finger is at index 0. To type a character, you have to move your finger to the index of the desired character.... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)... | 3 | Algorithms_easy/1165. Single-Row Keyboard.py | VinceW0/Leetcode_Python_solutions |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'ui_multi_rename_qt5.ui'
#
# Created: Thu Aug 14 17:13:08 2014
# by: PyQt5 UI code generator 5.2.1
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_Multi_Rename_Dialog(object... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answe... | 3 | grom/ui/ui_multiRename.py | hovo1990/GROM |
def can_build(plat):
return (plat == "android")
def configure(env):
if env["platform"] == "android":
# Amazon dependencies
env.android_add_dependency("compile fileTree(dir: '../../../modules/godotamazon/android/lib/', include: ['*.jar'])")
env.android_add_java_dir("android/src")
... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"... | 3 | config.py | xsellier/godotamazon |
#!/usr/bin/python3
# encoding: utf-8
""" run_web_pycode 's entry_points"""
import fire
from run_web_pycode.core import read_proxy, run_remote_script, set_proxy
def entry_point() -> None: # pragma: no cover
"""
默认函数 触发fire包
https://github.com/google/python-fire
"""
fire.core.Display = lambda line... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
... | 3 | run_web_pycode/__main__.py | AngusWG/run-web-pycode |
import numpy as np
from prml.nn.tensor.constant import Constant
from prml.nn.tensor.tensor import Tensor
from prml.nn.function import Function
class Inverse(Function):
def forward(self, x):
x = self._convert2tensor(x)
self.x = x
self._equal_ndim(x, 2)
self.output = np.linalg.inv(x... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
}... | 3 | books/PRML/PRML-master-Python/prml/nn/linalg/inv.py | iamfaith/DeepLearning |
import torch
from layers import Conv2d, Linear
class ConvModel(torch.nn.Module):
def __init__(self, in_channels: int, out_channels: int, dropout: bool = True):
super().__init__()
self.features = torch.nn.Sequential(
Conv2d(in_channels, 32, 3, padding=1),
torch.nn.ReLU(),
... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 line... | 3 | models/conv.py | RobertCsordas/modules |
import logging
import attr
import IPython
from ..hookspec import hookimpl
from ..pm import pm
log = logging.getLogger(__name__)
@attr.s(cmp=False)
class IPythonUI:
'IPython UI for usbq'
ns = {}
@hookimpl
def usbq_ipython_ns(self):
res = {'pm': pm}
return res
def run(self, eng... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},... | 3 | usbq/plugins/ipython.py | CarveSystems/usbq |
from flask import Blueprint, render_template
main = Blueprint("main", __name__)
@main.route("/")
def index():
return render_template("index.html")
@main.route("/about")
def about():
return render_template("about.html")
| [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"ans... | 3 | app/main.py | SuperOrca/Notes |
import torch
from models.deep_mix_net import DeepSeqNet
from torch import nn
class FastText(DeepSeqNet):
def __init__(self, vocab_size, embeddings, embedding_size, hidden_layer_size,
tab_input_dim, linear_layers_dim, output_dim, dropout_rate, optimizer="adam", learning_rate=0.01):
sup... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cl... | 3 | models/fasttext.py | alipsgh/deep-mix-nets |
# -*- coding: utf-8 -*-
import os
import shutil
def make_empty_folder(folder_path:str):
if os.path.exists(folder_path):
if os.path.isdir(folder_path):
shutil.rmtree(folder_path)
else:
os.remove(folder_path)
os.mkdir(folder_path)
def copy_files(from_path:str, to_path:... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (exclu... | 3 | submission_builder.py | TrpFrog/jellyfish-aquarium |
from tkinter import*
from tkinter import ttk
from voice_project import *
from maill import *
from send import *
def after_login():
def success():
send_screen.destroy()
mailing()
def success2():
send_screen.destroy()
send_message()
global send_screen
sen... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"... | 3 | login_page.py | p4nkaj/email-and-voice-mail |
from django.contrib.auth.models import AbstractUser
from django.core.urlresolvers import reverse
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import ugettext_lazy as _
@python_2_unicode_compatible
class User(AbstractUser):
""" User Model ... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer":... | 3 | djangotest/users/models.py | maybe9210/learnFrontEnd_django |
import unittest, sys
from eosfactory.eosf import *
verbosity([Verbosity.INFO, Verbosity.OUT])
CONTRACT_WORKSPACE = sys.path[0] + "/../"
# Actors of the test:
MASTER = MasterAccount()
HOST = Account()
ALICE = Account()
BOB = Account()
CAROL = Account()
class Test(unittest.TestCase):
def run(self, result=None):
... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},... | 3 | templates/contracts/hello_world/tests/unittest1.py | tuan-tl/eosfactory |
from flask import render_template, url_for, request, redirect
from flask.ext.login import login_required, current_user
import rfk
import rfk.site
import rfk.database
import rfk.liquidsoap
from rfk.site.helper import permission_required
from rfk.site.forms.stream import new_stream
from rfk.database.streaming import Str... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"ans... | 3 | lib/rfk/site/admin/streams.py | buckket/PyRfK |
#!/usr/bin/env python3
from collections import Mapping
from collections import MutableMapping
from datetime import datetime
from shared.random import Random
from shared.console import *
random = Random()
def format_timedelta(timedelta_1):
seconds = timedelta_1.seconds
hours = int (seconds // 3600)
sec... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
... | 3 | source/shared/utils.py | toconn/nobotty |
import requests
from datetime import datetime
def get_country(country):
url = 'https://corona.lmao.ninja/countries/' + country
response = requests.get(url)
data = [
response.json()['country'],
response.json()['cases'],
response.json()['todayCases'],
response.json()['deaths'... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding ... | 3 | coronapy/lib/get_country.py | MDK-Moroccan-Developers-Knighthood/coronapy-cli |
from noise.hash.hash import Hash
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives.hmac import HMAC
class Blake2bHash(Hash):
def __init__(self):
super(Blake2bHash, self).__init__("BLAKE2b", 64, 128)
def hash... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written ... | 3 | noise/hash/blake2b.py | mgp25/noise |
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... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": fal... | 3 | mmdet/models/bbox_heads/mgan_head.py | zjplab/Pedestron |
import os
from flask import Flask, redirect, url_for
from manager import config
from manager.models import db
from manager.oauth2 import config_oauth
from manager.routes import auth, oauth, api, admin
from manager.auth import csrf, login_manager
def create_app(test_config=None):
"""
create and configure the ... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
... | 3 | manager/app.py | W-DEJONG/Id-manager |
import io
import os.path
import pytest
from astral import GoogleGeocoder
def read_contents(*names, **kwargs):
return io.open(
os.path.join(*names),
encoding=kwargs.get("encoding", "utf8")
).read()
try:
api_key = read_contents(os.path.dirname(__file__), '.api_key').strip()
except:
api_... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer"... | 3 | src/test/test_GoogleGeocoder.py | rezemika/astral |
from django.shortcuts import render, redirect
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from . forms import UserRegisterForm, UserUpdateForm, ProfileUpdateForm
def register(request):
if request.method == 'POST':
form = UserRegisterForm(request.POST)
... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
... | 3 | backend/users/views.py | OkothPius/Arexa |
from django.shortcuts import render
from apps.mysensing import Room, Door
from rest_framework import viewsets
from apps.mysensing.serializers import RoomSerializer, DoorSerializer
import requests
import json
# Create your views here.
class RoomViewSet(viewsets.ModelViewSet):
queryset = Room.objects.all()
seri... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{... | 3 | ran-django-template/apps/mysensing/views.py | nature1995/Face-Recognition-System |
import reasoner
def get_result(result_id): # noqa: E501
"""Request stored result
# noqa: E501
:param result_id: Integer identifier of the result to return
:type result_id: int
:rtype: Result
"""
return reasoner.get_result(result_id)
def get_result_feedback(result_id): # noqa: E501
... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fe... | 3 | server/openapi_server/controllers/result_controller.py | NCATS-Tangerine/kba-reasoner |
import os
from os.path import join
from ...utils import remove
from .. import run_nbgrader
from .base import BaseTestApp
class TestNbGraderExport(BaseTestApp):
def test_help(self):
"""Does the help display without error?"""
run_nbgrader(["export", "--help-all"])
def test_export(self, db, co... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
}... | 3 | nbgrader/tests/apps/test_nbgrader_export.py | FrattisUC/nbgrader |
class FabricLocation(Enum,IComparable,IFormattable,IConvertible):
"""
Fabric location in the host
enum FabricLocation,values: BottomOrInternal (1),TopOrExternal (0)
"""
def __eq__(self,*args):
""" x.__eq__(y) <==> x==yx.__eq__(y) <==> x==yx.__eq__(y) <==> x==y """
pass
def __format__(self,*args):... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
}... | 3 | stubs.min/Autodesk/Revit/DB/Structure/__init___parts/FabricLocation.py | ricardyn/ironpython-stubs |
"""
Provides a function to report all internal modules for using freezing tools
pytest
"""
def pytest_namespace():
return {'freeze_includes': freeze_includes}
def freeze_includes():
"""
Returns a list of module names used by py.test that should be
included by cx_freeze.
"""
import py
impo... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"ans... | 3 | myvenv/lib/python3.5/site-packages/_pytest/freeze_support.py | tuvapp/tuvappcom |
# -- coding: utf-8 --
import random
import StringIO
import sys
import time
import pycurl
from . import Fetcher
from ..core.task import Task
from ..core.settings import settings
class Sock5Fetcher(Fetcher):
def __init__(self):
Fetcher.__init__(self)
def url_fetch(self, url, useProxy=False):
... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding ... | 3 | crawler/crawler/framework/fetcher/sock5fetcher.py | H0w13/WebGrabber |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
class AlipayMarketingDataDashboardQueryResponse(AlipayResponse):
def __init__(self):
super(AlipayMarketingDataDashboardQueryResponse, self).__init__()
self._url = None
... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": ... | 3 | alipay/aop/api/response/AlipayMarketingDataDashboardQueryResponse.py | snowxmas/alipay-sdk-python-all |
from __future__ import annotations
from abc import ABC, abstractmethod
from typing import TYPE_CHECKING, Any, List
# This is a hack to prevent circular imports; since Interpreter imports from this file,
# we will only import it during the type_checking run from mypy
if TYPE_CHECKING:
from yaplox.interpreter impor... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},... | 3 | src/yaplox/yaplox_callable.py | RoelAdriaans/yaplox |
from django.conf import settings
import datetime
def template_settings(request):
return {
'site_name': settings.SITE_NAME,
'site_desc': settings.SITE_DESC,
'site_author': settings.SITE_AUTHOR,
'site_url': settings.SITE_URL,
'site_register': settings.ALLOW_NEW_REGISTRATIONS,
... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"ans... | 3 | app/apps/coreExtend/context_processors.py | underlost/ulost.net |
import json
from unittest.mock import patch
from click.testing import CliRunner
from mythx_models.response import VersionResponse
from mythx_cli.cli import cli
from .common import get_test_case, mock_context
VERSION_RESPONSE = get_test_case("testdata/version-response.json", VersionResponse)
VERSION_SIMPLE = get_tes... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"ans... | 3 | tests/test_version.py | maurelian/mythx-cli |
import lightgbm as lgb
import xgboost as xgb
from sklearn.metrics import mean_squared_error, mean_absolute_error, explained_variance_score, r2_score
from matplotlib import pyplot as plt
import numpy as np
import pandas as pd
def compile_model(network):
"""
:param network dict: dictionary with network parameter... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
... | 3 | gb_rf_evolution/gb_train.py | EvanBagis/gb_rf_evolution |
from django.db import models
class City(models.Model):
name = models.CharField(max_length=25)
def __str__(self): #show the actual city name on the dashboard
return self.name
class Meta: #show the plural of city as cities instead of citys
verbose_name_plural = 'cities' | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{... | 3 | index/models.py | kv-95/Django-WeatherApp |
"""
Simplest plugin that exercises all the hooks
"""
from tljh.hooks import hookimpl
@hookimpl
def tljh_extra_user_conda_packages():
return [
'hypothesis',
]
@hookimpl
def tljh_extra_user_pip_packages():
return [
'django',
]
@hookimpl
def tljh_extra_hub_pip_packages():
return [
... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answ... | 3 | integration-tests/plugins/simplest/tljh_simplest.py | windwood-xmu/tljh-cn |
from django_filters.views import FilterView
from django_tables2.views import SingleTableMixin
from django_tables2 import tables, TemplateColumn
from django.contrib.auth.models import Group
from guardian.mixins import LoginRequiredMixin
from profiles.filters.group_filter import GroupFilter
class GroupTable(tables.Tab... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": true
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
... | 3 | profiles/views/group_list_view.py | Sispheor/squest |
import os
from PIL import Image
class Camera:
def __init__(self, img_width=128, img_height=96, img_rot=0):
self.value = None
self.img_width = img_width
self.img_height = img_height
self.img_rot = img_rot
def get_value(self):
return self.value
def u... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than clas... | 3 | camera.py | andreajessen/robot |
#!/usr/bin/env python
__all__ = ['nicovideo_download']
from ..common import *
def nicovideo_login(user, password):
data = "current_form=login&mail=" + user +"&password=" + password + "&login_submit=Log+In"
response = request.urlopen(request.Request("https://secure.nicovideo.jp/secure/login?site=niconico", he... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding s... | 3 | src/you_get/extractors/nicovideo.py | lgis80boy/you-get |
#!/usr/bin/env python3
# Copyright (c) 2015-2019 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test the setban rpc call."""
from test_framework.test_framework import BitcoinTestFramework
from test_... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},... | 3 | test/functional/rpc_setban.py | FihlaTV/lbrycrd |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.