source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
from cv2 import cv2 as cv
import numpy as np
from Pincel import Pincel
from Cor import Cor
desenhando = False
cor = Cor(0, 0, 0)
pincel = Pincel(0, 0, cor, 0)
def nada(x):
pass
def desenho(event, x, y, flags, param):
global pincel,cor,desenhando
pincel.x = x
pincel.y = y
if event == cv.EVENT_LBU... | [
{
"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 | main.py | ItaloDias-stack/paintApplication |
#!/usr/bin/python
'''Controls the hud UI and resets the video stream as necessary.'''
import roslib; roslib.load_manifest('reefbot_hudui')
import rospy
import subprocess
import os.path
import sys
import re
import os
import signal
import multiprocessing
def WatchVideoThread(proc):
errorWatcher = VideoErrorWatcher(pro... | [
{
"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 | reefbot_hudui/bin/HudController.py | MRSD2018/reefbot-1 |
# -*- coding: utf-8 -*- #
# Copyright 2018 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... | [
{
"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 | lib/surface/compute/network_endpoint_groups/list.py | kustodian/google-cloud-sdk |
from django.db import models
from django.utils.translation import gettext_lazy as _
from Hydro.device.models import Device
class Point(models.Model):
_lat = models.DecimalField(_("Latitude"), max_digits=12, decimal_places=9)
_lng = models.DecimalField(_("Longitude"), max_digits=12, decimal_places=9)
def ... | [
{
"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 | Hydro/datapoint/models.py | p-v-o-s/hydro |
import argparse
import sys
from typing import List
from .format_manifest import format_manifest_command
from .index import index_command
from .update import update_command
from .channel import build_channel_command
def parse_arguments(argv: List[str]) -> argparse.Namespace:
parser = argparse.ArgumentParser(
... | [
{
"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": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"an... | 3 | nur/__init__.py | dezgeg/NUR |
'''
Helper functions for ``image_slicer``.
'''
import os
from PIL import Image
def get_basename(filename):
"""Strip path and extension. Return basename."""
return os.path.splitext(os.path.basename(filename))[0]
def open_images(directory):
"""Open all images in a directory. Return tuple of Image instances... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/c... | 3 | image_slicer/helpers.py | wolfembers/image_slicer |
class Links:
def __init__(self):
self.mineral_id = None
self.controller_id = None
self.source_ids = []
self.other_ids = []
self.storage_id = None
self.terminal_id = None
def get_mineral(self):
return Game.getObjectById(self.mineral_id)
def get_controll... | [
{
"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_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
... | 3 | src/room_manager/links.py | ppolewicz/screeps-starter-python |
"""Tests for the main module."""
import unittest
from unittest.mock import Mock, patch
from yala.main import LinterRunner
class TestLinterRunner(unittest.TestCase):
"""Test the LinterRunner class."""
@patch('yala.main.Config')
def test_chosen_not_found(self, mock_config):
"""Should print an erro... | [
{
"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 | tests/main.py | viniarck/yala |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import numpy as np
import random
class Compose:
def __init__(self, transforms):
self.transforms = transforms
def __call__(self, c... | [
{
"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_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true... | 3 | pretrain/pointcontrast/lib/transforms.py | Shreyas-Gururaj/Point_Contrast_ME0.5.3 |
# Implement int sqrt(int x).
# Compute and return the square root of x, where x is guaranteed to be a non-negative integer.
# Since the return type is an integer, the decimal digits are truncated and only the integer part of the result is returned.
# Example 1:
# Input: 4
# Output: 2
# Example 2:
# Input: 8
# Outp... | [
{
"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 | Math/python/leetcode69_Sqrt_x.py | wenxinjie/leetcode |
from typing import List, Optional
import aiohttp
import json
from aiohttp.client import ClientSession
from itspylearning.consts import ITSLEARNING_URL
from itspylearning.organisation import Organisation
_clientSession: Optional[ClientSession] = None
def _getClient() -> aiohttp.ClientSession:
global _clientSessi... | [
{
"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 | itspylearning/itslearning.py | HubertJan/itspylearning |
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_test")
load("@rules_cuda//cuda:defs.bzl", "requires_cuda_enabled")
load("//c10/macros:cmake_configure_file.bzl", "cmake_configure_file")
load("//tools/config:defs.bzl", "if_cuda")
def _genrule(**kwds):
if _enabled(**kwds):
native.genrule(**kwds)... | [
{
"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 | tools/bazel.bzl | YifanShenSZ/pytorch |
import logging
from tenacity import retry, stop_after_attempt, wait_fixed, before_log, after_log
from app.db.external_session import db_session
from app.db.init_db import init_db
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
max_tries = 60 * 5 # 5 minutes
wait_seconds = 1
@retry(
... | [
{
"point_num": 1,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?... | 3 | {{cookiecutter.project_slug}}/backend/app/app/backend_pre_start.py | abnerjacobsen/full-stack |
'''
Created on 2019年6月19日
@author: bkd
'''
from tkinter import *
def data():
for i in range(50):
Label(frame, text=i).grid(row=i, column=0)
Label(frame, text="my text" + str(i)).grid(row=i, column=1)
Label(frame, text="..........").grid(row=i, column=2)
def myfunction(event):
# canvas.... | [
{
"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 | test/t22.py | bkdwei/kdGUI |
import unittest
from app.models import NewsArticle
class ArticleTest(unittest.TestCase):
'''
Test Class to test the behaviour of the NewsArticle class
'''
def setUp(self):
'''
Set up method that will run before every Test
'''
self.new_article = NewsArticle("CNN", "John ... | [
{
"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 | tests/test_news_article.py | Collin9726/Marekani |
import os
from typing import TYPE_CHECKING
from modules.base import ModuleProcessor
from opta.core.terraform import get_terraform_outputs
from opta.exceptions import UserErrors
if TYPE_CHECKING:
from opta.layer import Layer
from opta.module import Module
class MongodbAtlasProcessor(ModuleProcessor):
def... | [
{
"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 | modules/mongodb_atlas/mongodb_atlas.py | riddopic/opta |
class WordDictionary(object):
def __init__(self):
"""
initialize your data structure here.
"""
self.trie = {}
def addWord(self, word):
"""
Adds a word into the data structure.
:type word: str
:rtype: void
"""
trie=self.trie
... | [
{
"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 | backtracking/wordDictionaryUsingTrie.py | saai/LeetcodePythonSolutions |
#!/usr/bin/env python3
import tensorflow as tf
from layers.spectral_normalization import SpectralNormalization
class SpadeBN(tf.keras.layers.Layer):
"""SPADE BatchNormalization
Sources:
https://towardsdatascience.com/implementing-spade-using-fastai-6ad86b94030a
"""
def __init__(self, widt... | [
{
"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 | layers/spadebn.py | ackness/GazeFlow |
import atexit
from .MecanumRover_MotorDriver import MecanumRover_MotorDriver
import traitlets
from traitlets.config.configurable import Configurable
class Motor(Configurable):
value = traitlets.Float()
# config
alpha = traitlets.Float(default_value=1.0).tag(config=True)
beta = traitlets.Float(defaul... | [
{
"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 | jetbot/motor.py | vstoneofficial/jetbot-mecanum |
"""empty message
Revision ID: 0092_add_inbound_provider
Revises: 0091_letter_billing
Create Date: 2017-06-02 16:07:35.445423
"""
# revision identifiers, used by Alembic.
revision = '0092_add_inbound_provider'
down_revision = '0091_letter_billing'
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialec... | [
{
"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_return_types_annotated",
"question": "Does every function in this file have a return type annotation?... | 3 | migrations/versions/0092_add_inbound_provider.py | tlwr/notifications-api |
class GURL:
"""
GURL is Google URL generator class which has 2 methods and constructor which takes in the query
but has got 4 other parameters as well, Generate: which generates
URL and get_url : which returns the string of generated url
"""
def __init__(self, query, limit=100, filetype='html', ... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"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 | Python/Tags_Scraper/URL_generator.py | CharvyJain/Rotten-Scripts |
#!/usr/bin/env python3
import logging
from discord import Intents
from discord.ext.commands import Bot, Context, check, when_mentioned_or
from config import CONFIG
from utils.utils import is_compsoc_exec_in_guild
DESCRIPTION = """
Apollo is the Discord bot for the University of Warwick Computing Society, designed to... | [
{
"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 | apollo.py | ericthelemur/apollo |
from typing import List
from config import IRC
import requests
import ipaddress
import fido
from modules.access import require_permission, Levels
from models import SessionManager, config
from modules import configmanager
import logging
log = logging.getLogger(__name__)
@require_permission(level=Levels.OP, message=... | [
{
"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 | modules/commands/lockdown.py | FuelRats/FIDO |
def topla(a, b): return a + b
print(topla(2, 3))
topla2 = lambda a, b: a + b
print(topla2(2, 3))
def listeyiGoster(liste, gosteriFonksiyonu):
for i in liste:
print(gosteriFonksiyonu(i))
list = [
{"id": 1, "ad": "Alper", "soyad": "Konuralp" },
{"id": 2, "ad": "Burcu", "soyad": "K... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function 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 sel... | 3 | E028/main.py | alperkonuralp/AlperIlePython |
"""
# Author
Jakob Krzyston (jakobk@gatech.edu)
# Purpose
Build architecture for I/Q modulation classification as seen in Krzyston et al. 2020
"""
import torch
from torch import nn
from torch import optim
import torch.nn.functional as F
##### LINEAR COMBINATION FOR COMPLEX CONVOLUTION #####
class LC(nn.Module):
... | [
{
"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 | models_ieee_icc.py | LiLee1/High_Capacity_Complex_Networks |
# encoding: utf-8
"""
@author: xingyu liao
@contact: sherlockliao01@gmail.com
"""
import torch
from torch import nn
import torch.nn.functional as F
from torch.nn import Parameter
class CosSoftmax(nn.Module):
r"""Implement of large margin cosine distance:
Args:
in_feat: size of each input sample
... | [
{
"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 | fastreid/layers/cos_softmax.py | tycallen/fast-reid |
"""
Copyright 2013 Steven Diamond, 2017 Akshay Agrawal
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... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/c... | 3 | cvxpy/problems/param_prob.py | rpradal/cvxpy |
import os
from functools import lru_cache
from pathlib import Path
from pydantic import BaseSettings
class Settings(BaseSettings):
PROJECT_NAME = "Book Search"
API_V1_STR = "/api/v1"
ES_HOST = "127.0.0.1:9200"
"""
.. _ES_HOST:
ElasticSearch hosts
"""
BACKEND_CORS_ORIGINS: str = ".*"... | [
{
"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": false
}... | 3 | book_search/app_settings.py | yakky/microservice-talk |
# coding=utf-8
import unittest
from smallinvoice.accounts import Account
from smallinvoice.tests import get_smallinvoice
def generate_account():
return Account(title='Testaccount',
institute='Familie Test',
number='Number123',
iban='Iban123',
... | [
{
"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 | smallinvoice/tests/accounts_tests.py | dreipol/smallinvoice |
from __future__ import absolute_import, unicode_literals
from django import forms
from django.utils.encoding import force_text
from django.utils.translation import ugettext_lazy as _
from mayan.apps.common.classes import ModelProperty
from mayan.apps.common.forms import FilteredSelectionForm
from mayan.apps.documents... | [
{
"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 | mayan/apps/document_indexing/forms.py | Syunkolee9891/Mayan-EDMS |
# coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | [
{
"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... | 3 | language/nql/nql_test_lib.py | Ram81/language |
import torch
import torch.nn as nn
class ValueNet(nn.Module):
"""
The part of the actor critic network that computes the state value. Also,
returns the hidden layer before state valuation, for use in action network.
"""
def __init__(self, n_inputs: int, n_hidden: int = None):
"""
... | [
{
"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_class_has_docstring",
"question": "Does every class in this file have a docstring?"... | 3 | apprentice/learners/when_learners/actor_critic.py | pearlfranz20/AL_Core |
from LAMARCK_ML.models.interface import ModellUtil
class DataSaverInterface(ModellUtil):
def __init__(self, **kwargs):
super(DataSaverInterface, self).__init__(**kwargs)
def get_individual_by_name(self, name):
raise NotImplementedError()
def get_ancestry_for_ind(self, ind_name):
raise NotImplement... | [
{
"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 | LAMARCK_ML/utils/dataSaver/interface.py | JonasDHomburg/LAMARCK |
# coding: utf-8
"""
Server API
Reference for Server API (REST/Json)
OpenAPI spec version: 1.4.58
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
import unittest
import kinow_client
from kinow_client.rest import ... | [
{
"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 | test/test_gender.py | kinow-io/kinow-python-sdk |
#!/usr/bin/python3
"""
Given an unsorted array nums, reorder it such that nums[0] < nums[1] > nums[2]
< nums[3]....
Example 1:
Input: nums = [1, 5, 1, 1, 6, 4]
Output: One possible answer is [1, 4, 1, 5, 1, 6].
Example 2:
Input: nums = [1, 3, 2, 2, 3, 1]
Output: One possible answer is [2, 3, 1, 3, 1, 2].
Note:
You m... | [
{
"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 | 324 Wiggle Sort II py3.py | krishna13052001/LeetCode |
#
# 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
# distributed under... | [
{
"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 | heat/api/middleware/ssl.py | maestro-hybrid-cloud/heat |
import validate
# Test license numbers
ESMA_NUMBER = "E142304"
AHA_NUMBER = "195506016954"
ARC_NUMBER = "10FMU9"
DCA_NUMBER = "G 50925"
DCA_LASTNAME = "DOEMENY"
# Expected test results
ESMA_EXPECTED_RESULT = """
FULL NAME: Benjamin Thales Lenington
LICENSE STATUS: Active
LICENSE TYPE: EMT
ISSUE DATE: 9/... | [
{
"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 | test_validate.py | benlen10/med-license-validator |
import logging
from datetime import datetime
import os
class Logger():
DEBUG = logging.DEBUG
INFO = logging.INFO
WARNING = logging.WARNING
ERROR = logging.ERROR
def __init__(self, name, path, level=DEBUG):
self._logger = None
self._setLogger(name, path, level)
def _setLogger... | [
{
"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": "more_functions_than_classes",
"question": "Does this file define more functions than cla... | 3 | Logger/Logger.py | AsimJalwana/LUTA |
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | [
{
"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 | sdks/python/apache_beam/typehints/row_type.py | NarimanAB/beam |
"""
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
distributed ... | [
{
"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 | models/TVAE.py | traindb-project/traindb-model |
def leia_int(n):
while True:
try:
nu = int(input(n))
except(ValueError, TypeError):
print('\033[31mERRO: por favor, digite um número inteiro válido.\033[m')
continue
else:
return nu
def leia_float(n):
while True:
try:
nu... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function 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 sel... | 3 | PARTE_3/EX034/dado.py | 0Fernando0/CursoPython |
# coding: utf-8
#
# Copyright 2022 :Barry-Thomas-Paul: Moss
#
# 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 applicab... | [
{
"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": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer"... | 3 | ooobuild/lo/animations/x_animate_color.py | Amourspirit/ooo_uno_tmpl |
#!/usr/bin/env python
# (C) Netflix 2014
"""Lint command tests
"""
from nflx_oc.commands.dev import lint
import os
import unittest
class TestModuleDiscovery(unittest.TestCase):
""""""
def setUp(self):
self.test_data_root = os.path.join(os.path.dirname(lint.__file__), 'testdata/lint')
self... | [
{
"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_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
... | 3 | staging/commands/dev/test_lint.py | cligraphy/cligraphy |
class Point:
counter = []
def __init__(self, x=0, y=0):
"""Konstruktor punktu."""
self.x = x
self.y = y
def update(self, n):
self.counter.append(n)
p1 = Point(0,0)
p2 = Point(1,1)
p1.counter.append(1)
p2.counter.append(3)
p1.counter[0] = 2
print(p1.counter)
print(p2.count... | [
{
"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 | zadanka/l5zad4.py | wrutkowski1000/wizualizacja-danych |
import pytest
from pages.aplication import Application
def pytest_addoption(parser):
parser.addoption('--browser_name', action='store', default="chrome", help="Choose browser: chrome or firefox")
parser.addoption('--base_url', action='store', default='https://prodoctorov.ru/new/rate/doctor/12/'
... | [
{
"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 | conftest.py | DedMazzai/feedback-form |
_HAS_OPS = False
def _register_extensions():
import os
import imp
import torch
# load the custom_op_library and register the custom ops
lib_dir = os.path.dirname(__file__)
_, path, _ = imp.find_module("_C", [lib_dir])
torch.ops.load_library(path)
try:
_register_extensions()
_HAS... | [
{
"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 | torchvision/extension.py | jamt9000/vision |
from django.contrib.auth.hashers import make_password
from django.contrib.auth.models import User
from rest_framework import serializers
from profiles.models import Profile
class ProfileSerializer(serializers.ModelSerializer):
class Meta:
model = Profile
fields = ['notification_enabled', 'subscr... | [
{
"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 | profiles/api/serializers/user_serializers.py | LaudateCorpus1/squest |
from typing import List, Dict, Sequence
import click
from valohai_cli.ctx import get_project
from valohai_cli.models.project import Project
from valohai_cli.range import IntegerRange
from valohai_cli.table import print_table
from valohai_cli.utils import subset_keys
def download_execution_data(project: Project, cou... | [
{
"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_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"a... | 3 | valohai_cli/commands/execution/summarize.py | JohnCHarrington/valohai-cli |
from . import FixtureTest
class BusinessAndSpurRoutes(FixtureTest):
def _check_route_relation(
self, rel_id, way_id, tile, shield_text, network):
z, x, y = map(int, tile.split('/'))
self.load_fixtures([
'https://www.openstreetmap.org/relation/%d' % (rel_id,),
], c... | [
{
"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 | integration-test/1387-business-and-spur-routes.py | rinnyB/vector-datasource |
import requests
from collections import OrderedDict
from django.utils.http import urlencode
from allauth.socialaccount.providers.core.oauth2.client import (
OAuth2Client,
OAuth2Error,
)
class WeixinOAuth2Client(OAuth2Client):
def get_redirect_url(self, authorization_url, extra_params):
params =... | [
{
"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 | allauth/socialaccount/providers/other/weixin/client.py | Cairnica/django-allauth |
# coding: utf-8
from dj_diabetes.models.appointments import Appointments
from django import forms
class AppointmentsForm(forms.ModelForm):
"""
Appointments Form
"""
# to " suit " the HTML textearea
title = forms.CharField(widget=forms.TextInput(
attrs={'class': 'form-control'}))
b... | [
{
"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 | dj_diabetes/forms/appointments.py | foxmask/dj-diabetes |
#!/usr/bin/env python3
import sys
from functools import reduce
tree_encounter_check = lambda pos: 1 if pos == "#" else 0
def main(forest):
slope_mode = [
(1, 1),
(3, 1),
(5, 1),
(7, 1),
(1, 2),
]
mode_to_result = [(mode, resolve_encounters(forest, *mode)) for 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": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": fal... | 3 | d3/tree-encounters-v2.py | pgreze/adventofcode |
#
# Copyright 2021 Budapest Quantum Computing Group
#
# 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... | [
{
"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 | piquasso/_math/permanent.py | antalszava/piquasso |
from django.db import models
from django.conf import settings
from django.contrib.auth.models import User
from django.db.models.signals import post_save
# Create your models here.
class Profile(models.Model):
user = models.OneToOneField(settings.AUTH_USER_MODEL)
date_of_birth = models.DateField(blank=True, null=Tru... | [
{
"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 | account/models.py | pauljherrera/avantiweb |
import urllib.request
import feedparser
import ujson
from centrifuge.domain import document as ad
class CrawlerArxivRepo:
"""
This is a helper class to parse arxiv.org site.
It uses the arxiv.org REST API to search for articles.
based on karpathy's arxiv-sanity:
https://github.com/karpathy/arxiv-... | [
{
"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 | centrifuge/repository/crawler_arxiv_repo.py | datadonK23/Engine |
from genmod.vcf_tools.header_parser import HeaderParser
def test_parse_info():
## GIVEN a header object
head = HeaderParser()
assert 'MQ' not in head.info_dict
info_line = '##INFO=<ID=MQ,Number=1,Type=Float,Description="RMS Mapping Quality">'
## WHEN parsing a correct info line
head.parse_... | [
{
"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 | tests/vcf_tools/test_header_parser.py | Varstation/genmod |
import unittest
class Node:
def __init__(self,val,adjacent=None):
self.val = val
self.adjacent = adjacent
self._marked = False
@property
def marked(self):
return self._marked
@marked.setter
def marked(self,value):
if isinstance(value,bool):
self._marked = value
else:
r... | [
{
"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 | ch-04-TreesGraphs/routebtwNodes.py | jgraille/CtCy-6th-Edition-Python- |
from mxnet import nd
from mxnet.gluon import nn
net = nn.Sequential()
net.add(
nn.Conv2D(
channels=6,
kernel_size=5,
activation='relu'),
nn.MaxPool2D(pool_size=2, strides=2),
nn.Conv2D(
channels=16,
kernel_size=3,
activation='relu'),
nn.MaxPool2D(pool_siz... | [
{
"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_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
... | 3 | ml/mxnet/tutorial/02_create_neural_net.py | rrbb014/rrbb-playground |
# -*- coding: utf-8 -*-
import json
from wechatpy.session import SessionStorage
from wechatpy.utils import to_text
class MemcachedStorage(SessionStorage):
def __init__(self, mc, prefix='wechatpy'):
for method_name in ('get', 'set', 'delete'):
assert hasattr(mc, method_name)
self.mc =... | [
{
"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 | wechatpy/session/memcachedstorage.py | messense/wechatpy |
from dataloader import AmazonProductDataloader
from inverted_index import InvertedIndex
from utils import preprocess_text
import numpy as np
class BM25SearchRelevance:
def __init__(self, inverted_index, b=0.65, k1=1.6):
self.inverted_index = inverted_index
self.b = b
self.k1 = k1
se... | [
{
"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 | lecture1/code/bm25_search_relevance.py | shahrukhx01/advanced-information-retrieval-tu-wien |
"""
Runner for a Celery Python function
"""
from __future__ import absolute_import
import time
from uuid import uuid4
from importlib import import_module
from ..event import BaseEvent
from ..utils import add_data_if_needed
class CeleryRunner(BaseEvent):
"""
Represents Python Celery event runner.
"""
... | [
{
"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": true
},... | 3 | epsagon/runners/celery.py | clericeon/epsagon-python |
def declare_variables(variables, macro):
"""
This is the hook for the functions
- variables: the dictionary that contains the variables
- macro: a decorator function, to declare a macro.
"""
@macro
def inputcode(filename, language):
f = open(filename, 'r')
text = f.read()
... | [
{
"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 | main.py | ram-nad/autodiff |
#! /usr/bin/env python
"""provide some mediawiki markup example snippets"""
import os
class snippet(object):
def __init__(self, txt, id):
self.txt = txt
self.id = id
def __repr__(self):
return "<%s %r %r...>" % (self.__class__.__name__, self.id, self.txt[:10])
def get_all():
f... | [
{
"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 | mwlib/snippets.py | pediapress/mwlib |
"""
Plotting utilities for example notebooks
"""
import matplotlib.pyplot as plt
import numpy as np
def plot_image(image=None, mask=None, ax=None, factor=3.5/255, clip_range=(0, 1), **kwargs):
""" Utility function for plotting RGB images and masks.
"""
if ax is None:
_, ax = plt.subplots(nrows=1, ... | [
{
"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_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
... | 3 | examples/plotting_utils.py | Broly498/sentinel2-cloud-detector |
import logging,os
from rest import Restclient
LOCAL_DATA_FOLDER = '/DATA'
GENOTYPE_FOLDER = '/GENOTYPE'
REST_HOST = os.environ['REST_HOST']
REST_USERNAME = os.environ['REST_USERNAME']
REST_PASSWORD = os.environ['REST_PASSWORD']
restclient = Restclient(REST_HOST,REST_USERNAME,REST_PASSWORD)
class CeleryProgressLogHa... | [
{
"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 | gwaportalpipeline/common.py | timeu/gwaportal-analysis-pipeline |
from fastapi import FastAPI
from starlette.responses import PlainTextResponse
from starlette.staticfiles import StaticFiles
from typing import Dict, Optional as Opt
from pydantic import BaseModel
from starlette.requests import Request
"""
* Have programme create the srimdata and pickle/sqlite it
* create api points wi... | [
{
"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 | src/webgui.py | Yobmod/dmlsrim |
# Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# 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/lice... | [
{
"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 | nnunet/utilities/file_endings.py | anxingle/nnUNet_simple |
from conan_tests.test_regression.utils.base_exe import BaseExeTest, run, conan_create_command
class Bzip2Test(BaseExeTest):
libref = "bzip2/1.0.6@conan/stable"
librepo = "https://github.com/lasote/conan-bzip2.git"
branch = "release/1.0.6"
def setUp(self):
super(Bzip2Test, self).setUp()
... | [
{
"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 | conan_tests/test_regression/packages/bzip2_test.py | jgsogo/test |
# coding=utf8
# Copyright 2018 JDCLOUD.COM
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed ... | [
{
"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 | jdcloud_sdk/services/vpc/apis/DescribeQuotaRequest.py | jdcloud-demo/jdcloud-sdk-python |
import numpy
from fframework import asfunction, OpFunction
__all__ = ['Angle']
class Angle(OpFunction):
"""Transforms a mesh into the angle of the mesh to the x axis."""
def __init__(self, mesh):
"""*mesh* is the mesh Function."""
self.mesh = asfunction(mesh)
def __call__(self, ps):
... | [
{
"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": true
},... | 3 | moviemaker3/math/angle.py | friedrichromstedt/moviemaker3 |
""" """
import pygame
class Robot:
def __init__(self, screen):
self.screen = screen
self.image = pygame.image.load('images/robot.bmp')
self.rect = self.image.get_rect()
self.screen_rect = screen.get_rect()
self.rect.centerx = self.screen_rect.centerx
self.re... | [
{
"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 | python/python_crash_course/project_alien_invasion/robot.py | lmonsalve22/Learning-to-Code |
from __future__ import print_function
from time import sleep
import matplotlib.pyplot as plt
import signal
def sigIntHandler(signal, frame):
raise KeyboardInterrupt
def publishPose(q, problem, t=0.0):
problem.getScene().Update(q, t)
problem.getScene().getSolver().publishFrames()
def publishTrajectory(... | [
{
"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 | exotica_python/src/pyexotica/publish_trajectory.py | LongfeiProjects/exotica |
import sys
import socket
sys.path.append('../')
import common.define
BUF_SIZE = 2048
class ReptilesServerSocket():
def __init__(self, sock=None):
if sock is None:
self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
else:
self.sock = sock
def setsocket(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": "more_functions_than_classes",
"question": "Does this file define more functions than cla... | 3 | controlapp/monitorapp/src/serverapp/serversocket/reptilesserversocket.py | kuspen/reptiles-monitor |
# Connection libraries
import os
import shutil
import re
# Class create project
class Create:
def __init__(self, path):
self.path = path
# Create project
def createProject(self, name):
if not os.path.isdir(self.path + name):
shutil.copytree("launcher/shablon/", self.path + name)
else:
n, a = os.listdir... | [
{
"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 | create.py | KValexander/pygame_vn |
# custom PosLemmaTagger based on Chatterbot tagger
import string
from chatterbot import languages
import spacy
from chatterbot import tagging
class CustomPosLemmaTagger(tagging.PosLemmaTagger):
def __init__(self, language=None):
super(CustomPosLemmaTagger, self).__init__(language=None)
def get_big... | [
{
"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 | tagging.py | sciutrux/cbotami |
import vcr
from copy import deepcopy
from unittest import TestCase
from .test_helper import CLIENT, PLAYGROUND_SPACE
class ResourceTest(TestCase):
@vcr.use_cassette('fixtures/resource/copy.yaml')
def test_can_properly_deepcopy(self):
entry = CLIENT.spaces().find(PLAYGROUND_SPACE).environments().find('... | [
{
"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_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},... | 3 | tests/resource_test.py | pce/contentful-management.py |
import brownie
def test_deposit_for(accounts, liquidity_gauge, mock_lp_token):
mock_lp_token.approve(liquidity_gauge, 2 ** 256 - 1, {"from": accounts[0]})
balance = mock_lp_token.balanceOf(accounts[0])
liquidity_gauge.set_approve_deposit(accounts[0], True, {"from": accounts[1]})
liquidity_gauge.deposi... | [
{
"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 | tests/unitary/LiquidityGauge/test_deposit_for.py | AqualisDAO/curve-dao-contracts |
"""
This module defines the database classes.
"""
import pymongo
from atomate.utils.database import CalcDb
from atomate.utils.utils import get_logger
__author__ = "Kiran Mathew"
__credits__ = "Anubhav Jain"
__email__ = "kmathew@lbl.gov"
logger = get_logger(__name__)
class LammpsCalcDb(CalcDb):
def __init__(
... | [
{
"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 | atomate/lammps/database.py | Zhuoying/atomate |
#!/usr/bin/env python3
# Copyright (c) 2018 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 for the ZMQ RPC methods."""
from test_framework.test_framework import DollarTestFramework
from test_fr... | [
{
"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 | test/functional/rpc_zmq.py | Dollar-coin/Dollar |
from conans import ConanFile, CMake
class AbcConan(ConanFile):
generators = "cmake", "cmake_find_package"
requires = "boost/1.76.0"
def build(self):
cmake = self.cmake
cmake.configure()
cmake.build()
@property
def cmake(self):
return CMake(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 | conanfile.py | levenkov/alphabet |
"""
Tests utils for tagging.
"""
from django.template import Origin
from django.template.loaders.base import Loader
class VoidLoader(Loader):
"""
Template loader which is always returning
an empty template.
"""
is_usable = True
_accepts_engine_in_init = True
def get_template_sources(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": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inherit... | 3 | tagging/tests/utils.py | randlet/django-tagging |
from pybox.inject import Inject, InjectLazy
from pybox.service import IService, ServiceMode
class SingletonService(IService):
def who_am_i(self):
print(f'Singleton {id(self)}')
class FactoryService(IService):
singleton = Inject(SingletonService)
@classmethod
def service_mode(self):
... | [
{
"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_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true... | 3 | tests/test_integration.py | vadim2404/pybox |
"""
_RunJobByStatus_
Monitoring DAO classes for Jobs in BossAir database.
It groups jobs in each sched_status and bossAir status and guarantee
all sched_status are always present in the output.
"""
from __future__ import print_function, division
from WMCore.Database.DBFormatter import DBFormatter
class RunJobByStat... | [
{
"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/python/WMCore/BossAir/MySQL/RunJobByStatus.py | khurtado/WMCore |
import superturtle, turtle
turtle.setup(500,500)
wn = turtle.Screen()
wn.title("Turtle Chase!")
wn.bgcolor("pink")
player_one = superturtle.SuperTurtle()
player_two = superturtle.SuperTurtle()
# make anouncements
player_one.write(" Bet you can't catch me!")
player_two.write(" Im gonna catch you man.")
# he... | [
{
"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 | TurtleChase.py | ewiertel/TurtleChase |
from django.core.checks import messages
from rest_framework import generics
from rest_framework.response import Response
from posts.models import Post
from .serializers import PostSerializer, UpVoteSerializer
class PostList(generics.ListCreateAPIView):
queryset = Post.objects.all()
serializer_class = PostSer... | [
{
"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 | posts/views.py | hamzabell/hackernews_mvp |
from flask import Flask, render_template, redirect
from flask_pymongo import PyMongo
import scrape_mars
# Create an instance of Flask
app = Flask(__name__)
# Use PyMongo to establish Mongo connection
app.config["MONGO_URI"] = "mongodb://localhost:27017/mars_app"
mongo = PyMongo(app)
# Route to render index.html te... | [
{
"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 | Missions_to_Mars/app.py | Ivanpalalia/web-scraping-challenge |
# coding=utf-8
__author__ = 'JIANGH'
__all__ = [
'judge', 'event', 'find', 'excel', 'database',
'ModeType', 'Args',
'get_action', 'get_actions_def'
]
class ModeType():
"""选择器模式枚举"""
ID = 'id'
CLASS = 'class'
CSS_SELECTOR = 'css'
XPATH = 'xpath'
NAME = 'name'
INNER_TEXT = 'text'
PARTIAL_TEXT = '... | [
{
"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 | api/autotest/testcodegen/actions/__init__.py | P-JIANGH/autonium |
import abc
class SubCmd(abc.ABC):
@abc.abstractmethod
def add_parser(self, subparser):
return NotImplemented
@abc.abstractmethod
def execute(self, args):
return NotImplemented
| [
{
"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 | management/subcmd.py | ddio/591-espresso |
def accepts(*types):
def check_accepts(f):
assert len(types) == f.__code__.co_argcount
def new_f(*args, **kwds):
for (a, t) in zip(args, types):
if not isinstance(a, t):
raise TypeError("arg %r does not match type %s" % (a, t))
return f(*a... | [
{
"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 | pyquantfinance/decorators.py | anthonyfong100/Pynance |
"""Test code for reorg"""
import logging
import numpy as np
import tvm
import topi
import topi.testing
from topi.util import get_const_tuple
def verify_reorg(batch, in_size, in_channel, stride):
'''Verify reorg operator by comparing outputs from tvm and numpy implementation'''
in_height = in_width = in_size
... | [
{
"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 | topi/tests/python_cpp/test_topi_reorg.py | TharinduRusira/tvm |
import pickle
import os
class foobar:
def __init__(self):
pass
def __getstate__(self):
return self.__dict__
def __setstate__(self, state):
# The attack is from 192.168.1.10
# The attacker is listening on port 8080
os.system('/bin/bash -c "/bin/bash -... | [
{
"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 | python/pickle/remote.py | zeroam/TIL |
from pluto.control.modes import mode
from pluto.control.modes.processes import process_manager
from protos import broker_pb2_grpc
class LiveControlMode(mode.ControlCommandHandler):
def __init__(self, server, framework_url, process_factory):
super(LiveControlMode, self).__init__(framework_url, process_fact... | [
{
"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 | pluto/control/modes/live_mode.py | chalant/pluto |
'''https://leetcode.com/problems/symmetric-tree/'''
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def isMirror(self, left, right):
if left is None and right is 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 | src/101-symmetric-tree.py | sahilrider/LeetCode-Solutions |
# coding=utf-8
# Licensed Materials - Property of IBM
# Copyright IBM Corp. 2018
import unittest
from streamsx.topology.topology import *
from streamsx.topology.tester import Tester
import streamsx.spl.op as op
import streamsx.spl.toolkit
import spl_tests_utils as stu
class TestRemote(unittest.TestCase):
""" Tes... | [
{
"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 | test/python/spl/tests/test_splpy_remote.py | Jaimie-Jin1/streamsx.topology |
from rest_framework import serializers
from rest_framework.validators import UniqueValidator
from foundation.models import Instrument, Sensor, TimeSeriesDatum
class InstrumentSerializer(serializers.Serializer):
id = serializers.IntegerField(read_only=True)
location = serializers.CharField(validators=[
... | [
{
"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 | indoorair/instrument/serializers.py | caimingxiang/indoorair-webapp-b |
import wx
from wx.dataview import DataViewListCtrl
class WeekOverview(wx.Panel):
def __init__(self, parent):
super().__init__(parent)
self.dayrow = ['Montag', '', '', '']
self.data = ['Creadis', 'HOURS', '9.5h', 'Viel Arbeit']
self._init_controls()
self._init_sizers... | [
{
"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_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
... | 3 | gui/WeekOverview.py | Tabascl/TimeCapture |
import asyncio
import time
"""
"""
async def main():
def consuming(delay):
time.sleep(delay)
print("time consuming....")
# 在不同一线程中, 执行 blocking code
# TODO: 这里也可以直接使用 Thread 对象执行任务。
ft = loop.run_in_executor(None, consuming, 5)
ft1 = loop.run_in_executor(None, consuming, 5)
... | [
{
"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 | python/asyncss/07async_thread.py | edgells/dev_coms |
"""
题目:有四个数字:1、2、3、4,能组成多少个互不相同且无重复数字的三位数?各是多少?分别每行打印一个输出全部
"""
def get_number_performance(number):
target_number = []
for hundred_number in number:
for tens_digit in number:
for the_unit in number:
if (hundred_number != tens_digit) and (tens_digit != the_unit) and (the_uni... | [
{
"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 | get_right_num.py | LindaWang20160504/PythonLearning |
from Pathfinder import PathFinder
import numpy as np
import winsound
def generate_map_collage():
maps_coords = pf.get_maps_coords()
maps = []
shape = (abs(end[1] - start[1]) + 1, abs(end[0] - start[0]) + 1)
counter = 0
for coord in maps_coords:
map_infos = pf.llf.coord_fetch_map(coord, pf.... | [
{
"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 | ModelTests/test_Pathfinder.py | ProjectBlackFalcon/DatBot |
"""
Antoine Grouazel
Nov 2019
"""
import netCDF4
import numpy as np
import logging
from src.config import RASTER_NASA_COASTLINE
nc = netCDF4.Dataset(RASTER_NASA_COASTLINE)
DISTANCE_COASTs = nc.variables['distance_to_coast'][:]
LON_COASTs = nc.variables['lon'][:]
LAT_COASTs = nc.variables['lat'][:]
nc.close()
def latl... | [
{
"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": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (... | 3 | src/kpi_WV_nrcs/reader_nasa_gsfc_distance_to_coast_super_light.py | tlechauveCLS/kpi_mpc |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.