source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
# -*- coding: utf-8 -*-
from django.db.models import F
from django.db.models.expressions import BaseExpression
from djmoney.money import Money
from moneyed import Money as OldMoney
MONEY_CLASSES = (Money, OldMoney)
def get_currency_field_name(name):
return '%s_currency' % name
def get_amount(value):
"""
... | [
{
"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 | djmoney/utils.py | mikeiwi/django-money-fork |
from django.shortcuts import render
#from django.db.models.aggregates import Sum
from product.models import Customer, Product, Payment, Rep
from core.views import BaseActivityListView
def last_activity(request):
return render(request, 'reports/last_activity.html',
{'reps': Rep.objects.all()})
... | [
{
"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 | pharmrep/reports/views.py | boyombo/pharmrep |
"""Binary sensor platform for Home Assistant PyJU-Control."""
from homeassistant.components.binary_sensor import BinarySensorEntity
from .const import BINARY_SENSOR
from .const import BINARY_SENSOR_DEVICE_CLASS
from .const import DEFAULT_NAME
from .const import DOMAIN
from .entity import PyJuControlEntity
async def ... | [
{
"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 | custom_components/hass_pyjucontrol/binary_sensor.py | Dreanaught/hass-pyjucontrol |
# File header
# Header row2
import_var = "ABC"
# Also move this as a comment
# for 'comment_this_func.
#
# With extra empty line
def comment_this_func(aaa):
return aaa * 2
## Move this as class comment docstring
## Add this to class
class ABC():
def do_not_comment_this(self):
pass
# Nothing to ... | [
{
"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 | bin/test_file.py | rodrigomelo9/uvm-python |
#TODO- for loop with 16bit that trains a vgg19bn to recognize writers
from torch import optim
from torch.cuda.amp import GradScaler, autocast
from models.StyleEncoder_model import StyleEncoder
def freeze_conv(model):
for param in model.features:
param.requires_grad = False
def train_vgg_extractor():
... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 lines?",
"answer": true
... | 3 | util/train_extractor.py | yehonatanHarmatz/HandwritingGAN |
import constants
from model.LehnertGridworldModelHMM import LehnertGridworldModelHMM
from runners.bisim.lehnert_gridworld.LehnertGridworldGMM import LehnertGridworldGMMRunner
class LehnertGridworldHMMRunner(LehnertGridworldGMMRunner):
def __init__(self, runner_config, model_config):
super(LehnertGridwor... | [
{
"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 | runners/bisim/lehnert_gridworld/LehnertGridworldHMM.py | ondrejba/discrete_abstractions |
import pytest
def test_shellsrc(script_runner):
exit_status = script_runner('')
assert exit_status == 0
assert script_runner.output == ''
@pytest.mark.parametrize('env_name,is_valid', [
('', False),
('.', False),
('..', False),
('foo/bar', False),
('/foo', False),
('foo/', False)... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a ty... | 3 | tests/shell/test_shell.py | un-def/luamb |
# This has not been tested yet.
import os
def install():
# Move the ITSToolKit.sh to the /bin/ directory
os.system("mv ITSToolKit.py ~bin/")
os.system("mv ITSToolKit ~bin/")
# Install the pip3 requirements
os.system("pip3 install os")
os.system("pip3 install time")
os.system("pip3 i... | [
{
"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 | BrewInstaller.py | CollinEdward/ITSToolKit |
import logging
import os
import re
import pandas
from .. import Constants
from .. import PredictionModel
from ..gwas import Utilities as GWASUtilities
def align_data_to_alleles(data, base, left_on, right_on):
EA, NEA = Constants.EFFECT_ALLELE, Constants.NON_EFFECT_ALLELE
EA_BASE, NEA_BASE = EA+"_BASE", NEA+"_... | [
{
"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 | software/metax/misc/GWASAndModels.py | ChendiWang/MetaXcan |
from charms.reactive import (
Endpoint,
set_flag,
clear_flag
)
from charms.reactive import (
when,
when_not
)
class ContainerRuntimeRequires(Endpoint):
@when('endpoint.{endpoint_name}.changed')
def changed(self):
set_flag(self.expand_name('endpoint.{endpoint_name}.available'))
... | [
{
"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/unit/fake_data_root/kubernetes/var/lib/juju/agents/unit-containerd-2/charm/hooks/relations/untrusted-container-runtime/requires.py | KellenRenshaw/hotsos |
"""User defaults
Revision ID: 30b25dd39af0
Revises: 46b85e11f48f
Create Date: 2015-02-12 15:34:59.515740
"""
# revision identifiers, used by Alembic.
revision = '30b25dd39af0'
down_revision = '46b85e11f48f'
branch_labels = None
depends_on = None
from alembic import op
import sqlalchemy as sa
def upgrade():
##... | [
{
"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 | migrations/versions/30b25dd39af0_user_defaults.py | havanhuy1997/pmg-cms-2 |
import json
from django.http import HttpResponseBadRequest, JsonResponse
from django.utils.decorators import method_decorator
from django.views.decorators.csrf import csrf_exempt
from django.views.generic.base import View
from telegram import Update
from .handler import bot, dispatcher
class UpdateHandler(View):
... | [
{
"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 | telegram_bot/views.py | alenworld/django_telegram_bot |
from hextokenizer import HexTokenizer
class HexReader(object):
def __init__(self):
self.tokenizer = HexTokenizer()
def readHex(self, hexStr, callback):
self.tokenizer.lexer.input(hexStr)
while True:
token = self.readToken()
if not token:
break
if token.type != 'START':
raise Exception("In... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer"... | 3 | lib/hexreader.py | zr40/scc |
from pygame import event
from albow.widgets.Control import Control
class CheckControl(Control):
def mouse_down(self, e: event):
self.value = not self.value
def get_highlighted(self):
return self.value
| [
{
"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 | albow/widgets/CheckControl.py | hasii2011/albow-python-3 |
from spaceone.api.inventory.v1 import network_type_pb2, network_type_pb2_grpc
from spaceone.core.pygrpc import BaseAPI
class NetworkType(BaseAPI, network_type_pb2_grpc.NetworkTypeServicer):
pb2 = network_type_pb2
pb2_grpc = network_type_pb2_grpc
def create(self, request, context):
params, metada... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"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 | src/spaceone/inventory/api/v1/network_type.py | choonho/inventory |
# coding: utf-8
from __future__ import unicode_literals, print_function, division, absolute_import
import unittest
from django.core.urlresolvers import reverse
from onadata.apps.main.models import UserProfile
from onadata.apps.main.views import profile_settings
from .test_base import TestBase
class TestUserSettings(... | [
{
"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 | onadata/apps/main/tests/test_user_settings.py | ubpd/kobocat |
from unittest import IsolatedAsyncioTestCase
from unittest.mock import patch, AsyncMock, call
from guapow import __app_name__
from guapow.service.watcher import util
class MapProcessesTest(IsolatedAsyncioTestCase):
@patch(f'{__app_name__}.service.watcher.util.async_syscall', side_effect=[(0, " 1 # a \n 2 # b \n... | [
{
"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 | tests/service/watcher/test_util.py | vinifmor/guapow |
from docusign_rooms import RoomsApi
from flask import session, request
from ...utils import create_rooms_api_client
class Eg003Controller:
@staticmethod
def get_args():
"""Get required session and request arguments"""
return {
"account_id": session["ds_account_id"], # Represents ... | [
{
"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 | app/rooms/examples/eg003_export_data_from_room/controller.py | olegliubimov/code-examples-python |
from fastapi import FastAPI, Form
from fastapi.responses import HTMLResponse
from pydantic import BaseModel
from typing import Optional
app = FastAPI()
class UssdParams(BaseModel):
session_id: str
service_code: str
phone_number: str
text: str
# dummy acc. data
accounts = {
"A001": {
"bi... | [
{
"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 | fastapi_app/main.py | DanNduati/AT-USSD |
'''@file feature_computer.py
contains the FeatureComputer class'''
from abc import ABCMeta, abstractmethod
class FeatureComputer(object):
'''A featurecomputer is used to compute features'''
__metaclass__ = ABCMeta
def __init__(self, conf):
'''
FeatureComputer constructor
Args:
... | [
{
"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 | nabu/processing/feature_computers/feature_computer.py | rzcwade/nabu |
from django.db import models
from django.core.validators import URLValidator
from django.contrib.auth.models import User
from tinymce.models import HTMLField
# Create your models here.
class Project(models.Model):
title = models.CharField(max_length = 50)
image = models.ImageField(upload_to = 'projects/')
... | [
{
"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 | upload/models.py | drewheathens/Awwwards |
import pyblish.api
from reveries import plugins
class ValidateMeshNoMoreThan4Sides(pyblish.api.Validator):
"""Ensure that meshes don't have face that is more than 4 sides
To debug the problem on the meshes you can use Maya's modeling
tool: "Mesh > Cleanup..."
"""
order = pyblish.api.ValidatorO... | [
{
"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 | plugins/maya/publish/validate_mesh_no_more_than_4_sides.py | davidlatwe/reveries-config |
# EE348N: Ocean Acoustics
# Sound speed profiles used in class
from numpy import exp, sin
### FUNCTIONS ###
def cSTD (t,s,z, lat=0, eqn='mackenzie81'):
# Inputs:
# t : tempurature [degC]
# s : salinity [ppt]
# z : column depth [m]
# lat : latitude [deg]
# eqn : mackenzie81, leroy08
# Returns:
# c : seawa... | [
{
"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 | oceanAcouPy/soundSpeed.py | IvanaEscobar/oceanAcouPy |
import json
import os
import time
import schedule
with open(r'..\..\secrets.json') as f:
s = f.read()
d = json.loads(s)
PYTHONPATH_ABS = d['PYTHONPATH_ABS']
REPO_ROOT = d['REPO_ROOT']
def calld_django_send_diary_user_email():
time_string = time.strftime('%Y%m%d%H%M%S')
print(time_string)
print('sta... | [
{
"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 | scripts/schedules/autodjangocommand.py | j3ygh/ctdb |
import pygame
class Display():
def __init__(self, w=800, h=600) -> None:
self.w, self.h = w, h
self.fullscreen = False
self.brightness = 255
self.brightness_mask = pygame.Surface((w,h), pygame.SRCALPHA)
self.brightness_mask.fill((0,0,0,0))
def create(self, c... | [
{
"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 | display.py | Chappie733/GravitationSimulator |
# 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": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer"... | 3 | aliyun-python-sdk-idrsservice/aliyunsdkidrsservice/request/v20200630/GetTaskRequest.py | yndu13/aliyun-openapi-python-sdk |
# Copyright (c) 2018 European Organization for Nuclear Research.
# 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/LIC... | [
{
"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_has_docstring",
"question": "Does every function in this file have a docs... | 3 | aardvark/conf/nova_conf.py | ttsiouts/aardvark |
def alphabet_subsequence(s):
return ''.join(sorted(s)) == s and len(set(s)) == len(s)
def alphabet_subsequence_two(s):
""" I like this solution better.
Clear and concise
"""
return all(s[i]<s[i+1] for i in range(len(s) -1))
if __name__ == '__main__':
s = 'effg'
print(alphabet_subsequence... | [
{
"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 | arcade_solutions/the_core/alphabet_subsequence.py | nickaigi/automatic-dollop |
import http.server
import threading
import testPackage
class MyHTTPRequestHandler(http.server.BaseHTTPRequestHandler):
def _set_headers(self):
self.send_response(200)
self.send_header('Content-type', 'text/html')
self.end_headers()
def do_GET(self):
self._set_headers()
... | [
{
"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 | Python/simple-web-server.py | babebeebaboo/Practicum_SmartBedRoom |
import os
import sys
import re
import requests
import json
import time
import logging
root = logging.getLogger()
root.setLevel(logging.DEBUG)
handler = logging.StreamHandler(sys.stdout)
handler.setLevel(logging.DEBUG)
formatter = logging.Formatter('%(asctime)s - %(message)s')
handler.setFormatter(formatter)
root.addHa... | [
{
"point_num": 1,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?... | 3 | nginx-parser/app.py | fly304625/nginx-geo-metricsreporter |
from __future__ import absolute_import
import six
from sentry.api.serializers import register, Serializer
from sentry.incidents.models import AlertRuleTriggerAction
@register(AlertRuleTriggerAction)
class AlertRuleTriggerActionSerializer(Serializer):
def human_desc(self, action):
# Returns a human reada... | [
{
"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/sentry/api/serializers/models/alert_rule_trigger_action.py | pierredup/sentry |
# -*- coding: utf-8 -*-
import numpy as np
import torch
"""
The complete formulas and explanations are available in our doc:
https://dwi-ml.readthedocs.io/en/latest/formulas.html
"""
def fisher_von_mises_log_prob_vector(mus, kappa, targets):
log_c = np.log(kappa) - np.log(2 * np.pi) - np.log(np.exp(kappa) -
... | [
{
"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 | dwi_ml/models/utils/fisher_von_mises.py | EmmaRenauld/dwi_ml |
from unittest import mock
import pytest
from asserts import assert_cli_runner
from meltano.cli import cli
from meltano.core.project_settings_service import (
ProjectSettingsService,
SettingValueStore,
)
from meltano.core.tracking import GoogleAnalyticsTracker
class TestCliUi:
def test_ui(self, project, c... | [
{
"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/meltano/cli/test_ui.py | siilats/meltano |
import pandas as pd
import folium
from flask import Flask,render_template
def find_top_confirmed(n = 15):
corona_df=pd.read_csv("covid-19-dataset-2.csv")
by_country = corona_df.groupby('Country').sum()[['Confirmed', 'Deaths', 'Recovered', 'Active']]
cdf = by_country.nlargest(n, 'Confirmed')[['... | [
{
"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 | Covid_project/app.py | Raashil/EasyProgrammingPython |
from MoveGetter import MoveGetter
import chess
class CommandLineMoveGetter(MoveGetter):
def getMove(self, board):
print("\n")
print(board)
self.printLegalMoves(board)
return self.getMoveFromCLI(board)
def printLegalMoves(self, board):
for index, move in enumerate(board... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer":... | 3 | CommandLineMoveGetter.py | okiyama/Chess-EEA-Opponent-Modelling |
import json
import responses
from pbpstats.data_loader.live.boxscore.file import LiveBoxscoreFileLoader
from pbpstats.data_loader.live.boxscore.loader import LiveBoxscoreLoader
from pbpstats.data_loader.live.boxscore.web import LiveBoxscoreWebLoader
from pbpstats.resources.boxscore.live_boxscore_item import LiveBoxsc... | [
{
"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/data_loaders/test_live_boxscore_loader.py | bahalbach/pbpstats |
from django.contrib.auth.models import User
from django.db import models
class LearnerProfile(models.Model):
user = models.OneToOneField(User, unique=True, related_name='learner_profile')
active = models.BooleanField(default=True)
def __str__(self):
return "LearnerProfile: {name}".format(name=sel... | [
{
"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_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
... | 3 | rome/accounts/models.py | fpruitt/Rome |
from __future__ import annotations
import typing
from vuakhter.base.base_log import BaseLog
from vuakhter.utils.types import TimestampRange
if typing.TYPE_CHECKING:
from vuakhter.base.access_log import AccessLog
from vuakhter.metrics.base import StatisticsMetrics
from vuakhter.utils.types import DateOrDat... | [
{
"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_params_annotated",
"question": "Does every function parameter in this file have a type annotation (exclu... | 3 | vuakhter/analyzer.py | best-doctor/vuakhter |
#import findspark
#findspark.init()
from pyspark import SparkConf,SparkContext
from pyspark.streaming import StreamingContext
from pyspark.sql import Row,SQLContext
import sys
import requests
def compute(hashtag):
tags = hashtag.split(',')
for h in tags:
if(len(h)>1):
yield (h,1)
def get_... | [
{
"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 | adminmgr/media/code/A3/task3/BD_0970_1370_1384_Q2rVuhM.py | IamMayankThakur/test-bigdata |
#! /usr/bin/env python3
# -*- coding:utf-8 -*-
'''
if_service_exists(): Boolean:服务是否存在
if_service_running(): Booleans:服务是否运行
start_run_service(): 无法以admin运行
'''
import os, subprocess, time
import ctypes, sys
# from tool import bat
import zhangwei_helper.function.Os as self_os
import zhangwei_helper.enum.SelfEnum as sel... | [
{
"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 | zhangwei_helper/function/WindowsService.py | zwzw911/zhangwei_helper |
weight=10
def run():
@_spawn
def _():
lfliper(2)
_sync()
r.curve_rel(-122, 52)
r.forward(57)
r.forward(20)
#hvatanje
lfliper(1)
llift(0)
pump(0, 1)
sleep(1)
#provera zahvata
# p1 = sp_left.picked()
# @_do
# def _():
# if (p1.val):
# print("Uhvatio ------------------------------")
# else:
# pri... | [
{
"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 | robots/big/strategies/osnovna/plava/casa_toranj.py | memristor/mep2 |
import sys
from setuptools import setup, find_packages
from setuptools.command.test import test as TestCommand
import sqlacodegen
class PyTest(TestCommand):
def finalize_options(self):
TestCommand.finalize_options(self)
self.test_args = []
self.test_suite = True
def run_tests(self):... | [
{
"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 | setup.py | linewalks/flask-sqlacodegen |
# pylint: disable=invalid-name
"""Helper utility to save parameter dicts."""
import tvm
_save_param_dict = tvm.get_global_func("tvm.relay._save_param_dict")
_load_param_dict = tvm.get_global_func("tvm.relay._load_param_dict")
def save_param_dict(params):
"""Save parameter dictionary to binary bytes.
The resu... | [
{
"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 | python/tvm/relay/param_dict.py | mostafaelhoushi/tvm |
import logging
import sys
import time
from rdflib.graph import Graph
from hexastore import turtle
from hexastore.memory import InMemoryHexastore
logger = logging.getLogger(__name__)
root = logging.getLogger()
root.setLevel(logging.DEBUG)
class Timer:
def __enter__(self):
self.start = time.perf_counte... | [
{
"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 | benchmarks/bnb.py | alexchamberlain/mutant |
from typing import Tuple
from elegy.metrics.metric import Metric
import typing as tp
import haiku as hk
from elegy import utils
import jax
def forward_all(metrics_fn):
def _metrics_fn(**kwargs):
if isinstance(metrics_fn, (tp.List, tp.Tuple, tp.Dict)):
metrics = jax.tree_multimap(lambda f: f(... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"... | 3 | elegy/metrics/metric_modes.py | srcolinas/elegy |
import sqlite3
import click
from flask import current_app, g
from flask.cli import with_appcontext
# g
# g is a unique request object used to store data that might be accessed by multiple functions during the request.
# Stored and re-used if called during the same request instead of creating a new connection
def ge... | [
{
"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 | pyBlog/db.py | IXLives/pyBlog |
# -*- coding: utf-8 -*-
# Copyright (c) 2019, Frappe Technologies and Contributors
# License: MIT. See LICENSE
import unittest
import frappe
from frappe.core.doctype.session_default_settings.session_default_settings import (
clear_session_defaults,
set_session_default_values,
)
class TestSessionDefaultSettings(uni... | [
{
"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 | frappe/core/doctype/session_default_settings/test_session_default_settings.py | oryxsolutions/frappe |
import pygame
from pygame.sprite import Sprite
class Ship(Sprite):
def __init__(self, ai_settings, screen):
super(Ship, self).__init__()
self.screen = screen
self.ai_settings = ai_settings
self.image = pygame.image.load('images/ship.bmp')
self.rect = self.image.... | [
{
"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 | Alien_Invasion/ship.py | carmineDYJ/Python-Games |
from sys import maxsize
class Contact:
def __init__(self, firstname=None, lastname=None, homephone=None, mobilephone=None,workphone=None, secondaryphone=None, id=None):
self.firstname=firstname
self.lastname=lastname
self.homephone=homephone
self.workphone = workphone
sel... | [
{
"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 | model/contact.py | Valeryiar/python_training |
def leiaInt(msg):
while True:
try:
n = int(input(msg))
except (ValueError, TypeError):
print('\033[0;31mERRO: Por favor, digite um número inteiro válido.\033[m')
continue
except KeyboardInterrupt:
print('\033[0;31mERRO: Usuáio preferiu não, dig... | [
{
"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 | Exercicios/Mundo3/ex113.py | mpaullos/cursoemvideo-python |
import unittest
import example_module
class MainTest(unittest.TestCase):
def test_add(self):
self.assertEqual(example_module.add(1, 1), 2)
def test_subtract(self):
self.assertEqual(example_module.subtract(1, 1), 0)
if __name__ == '__main__':
unittest.main() | [
{
"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/math_test.py | hokiedsp/test_python |
import operator
from typing import (
List,
)
from cytoolz import (
curry,
)
from cytoolz.curried import reduce
from itertools import (
zip_longest,
)
@curry
def has_voted(bitfield: bytes, index: int) -> bool:
return bool(bitfield[index // 8] & (128 >> (index % 8)))
def set_voted(bitfield: bytes, in... | [
{
"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 | eth/utils/bitfield.py | C4Coin/py-fhm-evm |
class MusicEntry:
__slots__ = ['title', 'duration', 'url','webpage_url', 'author', 'channel',
'lock', 'effect', 'thumb', 'search_query', 'is_live', 'filename', 'status']
def __init__(self, url, webpage_url, author, channel, title, duration,
lock, effect, thumb, is_live, searc... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than cl... | 3 | music/musicentry.py | PrestigeDox/Tanjo |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
"""
__version__ = "1.0.0"
__author__ = "Qu DoNG"
# https://leetcode.com/problems/reverse-string/
class Solution(object):
def reverseString_(self, s):
"""
result status: Time Limit Exceeded...
:type s: str
:rtype: str
"""
... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"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 | Leetcode/src/Reverse_string.py | QuDong/Algorithm4 |
from thefuck.utils import for_app
@for_app('brew', at_least=2)
def match(command):
return (command.script_parts[1] in ['uninstall', 'rm', 'remove']
and "brew uninstall --force" in command.stdout)
def get_new_command(command):
command_parts = command.script_parts[:]
command_parts[1] = 'uninst... | [
{
"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 | thefuck/rules/brew_uninstall.py | pybenchmark/thefuck |
from nonebot import on_command, CommandSession
@on_command('help', aliases=('h', '帮助'), only_to_me=False)
async def manual(session: CommandSession):
await session.send(f'[CQ:image,file=/admin/manual.png]')
@manual.args_parser
async def _(session: CommandSession):
# do nothing
return | [
{
"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 | dragon/plugins/help.py | sahuang/DragonBot-ReDive |
# Easy
# https://leetcode.com/problems/intersection-of-two-linked-lists/
# Refer CTCI PAGE 222
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
# Time Complexity: O(N + M) where N = len(list1) and M = len(list2)
... | [
{
"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": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (e... | 3 | LinkedList/160. Intersection of two linked lists.py | Rage-ops/Leetcode-Solutions |
class Account:
def __init__(self, balance, account_no):
self.balance = float(balance)
self.account_no = account_no
def deposit(self, amount):
self.balance+=amount
def print_balance(self):
pri... | [
{
"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 | university_tasks/first_year/banking_system/account.py | alexbanks2399/python_projects |
import os
import numpy as np
import pandas as pd
import cv2
import matplotlib.pyplot as plt
import fnmatch
from sklearn.model_selection import train_test_split
from glob import glob
imagePatches = glob('./IDC_regular_ps50_idx5/**/*.png',recursive = True)
def multiplot():
plt.rcParams['figure.figsize'] = (10.0, 10.... | [
{
"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 | data_preprocess.py | atharvamh/Predicting-IDC-in-Breast-Cancer |
import numpy as np
from .. import pad
from .base import Refocus
class RefocusNumpy(Refocus):
"""Refocusing with numpy-based Fourier transform
.. versionadded:: 0.3.0
"""
def _init_fft(self, field, padding):
"""Perform initial Fourier transform of the input field
Parameters
... | [
{
"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 | nrefocus/iface/rf_numpy.py | RI-imaging/nrefocus |
# coding: utf-8
"""
Isilon SDK
Isilon SDK - Language bindings for the OneFS API # noqa: E501
OpenAPI spec version: 7
Contact: sdk@isilon.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import isi_sdk_8_2_0
from i... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": fals... | 3 | isi_sdk_8_2_0/test/test_reports_threats_report.py | mohitjain97/isilon_sdk_python |
from sklearn.linear_model import LinearRegression
from sklearn.model_selection import train_test_split
import pandas as pd
import sqlalchemy
from config.config import symbol,backward_steps
import joblib
from df_functions import *
def prepare_single_dataset(df,remove_from_heads:int,remove_from_tails:int,label:int):
... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (... | 3 | src/trainer.py | Chicco94/crypto-bot |
import logging
from typing import Union
import verboselogs
class Logger:
__instance: verboselogs.VerboseLogger = None
@staticmethod
def logger() -> verboselogs.VerboseLogger:
if Logger.__instance is None:
Logger()
assert(Logger.__instance is not None)
return Logger.__i... | [
{
"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/app/utility/logger.py | acatalfano/chord-dht |
import os
import numpy as np
import random
import torch
import torch.nn as nn
import yaml
from typing import Any, List, Tuple, Dict
from types import ModuleType
from utils.logger import setup_logger
logger = setup_logger(__name__)
def get_instance(module: ModuleType, name: str, config: Dict, *args: Any) -> Any:
... | [
{
"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 | CIFAR10/Session3/dl_vision/utils/config.py | gmshashank/pytorch_vision |
# Copyright 2017 Renato Utsch
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | [
{
"point_num": 1,
"id": "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 | flatbuffers/repositories.bzl | RenatoUtsch/rules_flatbuffers |
import sys
def does_exist(cur_list, start_loc, end_loc):
for s, e, _ in cur_list:
if (s >= start_loc and s <= end_loc) or (start_loc >= s and start_loc <= e):
return True
return False
def read_fimo(fimo_input):
fimo_dict = {}
with open(fimo_input, "r") as f:
for line in f:
line = line.strip()
if lin... | [
{
"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_has_docstring",
"question": "Does every function in this file have a docs... | 3 | syntax_analysis/code/process_fimo_output.py | minjunp/scATAC-seq |
'''
Created on 3 lut 2019
@author: civ
'''
import unittest
import sys
print(sys.path)
from com.civ.rest import CivRest as C
from com.civ.play.Play import TestGame
from helper import TestHelper
class Test(unittest.TestCase):
def setUp(self):
C.registerAutom()
# @unittest.skip("demonstrating sk... | [
{
"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 | test/test1/test1.py | stanislawbartkowski/CivPython |
# -*- coding: UTF-8 -*-
import os
import unittest
from mock import Mock
import oca
class TestUserPool(unittest.TestCase):
def setUp(self):
self.client = oca.Client('test:test')
self.xml = open(os.path.join(os.path.dirname(oca.__file__),
'tests/fixtures/userpo... | [
{
"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 | oca/tests/test_user_pool.py | Monstrofil/python-oca |
'''
Created on 27.05.2015
@author: vvladych
'''
from gi.repository import Gtk
from rawtext_process_component import RawTextProcessComponent
class RawTextAddDialog(Gtk.Dialog):
def __init__(self, parent, forecast):
Gtk.Dialog.__init__(self, "Text model Dialog", None, 0,
(Gtk.STOCK_CANCEL,... | [
{
"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 | src/forecastmgmt/ui/forecast/rawtext_add_dialog.py | vvladych/forecastmgmt |
def main():
n = get_positive_int()
def get_positive_int():
while True:
n = int(input("Enter a positive number: "))
if n > 0:
return n
main() | [
{
"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 | python/positive.py | scienceacademy/apcsp_2021 |
# Advent of Code 2019, Day 3
# (c) blu3r4y
from operator import itemgetter
from aocd.models import Puzzle
from funcy import print_calls
from parse import parse
def solve(wires):
touched, steps = set(), dict() # cells touched by 1st wire & number of steps
intersections = set() # crossing points with 2nd wi... | [
{
"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 | src/day3.py | blu3r4y/AdventOfCode2019 |
# ___________________________________________________________________________
#
# Pyomo: Python Optimization Modeling Objects
# Copyright 2017 National Technology and Engineering Solutions of Sandia, LLC
# Under the terms of Contract DE-NA0003525 with National Technology and
# Engineering Solutions of Sandia, LLC... | [
{
"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 | mpisppy/utils/pysp_model/tests/testdata/both_callbacks.py | Matthew-Signorotti/mpi-sppy |
import os
import numpy as np
import pickle
# import tqdm
def load_GLOVE():
model = 'glove_pretrained_840b_300d.pkl'
print("loading GLOVE pretrained model ......")
with open('./Embeddings/GLOVE_pretrained/'+model,'rb') as pk:
glove_emb = pickle.load(pk)
print('GLOVE loaded.\n')
return glove... | [
{
"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 | Hyperband/Embeddings/GLOVE.py | tian1327/AutoLDA |
import collections
from typing import Any, Sequence
from django.core.exceptions import ObjectDoesNotExist
from django.db.models import Manager
# Mock is_simple_callable for now
# instead of the more sophisticated one from rest_framework.fields
def is_simple_callable(possible_callable: Any) -> bool:
return callab... | [
{
"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 | reactivated/utils.py | silviogutierrez/reactivated |
import pytube as pt
tags = {
313: '2160p',
271: '1440p',
137: '1080p',
22: '720p',
18: '360p',
278: '144p',
140: 'MP4 128kb/s (only audio)',
249: 'webm 50Kb/s (only audio)',
251: 'webm 160kb/s (onlu audio)',
}
def get_available_qualities(url):
video = pt.YouTube(ur... | [
{
"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 | Tags.py | KrishnarajT/IP-Project-Youtube-Video-Downloader |
import requests
API_URL = 'https://secure.techfortesco.com/tescolabsapi/restservice.aspx'
class TescoLabsApi(object):
def __init__(self, url, developerkey, applicationkey):
self.url = url
self.developerkey = developerkey
self.applicationkey = applicationkey
res = requests.get(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": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answ... | 3 | tescolabsapi.py | moreati/tescolabsAPI |
# -*- coding: utf-8 -*-
# Copyright 2019 Cohesity Inc.
class OracleSession(object):
"""Implementation of the 'Oracle Session.' model.
Specifies information about session configuration for an Oracle host.
Attributes:
location (string): Location is the path where Oracle is installed.
syst... | [
{
"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 | cohesity_management_sdk/models/oracle_session.py | sachinthakare-cohesity/management-sdk-python |
from wagtail.core import blocks
from wagtail.images.blocks import ImageChooserBlock
class StandoutItemsBlock(blocks.StructBlock):
class LinkBlock(blocks.StreamBlock):
internal = blocks.PageChooserBlock()
external = blocks.URLBlock()
class Meta:
required = False
max... | [
{
"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 | tbx/people/blocks.py | elviva404/wagtail-torchbox |
from enum import Enum
from time import time
import numpy as np
class State(Enum):
"""The status for the timer. This class is inherited from Enum.
Attributes:
activate: int
Let the timer engine start.
deactivate: int
The timer shutdown its engine.
"""
activate =... | [
{
"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 | skshapelet/utils/timer.py | Hephaest/skshapelet |
from stencil_kernel import *
import sys
import numpy
import math
width = 50
height = 50
image_in = open('mallard_tiny.raw', 'rb')
stdev_d = 1
stdev_s = 70
radius = 1
class Kernel(object):
def kernel(self, in_img, filter_d, filter_s, out_img):
for x in out_img.interior_points():
for y in in_img.ne... | [
{
"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/debugger/bilateral_filter.2.py | shoaibkamil/asp |
from __future__ import print_function
import time
import helpers
from roslibpy import Ros
from roslibpy import Service
from roslibpy import ServiceRequest
def run_add_two_ints_service():
ros_client = Ros('127.0.0.1', 9090)
ros_client.run()
def add_two_ints(request, response):
response['sum'] =... | [
{
"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 | tests/test_service.py | jeandeaual/roslibpy |
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license.
from typing import Tuple, Mapping, Any
from textworld.core import Environment, Wrapper
class Limit(Wrapper):
"""
Environment wrapper to limit the number of steps.
"""
def __init__(self, env: Environment,... | [
{
"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": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 2... | 3 | textworld/envs/wrappers/limit.py | JohnnySun8/TextWorld |
# 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": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding sel... | 3 | aliyun-python-sdk-codeup/aliyunsdkcodeup/request/v20200414/UpdateRepositoryMemberRequest.py | yndu13/aliyun-openapi-python-sdk |
from flask_wtf import FlaskForm
from wtforms import TextAreaField, StringField, validators
from wtforms.validators import DataRequired
from fuzzywuzzy import fuzz, process
from TA_functions import *
def closest_match(search):
choices = get_ta_list()
return process.extract(search, choices, limit=1)
def closest_5_ma... | [
{
"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 | router_logic/search.py | sdulaney/project-paul-eggtart |
# https://www.geeksforgeeks.org/quick-sort/
def sorted(arr, n):
if not arr:
return []
pivot = arr[n]
left = list(filter(lambda x: x < pivot, arr))
mid = list(filter(lambda x: x == pivot, arr))
right = list(filter(lambda x: x > pivot, arr))
return sorted(left, len(left) - 1) + mid + sorted(right, len... | [
{
"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 | sort/quick.py | haandol/dojo |
# -*- coding: utf-8 -*-
"""Template engine using Python's builtin string format."""
import re
from piecutter.engines import Engine
class PythonFormatEngine(Engine):
"""Template engine using Python's builtin string format."""
def render(self, template, context):
"""Return the rendered template against... | [
{
"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 | piecutter/engines/pythonformat.py | diecutter/piecutter |
from django import template
from django.contrib.auth.models import Group
register = template.Library()
@register.filter(name='has_group')
def has_group(user, group_name):
try:
group = Group.objects.get(name=group_name)
except:
return False # group doesn't exist, so for sure the user isn't par... | [
{
"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 | djangoPharma/app/templatetags/app_tags.py | thodoris/djangoPharma |
from .base import DownloadSource
import requests
from mod_updater.util.utils import TermColors
class CurseForgeSource(DownloadSource):
REQUIRED_ARGS = ["project_id"]
OPTIONAL_ARGS = [("release_type", "release")]
def __init__(self, project, release_type, path, mc_version):
self._file_data_url =... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a ty... | 3 | mod_updater/sources/curse_forge.py | snallapa/mod_updater |
import json
import os
from .tf_doc_setup import TFDocSetup
from .dashing import DASHING
class TFManualDocSetup(TFDocSetup):
""" This class is designed to create DocSet for all versions of TensorFlow 2.x automatically."""
def __init__(self, md_dir_path, html_dir_path, version=''):
"""
Initiali... | [
{
"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 | src/tf_manual_doc_setup.py | bingo-todd/tensorfow-docset-maker |
"""Module containing some of the logic for our VCS installation logic."""
from flake8 import exceptions as exc
from flake8.main import git
from flake8.main import mercurial
# NOTE(sigmavirus24): In the future, we may allow for VCS hooks to be defined
# as plugins, e.g., adding a flake8.vcs entry-point. In that case, ... | [
{
"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/flake8/main/vcs.py | brianv0/flake8 |
from django.db import models
from login.models import User #add this
from django.dispatch import receiver #add this
from django.db.models.signals import post_save
from datetime import datetime
# SOURCE: https://www.ordinarycoders.com/django-custom-user-profile
class Profile(models.Model):
user = models.OneToOne... | [
{
"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 | dashboard/models.py | farahaulita/pbp-tk |
"""
NLP Sandbox Date Annotator API
# Overview The OpenAPI specification implemented by NLP Sandbox Annotators. # noqa: E501
The version of the OpenAPI document: 1.1.1
Contact: thomas.schaffter@sagebionetworks.org
Generated by: https://openapi-generator.tech
"""
import sys
import unittest
impo... | [
{
"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_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer":... | 3 | test/test_text_covid_symptom_annotation_response.py | Sage-Bionetworks/nlp-sandbox-client |
import os
from unittest import TestCase
from django.template import Engine
from .utils import TEMPLATE_DIR
class OriginTestCase(TestCase):
def setUp(self):
self.engine = Engine(dirs=[TEMPLATE_DIR])
def test_origin_compares_equal(self):
a = self.engine.get_template('index.html')
b = ... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",... | 3 | tests/template_tests/test_origin.py | KaushikSathvara/django |
"""Test module."""
import unittest
from accessor import accessor as _, flatten
tester = [
{
'a': 1,
'b': {'c': 5, 'cc': {'d': 6, 'e': 7}},
'f': [
{'g': 11, 'h': 12},
{'g': 13, 'h': 14},
]
},
{
'a': 3,
'b': {'c': 8, 'cc': {'d': 9, 'e... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",... | 3 | tests/test.py | jjagielka/python-accessor |
import pandas as pd
import sys
sys.path.append('../')
from src.database.insert_data import ReadData
# Set testing objects
# read song data as dataframe
song_df = ReadData().readSongData()
# random sample n users
random_song_df = ReadData().random_select_user(song_df, 10)
def test_readSongData():
"""Test method... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true... | 3 | test/test_database.py | johnnychiuchiu/Music-Recommender |
from .mScene import Scene
from .model import Model
from .structures import Float3
class LightingScene(Scene):
def __init__(self, device, size):
self.mushroom = Model(device, 'mushroom')
self.previousTouchLocation = (0.0, 0.0)
super().__init__(device, size)
self.mushroom.specularIntensity = 0.2
... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answ... | 3 | src/beginningMetal/12_DiffuseSpecularLighting/Challenge/pyMetal/lightingScene.py | pome-ta/pystaMetalStudy |
from django.test import TestCase
from django.contrib.auth import get_user_model
from core import models
def sample_user(email='rg171195@gmail.com', password='testpass'):
'''Creating sample user'''
return get_user_model().objects.create_user(email, password)
class ModelTests(TestCase):
def test_create_u... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},... | 3 | app/core/tests/test_models.py | Rish1711/recipe-app-api |
import torch
import torch.nn as nn
from saliency.saliency import Saliency
class DeconvSaliency(Saliency):
"""docstring for DeconvSaliency."""
def __init__(self, model):
super(DeconvSaliency, self).__init__(model)
def guided_relu_hook(self, module, grad_in, grad_out):
return (torch.nn.fun... | [
{
"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 | saliency/deconv/saliency.py | dendisuhubdy/pytorch-saliency |
class FakeResponse:
def __init__(self, data=None, status_code=None):
self._data = data
self._status_code = status_code
@property
def data(self):
return self._data
@property
def status_code(self):
return self._status_code
| [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"ans... | 3 | tests/mocks.py | ashu-tosh-kumar/Calendar-Python |
from unittest import TestCase
from pet import Pet
class PetTestCase(TestCase):
def setUp(self):
self.pet = Pet("Test")
def test_name(self):
self.assertEqual(self.pet.name, "Test")
| [
{
"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 | test.py | j0nm1/pipeline-python-demo-issue |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.