source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
# Copyright (C) 2019-2021 HERE Europe B.V.
# SPDX-License-Identifier: Apache-2.0
"""This module defines all the configs which will be required as inputs to autosuggest API."""
from .base_config import Bunch
class SearchCircle:
"""A class to define ``SearchCircle``
Results will be returned if they are locat... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
... | 3 | here_location_services/config/autosuggest_config.py | jain-aayush1123/here-location-services-python |
from django.db import models
# Create your models here.
class commands(models.Model):
title = models.CharField('命令标题', max_length=300)
command = models.CharField('命令', max_length=2000)
describe = models.CharField('命令描述', max_length=300)
created_time = models.DateTimeField('创建时间', auto_now_add=True)
... | [
{
"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 | servermanager/models.py | owen-kuai/DjangoBlog |
import logging
import sys
from notion.block import PageBlock
from notion.client import NotionClient
from requests import HTTPError, codes
from enex2notion.utils_exceptions import BadTokenException
logger = logging.getLogger(__name__)
def get_root(token, name):
if not token:
logger.warning(
... | [
{
"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 | enex2notion/cli_notion.py | vzhd1701/enex2notion |
import discord
from key_loader import GENERAL_ACCESS_TOKEN as TKN
client = discord.Client()
@client.event
async def on_ready():
print('Logged in as')
print(client.user.name)
print(client.user.id)
print('------')
@client.event
async def on_message(message):
global on_watch_users
# Prevents re... | [
{
"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 | projects/example/bot_discord.py | parampaa2/bot-quick-guide-id |
import discord
from discord.ext import commands
from core.classes import Cog_Extension
import asyncio, time, datetime, pytz, random
import json
with open("config.json", mode="r", encoding="utf8") as jfile:
conf = json.load(jfile)
class Game(Cog_Extension):
@commands.command()
async def nitro(self, ct... | [
{
"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 | cmds/fun.py | Hugo-Dragon/Junior-Dragon |
import tensorflow as tf
def sample_random_seq(model_input, num_frames, num_samples):
batch_size = tf.shape(model_input)[0]
frame_index_offset = tf.tile(tf.expand_dims(tf.range(num_samples), 0),
[batch_size, 1])
max_start_frame_index = tf.maximum(num_frames - num_samples, 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 | model_utils.py | banr1jnts/kaggle-youtube2nd |
from cjrh_template import Template
def test_basic():
s = '$person1 gave $thing to $person2'
tmpl = Template(s)
assert set(tmpl.placeholders()) == {'person1', 'thing', 'person2'}
def test_basic_braces():
s = '${person1} gave ${thing} to ${person2}'
tmpl = Template(s)
assert set(tmpl.placehold... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer"... | 3 | tests/test_template.py | cjrh/cjrh_template |
from typing import Iterable
from tokenizers import decoders, Tokenizer
from tokenizers.models import WordPiece
from tokenizers.normalizers import Lowercase, NFD, Normalizer, Sequence, StripAccents
from tokenizers.pre_tokenizers import Whitespace
from tokenizers.trainers import WordPieceTrainer
PAD_TOKEN = "[PAD]"
UNK... | [
{
"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 | perceiver/tokenizer.py | usryokousha/perceiver-io |
import numpy as np
import pytest
from jina.executors.evaluators.rank.recall import RecallEvaluator
@pytest.mark.parametrize(
'eval_at, expected',
[
(0, 0.0),
(1, 0.2),
(2, 0.4),
(3, 0.4),
(5, 0.4),
(100, 0.4)
]
)
def test_recall_evaluator(eval_at, expected)... | [
{
"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 | tests/unit/executors/evaluators/rank/test_recall.py | serge-m/jina |
from typing import Dict, List, Optional, Union
from psqlextra.types import PostgresPartitioningMethod, SQLWithParams
class PostgresPartitionedModelOptions:
"""Container for :see:PostgresPartitionedModel options.
This is where attributes copied from the model's `PartitioningMeta`
are held.
"""
d... | [
{
"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 | psqlextra/models/options.py | adamchainz/django-postgres-extra |
# -*- coding: utf-8 -*-
from ._common import *
class Ku6(SimpleExtractor):
name = '酷6 (Ku6)'
def init(self):
self.url_pattern = 'flvURL: "([^"]+)'
self.title_pattern = 'title = "([^"]+)'
pass
def list_only(self):
return match(self.url, 'https://www.ku6.com/detail/\d+')
... | [
{
"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 | ykdl/extractors/ku6.py | love2wind/ykdl |
import math
class emadiff:
def twe_hund_ema_diff(twema, hundema):
return abs(twema - hundema)
def wrapper_Least_ema_diff(stocks, twemas, hundemas):
Stocks_short_list = []
threshold = 0.25
stock_list_size = len(stocks)
if stock_list_size == len(twemas) and stock_list_siz... | [
{
"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 | emadiff.py | prashlkam/money-spinner |
from Crypto.Cipher import Blowfish
def encode_dataset_user(trans, dataset, user):
# encode dataset id as usual
# encode user id using the dataset create time as the key
dataset_hash = trans.security.encode_id(dataset.id)
if user is None:
user_hash = 'None'
else:
user_hash = str(use... | [
{
"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 | lib/galaxy/datatypes/display_applications/util.py | emily101-gif/immport-galaxy |
"""Describe logbook events."""
from homeassistant.const import ATTR_ENTITY_ID, ATTR_NAME
from homeassistant.core import callback
from . import DOMAIN, EVENT_SCRIPT_STARTED
@callback
def async_describe_events(hass, async_describe_event):
"""Describe logbook events."""
@callback
def async_describe_logbook... | [
{
"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 | homeassistant/components/script/logbook.py | tbarbette/core |
'''
Created by auto_sdk on 2015.02.10
'''
from aliyun.api.base import RestApi
class Ecs20140526DescribeEipMonitorDataRequest(RestApi):
def __init__(self,domain='ecs.aliyuncs.com',port=80):
RestApi.__init__(self,domain, port)
self.AllocationId = None
self.EndTime = None
self.Period = None
self.Start... | [
{
"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 | aliyun/api/rest/Ecs20140526DescribeEipMonitorDataRequest.py | snowyxx/aliyun-python-demo |
import shutil
import os
def saveTempFile(file):
""" save the file to the temp images folder """
with open(file.filename, "wb") as f:
shutil.copyfileobj(file.file, f)
shutil.move(file.filename, 'temp/images/'+file.filename)
# return the filename for identification purposes
return file.... | [
{
"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/helpers/File.py | Abdusalam-mah/omr-fastapi |
import abc
from bin.contentctl_project.contentctl_core.domain.entities.enums.enums import SecurityContentProduct
from bin.contentctl_project.contentctl_core.domain.entities.security_content_object import SecurityContentObject
from bin.contentctl_project.contentctl_core.domain.entities.enums.enums import SecurityConten... | [
{
"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 | bin/contentctl_project/contentctl_core/application/builder/detection_builder.py | stevengoossensB/security_content |
from django.shortcuts import render
from accounts import models
from rest_framework import viewsets
from rest_framework.authentication import TokenAuthentication
from rest_framework.permissions import IsAuthenticated
from rest_framework.authtoken.views import ObtainAuthToken
from rest_framework.settings import api_set... | [
{
"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 | backend/accounts/views.py | eliefrancois/project2-diabetesapplication-api |
# GENERATED BY KOMAND SDK - DO NOT EDIT
import komand
import json
class Input:
_REF = "_ref"
class Output:
_REF = "_ref"
class DeleteHostInput(komand.Input):
schema = json.loads("""
{
"type": "object",
"title": "Variables",
"properties": {
"_ref": {
"type": "string",
"... | [
{
"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 | infoblox/komand_infoblox/actions/delete_host/schema.py | xhennessy-r7/insightconnect-plugins |
from sys import path
path.insert(0, '.')
import theano.tensor as T
import extheano
def test_power():
# Example usage of extheano.scan
@extheano.jit
def power(A, k):
# Again, no updates.
result = extheano.scan(
fn=lambda prior_result, A: prior_result * A,
outputs_in... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"... | 3 | test_scan.py | koheimiya/extheano |
import random
from sanic import Sanic
from sanic.response import json
try:
from ujson import loads
except ImportError:
from json import loads
def test_storage():
app = Sanic('test_text')
@app.middleware('request')
def store(request):
request['user'] = 'sanic'
request['sidekick']... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answ... | 3 | tests/test_request_data.py | SimonCqk/sanic |
import machine
import time
import _thread
GPIO_NUM = 5
def set(num):
pin = machine.Pin(num, machine.Pin.OUT)
pin.value(1)
def reset(num):
pin = machine.Pin(num, machine.Pin.OUT)
pin.value(0)
def rfs_wd():
print("refreshing watchdog")
while (True):
set(GPIO_NUM)
time.sleep(3... | [
{
"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 | MicroPython_BUILD/components/micropython/esp32/modules/refresh_wd.py | linus-gates/mp |
#!/usr/bin/env python3
"""
Sends a PWM via UAVCAN
"""
import argparse
import uavcan
import os
DSDL_DIR = os.path.join(os.path.dirname(__file__), "../uavcan_data_types/cvra")
def parse_args():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument(
"port",
help="SocketCAN i... | [
{
"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 | can-io-firmware/set_servo.py | greck2908/robot-software |
from kivy.lang import Observable
import gettext
from constants import LOCALE_DIR
class Lang(Observable):
observers = []
lang = None
def __init__(self, defaultlang, transalte=None):
super(Lang, self).__init__()
self.ugettext = None
self.lang = defaultlang
self._translate =... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding ... | 3 | src/kv_classes/lang.py | Mulugruntz/deep_3d_photo |
# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import frappe, unittest
from werkzeug.wrappers import Response
from frappe.app import process_response
from frappe.tests import set_request
HEADERS = ('Access-Control-Allow-Origi... | [
{
"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 | frappe/tests/test_cors.py | marwand/frappe |
# Test problem 8520
# To compute modulo multiplicate inverse
# Cannot use division? "sudo make me a sandwitch" Yo.
def binpow(a, b, m):
a = a % m
res = 1
while b > 0:
if b % 2 > 0:
res = (res * a) % m
a = (a * a) % m
b = b // 2
return res
def getProductArray(nums):
... | [
{
"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 | adhoc/array_product.py | MrCsabaToth/IK |
class RenderNodeAction(Enum,IComparable,IFormattable,IConvertible):
"""
Enumerated actions for processing a render node during custom export.
enum RenderNodeAction,values: Proceed (0),Skip (1)
"""
def __eq__(self,*args):
""" x.__eq__(y) <==> x==yx.__eq__(y) <==> x==yx.__eq__(y) <==> x==y """
pass
... | [
{
"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 | stubs.min/Autodesk/Revit/DB/__init___parts/RenderNodeAction.py | ricardyn/ironpython-stubs |
# Time: O(n)
# Space: O(26)
# combinatorics
class Solution(object):
def appealSum(self, s):
"""
:type s: str
:rtype: int
"""
result = curr = 0
lookup = [-1]*26
for i, c in enumerate(s):
result += (i-lookup[ord(c)-ord('a')])*(len(s)-i)
... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true... | 3 | Python/total-appeal-of-a-string.py | Priyansh2/LeetCode-Solutions |
# This file is a part of pyctr.
#
# Copyright (c) 2017-2021 Ian Burgwin
# This file is licensed under The MIT License (MIT).
# You can find the full license text in LICENSE in the root of this project.
import os
from math import ceil
from sys import platform
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer":... | 3 | pyctr/util.py | Desterly/pyctr |
# ---------------------------------------- IMPORT HERE ----------------------------------------
from custom_timer import RepeatedTimer
from flask import Flask, request, make_response
import docker, os, re, requests
# ---------------------------------------- CONFIGS ----------------------------------------
timerapp =... | [
{
"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 | timer/timer.py | hritvikpatel4/eVote |
# coding=utf8
from __future__ import unicode_literals
import codecs
from pyecharts import (Bar, Scatter3D)
from pyecharts import Page
from pyecharts.conf import configure, online
from test.constants import RANGE_COLOR, CLOTHES
def create_three():
# bar
v1 = [5, 20, 36, 10, 75, 90]
v2 = [10, 25, 8, 60, 2... | [
{
"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 | pyecharts-0.3.1/test/test_custom_render.py | RuanJylf/Data_Visualization |
import torch
import torch.nn.functional as F
from scripts.study_case.ID_4.torch_geometric.nn import GATConv
class GAT(torch.nn.Module):
def __init__(self, in_channels, out_channels):
super(GAT, self).__init__()
self.conv1 = GATConv(in_channels, 8, heads=8, dropout=0.6)
self.conv2 = GATConv... | [
{
"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 | scripts/study_case/ID_4/benchmark/runtime/gat.py | kzbnb/numerical_bugs |
import os
from flask import Flask, jsonify
from flask_pymongo import PyMongo
from werkzeug.exceptions import InternalServerError
from backends.mongo import find_records, MongoJSONEncoder, ObjectIdConverter, get_record_by_id
app = Flask(__name__)
app.config['MONGO_URI'] = os.environ.get('MONGO_URI')
app.json_encoder ... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"ans... | 3 | app.py | dontlaugh/flask-on-k8s |
# The MIT License (MIT)
#
# Copyright (c) 2018 Mateusz Pusz
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modi... | [
{
"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 | test_package/conanfile.py | Twon/units |
from __future__ import print_function
import sys
def errprinter(*args):
logger(*args)
def logger(*args):
print(*args, file=sys.stderr)
sys.stderr.flush()
| [
{
"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 | old/dronekit-python/dronekit/util.py | sirmammingtonham/droneee |
'''
This file is part of PM4Py (More Info: https://pm4py.fit.fraunhofer.de).
PM4Py is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any late... | [
{
"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 | ws2122-lspm/Lib/site-packages/pm4py/objects/petri_net/data_petri_nets/data_marking.py | Malekhy/ws2122-lspm |
def valid(fn):
return lambda sides: all(sides) and 2 * max(sides) < sum(sides) and fn(
sides)
@valid
def equilateral(sides):
return sides[0] != 0 and len(set(sides)) == 1
@valid
def isosceles(sides):
return len(set(sides)) < 3
@valid
def scalene(sides):
return len(set(sides)) == 3
| [
{
"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 | triangle/triangle.py | pmareke/exercism-python |
import unittest
from odml import Property, Section, Document
from odml.doc import BaseDocument
from odml.section import BaseSection
class TestSection(unittest.TestCase):
def setUp(self):
pass
def test_value(self):
pass
def test_name(self):
pass
def test_parent(self):
... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},... | 3 | test/test_section.py | lzehl/python-odml |
import dataclasses
from typing import Optional
from .base_entity import BaseEntity
@dataclasses.dataclass
class CallbackEntity(BaseEntity):
uuid: Optional[str] # or request_code
callback_url: Optional[str]
state: Optional[str]
def __init__(self, data: dict):
self.uuid = data.get('uuid')
... | [
{
"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 | smaregipy/entities/callback.py | shabaraba/SmaregiPy |
import os
import pathlib
import tensorflow as tf
import tensorflow_federated as tff
AUTOTUNE = tf.data.experimental.AUTOTUNE
def make_client_ids(clients_dir: pathlib.Path):
return [p.name for p in clients_dir.iterdir() if p.is_dir()]
def provide_client_data_fn(
clients_dir: pathlib.Path,
img_height: int... | [
{
"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 | tflib/data_helpers.py | makaveli10/4P |
from os.path import isfile
from sqlite3 import connect
from apscheduler.triggers.cron import CronTrigger
DB_PATH = "./data/db/database.db"
BUILD_PATH = "./data/db/build.sql"
cxn = connect(DB_PATH, check_same_thread=False)
cur = cxn.cursor()
def with_commit(func):
def inner(*args, **kwargs):
func(*args, **kwargs... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside... | 3 | lib/db/db.py | namanyt/discord-lassan-bot |
import numpy as np
import cv2
from helpers.constants import MODEL_PATH, DIGITS_PATH, DIGIT_RECOGNIZER_MODEL_NAME
from helpers.helpers import preprocess_image, check_if_white
from keras.models import load_model
class DigitRecognition:
def __init__(self):
'''
Init function
'''
sel... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer":... | 3 | recognition/recognition.py | sherwyn11/Sudoku-AI |
from subprocess import Popen, PIPE
from plyer.facades import UniqueID
from plyer.utils import whereis_exe
from os import environ
class LinuxUniqueID(UniqueID):
def _get_uid(self):
old_lang = environ.get('LANG')
environ['LANG'] = 'C'
lshw_process = Popen(["lshw", "-quiet"], stdout=PIPE, st... | [
{
"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 | plyer/platforms/linux/uniqueid.py | malverick/noti_improve |
from lib import BaseTest
class DropRepo1Test(BaseTest):
"""
drop repo: regular drop
"""
fixtureCmds = [
"aptly repo create repo1",
]
runCmd = "aptly repo drop repo1"
def check(self):
self.check_output()
self.check_cmd_output("aptly repo show repo1", "repo-show", ex... | [
{
"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 | system/t09_repo/drop.py | Yelp/aptly |
# coding=utf-8
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
from twitter.common.... | [
{
"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 | tests/python/pants_test/goal/test_union_products.py | WamBamBoozle/pants |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
File: test_send_message.py
Author: huxuan
Email: i(at)huxuan.org
Description: Unittest for sending message.
"""
import unittest
from wxpusher import WxPusher
from . import config
class TestSendMessage(unittest.TestCase):
"""Unittest for sending message."""
... | [
{
"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/wxpusher/tests/test_send_message.py | huxuan/wxpusher-client |
"""
Generates a robot tree with the help of Revolve.Generate. This is a bit
backwards, but it allows for more configurability. A generator is defined
with a body generator and a neural net generator. First, a body is
generated. The interface of this body is then fed to the neural net
generator resulting in a neural net... | [
{
"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 | pyrevolve/angle/generate.py | braj29/robo_swimmers |
# Copyright 2019 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from dataclasses import dataclass
from pathlib import Path
from pants.base.build_root import BuildRoot
from pants.engine.rules import collect_rules, rule
from pants.option.global_options ... | [
{
"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": "all_function_names_snake_case",
"question": "Are all function names in this file written i... | 3 | src/python/pants/core/util_rules/distdir.py | rcuza/pants |
"""Things involving data, variables, and typesin x-python."""
try:
import vmtest
except ImportError:
from . import vmtest
from xdis.version_info import PYTHON_VERSION_TRIPLE
class TestData(vmtest.VmTestCase):
def test_constant(self):
self.do_one()
def test_attributes(self):
self.sel... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer"... | 3 | test/test_data.py | rocky/xpython |
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answ... | 3 | tensorflow/python/framework/kernels.py | abhaikollara/tensorflow |
from chef.api import ChefAPI
from chef.base import ChefObject
class Client(ChefObject):
"""A Chef client object."""
url = '/clients'
def _populate(self, data):
self.platform = self.api and self.api.platform
self.private_key = None
if self.platform:
self.orgname = data.... | [
{
"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 | janitor/package/chef/client.py | nilesh-naik/lambda-functions |
from HDPython.ast.ast_classes.ast_base import v_ast_base, add_class
import HDPython.hdl_converter as hdl
from HDPython.ast.ast_hdl_error import HDPython_error
from HDPython.base import HDPython_base
class v_re_assigne_rhsift(v_ast_base):
def __init__(self,lhs, rhs,context=None, astParser=None):
self.lhs ... | [
{
"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 | HDPython/ast/ast_classes/ast_op_stream_out.py | HardwareDesignWithPython/HDPython |
import IoTSensor
import LORAGateway
class GatewayPlacement:
def __init__(self, sensor_list):
self._sensor_list = sensor_list
self._gateway_list = []
def add_gateway(self, gateway):
self._gateway_list.append(gateway)
def remove_gateway(self, gateway):
self._gateway_list.re... | [
{
"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 | GatewayPlacement.py | vindem/eeplacement |
def main(j, args, params, tags, tasklet):
page = args.page
attributes = "class='nav nav-list' style='-moz-column-count: 3; -webkit-column-count:3; column-count:3;'"
refresh = j.tools.text.getBool(args.tags.tagGet('refresh', False))
page.addHTML("""
<a class="right margin-right-medium" href="/... | [
{
"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 | apps/gridportal/base/AYS/.macros/page/templateslist/3_templateslist.py | jumpscale7/jumpscale_portal |
# -*- coding: UTF-8 -*-
import os, sqlite3
from PySide2.QtWidgets import QComboBox
from moduels.component.NormalValue import 常量
# 添加预设对话框
class Combo_EngineList(QComboBox):
def __init__(self):
super().__init__()
self.initElements() # 先初始化各个控件
self.initSlots() # 再将各个控件连接到信号槽
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 | src/moduels/gui/Combo_EngineList.py | HaujetZhao/Caps_Writer |
from tests.util import BaseTest
class Test_TYCO110(BaseTest):
@classmethod
def flags(cls):
return ["--tyco_generic_alt"]
def test_pass_1(self):
code = """
import typing
def foo(x: typing.MutableMapping):
...
"""
result = self.run_flake8(code)
... | [
{
"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 | tests/test_tyco110.py | atollk/flake8-typing-collections |
class PiggyBank:
# create __init__ and add_money methods
def __init__(self, dollars, cents):
self.dollars = dollars
self.cents = cents
def add_money(self, deposit_dollars, deposit_cents):
self.dollars += deposit_dollars
self.cents += deposit_cents
if self.cents >= 10... | [
{
"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 | jetbrains-academy/Numeric Matrix Processor/Problems/Piggy bank/task.py | robinpatra/ML-Study-3 |
# -*- coding: utf-8 -*-
"""
Minimum Dominating Set
=======================
"""
# Copyright (C) 2017 by
# Alex Gates <ajgates42@gmail.com>
# Rion Brattig Correia <rionbr@gmail.com>
# All rights reserved.
# MIT license.
import networkx as nx
import itertools
import copy
#
# Minimum Dominating Set
#
def mds(d... | [
{
"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": tru... | 3 | cana/control/mds.py | xuan-w/CANA |
import abc
import enum
from dataclasses import dataclass
from typing import Optional, Sequence
from .common import Location, Address, GeoPoint
class Confidence(enum.Enum):
LOW = 0
PARTIAL = 1
EXACT = 2
class Precision(enum.Enum):
APPROXIMATE = 0
GEOMETRIC_CENTER = 1
RANGE_INTERPOLATED = 2
... | [
{
"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 | geode/models/geocoding.py | daimeng/py-geode |
import itertools
def flattened_ranges(range_lengths):
return list(itertools.chain.from_iterable(range(n) for n in range_lengths))
def take(n, gen):
"""Take the first n items from the generator gen. Return a list of that many items
and the resulting state of the generator."""
lst = list(itertools.isl... | [
{
"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 | tools/numpy_numerology.py | HEPonHPC/pandana3-prototype |
import contextlib
import sys
# Python 2 support.
if sys.version_info < (3,):
from StringIO import StringIO
else:
from io import StringIO
@contextlib.contextmanager
def capture_stdout(target=None):
original = sys.stdout
if target is None:
target = StringIO()
sys.stdout = target
yield t... | [
{
"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 | sortedm2m_tests/utils.py | ninemoreminutes/django-sortedm2m |
import strawberry
from typing import Callable, List, Optional, Dict
import dataclasses
from . import utils, queries
@dataclasses.dataclass
class DjangoField:
resolver: Callable
field_name: Optional[str]
kwargs: dict
def resolve(self, is_relation, is_m2m):
resolver = queries.resolvers.get_resol... | [
{
"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 | strawberry_django/legacy/fields.py | NeoLight1010/strawberry-graphql-django |
from typing import List, Set
from io_utils import read_input_file
def day6_1():
input_list = read_input_file("day6.txt", input_type=str)
answers = get_all_yes_answers_per_group(input_list)
amount_yes_answers = 0
for answers_per_group in answers:
amount_yes_answers += len(answers_per_group)
... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer":... | 3 | 2020/src/day6.py | vionion/advent-of-code-2019 |
import re
from irc.client import Event
from lib.cog import Cog, event
from lib.command import Command, command
from lib.objects import Events
from lib.web import Web, get
class Youtube(Cog):
@event(Events.PubMsg)
def youtube(self, event: Event):
# TODO store videoid's in db
if re.search("you... | [
{
"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/youtube.py | 0xfdb/vicky |
from utils import create_newfig, create_moving_line, create_still_segment, run_or_export
func_code = 'ah'
func_name = 'test_line_line_intr_later'
def setup_fig01():
fig, ax, renderer = create_newfig('{}01'.format(func_code))
create_moving_line(fig, ax, renderer, (5, 4), (6, 3), (-2, -2), 'topright')
crea... | [
{
"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 | imgs/test_geometry/test_extrapolated_intersection/ah_test_line_line_intr_later.py | devilcry11/pygorithm |
import sys
from importlib import import_module
from .compiler import config_compiler as config_compiler
from .compiler import actions as actions
def get_object_from_standard_name(std_name: str):
pckg_parts = std_name.split(".")
pckg_name, cls_name = ".".join(pckg_parts[:-1]), pckg_parts[-1]
try:
p... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
... | 3 | src/utils/factory.py | dominikstipic/DeepSat |
"""View Helper Module."""
from jinja2 import Markup
def set_request_method(method_type):
"""Return an input string for use in a view to change the request method of a form.
Arguments:
method_type {string} -- Can be options like GET, POST, PUT, PATCH, DELETE
Returns:
string -- An input s... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true... | 3 | masonite/helpers/view_helpers.py | nilsreichert/core |
"""
Polimorfismo e o principio onde permite que classes derivadas
de uma mesma superclasse tenha metodos iguais (com a mesma
assinatura) mas comportamentos diferentes
Mesma assinatura - Mesma quantidade e tipo de parametros
"""
from abc import ABC, abstractmethod
class A(ABC):
@abstractmethod
def fala(self, m... | [
{
"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 | 3 - python POO/106 - Polimorfismo/polimorfismo.py | AdrianaViabL/Curso-Python-udemy |
from build_migrator.helpers import get_minified_target
from build_migrator.modules import Generator
class CMakeModuleCopy(Generator):
priority = 1
@staticmethod
def add_arguments(arg_parser):
pass
def __init__(self, context):
self.context = context
# recursively search for origi... | [
{
"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 | build_migrator/generators/_cmake/cmake_module_copy.py | alexsharoff/BuildMigrator |
'''
Created on Nov 16, 2021
@author: mballance
'''
from mkdv.tools.hdl.hdl_tool_config import HdlToolConfig
import os
class HdlTool(object):
def config(self, cfg : HdlToolConfig):
raise NotImplementedError("config not implemented for %s" % str(type(self)))
def setup(self, cfg : HdlToolConfig... | [
{
"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 | src/mkdv/tools/hdl/hdl_tool.py | fvutils/sim-mk |
import numpy as np
import pandas as pd
import os
import joblib
def preparedata(df):
x=df.drop("y",axis=1)
y=df["y"]
return x,y
def save_model(model,filename):
model_dir="model"
os.makedirs(model_dir,exist_ok=True)
filepath=os.path.join(model_dir,filename)
joblib.dump(model,filepath) | [
{
"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 | utils/all_utils.py | codersatyam/Perceptron |
# Copyright (c) 2022 CRS4
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, su... | [
{
"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/conftest.py | crs4/pywhub |
from django.core.exceptions import ValidationError
'''
# (Developers) Tests where environment/lang matters (if Django => tests in python)
1. Unit tests -> concrete isolated piece of code
2. Integration tests -> integration of coupled pieces of code
# Tests where environment/lang does NOT matter
3. (QAs) API tests ->... | [
{
"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 | testing_demos/testing_demos/__init__.py | Minkov/python-web-framework-demos- |
from torch import nn
import torch.nn.functional as F
from torch import distributions as pyd
class TanhTransform(pyd.transforms.Transform):
domain = pyd.constraints.real
codomain = pyd.constraints.interval(-1.0, 1.0)
bijective = True
sign = +1
def __init__(self, cache_size=1):
super().__in... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
... | 3 | distributions/squashed_normal.py | willwhitney/sac_dists |
#!/usr/bin/env python
"""Tests for `SEIR` package."""
import os
import pytest
from click.testing import CliRunner
from SEIR import cli
@pytest.fixture
def response():
"""Sample pytest fixture.
See more at: http://doc.pytest.org/en/latest/fixture.html
"""
import requests
return requests.get('h... | [
{
"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 | tests/test_SEIR.py | sellisd/seir |
from django.contrib import messages
from django.test import RequestFactory, TestCase
class DummyStorage(object):
"""
dummy message-store to test the api methods
"""
def __init__(self):
self.store = []
def add(self, level, message, extra_tags=''):
self.store.append(message)
clas... | [
{
"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/messages_tests/test_api.py | bpeschier/django |
import requests
import re
from pathlib import Path
import os
def get_file_name_from_cd(cd):
""" GET FILE NAME FORM CONTENT-DISPOSITION ATTRIBUTE OF RESPONSE HEADER
Arguments:
cd {string} -- content-disposition attribute of a response header, usually: r.headers.get('content-disposition')
"""
if... | [
{
"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 | utils/downloader.py | mutazag/ilab1 |
import os
import torch
from torch import nn
from torch.nn import functional as F
from torchvision import datasets, transforms
from src.models.base import BaseModel
class MNIST(BaseModel):
def _setup(self):
self.conv1 = nn.Conv2d(1, 10, kernel_size=5)
self.conv2 = nn.Conv2d(10, 20, kernel_size=5... | [
{
"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 | src/models/mnist.py | jalexvig/imitating_optimizer |
from zerver.lib.test_classes import WebhookTestCase
class BuildbotHookTests(WebhookTestCase):
STREAM_NAME = "buildbot"
URL_TEMPLATE = "/api/v1/external/buildbot?api_key={api_key}&stream={stream}"
FIXTURE_DIR_NAME = "buildbot"
def test_build_started(self) -> None:
expected_topic = "buildbot-he... | [
{
"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": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
... | 3 | zerver/webhooks/buildbot/tests.py | TylerPham2000/zulip |
#!/usr/bin/python3
"""
Unit Test for api v1 Flask App
"""
import inspect
import pep8
import web_flask
import unittest
from os import stat
web_flask = __import__('web_flask.2-c_route', globals(), locals(), ['*'])
class TestCRouteDocs(unittest.TestCase):
"""Class for testing Hello Route docs"""
all_funcs = ins... | [
{
"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 | tests/test_web_flask/test_c_route.py | RodrigoSierraV/AirBnB_clone_v4 |
import datetime
from taxi.timesheet import Entry
from . import create_timesheet
def test_to_lines_returns_all_lines():
contents = """10.10.2012
foo 09:00-10:00 baz
bar -11:00 foobar"""
t = create_timesheet(contents, True)
lines = t.entries.to_lines()
assert lines == ['10.10.2012', 'foo 09:00-1... | [
{
"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 | tests/timesheet/test_to_lines.py | simonbru/taxi |
# module application.py
#
# Copyright (c) 2015 Rafael Reis
#
"""
application module - Main module that solves the Prize Collecting Travelling Salesman Problem
"""
from pctsp.model.pctsp import *
from pctsp.model import solution
from pctsp.algo.genius import genius
from pctsp.algo import ilocal_search as ils
from pkg_... | [
{
"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": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 lin... | 3 | problems/pctsp/salesman/pctsp/application.py | AYaddaden/attention-learn-to-route |
from rest_framework import authentication, exceptions
from rest_framework.authentication import get_authorization_header
from django.utils.translation import ugettext_lazy as _
from .models import Token
class TokenAuthentication(authentication.BaseAuthentication):
"""
Simple token based authentication.
Cl... | [
{
"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/authtoken/authentication.py | uppsaladatavetare/foobar-api |
import datetime
import traceback
import os
def log(*messages, **kwargs):
ts = datetime.datetime.now(datetime.timezone.utc)
ts = ts.strftime("%Y-%m-%d %H:%M:%S %z")
tg = kwargs.get("tag", "STDOUT ")
if len(tg) > 10:
tg = tg[0:10]
elif len(tg) < 10:
tg += " " * (10 - len(tg))
... | [
{
"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 | asmbot/utils/logger.py | Emzi0767/Discord-ASM-Bot |
class Holder:
def __init__(self, x):
self.x = x
def get(self):
return self.x | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
}... | 3 | python/testData/pyi/type/genericClassDefinitionInOtherFile/other.py | truthiswill/intellij-community |
import matplotlib.pyplot as plt
import numpy as np
from autoins.common import common, io
class RewardShapingTester():
def __init__(self,
env,
exp_dir,
ccl_id,
data_name):
self.env = env
self.exp_dir = exp_dir
self.ccl_id = ccl_id
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 | autoins/rl/tester.py | ka2hyeon/autoins_public |
"""
AWS S3.
"""
from typing import IO, Optional, Tuple
import boto3
import botocore
from cached_path.common import _split_cloud_path
from cached_path.schemes.scheme_client import SchemeClient
from cached_path.tqdm import Tqdm
class S3Client(SchemeClient):
recoverable_errors = SchemeClient.recoverable_errors + ... | [
{
"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 | cached_path/schemes/s3.py | allenai/cached_path |
from abc import ABC, abstractmethod
class Duck(ABC):
@staticmethod
@abstractmethod
def quack():
pass
@staticmethod
@abstractmethod
def walk():
pass
@staticmethod
@abstractmethod
def fly():
pass
class RubberDuck(Duck):
@staticmethod
def quack():... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false... | 3 | SOLID - Lab/Ducks.py | DiyanKalaydzhiev23/OOP---Python |
from maneuvers.kit import *
from maneuvers.strikes.aerial_strike import AerialStrike
class AerialShot(AerialStrike):
def intercept_predicate(self, car: Car, ball: Ball):
return ball.position[2] > 500
def configure(self, intercept: AerialIntercept):
ball = intercept.ball
... | [
{
"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 | RLBotPack/BotimusPrime/maneuvers/strikes/aerial_shot.py | RLMarvin/RLBotPack |
import argparse
import json
import os
import shlex
def parse_json(json_path):
with open(json_path) as f:
data = json.load(f)
return data
def output_bash_commands(json_path):
for k, v in parse_json(json_path).items():
value = shlex.quote(str(v))
export = f"export {k}={value}"
... | [
{
"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 | runtime/load_env.py | yanglinz/backpack |
"""레포지터리 패턴 구현."""
from __future__ import annotations
from typing import List, Optional, Type, TypeVar
from sqlalchemy.orm import Session
from fastmsa.core import AbstractRepository, Entity
from fastmsa.orm import get_sessionmaker
E = TypeVar("E", bound=Entity)
class SqlAlchemyRepository(AbstractRepository[E]):
... | [
{
"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": "all_function_names_snake_case",
"question": "Are all function names in this file written i... | 3 | fastmsa/repo.py | abhan00/fastana |
import re, collections
def get_stats(vocab):
pairs = collections.defaultdict(int)
for word, freq in vocab.items():
symbols = word.split()
for i in range(len(symbols) - 1):
pairs[symbols[i], symbols[i + 1]] += freq
return pairs
def merge_vocab(pair, v_in):
v_out = {}
b... | [
{
"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 | paper-code/bpe.py | DengBoCong/nlp-paper |
from flask_wtf import Form
from wtforms import StringField, BooleanField, TextAreaField, validators
from app.models import User
class LoginForm(Form):
remember_me = BooleanField('remember_me', default=False)
class EditForm(Form):
nickname = StringField('nickname', [validators.DataRequired()])
about_me =... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"ans... | 3 | app/forms.py | juliuskrah/flask-blog |
import os
import pandas as pd # type: ignore
from metaflow import FlowSpec, step
from datasets import Mode, dataset
from datasets.plugins import BatchDataset, BatchOptions
flow_dir = os.path.dirname(os.path.realpath(__file__))
my_dataset_foreach_path = os.path.join(flow_dir, "data/my_dataset_foreach")
class Fore... | [
{
"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 | datasets/tutorials/3_foreach_dataset_flow.py | zillow/datasets |
# -*- coding:utf-8 -*-
"""Test function for vega.run"""
import unittest
def lazy(func):
"""lazy function wrapper
:param func: function name
"""
attr_name = "_lazy_" + func.__name__
def lazy_func(*args, **kwargs):
"""Wrapper of lazy func
:param args: any object
:param kwa... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answ... | 3 | built-in/TensorFlow/Official/cv/image_classification/ResnetVariant_for_TensorFlow/automl/test/core/test_run.py | Huawei-Ascend/modelzoo |
#
# Copyright (C) 2018 Giuliano Pasqualotto (github.com/giulianopa)
# This code is licensed under MIT license (see LICENSE.txt for details)
#
import platform
import datetime
import geocoder
import decimal
import socket
import boto3
import time
import json
from urllib2 import urlopen
def get_location():
""" Get cu... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true... | 3 | get_location.py | giulianopa/geolocator |
import numpy as np
from sklearn.decomposition import PCA
import pandas as pd
import tensorflow as tf
import matplotlib.pyplot as plt
import os
def plot(set_type, color):
df = None
title_name = None
if set_type == 'train':
df = pd.read_csv("./datasets/track1_round1_train_20210222.csv"... | [
{
"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": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 lin... | 3 | final/plot/plot_2D_distribution.py | YihaoChan/2021-Tianchi-GAIIC-Track1-Rank-3 |
import numpy as np
import cv2
import matplotlib.image as mpimg
def perspect_transform(img, src, dst):
# Get transform matrix using cv2.getPerspectivTransform()
M = cv2.getPerspectiveTransform(src, dst)
# Warp image using cv2.warpPerspective()
# keep same size as input image
warped = cv2.warpPersp... | [
{
"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 | src/rover/ex_4/extra_functions.py | juancruzgassoloncan/Udacity-Robo-nanodegree |
# @title Cumulative Sum
from itertools import chain
from typing import List
class CumulativeSum:
"""Cumulative Sum
Notes
-----
Get sum of semi-open interval [left, right)
Time complexity
* Build : :math:`O(N)`
* fold : :math:`O(1)`
Examples
--------
>>> cs = CumulativeSum([3... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class 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": true
... | 3 | byslib/data/cumulative_sum.py | bayashi-cl/byslib-python |
import time
from bibliopixel.animation.circle import Circle
from bibliopixel.colors import COLORS
class ArcClock(Circle):
def __init__(self, layout, **kwds):
super().__init__(layout, **kwds)
self.hands = [
{
'rings': [0, 1],
'color': COLORS.... | [
{
"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 | BiblioPixelAnimations/circle/arc_clock.py | jessicaengel451/BiblioPixelAnimations |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.