source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
# coding: utf-8
"""
Kubernetes
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
The version of the OpenAPI document: v1.19.15
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import unitt... | [
{
"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 | kubernetes_asyncio/test/test_authorization_v1_api.py | lsst-sqre/kubernetes_asyncio |
MOD = 10**9 + 7
class Solution:
def numDecodings(self, s):
"""
:type s: str
:rtype: int
"""
if not s:
# Should be 1, but for a related problem (#91) the leetcode.com
# online judge wanted 0, so I assume that's preferred here too.
return 0
... | [
{
"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": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": fals... | 3 | main/decode-ways-ii/decode-ways-ii.py | EliahKagan/old-practice-snapshot |
import torch
import torchio as tio
import numpy as np
def load_tio_image(fn):
"""
ScalarImage(shape: (c, w, h, d))
dtype: torch.DoubleTensor
"""
arr = np.load(fn).swapaxes(0,3)
return tio.ScalarImage(tensor=arr)
def arr_2_tio_image(arr):
"""
ScalarImage(shape: (c, w, h, d))
dtype: ... | [
{
"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 | src/seg_model_utils/torchio_transforms.py | jpjuvo/RSNA-MICCAI-Brain-Tumor-Classification |
class RandomAgent(object):
"""The world's simplest agent!"""
def __init__(self, action_space):
self.action_space = action_space
def act(self, observation, reward, done):
return self.action_space.sample() | [
{
"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": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inherit... | 3 | components/__init__.py | ivegner/PyDSRL |
# signals are for when a user modifies something in the db, example, creates a post
from django.db.models.signals import post_save
from django.contrib.auth.models import User
from django.dispatch import receiver
from .models import Profile
# Creates a profile each time a new user is created
@receiver(post_save, send... | [
{
"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": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (ex... | 3 | bookStore/users/signals.py | afern247/BookStore-Web |
"""Frameworks for running multiple Streamlit applications as a single app.
https://github.com/upraneelnihar/streamlit-multiapps
"""
import streamlit as st
class MultiApp:
"""Framework for combining multiple streamlit applications.
Usage:
def foo():
st.title("Hello Foo")
def bar():
... | [
{
"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 | multiapp.py | Astrohackers-TW/StreamlitForAstroEdu_data-query-examples |
# ----------------------------------------------------------------------------
# Copyright (c) 2016-2020, QIIME 2 development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# ------------------------------------------------... | [
{
"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 | q2_vsearch/_format.py | jcmcnch/q2-vsearch |
# Copyright 2016 ZTE Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | [
{
"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 | lcm/pub/nfvi/vim/api/openstack/api.py | onap/vfc-nfvo-lcm |
"""
Sust Global Climate Explorer API
This API provides programmatic access to physical risk exposure data. For more guidance on using this API, please visit the Sust Global Dev Center: https://developers.sustglobal.com. # noqa: E501
The version of the OpenAPI document: beta
Generated by: https://op... | [
{
"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 | clients/python/sust/api/climate_explorer/clientgen/test/test_physical_risk_summary_indicators.py | sustglobal/dev-center |
__author__ = "Børge Jakobsen, Thomas Donegan"
__copyright__ = "Copyright 2019, Brexit boy and SaLmon king"
__credits__ = ["Børge Jakobsen, Thomas Donegan"]
__license__ = "Apache License"
__version__ = "2.0"
__maintainer__ = "Børge Jakobsen, Thomas Donegan"
__status__ = "Development"
from Db import Db
from ModelDbFunct... | [
{
"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 | models/Loyalty.py | borgej/BrexBot |
import numpy as np
import pickle
import gzip
class Transition:
def __init__(self, size):
self.score_matrix = np.full((size, size), -np.inf)
def put(self, prev_pos_id, cur_pos_id, score):
self.score_matrix[prev_pos_id][cur_pos_id] = score
def get(self, prev_pos_id, cur_pos_id):
sc... | [
{
"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": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inherit... | 3 | KOMORANPy/training/model/transition.py | shineware/KOMORANPy |
from argus.metrics.metric import Metric
from argus.utils import AverageMeter
class Loss(Metric):
name = 'loss'
def __init__(self):
self.avg_meter = AverageMeter()
super().__init__()
def reset(self):
self.avg_meter.reset()
def update(self, step_output: dict):
self.avg... | [
{
"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 | argus/metrics/loss.py | nd1511/argus |
from flask import render_template,redirect,url_for,request,flash
from . import auth
from ..models import Group
from .forms import RegistrationForm,LoginForm
from .. import db
from flask_login import login_user,logout_user,login_required
@auth.route('/login', methods=["GET", "POST"])
def login():
login_form = Logi... | [
{
"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": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",... | 3 | app/auth/views.py | mwerumuchai/jukebox |
from __future__ import unicode_literals, print_function, absolute_import, division
import sys
import collections
if sys.version_info < (3,):
integer_types = (int, long,)
bytes_type = bytes # "bytes" == "str" == a slice of bytes
unicode_type = unicode # "unicode" == a valid unicode string
bytearray_ty... | [
{
"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 | pcstools/compat.py | DIKU-PCS/pcstools |
import unittest
from unittest.mock import sentinel, DEFAULT
class SentinelTest(unittest.TestCase):
def testSentinels(self):
self.assertEqual(sentinel.whatever, sentinel.whatever,
'sentinel not stored')
self.assertNotEqual(sentinel.whatever, sentinel.whateverelse,
'sentinel... | [
{
"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": tru... | 3 | code/tmp_rtrip/unittest/test/testmock/testsentinel.py | emilyemorehouse/ast-and-me |
# Copyright 2008-2015 Nokia Networks
# Copyright 2016- Robot Framework Foundation
#
# 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
... | [
{
"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 | src/robot/version.py | sipke/robotframework |
"""
Copyright 2013 Rackspace
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, software
dist... | [
{
"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 | cloudcafe/compute/hosts_api/models/responses.py | rcbops-qa/cloudcafe |
from flask import Blueprint, jsonify, request
from flask_login import login_required
from app.models import db, Comment, CommentTaggedUser
import json
comment_routes = Blueprint('comments', __name__)
@comment_routes.route('/')
@login_required
def allComments():
# query to grab all comments
comments = Commen... | [
{
"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/api/comment_routes.py | tonyngophd/instavibes |
'''
Created by auto_sdk on 2020.11.25
'''
from dingtalk.api.base import RestApi
class OapiSmartdeviceBatcheventPostRequest(RestApi):
def __init__(self,url=None):
RestApi.__init__(self,url)
self.device_event_vos = None
def getHttpMethod(self):
return 'POST'
def getapiname(self):
return 'dingtalk.oapi.smartd... | [
{
"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 | other/dingding/dingtalk/api/rest/OapiSmartdeviceBatcheventPostRequest.py | hth945/pytest |
# picbed gunicorn config
from os.path import abspath, dirname, join, exists, isdir
from os import getenv, mkdir
from multiprocessing import cpu_count
from config import GLOBAL
def delete_hookloadtime():
from libs.storage import get_storage
s = get_storage()
del s['hookloadtime']
IS_RUN = True if getenv... | [
{
"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 | src/picbed.py | huoshuaibing/picbed |
"""
CommonObject is the object that players can put into their inventory.
"""
from muddery.server.utils.exception import MudderyError
from muddery.server.mappings.element_set import ELEMENT
from muddery.server.elements.base_element import BaseElement
from muddery.server.utils.localized_strings_handler import _
clas... | [
{
"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 | muddery/server/elements/common_object.py | dongwudanci/muddery |
import numpy as np
import theano
def intX(X):
return np.asarray(X, dtype=np.int32)
def floatX(X):
return np.asarray(X, dtype=theano.config.floatX)
def sharedX(X, dtype=theano.config.floatX, name=None):
return theano.shared(np.asarray(X, dtype=dtype), name=name)
def shared0s(shape, dtype=theano.config.fl... | [
{
"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 | passage/theano_utils.py | vishalbelsare/Passage |
from functools import partial
from fabric.context_managers import shell_env
from fabric.contrib.files import exists
from fabric.operations import _run_command
from offregister_fab_utils.fs import cmd_avail
def install_node(node_version="latest", *args, **kwargs):
run_cmd = partial(
_run_command, sudo=kwa... | [
{
"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 | offregister_node/utils.py | offscale/offregister-node |
import asyncio
from .trigger import Trigger
###
class PubSubTrigger(Trigger):
def __init__(self, app, message_types, pubsub=None, id=None):
super().__init__(app, id)
self.PubSub = pubsub if pubsub is not None else app.PubSub
if isinstance(message_types, str):
self.PubSub.subscribe(message_types, self.on... | [
{
"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 | bspump/trigger/pubsub.py | gitter-badger/bspump |
from __future__ import absolute_import, division, print_function
class IntegrationAlgorithm(object):
"""A class to perform 3D summation integration"""
def __init__(self, **kwargs):
pass
def __call__(self, reflections, image_volume=None):
"""Process the reflections.
:param reflec... | [
{
"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 | algorithms/integration/sum/algorithm.py | jbeilstenedmands/dials |
import copy
from services.switcher_service import SwitcherService
from payloads.home import MODAL_REQUEST, APP_HOME
from utils.slack_payload_util import populate_selection
from utils.switcher_util import get_environment_keyval
def on_home_opened(client, event, logger):
try:
client.views_publish(
user_id =... | [
{
"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_has_docstring",
"question": "Does every function in this file have a docst... | 3 | src/controller/home.py | petruki/switcher-slack-app |
# coding: utf-8
# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
# This product includes software developed at Datadog (https://www.datadoghq.com/).
# Copyright 2019-Present Datadog, Inc.
from __future__ import absolute_import
import sys
import unittest
im... | [
{
"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 | tests/v1/test_dashboard_list_delete_response.py | MichaelTROEHLER/datadog-api-client-python |
from typing import Callable, Union
import torch
from torch import Tensor
from torch_geometric.nn.conv import MessagePassing
from torch_geometric.typing import OptPairTensor, Adj, Size
from unsupervised.convs.inits import reset
class WGINConv(MessagePassing):
def __init__(self, nn: Callable, eps: float = 0., train_... | [
{
"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 | unsupervised/convs/wgin_conv.py | susheels/adgcl |
import uuid
from .context_managers import change_logging
class ObjectChangeMiddleware(object):
"""
This middleware performs three functions in response to an object being created, updated, or deleted:
1. Create an ObjectChange to reflect the modification to the object in the changelog.
2. En... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answ... | 3 | netbox/extras/middleware.py | esljaz/netbox |
import sys
sys.path.append('../scripts')
from detect_duplicates import df
def test_nan_names():
assert df.name.isnull().sum() == 0
def test_dup_pid():
assert df.patient_id.duplicated().sum() == 0
def test_phone_dup():
assert df.phone_number.duplicated().sum() == 0 | [
{
"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 | tests/test.py | monkeyusage/duplicates |
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community
Edition) available.
Copyright (C) 2017-2019 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in co... | [
{
"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 | gcloud/contrib/function/handlers.py | gangh/bk-sops |
###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013-2017, John McNamara, jmcnamara@cpan.org
#
from ..excel_comparsion_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompareXLSXFiles(ExcelComparisonTest):
"""... | [
{
"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 | xlsxwriter/test/comparison/test_button06.py | haiyangd/XlsxWriter |
from cleanSent import cleanSentence
import numpy as np
import pandas as pd
def sent2vec(s, model):
res = np.zeros(200)
# sent = cleanSentence(s)
words = s.split()
num = 0
for w in words:
if model.__contains__(w):
res += model[w]
else:
res += model["method"]
... | [
{
"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 | submissions/available/CPC/CPC-what-property/classification/getCommentVecByMean.py | XZ-X/rose6icse |
from juno.resources import handler_request
from juno.resources.routes import subscription_routes
def create(dictionary):
return handler_request.post(subscription_routes.get_base_url(), dictionary)
def find_all():
return handler_request.get(subscription_routes.get_base_url())
def find_by_id(subscription_id... | [
{
"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 | juno/subscription.py | leogregianin/juno-python |
import pytest
from etcdb import OperationalError
from etcdb.lock import Lock, ReadLock, WriteLock
def test_readers(etcdb_connection):
cur = etcdb_connection.cursor()
cur.execute('CREATE TABLE bar(id int not null PRIMARY KEY)')
lock = ReadLock(etcdb_connection.client, 'foo', 'bar')
lock.acquire(ttl=0)... | [
{
"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 | tests/functional/test_lock.py | box/etcdb |
from sympy.strategies.core import (null_safe, exhaust, memoize, condition,
chain, tryit, do_one, debug, switch, minimize)
from functools import partial
def test_null_safe():
def rl(expr):
if expr == 1:
return 2
safe_rl = null_safe(rl)
assert rl(1) == safe_rl(1)
assert ... | [
{
"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": tru... | 3 | sympy/strategies/tests/test_core.py | eriknw/sympy |
# coding: utf-8
"""
Isilon SDK
Isilon SDK - Language bindings for the OneFS API # noqa: E501
OpenAPI spec version: 2
Contact: sdk@isilon.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import isi_sdk_7_2
from isi... | [
{
"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_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"ans... | 3 | isi_sdk_7_2/test/test_nfs_alias_create_params.py | mohitjain97/isilon_sdk_python |
__Author__ = "noduez"
import pygame
from pygame.sprite import Sprite
class Ship(Sprite):
def __init__(self,ai_settings, screen):
'''初始化飞船并设置其初始位置'''
super(Ship, self).__init__()
self.screen = screen
self.ai_settings = ai_settings
# 加载飞船图像并获取其外接矩形
self.image = pyg... | [
{
"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 | ship.py | Nickhool/alien_invasion |
import logging
import zipfile
import wget
from .utils import DOWNLOAD_DIR, make_dirs
baseurl = 'https://codeload.github.com/kocohub/{}/zip/master'
logger = logging.getLogger(__name__)
def download_dataset(dataset, verbose=True):
make_dirs(DOWNLOAD_DIR)
url = baseurl.format(dataset)
wget.download(url, ... | [
{
"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 | koco/patch.py | inmoonlight/koco |
import sqlite3
def crear_tabla_paises(archivo_bd = 'paises.db'):
conexion = sqlite3.connect(archivo_bd)
cursor = conexion.cursor()
cursor.execute('''CREATE TABLE Paises (
Nombre STRING PRIMARY KEY,
Lenguajes STRING,
Continente STRING,
Capital STRING,
Zona STRING)... | [
{
"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 | Ene-Jun-2019/José Peralta/Extraordinario/Ejercicio3_creartabla.py | Andremm303/DAS_Sistemas |
# -*- coding: utf-8 -*-
# Copyright (c) 2020, Frappe Technologies and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
from frappe import _
class NavbarSettings(Document):
def validate(self):
self.validat... | [
{
"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 | frappe/core/doctype/navbar_settings/navbar_settings.py | chentaoz/frappe |
import numpy as np
import random
from utils.game_utils import check_path, compute_availability_matrix, get_available_routes, compute_progress
class FrugalPlayer:
def __init__(self, num_colors, destination_cards, trains, id):
self.cards = num_colors * [0]
self.routes = {}
self.destination_ca... | [
{
"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 | nonRLplayers/frugal_player.py | xinhezhou/ticket2ride |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# (c) Copyright 2013 Hewlett-Packard Development Company, L.P.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apa... | [
{
"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 | cinder/brick/initiator/executor.py | hopem/cinder |
# -*- coding: utf-8 -*-
import random
import logging
from scrapy.downloadermiddlewares.useragent import UserAgentMiddleware
logger = logging.getLogger(__name__)
class RotateUserAgentMiddleware(UserAgentMiddleware):
"""避免被ban策略之一:使用useragent池。
使用注意:需在settings.py中进行相应的设置。
更好的方式是使用:
pip instal... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"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... | 3 | python/scrapy-spider/tutorial/middleware/uaagent.py | yc19890920/Learn |
class Pessoa:
olhos = 2
def __init__(self, *filhos, nome=None, idade=43):
self.idade = idade
self.nome = nome
self.filhos = list(filhos)
def cumprimentar(self):
return f'Olá {id(self)}'
if __name__ == '__main__':
fernando = Pessoa(nome='Fernando')
cesar = Pessoa(f... | [
{
"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 | oo/pessoa.py | FGalvao77/pythonbirds |
# -*- coding:utf-8 -*-
# @TIME :2019/3/11 16:02
# @Author :Fan
# @File :eval.py
import torch
import os
import sys
sys.path.insert(0, '..')
import argparse
from Eval.COCO_eval import run_eval
from Train.Network.Hourglass import Get_Hourglass
from Train.Network.rtpose_vgg import get_model
Parse ... | [
{
"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 | Eval/eval.py | mengfanShi/Pose-Estimate |
# -*- test-case-name: twisted.test.test_stdio.StandardInputOutputTests.test_lastWriteReceived -*-
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Main program for the child process run by
L{twisted.test.test_stdio.StandardInputOutputTests.test_lastWriteReceived}
to test that L{os.write} can... | [
{
"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": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer":... | 3 | twisted/test/stdio_test_lastwrite.py | jMyles/twisted |
import Domoticz
import json
from adapters.base_adapter import Adapter
from devices.switch.on_off_switch import OnOffSwitch
class GDKES02TZXD(Adapter):
def __init__(self, devices):
super().__init__(devices)
self.devices.append(OnOffSwitch(devices, 'left', 'state_left'))
self.devices.append... | [
{
"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": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter tha... | 3 | adapters/tuyatec/GDKES02TZXD.py | michahagg/domoticz-zigbee2mqtt-plugin |
from SimpleEvents import Dispatcher
# don't forget about those parentheses.
# It is a parameterized decorator,
# with just one optional parameter.
# @Dispatcher(delegateObject = None)
@Dispatcher()
def doNothing():
pass
@doNothing.subscribe
def noname():
print("A")
@doNothing.subscribe
def noname():
... | [
{
"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 | tests/mytest.py | Vladislav-Martian/SimpleEvents |
import openpyxl
def readExcelFile (path, sheetName):
file = openpyxl.load_workbook (path, read_only=True)
sheets = file.sheetnames
return file.get_sheet_by_name (sheetName)
def getValueCell (worksheet, row, col):
cell = worksheet.cell (row, col)
return cell.value
def getRowValues (worksheet, star... | [
{
"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 | src/pythonLib/readExcel.py | Artic42/ArticUtils |
import pickle
from appcore.services import Factory
from platforms.base_platform import BasePlatform
from platforms.helpers.mysql_connection import MysqlConnection
class CountryMapUpdate(BasePlatform):
API_URL = 'my.sql.server'
DB_SETTINGS = {
'hostname': API_URL,
'username': 'db_user',
... | [
{
"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 | app/platforms/country_map_update.py | QuittyMR/etlas-collector |
from django.contrib.auth.models import User
from django.utils.translation import ugettext_lazy
from django.core.management.base import BaseCommand
from django.conf import settings
from onadata.apps.logger.models import Instance, XForm
from onadata.libs.utils.model_tools import queryset_iterator
class Command(BaseCom... | [
{
"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 | onadata/apps/logger/management/commands/add_id.py | childhelpline/myhelpline |
import math
from pytopojson import transform
class BBox(object):
def __init__(self):
self.transform = transform.Transform()
self.x_0 = math.inf
self.y_0 = self.x_0
self.x_1 = -self.x_0
self.y_1 = -self.x_0
self.t = None
def __call__(self, topology, *args, **kw... | [
{
"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 | pytopojson/bbox.py | fferrin/pytopojson |
import dros_utils
from typing import Optional
class Workspace:
def __init__(self: Workspace, name: str, ros_version="melodic") -> Workspace:
self.name = name
self.ros_version = ros_version
def init(self: Workspace, path: Optional[str]=None) -> None:
dros_utils.new(self.workspace, self... | [
{
"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 | workspace.py | PointlessBox/dros |
# Copyright 2021 Kotaro Terada
#
# 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... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 lines?",
"answer": false
},
... | 3 | rectangle_packing_solver/problem.py | fossabot/rectangle-packing-solver |
from app import cache
from github import get, compute
# Note: This can be further parallelized using grequests or celery
def get_data_async():
cached_resources = cache.get("resources_to_cache")
if not cached_resources:
return
for resource in cached_resources:
(data, status, header) = get... | [
{
"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 | jobs.py | utsengar/GitMetrics |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import logging
import os
import sys
import click
from newschimp import renderer, sender
from newschimp.social import fb, gg, lanyrd
from newschimp.cli import cli_group
from newschimp.utils import ComplexCLI, load_settings
LOGGER = logging.getLogger(__name__)
def create... | [
{
"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_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/... | 3 | newschimp/core.py | sputnikus/newschimp |
import numpy as np
class MazeMap:
def __init__(self):
pass
def from_dict(self, mapdict):
pass
example_mapdict = {
"start": (5, 6),
"goal": (5, 3),
"walls": {
"top": [[(0,0), (10,0)],
[(2,1), (8,1)],
[(4,2), (6,2)]],
... | [
{
"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 | pomdp_problems/maze/models/components/map.py | Semanti1/pomdp_findit |
print("\n**Username should be characters\n\n**Password should be numbers")
def verify():
print("SIGN UP")
u=str(input("User name : "))
p=int(input("\nPassword : "))
print("SIGN IN")
username=str(input("\nUser name : "))
paw=int(input("Password : "))
if username==u and paw==p :
... | [
{
"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 | sign_up2.py | ashik39/Python-workouts |
from random import shuffle
from models.RainbowModelLeaveRecsOut import RainbowModelLeaveRecsOut
from tensorflow.keras.layers import Conv1D, MaxPooling1D, Flatten, Dense, Dropout # type: ignore
from tensorflow.keras.models import Sequential # type: ignore
import numpy as np
from utils.Recording import Recording
from ... | [
{
"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": fals... | 3 | archive/model_archive/ConvModel.py | Sensors-in-Paradise/OpportunityML |
from fastapi import FastAPI
from typing import Optional
from enum import Enum
from fastapi import FastAPI
fake_items_db = [{"item_name": "Foo"}, {"item_name": "Bar"}, {"item_name": "Baz"}]
class ModelName(str, Enum):
alexnet = "alexnet"
resnet = "resnet"
lenet = "lenet"
app = FastAPI()
@app.get("/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": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": fals... | 3 | main.py | GuerreiroLeonardo/first-FastAPI |
from flask import render_template
from app import app, db, models
import sys
@app.route('/')
@app.route('/index')
def index():
return render_template('index.html', title='Home')
@app.route('/contact')
def contact():
return render_template('contact.html', title='Contact')
@app.route('/faq')
def faq():
... | [
{
"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 | app/views/main.py | Kbman99/DDoS-Detector-Flask |
from rest_framework import generics, authentication, permissions
from rest_framework.authtoken.views import ObtainAuthToken
from rest_framework.settings import api_settings
from users.serializers import UserSerializer, AuthTokenSerializer
class CreateUserView(generics.CreateAPIView):
"""Create a new user in the ... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
}... | 3 | app/users/views.py | agi20dla/recipe-app-api |
# Copyright 2017 Mycroft AI Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | [
{
"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 | mycroft/client/enclosure/mark1/arduino.py | assistent-cat/mycroft-core |
import sqlite3
from db import db
class StoreModel(db.Model):
__tablename__ = 'stores'
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(80))
items = db.relationship('ItemModel', lazy='dynamic')
def __init__(self, _id, name):
self.id = _id
self.name = name
... | [
{
"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_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/... | 3 | models/storemodel.py | vitahoang/learn-flash |
import ast
import re
import pickle
from Crypto.PublicKey import RSA
from base64 import b64decode,b64encode
from tkinter import messagebox
def str2obj(s):
return ast.literal_eval(s.replace('true', 'True').replace('false', 'False'))
def trim_name(name):
return name.replace('@','').replace('#','')
def remove_sp... | [
{
"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": tru... | 3 | isolated_functions.py | wonabru/chainnet |
"""Dataclasses just to initialize and return Callback objects"""
from typing import Optional, TYPE_CHECKING
from omegaconf import DictConfig
from dataclasses import dataclass
from pytorch_lightning.callbacks import Callback, EarlyStopping, LearningRateMonitor, ModelCheckpoint
from prostate_cancer_segmentation.callbac... | [
{
"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 | prostate_cancer_segmentation/config_parse/callbacks_available.py | vpeopleonatank/pytorch_lightning_segmentation_template |
#src/app.py
from flask import Flask
from .config import app_config
from .models import db, bcrypt
from .models import UserModel, ReviewModel, NodeModel,AmenityModel,TourismModel,ShopModel
def create_app(env_name):
"""
Create app
"""
# app initiliazation
app = Flask(__name__)
app.config.from_object(app_... | [
{
"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_has_docstring",
"question": "Does every function in this file have a docstring?",
"answ... | 3 | backend/src/app.py | zonradkuse/city-tour-recsys |
# GENERATED BY KOMAND SDK - DO NOT EDIT
import komand
import json
class Component:
DESCRIPTION = "Query account info"
class Input:
ADDRESS = "address"
USER_ID = "user_id"
USERNAME_MD5 = "username_md5"
class Output:
RISK_SCORE = "risk_score"
class AccountLookupInput(komand.Input):
... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class 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": false
},
{... | 3 | plugins/minfraud/komand_minfraud/actions/account_lookup/schema.py | lukaszlaszuk/insightconnect-plugins |
# 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.
# ---------------------------------------------------------------------... | [
{
"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 | sdk/purview/azure-purview-administration/tests/testcase.py | praveenkuttappan/azure-sdk-for-python |
from toolbox.plugin import ToolboxPlugin
from toolbox.defaults import TOOLBOX_DIR
import os, re
class LogsPlugin(ToolboxPlugin):
name = 'logs'
description = 'view logs'
def prepare_parser(self, parser):
parser.add_argument('pluginlog', nargs="?", help="filter for plugin")
def execute(self, ar... | [
{
"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 | toolbox/contrib/logs/logs.py | jeff-99/toolbox |
from ..common.exceptions import DoesNotExist
class UserDoesNotExist(DoesNotExist):
entity_name = "User"
class EmailAlreadyExists(Exception):
def __init__(self, email: str) -> None:
super().__init__(f"Email already exists: {email!r}")
class LoginFailed(Exception):
pass
| [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
}... | 3 | server/domain/auth/exceptions.py | multi-coop/catalogage-donnees |
"""
Implements network utils like sending and receiving message over socket
"""
import pickle
def send_message(message, client_socket, HEADER_LENGTH, FORMAT):
"""
sends message on the client_socket
"""
message = pickle.dumps(message)
send_length = "{:<{}}".format(len(message), HEADER_LENGTH)
c... | [
{
"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 | distcache/utils.py | ujas09/distcache |
#!/usr/bin/env python3.7
# -*- encoding=utf8 -*-
from frame.common.param import *
from frame.blog_parser.com_linuxidc import COMLinuxidcParser
class ParserFactory:
def get_parser (self, parser_name: str):
if parser_name in self._parserDict:
return self._parserDict[parser_name]
_parserDict... | [
{
"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 | frame/parser_factory.py | dingjingmaster/blog_spider |
from transaction import Transaction
class FidelityCsvImporter(object):
transactions = []
def __init__(self, filepath):
with open(filepath, "r") as f:
lines = []
index_line = []
count = 0
for line in f:
items = line.strip().split(",")
... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class 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 | csv_importer.py | lasoren/fidelity-history-manager |
import os
import numpy as np
from .base import BaseParser
from .utils import read_imglist
class TXTParser(BaseParser):
"""Class of parser for classification TXT annotation file.
xxx.png dog
xxx.png cat
xxxx.png dog
Args:
anno_path (str): Path of annotation file.
cat... | [
{
"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 | volkscv/utils/parser/txt_parse.py | YuxinZou/volkscv |
# -*- coding: utf-8 -*-
# Copyright 2017 ProjectV 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 requi... | [
{
"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 | app/v/dream/controller/dreamCtl.py | jhbez/focus |
from datetime import datetime
import calendar
prefix_url = 'https://oscar.gatech.edu/pls/bprod/bwckschd.p_disp_detail_sched?term_in=202102&crn_in='
table_labels = {'seats_capacity': 0, 'seats_actual': 1, 'seats_remaining': 2, \
'waitlist_capacity': 3, 'waitlist_actual': 4, 'waitlist_remaining': 5, 't... | [
{
"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 | src/oscartest/getcrndetails/management/commands/scraper/get_capacities.py | AlexanderPuckhaber/django-oscar-scraper |
import ckan.plugins as p
from ckan.plugins.toolkit import add_template_directory
from ckanext.repeating import validators
class RepeatingPlugin(p.SingletonPlugin):
p.implements(p.IValidators)
p.implements(p.IConfigurer)
def update_config(self, config):
"""
We have some form snippets tha... | [
{
"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 | ckanext/repeating/plugins.py | SamuelBradley/ckanext-repeating |
#!/usr/bin/env python3
def runner(path, fn):
with open(path) as fh:
for i, line in enumerate(fh):
print('{}: {}'.format(i + 1, fn(line.rstrip())))
def captcha1(data):
result = 0
last = None
for ch in data + data[0]:
if last == ch:
result += int(ch)
las... | [
{
"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 | 2017/day01/captcha.py | kgaughan/aoc |
from django.test import TestCase
from django.template import loader, base
import oscar
class TestOscarCoreAppsList(TestCase):
def test_includes_oscar_itself(self):
core_apps = oscar.OSCAR_CORE_APPS
self.assertTrue('oscar' in core_apps)
def test_can_be_retrieved_through_fn(self):
cor... | [
{
"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_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
... | 3 | tests/unit/settings_tests.py | DrOctogon/unwash_ecom |
import os
class FileCredentials:
def __init__(self, credentials_file):
if credentials_file == None:
credentials_file = os.path.expanduser("~") + "/.pingboard"
self.credentials_file = credentials_file
self.client_id = None
self.client_secret = None
def load(self):
... | [
{
"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_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false... | 3 | pyngboard/credentials.py | tsouza/pyngboard |
#
# Turbo Encoder
#
import numpy as np
from .rsc import RSC
class TurboEncoder:
def __init__(self, interleaver):
self.interleaver = interleaver
self.block_size = len(self.interleaver)
self.encoders = 2 * [RSC()]
def reset(self):
for e in self.encoders:
e.reset()
... | [
{
"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 | turbo/turbo_encoder.py | DaulPavid/pyturbo |
import unittest
import pygments
from bin import highlight
class TestHighlight(unittest.TestCase):
@staticmethod
def has_language_formatter(lang):
try:
pygments.lexers.get_lexer_by_name(lang)
return True
except pygments.utils.ClassNotFound:
return False
d... | [
{
"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 | tests/test_highlight.py | zazbone/bin-server |
"""Tests for methods in row_handling.py."""
from claims_to_quality.lib.teradata_methods import row_handling
import mock
from tests.assets import test_helpers
def test_convert_list_of_lists_to_teradata_rows():
"""Test that lists of lists can be converted to Teradata row objects."""
data = [('value1', 2, 3), ... | [
{
"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 | tests/lib/test_row_handling.py | CMSgov/qpp-claims-to-quality-public |
#!/usr/bin/env python3
# Copyright (c) 2015-2016 The Bitcoin Core developers
# Copyright (c) 2017 The AmlBitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test p2p mempool message.
Test that nodes are disc... | [
{
"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 | test/functional/p2p_mempool.py | thehomosapien/AMLBitcoin |
from django.contrib import admin
from django.utils.translation import ugettext_lazy as _
from django.contrib.sites.shortcuts import get_current_site
from .models import RegistrationProfile
from .users import UsernameField
class RegistrationAdmin(admin.ModelAdmin):
actions = ['activate_users', 'resend_activation_... | [
{
"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 | Lib/site-packages/registration/admin.py | jonathanmejiah/proyecto-django |
from operator import itemgetter, attrgetter
from query.models import Video
from esper.prelude import collect
from rekall.interval_list import Interval, IntervalList
import os
import json
import re
CAPTION_METADATA_DIR = '/app/data/subs/meta'
def clean_speaker(speaker):
speaker = speaker.lower()
speaker = re.s... | [
{
"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 | app/esper/caption_metadata.py | DanFu09/esper |
"""Support for IKEA Tradfri sensors."""
from __future__ import annotations
from collections.abc import Callable
from typing import Any, cast
from pytradfri.command import Command
from homeassistant.components.sensor import SensorEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.const imp... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": fals... | 4 | homeassistant/components/tradfri/sensor.py | DoctorU/core |
#!/usr/bin/env python
"""Types-related part of GRR API client library."""
from grr_api_client import errors
from grr_api_client import utils
from grr.proto import flows_pb2
class UnknownFlowName(errors.Error):
pass
class Types(object):
"""Object that helps users to deal with GRR type system."""
def __init_... | [
{
"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 | api_client/python/grr_api_client/types.py | panhania/grr |
from app.constants import FAKE_GPIO
from statemachine import StateMachine, State, Transition
class Relay(StateMachine):
def __init__(self, pin_number):
super().__init__()
self.add(State('high'))
self.add(State('low', is_starting_state=True))
self.add(Transition('high', ['low'], aft... | [
{
"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 | app/mechanical/relay.py | Tomos-Evans/garrison |
from nose.plugins.attrib import attr
@attr('demo_smoke', 'smoke', 'known_bad')
def test_dummy_known_bad_with_assertion_error():
"""
test_dummy_known_bad_with_assertion_error
I'd like to buy the world a Dr Pepper!
"""
assert False
@attr('demo_smoke', 'smoke', 'known_bad')
def test_dummy_known_bad... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true... | 3 | test/nose_integration_tests/dummy_first_level_pkg_one_tests/dummy_second_level_pkg_A_tests/dummy_test_c.py | denisenkom/teamcity-python |
from .base import Widget
class Box(Widget):
def __html__(self):
return """
<div id="toga_{id}" class="toga box container" style="{style}">
{content}
</div>
""".format(
id=self.interface.id,
content="\n".join(
child._impl._... | [
{
"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 | src/web/toga_web/widgets/box.py | luizoti/toga |
# coding: utf-8
"""
Isilon SDK
Isilon SDK - Language bindings for the OneFS API # noqa: E501
OpenAPI spec version: 5
Contact: sdk@isilon.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import isi_sdk_8_1_0
from i... | [
{
"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 | isi_sdk_8_1_0/test/test_statistics_protocols.py | mohitjain97/isilon_sdk_python |
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from python_api.users import models as user_models
from python_api.images import models as image_models
@python_2_unicode_compatible
class Notification(image_models.TimeStampedModel):
TYPE_CHOICES = (
('like', 'Like... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
}... | 3 | python_api/notifications/models.py | hyecheon/python_api |
from ._base import Base, _rule
from .fullname_json import FullnameJson
from .values.text_val import TextVal
from .values.null import NULL
from .values.holder import Holder
from .values.true import TRUE
from .values.false import FALSE
class Field(FullnameJson, TextVal, NULL, Holder, TRUE, FALSE):
reserved = {**Bas... | [
{
"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_has_docstring",
"question": "Does every function in this file have a docst... | 3 | windyquery/validator/field.py | bluerelay/windyquery |
import json
import logging
import os
from logging import getLogger
from typing import Dict, List
from PIL import Image
from src.api_composition_proxy.constants import CONSTANTS, PLATFORM_ENUM
logger = logging.getLogger(__name__)
def get_label(json_path: str = "./data/image_net_labels.json") -> List[str]:
with o... | [
{
"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 | chapter6_operation_management/condition_based_pattern/src/api_composition_proxy/configurations.py | sudabon/ml-system-in-actions |
'''
Contains code for working with the Inference Engine.
You'll learn how to implement this code and more in
the related lesson on the topic.
'''
import os
import sys
import logging as log
from openvino.inference_engine import IENetwork, IECore
class Network:
'''
Load and store information for working with th... | [
{
"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": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true... | 3 | demo_files/inference.py | uranusx86/openvino-colab |
# Copyright (c) Microsoft Corporation and contributors.
# Licensed under the MIT License.
import numpy as np
import pandas as pd
class LeastSquaresBinaryClassifierLearner:
def __init__(self):
self.weights = None
def fit(self, X, Y, sample_weight):
sqrtW = np.sqrt(sample_weight)
matX ... | [
{
"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 | test/unit/reductions/exponentiated_gradient/simple_learners.py | Dref360/fairlearn |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | [
{
"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 | azext_csvmware/__init__.py | ctaggart/az-csvmware-cli |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.