source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
from pynq import DefaultIP
# Things to fix up about this driver:
# * Add safety checks [a la C driver](https://github.com/Xilinx/embeddedsw/blob/master/XilinxProcessorIPLib/drivers/axis_switch/src/xaxis_switch_hw.h)
# * Think about better interface / language to control the routing
class AxisSwitch(DefaultIP):
... | [
{
"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 | audio_lab_pynq/AxisSwitch.py | cramsay/Audio-Lab-PYNQ |
# (C) Copyright David Abrahams 2002. Permission to copy, use, modify, sell and
# distribute this software is granted provided this copyright notice appears in
# all copies. This software is provided "as is" without express or implied
# warranty, and with no claim as to its suitability for any purpose.
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": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/... | 3 | tools/build/v2/util/sequence.py | jmuskaan72/Boost |
class MenuItem(object):
TEXT_NAME = 'name'
TEXT_URL = 'url_name'
TEXT_SUBMENU = 'submenu'
def __init__(self, name, url=None, *args):
super(MenuItem, self).__init__()
self.name = name
self.url = url
self.url_args = args
self.sub_menu = []
def add_sub_menu_ite... | [
{
"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/core/Nav/Nav.py | airportmarc/bondy |
# python3
def max_pairwise_product_naive(numbers):
assert len(numbers) >= 2
assert all(0 <= x <= 2 * 10 ** 5 for x in numbers)
product = 0
for i in range(len(numbers)):
for j in range(i + 1, len(numbers)):
product = max(product, numbers[i] * numbers[j])
return product
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": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"ans... | 3 | Programming Challenges/Maximum Pairwise Product/maximum_pairwise_product.py | Tarbo/algo-data-structure |
# GENERATED BY KOMAND SDK - DO NOT EDIT
import komand
import json
class Component:
DESCRIPTION = "Delete user from WordPress instance"
class Input:
REASSIGNEE = "reassignee"
USERNAME = "username"
class Output:
SUCCESS = "success"
class DeleteUserInput(komand.Input):
schema = json.loa... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{... | 3 | plugins/wordpress/komand_wordpress/actions/delete_user/schema.py | lukaszlaszuk/insightconnect-plugins |
import pandas as pd
from sklearn.preprocessing import LabelEncoder
def categorical_features(data, features):
features['vehicleType'] = data['vehicleType']
features['vehicleOption'] = data['vehicleOption']
features['vehicleTypeOption'] = [a + '_' + b for a, b in zip(data['vehicleType'].values,
... | [
{
"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 | feature_extraction/other_features.py | smolendawid/ubaar-competition |
import torch
from .elliptical_slice import EllipticalSliceSampler
class MeanEllipticalSliceSampler(EllipticalSliceSampler):
def __init__(self, f_init, dist, lnpdf, nsamples, pdf_params=()):
"""
Implementation of elliptical slice sampling (Murray, Adams, & Mckay, 2010).
f_init: initial val... | [
{
"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 | pytorch_ess/mean_elliptical_slice.py | wjmaddox/pytorch_ess |
# Copyright 2018 tsuru authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
import os
import flask
from flask import Response
app = flask.Flask(__name__)
path1_count = 0
path2_count = 0
@app.route("/")
def hello():
return "Hello world... | [
{
"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 | app-demo/app.py | AlexRogalskiy/prometheus-as-a-service |
# 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 u... | [
{
"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 | aliyun-python-sdk-scdn/aliyunsdkscdn/request/v20171115/SetScdnDomainBizInfoRequest.py | yndu13/aliyun-openapi-python-sdk |
# coding=utf-8
from pyecharts.chart import Chart
class Map(Chart):
"""
<<< 地图 >>>
地图主要用于地理区域数据的可视化。
"""
def __init__(self, title="", subtitle="", **kwargs):
super(Map, self).__init__(title, subtitle, **kwargs)
def add(self, *args, **kwargs):
self.__add(*args, **kwargs)
... | [
{
"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 | pyecharts/charts/map.py | zwr8/pyecharts |
'''
Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand.
(i.e., [0,1,2,4,5,6,7] might become [4,5,6,7,0,1,2]).
You are given a target value to search. If found in the array return its index, otherwise return -1.
You may assume no duplicate exists in the array.
Your algorith... | [
{
"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 | search_in_rotated_sorted_array.py | nomadkitty/CS_unit2_build_week_challenges |
import subprocess
import pytest
from .test_common import _assert_eq
def test_mpi_adam():
"""Test RunningMeanStd object for MPI"""
# Test will be run in CI before pytest is run
pytest.skip()
return_code = subprocess.call(['mpirun', '--allow-run-as-root', '-np', '2',
... | [
{
"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 | tests/test_mpi_adam.py | 757670303037/stable-baselines |
import numpy as np
from unittest.mock import patch
from pyquil import Program
from pyquil.gates import H, CPHASE, SWAP, MEASURE
from grove.alpha.phaseestimation.phase_estimation import controlled
from grove.alpha.jordan_gradient.jordan_gradient import gradient_program, estimate_gradient
def test_gradient_program():
... | [
{
"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 | grove/tests/jordan_gradient/test_jordan_gradient.py | mkeshita/grove |
from typing import List
from .results import TaskResult
def test_get_learning_rates_unitary(unitary_results_json_fname):
# Prepare
result = TaskResult(unitary_results_json_fname)
# Execute
learning_rates = result.get_learning_rates()
# Assert
assert learning_rates is None
def test_get_lea... | [
{
"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 | xain/benchmark/aggregation/results_test.py | danieljanes/ox-msc-diss-code-freeze |
from django.conf import settings
from django.core.exceptions import ValidationError
from django.utils.encoding import smart_str
import datetime
import pytz
import functools
def localtime_for_timezone(value, timezone):
"""
Given a ``datetime.datetime`` object in UTC and a timezone represented as
a string, 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": "has_nested_function_def",
"question": "Does this file contain any function defined insid... | 3 | vendor/timezones/utilities.py | Paul3MK/NewsBlur |
from pathlib import Path
import os
from quest import Quest
RESOURCE_PATH = Path('resources')
QUESTS_PATH = RESOURCE_PATH / 'quests'
IMAGES_PATH = RESOURCE_PATH / 'images'
BATTLEPLANS_PATH = RESOURCE_PATH / 'battleplans'
class AutoFable:
def __init__(self):
self.quests = []
def load(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_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
}... | 3 | src/core/autofable.py | svew/autofable |
#This file was originally generated by PyScripter's unitest wizard
import unittest
from coord import Coord
from cell import Cell
from field import Field
def dummy():
""" Dummy function for comparison of the return values """
return
class CoordTest(unittest.TestCase):
def setUp(self):
... | [
{
"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 | src/game_of_life/python_coderetreat_socramob/cr_socramob08/coord_test.py | hemmerling/codingdojo |
'''
Created by auto_sdk on 2021.03.10
'''
from dingtalk.api.base import RestApi
class OapiCateringUnfreezeRequest(RestApi):
def __init__(self,url=None):
RestApi.__init__(self,url)
self.order_id = None
self.rule_code = None
self.userid = None
def getHttpMethod(self):
return 'POST'
def getapiname(self):
... | [
{
"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 | other/dingding/dingtalk/api/rest/OapiCateringUnfreezeRequest.py | hth945/pytest |
from enum import Enum
class WeatherCondition:
def __init__(self, severity, description, condition, condition_type):
self.severity = severity
self.description = description
self.condition = condition
self.condition_type = condition_type
def __eq__(self, other):
return s... | [
{
"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 | data_types/condition.py | Wil-Peters/rhasspy_weather |
import datetime
from sport_systems import stats
class TestBucketing(object):
def test_bucketing(self, results_1):
bucketed_results = stats.create_buckets(results_1)
assert len(bucketed_results['01-10']) == 2
class TestPercentile(object):
def test_generating(self, results_1):
percenti... | [
{
"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 | tests/test_stats.py | willcodefortea/sportssystems_crawler |
import grpc
import threading
import proto.connection_pb2_grpc
from libs.core.Log import Log
from libs.core.Switch import Switch
from libs.core.Event import Event
from libs.Configuration import Configuration
class SwitchConnection:
def __init__(self, grpc_address=None):
self.channel = grpc.insecure_channe... | [
{
"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 | Controller-Implementation/libs/core/SwitchConnection.py | qcz994/p4-bier |
from django.shortcuts import render
from django.http import HttpResponse, HttpResponseRedirect
from Logger.models import Run, Process
from Logger.libs import log_dealer
import json
# Create your views here.
def listen(request):
log_dealer(request)
context_dict = {}
response = render(request, 'index.html',... | [
{
"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 | Logger/views.py | MenheraMikumo/Nextflow-Kanban |
from __future__ import print_function, absolute_import, division # makes these scripts backward compatible with python 2.6 and 2.7
# Importing the base class
from time_integration_base_scheme import TimeIntegrationBaseScheme
# Importing tools
from co_simulation_tools import ValidateAndAssignDefaults
# Other imports... | [
{
"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": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excl... | 3 | applications/EmpireApplication/python_scripts/co_simulation_solvers/mdof/schemes/time_integration_bdf2_scheme.py | lcirrott/Kratos |
from urllib.parse import urlparse
from dotenv import load_dotenv
import requests
import os
import argparse
def shorten_link(token, url):
response = requests.post(
"https://api-ssl.bitly.com/v4/bitlinks",
headers={"Authorization": "Bearer {}".format(token)},
json={"long_url": url})
resp... | [
{
"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 | v-sht/url-shortener |
from keras.layers import Input
from keras.layers.merge import Concatenate
from keras.models import Model
from keras.optimizers import Adam
from .keras_base import KerasBaseExp
from .keras_base import exp_bag_of_strokes
from .blocks import fc_branch, final_type1
class mlp_type1(KerasBaseExp):
def initialize_mode... | [
{
"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 | experiment/exp1x.py | nguyen-binh-minh/logographic |
'''
Created by auto_sdk on 2019.07.31
'''
from dingtalk.api.base import RestApi
class OapiAttendanceShiftSearchRequest(RestApi):
def __init__(self,url=None):
RestApi.__init__(self,url)
self.op_user_id = None
self.shift_name = None
def getHttpMethod(self):
return 'POST'
def getapiname(self):
return 'dingt... | [
{
"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 | other/dingding/dingtalk/api/rest/OapiAttendanceShiftSearchRequest.py | hth945/pytest |
import json
import os
from umbral.keys import UmbralPrivateKey, UmbralPublicKey
DOCTOR_PUBLIC_JSON = 'doctor.public.json'
DOCTOR_PRIVATE_JSON = 'doctor.private.json'
def generate_doctor_keys():
enc_privkey = UmbralPrivateKey.gen_key()
sig_privkey = UmbralPrivateKey.gen_key()
doctor_privkeys = {
... | [
{
"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 | heartbeat_demo/doctor_keys.py | drbh/nucypher-ipfs |
import abc
class CombinationIndicator(metaclass=abc.ABCMeta):
def __init__(self, threshold: float):
self.__threshold: float = threshold
@property
def threshold(self):
return self.__threshold
@threshold.setter
def threshold(self, new_threshold: float):
self.__threshold = n... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excludi... | 3 | combine/indicator/combination_indicator.py | cwwang15/fudan-monte-carlo-pwd |
import numpy as np
# Generate some n number of colours, hopefully maximally different
# source: http://stackoverflow.com/questions/470690/how-to-automatically-generate-n-distinct-colors
import colorsys
def get_colors(num_colors):
colors=[]
for i in np.arange(0., 360., 360. / num_colors):
hue = i/360... | [
{
"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 | surface/misc.py | megodoonch/birdsong |
from molsysmt._private_tools.exceptions import *
def from_mdanalysis_Universe (item, molecular_system=None, atom_indices='all', frame_indices='all'):
from molsysmt.native.molsys import MolSys
from molsysmt.native.io.topology import from_mdanalysis_Universe as mdanalysis_Universe_to_molsysmt_Topology
from ... | [
{
"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 | molsysmt/native/io/molsys/mdanalysis_Universe.py | dprada/molsysmt |
from django.test import TestCase
from django_comments_xtd import django_comments
from django_comments_xtd.models import TmpXtdComment
from django_comments_xtd.forms import XtdCommentForm
from django_comments_xtd.tests.models import Article
class GetFormTestCase(TestCase):
def test_get_form(self):
# chec... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},... | 3 | django_comments_xtd/tests/test_forms.py | mcguia/critical-design |
"""Base actions for the players to take."""
from csrv.model.actions import action
from csrv.model import cost
from csrv.model import errors
from csrv.model import events
from csrv.model import game_object
from csrv.model import parameters
class RezIce(action.Action):
COST_CLASS = cost.RezIceCost
DESCRIPTION = '... | [
{
"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 | csrv/model/actions/rez_ice.py | mrroach/CentralServer |
from django.db import models
from django.contrib.auth.models import AbstractUser
class User(AbstractUser):
is_student = models.BooleanField(default=False)
is_teacher = models.BooleanField(default=False)
class Profile(models.Model):
user = models.OneToOneField(User, on_delete=models.CASCADE)
... | [
{
"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 | users/models.py | sandeepagrawal8875/DjangoMultipleUser |
# -*- coding: utf-8 -*-
"""
mundiapi
This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ).
"""
class GetCheckoutBankTransferPaymentResponse(object):
"""Implementation of the 'GetCheckoutBankTransferPaymentResponse' model.
Bank transfer checkout response
... | [
{
"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 | mundiapi/models/get_checkout_bank_transfer_payment_response.py | hugocpolos/MundiAPI-PYTHON |
# uint32_t RgbLed:: rectToRGB(float x, float y)
# {
# auto cval = [](float theta, float ro, float phase) {
# float val = sin(0.6 * theta - phase)
# if (val < 0)
# val = 0
# return val
# }
# float theta = atan2(y, x) * RAD_TO_DEG
# float ro = sqrt(x * x + y * y)
# flo... | [
{
"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 | control-panel/conversions.py | lukasz-tuz/kids-control-panel |
import pygame
from core import Vector2D, Color
from .shape import Shape
class Rectangle(Shape):
def __init__(self, position: Vector2D, size: Vector2D, color: Color):
self._position = position
self.size = size
self.color = color
self.size_color = color[:]
self.rect = pygam... | [
{
"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 | shapes/rectangle.py | mHaisham/Steruell |
from rest_framework import serializers
from shop.conf import app_settings
from shop.serializers.bases import BaseOrderItemSerializer
class OrderItemSerializer(BaseOrderItemSerializer):
summary = serializers.SerializerMethodField(
help_text="Sub-serializer for fields to be shown in the product's summary.")... | [
{
"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 | shop/serializers/defaults/order_item.py | 2000-ion/TIDPP-Lab3 |
#!/usr/bin/env python3
# Copyright (c) 2018 The Bitcoin Core developers
# Copyright (c) 2019-2021 Xenios SEZC
# https://www.veriblock.org
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test RPC help output."""
from test_framew... | [
{
"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 | test/functional/rpc_help.py | VeriBlock/b |
#
# This source file is part of the EdgeDB open source project.
#
# Copyright 2016-present MagicStack Inc. and the EdgeDB 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... | [
{
"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 | tests/test_errors.py | Fogapod/edgedb-python |
# WARNING: Do not edit by hand, this file was generated by Crank:
#
# https://github.com/gocardless/crank
#
class BankAuthorisation(object):
"""A thin wrapper around a bank_authorisation, providing easy access to its
attributes.
Example:
bank_authorisation = client.bank_authorisations.get()
... | [
{
"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": true
... | 3 | gocardless_pro/resources/bank_authorisation.py | gdvalderrama/gocardless-pro-python |
"""Tests for the macroeco_distributions module"""
from __future__ import division
from macroeco_distributions import *
import nose
from nose.tools import assert_almost_equals, assert_equals
from math import log
from decimal import Decimal
#Test values for Poisson lognomal are chosen from Table 1 and Table 2
#in Grun... | [
{
"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 | macroeco_distributions/tests_macroeco_distributions.py | ethanwhite/macroecotools |
from datetime import datetime, timedelta
from enum import Enum
from simple_pid import PID
class Direction(Enum):
COOLING = "cooling"
HEATING = "heating"
class Controller:
def __init__(
self,
setpoint,
pid_kp=1,
pid_ki=0.1,
pid_kd=0.05,
power_mult=30,
... | [
{
"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 | temp_control/control.py | flyte/beer-temp-control |
"""
This problem was asked by Amazon.
Given a matrix of 1s and 0s, return the number of "islands" in the matrix.
A 1 represents land and 0 represents water, so an island is a group of 1s
that are neighboring whose perimeter is surrounded by water.
For example, this matrix has 4 islands.
1 0 0 0 0
0 0 1 1 0
0 1 1 0 0... | [
{
"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 | DailyCodingProblem/84_Amazon_Find_Islands_From_Matrix.py | RafayAK/CodingPrep |
import logging
import pytest
from pydantic import BaseSettings
from pydantic_ssm_settings import AwsSsmSourceConfig
logger = logging.getLogger("pydantic_ssm_settings")
logger.setLevel(logging.DEBUG)
class SimpleSettings(BaseSettings):
foo: str
class Config(AwsSsmSourceConfig):
...
class IntSetti... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excludi... | 3 | tests/test_main.py | developmentseed/pydantic-ssm-settings |
from django.contrib.auth import get_user_model, authenticate
from django.utils.translation import ugettext_lazy as _
from rest_framework import serializers
class UserSerializer(serializers.ModelSerializer):
"""Serializer for the users object"""
class Meta:
model = get_user_model()
fields = ('... | [
{
"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": true... | 3 | app/user/serializers.py | faridos/my_delivery_app_django |
from __future__ import absolute_import, division, print_function
class hydrogen_toggle(object):
def __init__(self, separator=False):
import coot # import dependency
import coot_python
import gtk
toolbar = coot_python.main_toolbar()
assert (toolbar is not None)
if (separator):
toolbar.in... | [
{
"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 | cootbx/hydrogens_button.py | dperl-sol/cctbx_project |
# -*- coding: utf-8 -*-
from model.contact import Contact
def test_add_contact(app, db, json_contacts, check_ui):
contact = json_contacts
old_contacts = db.get_contact_list()
app.contact.create_light(contact)
new_contacts = db.get_contact_list()
old_contacts.append(contact)
assert old_contacts... | [
{
"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 | test/test_add_contact.py | olegbelyi/python_training |
'''
This code could allocate the GPU automatically.
Please run this code in Python 3 only!!!
'''
import os, sys, shutil
import subprocess as sbp
from datetime import datetime
def get_all_gpu():
all_gpus = list()
nvidia = sbp.run(['nvidia-smi', '-L'], stdout=sbp.PIPE)
for line in nvidia.stdout.decode('ut... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answ... | 3 | src/end2end/slurm.py | tszssong/DREAM |
#!/usr/bin/env python
import unittest
from tests.base import PyangBindTestCase
class EnumerationTests(PyangBindTestCase):
yang_files = ["enumeration.yang"]
def setUp(self):
self.enum_obj = self.bindings.enumeration()
def test_container_has_all_leafs(self):
for leaf in ["e", "f"]:
... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},... | 3 | tests/enumeration/run.py | jonnyrocks/pyangbind |
class UserError(Exception):
def __init__(self, message):
self.message = message
class UserNotFoundError(UserError):
pass
class UserAlreadyRegisteredError(UserError):
pass
class InvalidEmailError(UserError):
pass
class IncorrectPasswordError(UserError):
pass
| [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{... | 3 | models/user/errors.py | nealwobuhei/pricing-service |
from pysys.constants import *
from xpybuild.xpybuild_basetest import XpybuildBaseTest
class PySysTest(XpybuildBaseTest):
def execute(self):
self.mkdir('input-files')
for i in range(256+1):
open(self.output+'/input-files/input-%d.txt'%i, 'w').close()
msg = self.xpybuild(shouldFail=False, args=['-n', '-j1'... | [
{
"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 | tests/performance/Dependency_FindPaths_DirGeneratedByTarget_Performance/run.py | sag-tgo/xpybuild |
from .models import DeferredWebReflectedBase
from . import PACKAGE_PATH
from pathlib import Path
from typing import Union
import sqlalchemy
def run_sql_file(sql_subpath: Union[str, Path], engine: sqlalchemy.engine.Engine) -> None:
sql_path = Path(PACKAGE_PATH, 'sql', sql_subpath).resolve()
if not sql_path.is_... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excludi... | 3 | dataPipelines/gc_db_utils/web/utils.py | Wildertrek/gamechanger-data |
from .megapix_scaler import MegapixScaler
class MegapixDownscaler(MegapixScaler):
@staticmethod
def force_downscale(scale):
return min(1.0, scale)
def set_scale(self, scale):
scale = self.force_downscale(scale)
super().set_scale(scale)
| [
{
"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 | apps/opencv_stitching_tool/opencv_stitching/megapix_downscaler.py | nowireless/opencv |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import json
import gzip
from abc import ABCMeta
from abc import abstractmethod
class TextTransformer(object):
__metaclass__ = ABCMeta
def __init__(self, dictionary_file=None):
if dictionary_f... | [
{
"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 | attalos/dataset/texttransformer.py | karllab41/attalos |
from tkinter import *
from tkinter import ttk
class MyTreeview(Frame):
def __init__(self, master):
super().__init__(master)
self.treeview = ttk.Treeview(self)
# attach a vertical scrollbar to the frame
verbar = ttk.Scrollbar(self, orient='vertical')
verbar.pack(side = 'righ... | [
{
"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 | mytreeview.py | xiaoyaofe/bale-backstage |
import re
def test_silver():
assert 660 == valid_count(read_input(), silver)
def test_gold():
assert 530 == valid_count(read_input(), gold)
def silver(line: str) -> bool:
match = re.match(
r"(?P<min>\d+)-(?P<max>\d+) (?P<char>\w): (?P<password>\w+)",
line
)
return int(match.gro... | [
{
"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 | day2/day2.py | BLannoo/Advent-of-Code-2020 |
import re
import typing
from pathlib import Path
from configparser import ConfigParser
from typing import List
if typing.TYPE_CHECKING:
from rivals_workshop_assistant.script_mod import Script
FILENAME = "config.ini"
PATH = FILENAME
SMALL_SPRITES_FIELD = "small_sprites"
def read(root_dir: Path) -> ConfigParser:... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or few... | 3 | rivals_workshop_assistant/character_config_mod.py | Rivals-Workshop-Community-Projects/rivals-workshop-assistant |
# -*- coding: utf-8 -*-
# type: ignore
# copyright: (c) 2020 by Jesse Johnson.
# license: Apache 2.0, see LICENSE for more details.
'''Provide documentation task-runner.'''
import textwrap
from invoke import task
from . import config
@task
def lint(ctx):
'''Check code for documentation errors.'''
ctx.run('... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excludi... | 3 | tasks/docs.py | kuwv/spades |
# -*- coding: utf-8 -*-
from app.core.models import Domain
def get_domainid_bysession(request):
""" 获取操作域名ID
:param request:
:return:
"""
try:
domain_id = int(request.session.get('domain_id', None))
except:
domain_id = 0
if not domain_id:
obj = Domain.objects.order_b... | [
{
"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 | Linux-Operation0605/app/utils/domain_session.py | zhouli121018/nodejsgm |
"""
python-socketio.py
Sample Mcity OCTANE python socketio script
"""
import os
from dotenv import load_dotenv
import socketio
#Load environment variables
load_dotenv()
api_key = os.environ.get('MCITY_OCTANE_KEY', None)
server = os.environ.get('MCITY_OCTANE_SERVER', 'http://localhost:5000')
namespace = "/octane"
#If... | [
{
"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 | python-socketio.py | mcity/Mcity-octane-examples |
"""empty message
Revision ID: f0a99f6b5e5e
Revises: he536vdwh29f
Create Date: 2019-05-31 15:57:36.032393
"""
# revision identifiers, used by Alembic.
revision = 'f0a99f6b5e5e'
down_revision = 'he536vdwh29f'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - ... | [
{
"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 | migrations/versions/f0a99f6b5e5e_.py | CSCfi/pebbles |
from enum import Enum
from fastapi import FastAPI, Request, Response, status
from pydantic import BaseModel
from .config import API_CONFIG
from .logger import Logger
from .question_generator import QuestionGenerator
from .validator import validate_and_log, HTTP_500_ERROR_MESSAGE
logger = Logger()
class NQuestions(... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
... | 3 | app/question_generator/api/main.py | FerdiantJoshua/sonya-backend |
"""
Collaborator class. Part of the StoryTechnologies project.
April 08, 2020
Brett Alistair Kromkamp (brett.kromkamp@gmail.com)
"""
from topicdb.core.models.collaborationmode import CollaborationMode
class Collaborator:
def __init__(
self,
map_identifier: int,
user_identifier: int,
... | [
{
"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 | topic-db/topicdb/core/models/collaborator.py | anthcp-infocom/Contextualise |
from ctypes import *
class Node(Structure): pass
Node._fields_ = [
("leaf", c_int),
("g", c_float),
("min_samples", c_int),
("split_ind", c_int),
("split", c_float),
("left", POINTER(Node)),
("right", POINTER(Node))]
trees = CDLL("./trees.so")
trees.get_root.argtypes = (c_int, )
trees.get... | [
{
"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 | trees.py | dmancevo/trees |
""" Copied from """
import torch
class L2Normalization(torch.nn.Module):
def __init__(self, alpha=1.0):
super(L2Normalization, self).__init__()
self.alpha = alpha
def forward(self, v):
# v_ = v / norm * alpha
# norm = sqrt(norm_sq)
# norm_sq = sum(v ** 2)
v_s... | [
{
"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 | torch_collections/modules/_l2_normalization.py | mingruimingrui/torch-collections |
class ActionFactory:
__actions = None
__instance = None
def __new__(cls):
if ActionFactory.__instance is None:
ActionFactory.__instance = object.__new__(cls)
ActionFactory.__actions = {}
return ActionFactory.__instance
def create(self, name):
return Act... | [
{
"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 | source/actions/__init__.py | adailsonfilho/aktion |
# Copyright 2006 Vladimir Prus
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
# Declare a couple of functions called from Boost.Build
#
# Each function will receive as many arguments as there ":"-separated
# argument... | [
{
"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 | libraries/boost-build/src/example/python_modules/python_helpers.py | austinkeller/pwiz |
# -*- coding: utf-8 -*-
"""Public forms."""
from flask_wtf import Form
from wtforms import PasswordField, StringField
from wtforms.validators import DataRequired
from MorseFlask.user.models import User
class LoginForm(Form):
"""Login form."""
username = StringField('Username', validators=[DataRequired()])
... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{
... | 3 | MorseFlask/public/forms.py | gurkslask/MorseFlask |
import click
from app import app, db
from app.backend.models.user import User
from app.backend.models.cms import CMS
from app.backend import user_manager
from sqlalchemy.exc import SQLAlchemyError
from redis.exceptions import RedisError
@app.cli.command()
def seed():
"""
Add initial users to the db.
"""
... | [
{
"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/backend/commands/commands.py | alexraileanu/yacms |
from mitsbot_globals import discord, MITS_COLOR
async def sendTextEmbed(message, title, description):
textEmbed = discord.Embed(
title = title,
colour = discord.Colour(MITS_COLOR),
description = description
)
await message.channel.send(embed=textEmbed)
async def sendImageEmbed(me... | [
{
"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 | discordHelpers.py | mhwdvs/MITSBot |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.11.1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
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": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
... | 3 | kubernetes/test/test_v1_flex_volume_source.py | reymont/python |
from msdsl.expr.expr import ModelExpr
from msdsl.expr.signals import Signal, DigitalSignal, AnalogSignal
from msdsl.expr.format import RealFormat
from msdsl.expr.table import Table
class Assignment:
def __init__(self, signal: Signal, expr: ModelExpr, check_format=True):
self.signal = signal
... | [
{
"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_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": ... | 3 | msdsl/assignment.py | sgherbst/msdsl |
from fake_useragent import UserAgent
class Fetcher:
TYPE_GET = 'get'
TYPE_POST = 'post'
DEFAULT_TIMEOUT = 5.0
def __init__(self, logger):
self._logger = logger
self._agent = UserAgent()
self._headers = {
'dnt': '1', # Do Not Track
'user-agent': self._... | [
{
"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 | parser/source/base/fetcher.py | 1pkg/ReRe |
"""
Mutation for register a entrie
"""
import graphene
from django.contrib.auth import get_user_model
from condos.models import Apartment, Block
from condos.types import ApartmentType, BlockType
from graphql_jwt.decorators import superuser_required, login_required
from accounts.models import Resident, Entry
from accou... | [
{
"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": true
},
{
... | 3 | app/accounts/mutations/entries.py | Alohomora-team/AlohomoraAPI |
from unittest import mock
from django.core.exceptions import ValidationError
import pytest
from model_mommy import mommy
import stripe
from rest_framework.reverse import reverse
from restframework_stripe.test import get_mock_resource
from restframework_stripe import models
@mock.patch("stripe.Refund.create")
@pyt... | [
{
"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 | tests/test_refund.py | jayvdb/django-restframework-stripe |
import sqlite3
from app import app
from flask import g
DATABASE = 'db/trackpants.db'
def get_db():
db = getattr(g, '_database', None)
if db is None:
db = g._database = sqlite3.connect(DATABASE)
return db
@app.teardown_appcontext
def close_db(exception):
db = getattr(g, '_database', None)... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
... | 3 | db_helpers.py | crisb0/final3011 |
from pygments.lexers import Python3Lexer
from pygments.token import Comment, Keyword, Name, Number, Operator, Punctuation, String
def is_comment(token):
return token in Comment
def is_decorator(token):
return token in Name.Decorator
def is_function(token):
return token in Name.Function
def is_builti... | [
{
"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 | docs/tokenizer.py | concreted/prefect |
from nboost.plugins.models import resolve_model
from nboost import defaults
import unittest
import numpy as np
class TestPtBertRerankModelPlugin(unittest.TestCase):
def setUp(self):
self.model = resolve_model(
model_dir='onnx-bert-base-msmarco',
data_dir=defaults.data_dir,
... | [
{
"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 | tests/unit/test_onnx_bert_rerank.py | dravog7/nboost |
from django.test import TestCase
from django.urls import reverse
class AdminViewTests(TestCase):
def test_admin_restricted(self):
with self.settings(RESTRICT_ADMIN=True):
response = self.client.get(
reverse('admin:login'),
**{'HTTP_X_FORWARDED_FOR': '74.125.224... | [
{
"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 | contact/tests/test_admin.py | uktrade/help |
import os
import sys
from mock import patch
import shutil
sys.path.insert(0, '..')
import copy_ambertools as cam
this_path = os.path.join(os.path.dirname(__file__))
@patch('copy_ambertools._copy_folder')
@patch('os.getenv')
def test_copy_ambertools(mock_getenv, mock_copy):
fake_amberhome = os.path.join(this_path... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding... | 3 | conda_tools/test/test_copy_ambertools.py | Amber-MD/ambertools-binary-build |
import sys
from subprocess import Popen
import cx_Oracle
root_directory = sys.argv[1]
def main(directory):
public_projects = get_public_project_accessions()
for project_accession in public_projects:
Popen(['./runAnnotator.sh', directory, str(project_accession)])
# get all the project references fr... | [
{
"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 | scripts/batchAnnotator.py | PRIDE-Cluster/cluster-result-importer |
import datetime
import typing as tp
from pydantic import Field
from modules.routers.tcd.models import ProtocolStatus
from modules.routers.passports.models import UnitStatus
from ..types import Filter
async def parse_passports_filter(
status: tp.Optional[UnitStatus] = None,
name: tp.Optional[str] = None,
... | [
{
"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 | modules/dependencies/filters.py | Multi-Agent-io/feecc-analytics-backend |
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from telemetry.page import page as page_module
from telemetry.page import page_set as page_set_module
class ImageDecodingMeasurementPage(page_module.Page):
... | [
{
"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 | tools/perf/page_sets/image_decoding_measurement.py | Fusion-Rom/android_external_chromium_org |
import unittest
from creds3 import paddedInt
class TestPadLeft(unittest.TestCase):
def test_zero(self):
i = 0
self.assertEqual(paddedInt(i), "0" * 19)
def test_ten(self):
i = 10
self.assertEqual(paddedInt(i), str(i).zfill(19))
def test_arbitrary_number(self):
i = ... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},... | 3 | tests/pad_left_tests.py | wondermore/creds3 |
import pandas as pd
import pytest
from async_blp.instruments_requests import InstrumentRequestBase
@pytest.mark.asyncio
class TestInstrumentRequestBase:
def test__weight(self):
request = InstrumentRequestBase('query', max_results=5)
request.response_fields = ['field_1', 'field_2']
asser... | [
{
"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 | tests/test_instruments_request.py | rockscie/async_blp |
# -*- coding: utf-8 -*-
import codecs
import re
from os import path
from distutils.core import setup
from setuptools import find_packages
def read(*parts):
return codecs.open(path.join(path.dirname(__file__), *parts),
encoding='utf-8').read()
def find_version(*file_paths):
version_fil... | [
{
"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 | setup.py | greyside/django-floppyforms |
from django.shortcuts import render, redirect
from django.contrib.auth.forms import UserCreationForm
from django.contrib import messages
from .forms import UserRegisterForm, UserUpdateForm, ProfileUpdateForm
from django.contrib.auth.decorators import login_required
def register(request):
if request.method == 'POST... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": fal... | 3 | users/views.py | IshantThulla/Know-my-view |
#Дано натуральное число N. Выведите слово YES, если число N является точной степенью двойки, или слово NO в противном случае.
#Операцией возведения в степень пользоваться нельзя!
# Оформите в виде обычной и хвостовой рекурсии
# Вариант с хвостовой рекурсией преобразуйте в цикл while
def is_power_of_two(N):
r... | [
{
"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 | recursion/tail/power_of_two.py | MelkiyHondavod/computations |
import json
from error import ResolutionException
class Fetcher:
def get(self, url, data):
# Override in subclass
raise NotImplementedException()
def __get__(self, url, method, catch):
try:
json_results = method(url)
except catch:
raise ResolutionException('Could not connect to URL ' + url)
... | [
{
"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 | longingly/fetcher.py | sgibbons/longingly |
from PIL import Image
import json
import random
f = open('input.json')
data = json.load(f)
f.close()
images = []
count = 10000
def expand_props():
data['new_props'] = {}
for i in data['props']:
props = data['props'][i]
new_props = []
for p in props:
rarity = p['rarity']
... | [
{
"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": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answe... | 3 | generate_items.py | gigaverselabs/nft_generator |
import os
class PathBuilder():
"""Util class for intuitivly join and walk through paths using operators overload"""
def __init__(self, initial_path: str):
"""C'tor PathBuilder"""
self.initial_path = initial_path
self.current_path = self.initial_path
def __add__(self, other: 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": true
},... | 3 | Anylink-server/utils.py | orike122/anylink |
class LicenseProviderAttribute(Attribute,_Attribute):
"""
Specifies the System.ComponentModel.LicenseProvider to use with a class. This class cannot be inherited.
LicenseProviderAttribute()
LicenseProviderAttribute(typeName: str)
LicenseProviderAttribute(type: Type)
"""
def Equals(self,value):
... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"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 | release/stubs.min/System/ComponentModel/__init___parts/LicenseProviderAttribute.py | htlcnn/ironpython-stubs |
from django.views.generic import CreateView, TemplateView
from django_monitor.views import MonitorMixin
class BaseAddFriendlyOwnerView(MonitorMixin, CreateView):
def get_template_names(self):
return ['livinglots/friendlyowners/add_friendlyowner.html',]
class BaseAddFriendlyOwnerSuccessView(TemplateVie... | [
{
"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 | livinglots_friendlyowners/views.py | 596acres/django-livinglots-friendlyowners |
# -*- coding: utf-8 -*-
"""
Created on Tue Aug 20 17:19:02 2019
@author: LKK
"""
#will build 3 different databases
#each database has 10,0000 tuples
#A tuple has d attributes of type double and one bulk attribute with garbage characters to ensure that each tuple is 100 bytes long.
#The valus of the d doubles of a tup... | [
{
"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 | database_builder.py | Goodkorning/Skyline_operator |
from tests.src import BasePage
from tests.src.elements.select import SelectList
from tests.src.validator_error import ValidatorPhoneMixin
class FinderOpponentTab(BasePage):
def __init__(self, phone: str, district: str, category: str, datetime_: str,):
super().__init__()
self.phone = phone
... | [
{
"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 | tests/src/components/finder_opponent_tab.py | Alpaca00/alpaca_web |
from __future__ import print_function
import sys
sys.path.insert(1,"../../../")
from tests import pyunit_utils
import h2o
from h2o.estimators.glm import H2OGeneralizedLinearEstimator
try:
from io import StringIO # py3
except ImportError:
from StringIO import StringIO # py2
def h2ono_progress():
"""
... | [
{
"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 | h2o-py/tests/testdir_apis/H2O_Module/pyunit_h2ono_progress.py | vishalbelsare/h2o-3 |
from markovp import Markov
from src.forms import Markov_Form
from flask import Flask, render_template, request, redirect, url_for, Blueprint, make_response
home = Blueprint("home", __name__)
@home.route("/")
def index():
#{
form = Markov_Form()
return render_template('form.html', form = form)
#}
# The submis... | [
{
"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 | web/src/views/home.py | TexAgg/MarkovTextGenerator |
"""
Build a dictionary from a key/map regex group expression
"""
from openpipe.pipeline.engine import ActionRuntime
from re import compile, MULTILINE
class Action(ActionRuntime):
category = "Data Transformation"
required_config = """
regex: # A regex expression that must match two groups:
... | [
{
"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 | openpipe/actions/transform/using/regex/assign_.py | OpenPipe/openpipe |
from flask.ext.testing import TestCase
from contracts_api.settings import TestConfig
from contracts_api.app import create_app as _create_app
from contracts_api.database import db
from contracts_api.api.models import Stage, Contract, StageProperty, ContractAudit, Flow
class BaseTestCase(TestCase):
'''
A base t... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",... | 3 | contracts_api_test/unit/test_base.py | codeforamerica/contracts-api |
from __future__ import absolute_import, unicode_literals
from tox import reporter as report
def show_envs(config, all_envs=False, description=False):
env_conf = config.envconfigs # this contains all environments
default = config.envlist # this only the defaults
ignore = {config.isolated_build_env, conf... | [
{
"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 | src/tox/session/commands/show_env.py | wvangeit/tox |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.