source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
import os
from test.datastore import datastore
from test.utilities import BigTIFFHeader, JFIFHeader, JPEGHeader, PNGHeader, TIFFHeader # noqa
try:
from girder.models.folder import Folder
from girder.models.upload import Upload
except ImportError:
# Make it easier to test without girder
pass
def name... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excl... | 3 | girder/test_girder/girder_utilities.py | naglepuff/large_image |
from __future__ import print_function, unicode_literals
import logging
from traceplus.common.functional import LazyObjectProxy
__all__ = [
'Tracer',
'NoopTracer',
'tracer'
]
class Tracer(object):
"""The basic Trace++ client.
"""
logger = logging.getLogger('traceplus.tracer')
def __init_... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
... | 3 | traceplus/base.py | traceplusplus/traceplus-python |
"""Quick way to verify I provided matching download URL and MD5.
"""
import hashlib
import json
import pathlib
import sys
import requests
def download_data(url):
print('Downloading', url, '... ', end='', flush=True)
response = requests.get(url)
response.raise_for_status()
print('Done')
return re... | [
{
"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 | tools/check_md5.py | uranusjr/pythonup-windows |
from AbstractRequest import AbstractRequest
class SearchRequest(AbstractRequest):
name = ""
sequence = ""
sequence_option = ""
sequence_length = ""
n_terminus_id = ""
c_terminus_id = ""
target_group_id = ""
target_object_id = ""
synthesis_type = ""
kingdom_id = ""
bond_id =... | [
{
"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": false... | 3 | dbaasp_api_helper_libraries/python/request/SearchRequest.py | reymond-group/MLpeptide |
#!/usr/bin/env python3
import csv
from os import path
def get_miles_driven():
while True:
miles_driven = float(input("Enter miles driven : "))
if miles_driven > 0:
return miles_driven
else:
print("Entry must be greater than zero. Please try again.\n")
... | [
{
"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 | Python_Files/murach/exercises/ch07/mpg.py | Interloper2448/BCGPortfolio |
# -*- coding: utf-8 -*-
"""
Created on Mon Nov 11 17:08:18 2019
@author: Daniel
"""
from tensorflow.keras import Model
import HypersphericalLoss as HL
class HypersphericalModel(Model):
def __init__(self,
n_symbols: int,
encoder,
loss
):
... | [
{
"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_multiple_inheritance",
"question": "Does any class in this file use multiple inherita... | 3 | tape/hpn_models/HypersphericalModel.py | dtch1997/tape |
from django.test import TestCase
from django.contrib.auth import get_user_model
from django.urls import reverse
from django.test import Client
class AdminSiteTests(TestCase):
def setUp(self):
self.client = Client()
self.admin_user = get_user_model().objects.create_superuser(
email='adm... | [
{
"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_admin.py | imadharilla/recipe-api-django-rest |
def is_uppercase_letter(c):
return ord(c) >= 65 or ord(c) <= 90
def is_lowercase_letter(c):
return ord(c) >= 65 or ord(c) <= 90
def is_polarized(a, b):
if not (is_lowercase_letter(a) or is_uppercase_letter(a)) and \
(is_lowercase_letter(b) or is_uppercase_letter(b)):
return False
... | [
{
"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 | day05/python/util.py | jaredkwright/AdventOfCode2018 |
from django.shortcuts import render
def get_list(req):
return render(req, 'kwue/food.html', {})
def add_item(req):
return render(req, 'kwue/food.html', {})
def create_list(req):
return render(req, 'kwue/food.html', {})
| [
{
"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 | kwueBackend/kwue/controllers/list.py | bounswe/bounswe2016group4 |
# -*- coding: utf-8 -*-
def isURL(url):
if not url or not isStr(url): return False
try:
r=urlparse(urljoin(url, '/'))
return r.scheme and r.netloc and r.path and ('.' in r.netloc)
except Exception:
return False
def cropURL(t):
if(t[:7]=='http://'): t=t[7:]
if(t[:8]=='https://'): t=t[8... | [
{
"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 | url_ex.py | byaka/functionsEx_new |
import spacy
from glob import glob
from tqdm import tqdm
import errant
import json
import os
from mpire import WorkerPool
annotator = errant.load('en')
def tokenize(sent):
doc = nlp(sent)
tok = [i.text for i in doc]
return " ".join(tok)
target_pairs = glob("/home/parth.chudasama/data_mnt/target_pairs/*... | [
{
"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 | tokenize_sent.py | parth-chudasama/C4_200M-synthetic-dataset-for-grammatical-error-correction |
#! /usr/bin/env python
# coding:utf-8
import unittest
from kovot.response import Response
from kovot.response import ResponseTransformer
from kovot.response import ResponseSelector
class ResponseTest(unittest.TestCase):
def test_response(self):
text = "京都にいます"
score = 1.2
res = Response(... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": ... | 3 | test/test_response.py | kazh98/kovot |
# -*- coding: utf-8 -*-
"""
auto rule template
~~~~
:author: LoRexxar <LoRexxar@gmail.com>
:homepage: https://github.com/LoRexxar/Kunlun-M
:license: MIT, see LICENSE for more details.
:copyright: Copyright (c) 2017 LoRexxar. All rights reserved
"""
from utils.api import *
class CVI_300... | [
{
"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 | rules/javascript/CVI_3003.py | dahua966/Kunlun-M |
import collections
import cProfile
import csv
from pathlib import Path
profiler = cProfile.Profile()
profiler.disable()
Record = collections.namedtuple(
'Record',
'airline, fatal_accidents_85_99, fatalities_85_99, '
'fatal_accidents_00_14, fatalities_00_14'
)
def parse_row(row):
record = Record(
... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
... | 3 | python/profiling/csv_data_analysis.py | zkan/100DaysOfCode |
import os
class ConfigParams:
def __init__(self,configPath):
self.env_dist = os.environ
#权限验证
self.api_key = ""
# userID = ""
# ip = "0.0.0.0"
#模型相关存放根目录
self.modelPath = os.path.join(os.getcwd(),"model")
cpuCores = 0
threads = 2
por... | [
{
"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 | common/configParams.py | MistSun-Chen/py_verifier |
from scapy.all import *
class Traffic:
def __init__(self):
pass
def get_traffic_hexdump(self,packets):
for packet in packets:
while packet.payload:
packet=packet.payload
print(hexdump(packet))
def get_SSIDs(self,packets):
APs=list()
... | [
{
"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 | libs/traffic.py | adityashinde1506/deauth_sniper |
import sys
from loguru import logger
logger.remove()
logger.add(sys.stderr, format="", diagnose=False, backtrace=False, colorize=False)
logger.add(sys.stderr, format="", diagnose=True, backtrace=False, colorize=False)
logger.add(sys.stderr, format="", diagnose=False, backtrace=True, colorize=False)
logger.add(sys.std... | [
{
"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 | tests/exceptions/source/others/nested_with_reraise.py | ponponon/loguru |
#! /usr/bin/env python
# -*- coding: utf-8 -*
"""
Decorators to help manage our custom classes.
"""
TABLE_LIST = []
def register(cls):
"""
A decorator to register new table configuration classes.
"""
TABLE_LIST.append(cls)
return cls
def downloader(func):
"""
A decorator to download data... | [
{
"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": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
... | 3 | census_data_downloader/core/decorators.py | JoeGermuska/census-data-downloader |
# -*- coding: utf-8 -*-
from benedict.core import dump as _dump
from decimal import Decimal
from six import PY3
import datetime as dt
import unittest
class dump_test_case(unittest.TestCase):
@staticmethod
def _rstrip_lines(s):
return '\n'.join([line.rstrip() for line in s.splitlines()])
def te... | [
{
"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 | tests/core/test_dump.py | next-franciscoalgaba/python-benedict |
import os
os.chdir('D:\文档\pythonDir\chapter06')
def sanitize(time_string):
if '-' in time_string:
splitter='-'
elif ':' in time_string:
splitter=':'
else:
return time_string
(mins,secs)=time_string.split(splitter)
return(mins+'.'+secs)
def openFile(flieName):
try:
... | [
{
"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 | pythonProjects/demo06.py | iuoipx/All-Stydy-Projects |
"""Shares relation
Revision ID: 3bed7b8d8720
Revises: b86d7b60fbef
Create Date: 2019-09-30 10:21:56.725664
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '3bed7b8d8720'
down_revision = 'b86d7b60fbef'
branch_labels = None
depends_on = None
def upgrade():
... | [
{
"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 | server/migrations/versions/3bed7b8d8720_shares_relation.py | momikey/liblio |
from pathlib import Path
from sepal_ui import sepalwidgets as sw
from component import parameter as cp
from component.message import cm
class FolderSelect(sw.FileInput):
def __init__(self):
super().__init__([''], label=cm.widget.folder.label, folder=cp.down_dir)
def _on_file_s... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": fals... | 3 | component/widget/folder_select.py | lecrabe/bfast_gpu |
from mongoengine import (
Document,
DynamicDocument,
StringField,
FloatField,
DateField,
IntField,
EmbeddedDocument,
EmbeddedDocumentField,
ListField
)
import re
class Image(EmbeddedDocument):
original = StringField()
stack = StringField()
class Product(DynamicDocume... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{... | 3 | meal_hack_flask/models/product.py | davidoort/meal_hack |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
import rospy
from sensor_msgs.msg import Image
from cv_bridge import CvBridge, CvBridgeError
import ros_numpy
import cv2
class image_listenner:
def __init__(self):
self.bridge = CvBridge()
self.image_sub = ros... | [
{
"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 | camera_plugins/scripts/camera_plugins_node.py | liangzhao123/topic_ws |
from django.contrib.auth.models import Group
from django.utils.translation import pgettext_lazy, npgettext
from django_filters import ModelMultipleChoiceFilter, OrderingFilter
from ...userprofile.models import User
from ..customer.filters import UserFilter
SORT_BY_FIELDS = (
('email', 'email'),
('default_bil... | [
{
"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 | saleor/dashboard/staff/filters.py | tanjibpa/alrawaa |
from admin_tools.dashboard.modules import DashboardModule
from bluebottle.utils.model_dispatcher import get_task_model
from django.utils.translation import ugettext_lazy as _
TASK_MODEL = get_task_model()
class TaskModule(DashboardModule):
"""
"""
title = _('Recently Created Tasks')
template = 'admin... | [
{
"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 | bluebottle/bb_tasks/dashboard.py | maykinmedia/bluebottle |
# test all objects that should be configurable
import pytest
import os
BASE_DIR = os.path.dirname(__file__)
@pytest.fixture
def voila_config_file_paths_arg():
path = os.path.join(BASE_DIR, '..', 'configs', 'general')
return '--VoilaTest.config_file_paths=[%r]' % path
def test_config_app(voila_app):
a... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding ... | 3 | tests/app/config_paths_test.py | meeseeksmachine/voila |
# Copyright 2021 ZBW – Leibniz Information Centre for Economics
#
# 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 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/label_calibration/test_simple.py | annakasprzik/qualle |
import pyeccodes.accessors as _
def load(h):
def wrapped(h):
discipline = h.get_l('discipline')
parameterCategory = h.get_l('parameterCategory')
parameterNumber = h.get_l('parameterNumber')
if discipline == 0 and parameterCategory == 1 and parameterNumber == 10:
retu... | [
{
"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 | pyeccodes/defs/grib2/localConcepts/lfpw1/name_def.py | ecmwf/pyeccodes |
import string
import spacy
import pickle
from nltk.stem.wordnet import WordNetLemmatizer
from gensim.models import Phrases, Word2Vec
from nltk.corpus import stopwords
import warnings
warnings.filterwarnings("ignore")
class WordProcessor():
'''
This is a utility class that loads data related to processing words... | [
{
"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/word_processing.py | bsbhaskar/product_review_sentiments |
# Quals 2009
# Problem B: Watersheds
# Jon Hanson
#
# Declare Variables
#
ifile = 'input.txt'
ofile = 'output.txt'
caselist = []
#
#
#
class CaseMap(object):
def __init__(self,height,width,alts):
self.h = height
self.w = width
self.imap = alts
def printCase(self):
print(str(se... | [
{
"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 | python/codejam/2009-quals/b-Watersheds/watersheds.py | jonjon33/sandbox |
"""
Ory Kratos API
Documentation for all public and administrative Ory Kratos APIs. Public and administrative APIs are exposed on different ports. Public APIs can face the public internet without any protection while administrative APIs should never be exposed without prior authorization. To protect the admini... | [
{
"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 | clients/kratos/python/test/test_error_container.py | simoneromano96/sdk |
from abc import ABCMeta, abstractmethod
class Assembly(metaclass=ABCMeta):
@abstractmethod
def to_source(self,table):
pass
@abstractmethod
def dump(self):
pass
def is_instruction(self):
return False
def is_label(self):
return False
def is_directive... | [
{
"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 | cpc/asm/Assembly.py | U-Ar/Cpresto |
import os
import pandas
from functools import cached_property
from experimentator import StateLogger
import wandb
os.environ["WANDB_SILENT"] = "true"
os.environ["WANDB_START_METHOD"] = "thread"
class LogStateWandB(StateLogger):
best_report = {}
def __init__(self, criterion_metric=None, mode="online"):
... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true... | 3 | experimentator/wandb_experiment.py | gabriel-vanzandycke/experimentator |
class NumArray:
def __init__(self, nums: List[int]):
self.n = list(accumulate(nums))
def sumRange(self, left: int, right: int) -> int:
return self.n[right]- (self.n[left-1] if left>0 else 0)
| [
{
"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 | problems/303_range_sum_query_immutable.py | wasi0013/leet_code |
# Copyright 2017 Rice University
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | [
{
"point_num": 1,
"id": "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 | program_helper/ast/ops/leaf_ops/DSymtabMod.py | jajajaqlt/nsg |
"""API properties.
"""
from __future__ import print_function
from __future__ import unicode_literals
from tabulate import tabulate, tabulate_formats, simple_separated_format
from platform import python_version_tuple
if python_version_tuple() >= ('3','3','0'):
from inspect import signature, _empty
else:
from... | [
{
"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 | test/test_api.py | elcritch/tabulate.jl |
"""
Modified from https://github.com/rwightman/pytorch-image-models/blob/master/timm/models/layers/drop.py
"""
import oneflow as flow
import oneflow.nn as nn
import oneflow.nn.functional as F
def drop_path(x, drop_prob: float = 0.5, training: bool = False):
"""Drop paths (Stochastic Depth) per sample (when appli... | [
{
"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 | flowvision/layers/regularization/droppath.py | ZiqiuChi/vision |
"""
This module contains common reusable functions.
"""
from traceback import print_stack
from configparser import ConfigParser
from SupportLibraries.ui_helpers import UIHelpers
class BaseHelpers(UIHelpers):
"""
This class includes basic reusable base_helpers.
"""
def __init__(self, driver):
... | [
{
"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 | SupportLibraries/base_helpers.py | Abhilash04/SeleniumPythonHybridFramework |
# coding: utf-8
import numpy as np
def _numerical_gradient_1d(f, x):
h = 1e-4 # 0.0001
grad = np.zeros_like(x)
for idx in range(x.size):
tmp_val = x[idx]
x[idx] = float(tmp_val) + h
fxh1 = f(x) # f(x+h)
x[idx] = tmp_val - h
fxh2 = f(x) # f(x-h)
... | [
{
"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": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excl... | 3 | common/gradient.py | gangigammo/deep-learning-1 |
from django.db import models
from django.contrib.auth.models import AbstractBaseUser, \
BaseUserManager, PermissionsMixin
class UserManager(BaseUserManager):
def create_user(self, email, password=None, **extra_fields):
"""Creates and saves a new user"""
if n... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class 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 self/cls)... | 3 | app/core/models.py | StoikovOleh/recipe-app-api |
class Frame:
def __init__(self, surface, imgs):
self.idx = 0
self.imgs = imgs
self.num = len(imgs)
self.surface = surface
@property
def img(self):
return self.imgs[self.idx]
@property
def is_last_frame(self):
return self.idx == self.num - 1
def ... | [
{
"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 | src/frame.py | Hsinfu/NanChangPark |
# Copyright 2013 IBM Corp.
#
# 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 agree... | [
{
"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 | nova/tests/virt/test_images.py | vmthunder/nova |
from vector import Vector
class Translatable(object):
def __init__(self, position = (0, 0)):
self.__position = Vector(position[0], position[1])
def set_position(self, position):
self.__position = Vector(position[0], position[1])
def position(self):
return self.__position
def... | [
{
"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 | shaape/translatable.py | 251/shaape |
from django.db import models
from django.utils.translation import gettext_lazy as _
from taggit.managers import TaggableManager
from django.utils.text import slugify
from category.models import Category
from django.contrib.auth import get_user_model
from .mixins import TimeStamp
User = get_user_model()
class Post(Ti... | [
{
"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 | posts/models.py | mohammadanarul/drf-blog-api |
# -*- coding: utf-8 -*-
#
# 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, softwa... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding se... | 3 | f5_agent_auditor/publishers/json_publisher.py | f5devcentral/f5-agent-auditor |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from typing import List
import functools
from wire.element import ToElementConverter
from wire.helpers import identifiers
from wire.helpers import logging
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions... | [
{
"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 | wire/helpers/getelement.py | MisterBianco/Wire |
import os
import io
import re
import sys
from setuptools import setup, find_packages
from pkg_resources import get_distribution, DistributionNotFound
def read(*names, **kwargs):
with io.open(
os.path.join(os.path.dirname(__file__), *names),
encoding=kwargs.get("encoding", "utf8")
) as fp:
... | [
{
"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 | setup.py | qilei123/pytorch_vision_4_DR |
from django import forms
class EmailResetForm(forms.Form):
emails = forms.ChoiceField(label='Email')
def __init__(self, *args, **kwargs):
choices = kwargs.get('initial', {}).get('emails', [])
self.base_fields['emails'] = forms.ChoiceField(choices=choices)
super(EmailResetForm, 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": false
}... | 3 | admin/users/forms.py | alexschiller/osf.io |
import csv
import enum
class Usability(enum.Enum):
UNKNOWN = 0
USER = 1
BOT = 2
BOTH = 4
class MethodInfo:
def __init__(self, name, usability, errors):
self.name = name
self.errors = errors
try:
self.usability = {
'unknown': Usability.UNKNOWN,
... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding se... | 3 | telethon_generator/parsers/methods.py | bb010g/Telethon |
"""Entity for Surepetcare."""
from __future__ import annotations
from abc import abstractmethod
from surepy.entities import SurepyEntity
from homeassistant.core import callback
from homeassistant.helpers.update_coordinator import CoordinatorEntity
from . import SurePetcareDataCoordinator
from .const import DOMAIN
... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": fals... | 3 | homeassistant/components/surepetcare/entity.py | DoctorU/core |
#!/usr/bin/python
# Copyright 2015 Google Inc. 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 a... | [
{
"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 | test_runner.py | tmatsuo/appengine-blobstoremigrator-python |
from bitmovin.errors import FunctionalityNotAvailableError
from bitmovin.resources.models import RTMPInput
from ..rest_service import RestService
class RTMP(RestService):
BASE_ENDPOINT_URL = 'encoding/inputs/rtmp'
def __init__(self, http_client):
super().__init__(http_client=http_client, relative_url... | [
{
"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 | bitmovin/services/inputs/rtmp_input_service.py | camberbridge/bitmovin-python |
"""
1. Clarification
2. Possible solutions
- Prefix Hash
- Trie
3. Coding
4. Tests
"""
# T=O(sigma(wi^2)), S=O(n), wi=len(i-th word)
class Solution:
def replaceWords(self, dictionary: List[str], sentence: str) -> str:
def replace(word):
for i in range(1, len(word)):
if ... | [
{
"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_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": f... | 3 | algorithms/648. Replace Words.py | woozway/py3-leetcode |
# coding: utf-8
from __future__ import unicode_literals
from .. import Provider as DateTimeProvider
class Provider(DateTimeProvider):
@classmethod
def day_of_week(cls):
day = cls.date('%w')
DAY_NAMES = {
"0": "Воскресенье",
"1": "Понедельник",
"2": "Вторни... | [
{
"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 | oscar/lib/python2.7/site-packages/faker/providers/date_time/ru_RU/__init__.py | bhav11esh/Oscar-Bookshelf |
from abc import abstractmethod
from typing import Any, Optional, Union
from PySide6.QtWidgets import QCheckBox, QDoubleSpinBox, QHBoxLayout, QLabel, QSpinBox
from cilissa_gui.widgets.inputs.base import (
MAX_NEG_INTEGER,
MAX_POS_INTEGER,
CQInputWidget,
)
class CQNumberInputWidget(CQInputWidget):
sb:... | [
{
"point_num": 1,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"an... | 3 | cilissa_gui/widgets/inputs/number.py | EXLER/CILISSA |
"""Support for Aqualink temperature sensors."""
from __future__ import annotations
from openpeerpower.components.sensor import DOMAIN, SensorEntity
from openpeerpower.config_entries import ConfigEntry
from openpeerpower.const import DEVICE_CLASS_TEMPERATURE, TEMP_CELSIUS, TEMP_FAHRENHEIT
from openpeerpower.core import... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"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 | openpeerpower/components/iaqualink/sensor.py | pcaston/core |
from unittest.mock import patch
from django.core.management import call_command
from django.db.utils import OperationalError
from django.test import TestCase
class CommandTests(TestCase):
def test_wait_for_db_ready(self):
with patch('django.db.utils.ConnectionHandler.__getitem__') as gi:
gi.... | [
{
"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 | app/core/tests/test_comands.py | MauricioAntonioMartinez/recipie-api-django |
from django.contrib.auth.models import User
from django.test import TestCase
from django.urls import reverse
from boards.models import Board, Post, Topic
from boards.views import PostUpdateView
class PostUpdateViewTestCase(TestCase):
def setUp(self):
self.board = Board.objects.create(name='Django', descr... | [
{
"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 | boards/tests/test_view_edit_post.py | Hsing-Wei/django-boards |
# Copyright 2021 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# pylint: disable=W0401,W0614
from telemetry import story
from telemetry.page import page as page_module
from telemetry.page import shared_page_state
clas... | [
{
"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": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
... | 3 | tools/skp/page_sets/skia_motionmarksuits_desktop.py | vibeus/skia |
from cv2 import *
class Modificaciones (object):
def __init__(self,img,segIni,segFin,posx,posy):
self.im=img
self.height, self.width, self.channels = self.im.shape
self.segIni=segIni
self.segFin=segFin
self.posy=posy
self.posx=posx
d... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding se... | 3 | proyecto/Modificaciones.py | RandyDpoe45/proyectoMultimedial |
import json
from configparser import ConfigParser
from parse import parse
from pathlib import Path
from flask import Flask, render_template, request, redirect, flash, url_for
from pymongo import MongoClient
app = Flask(__name__)
app.secret_key = "5b52c330e091daea8979d94b3cbf6e4ff9f43fdf685787c8"
config = ConfigParser(... | [
{
"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_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"ans... | 3 | slo_config/app.py | dukedbgroup/BayesianTuner |
import unittest
from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.common.by import By
class AssertionsTest(unittest.TestCase):
def setUp(self):
self.driver = webdriver.Chrome('C:/Users/nicol/Documents/ProyectoPython/Selenium-Python/chromed... | [
{
"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 | assertions.py | NicolasImplant/Selenium-Python |
from typing import Optional, List, Dict
from ..model import Model, Entity, Property
from ..block import Block
from ..extensible import Writer
from ..utils import decamelize, to_identifier
class InfoWriter(Writer, name="info"):
"""Writer that creates basic information about the model"""
block_types = ["entity... | [
{
"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 | entigen/writers/info.py | Stiivi/entigen |
from app.ring_command import RingCommand
def test_turn_next(config_json):
ring = RingCommand(config_json)
status = ring.turn_next()
assert status == 2
status = ring.turn_next()
assert status == 3
status = ring.turn_next()
assert status == 1
def test_turn_prev(config_json):
ring = ... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding se... | 3 | tests/unit/test_ring_command.py | washiz99/sam-cli-sample |
#!/usr/bin/python3
# Find all the zephyr build artifacts required for sanitycheck to be able
# to run on another system and tgz them up.
import os
import tarfile
ARCHIVE_FILES = (
'build.ninja',
'CMakeCache.txt',
'.config',
'zephyr.hex',
'generated_dts_board.conf',
'rules.ninja',
)
def scan... | [
{
"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 | zephyr/archive.py | doanac/ci-scripts |
import bpy
import mathutils
import compas_blender
from compas.robots.base_artist import BaseRobotModelArtist
__all__ = [
'RobotModelArtist',
]
class RobotModelArtist(BaseRobotModelArtist):
"""Visualizer for robot models inside a Blender environment.
Parameters
----------
model : :class:`compas.... | [
{
"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/compas_blender/artists/robotmodelartist.py | XingxinHE/compas |
# Copyright 2017, Inderpreet Singh, All rights reserved.
import unittest
import json
from controller import AutoQueuePattern
from web.serialize import SerializeAutoQueue
class TestSerializeConfig(unittest.TestCase):
def test_is_list(self):
patterns = [
AutoQueuePattern(pattern="one"),
... | [
{
"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 | src/python/tests/unittests/test_web/test_serialize/test_serialize_auto_queue.py | AlekLT/seedsync |
import random
import time
import sys
numeros = []
def juntar(lst, string):
lst = str(string).join(str(x) for x in lst)
return lst
def sortear(lista):
print('A gerar valores para a lista: ', end='')
for c1 in range(0, 5):
n = random.randint(0, 100)
lista += [n]
sys.stdout.flus... | [
{
"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 | 1_Python/Desafios/100_Somar_os_pares.py | guilhermebaos/Curso-em-Video-Python |
#!/usr/bin/env python
import os
import sys
from pyramid.config import Configurator
from sqlalchemy import engine_from_config
from sqlalchemy.orm import sessionmaker
from sqlalchemy.orm import scoped_session
from chatter4.models import Base
from pyramid.paster import (
get_appsettings,
setup_logging,
)
DBSes... | [
{
"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 | examples/pyramid_backbone_redis_chat_persistence/chatter4/scripts/populate.py | benthomasson/gevent-socketio |
# -*- coding: utf-8 -*-
from django import template
register = template.Library()
class IndentByNode(template.Node):
def __init__(self, nodelist, indent_level, if_statement):
self.nodelist = nodelist
self.indent_level = template.Variable(indent_level)
if if_statement:
self.if_... | [
{
"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 | django_extensions/templatetags/indent_text.py | Qu4tro/django-extensions |
class Model(object):
"""Interface for detection model.
This allows a model-agnostic control loop"""
def __init__(self, model_path, input_shape):
self.model = model_path
self.input_shape = input_shape
self.index_offset = -1
def detect(self, img, conf_th):
"""
Abs... | [
{
"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 | aisscv/inference/model_interface.py | jo-jstrm/Damaged-Package-Detection |
from django.conf import settings as django_settings
from django.utils.functional import LazyObject
from django_comments_tree.conf import defaults as app_settings
class LazySettings(LazyObject):
def _setup(self):
self._wrapped = Settings(app_settings, django_settings)
class Settings(object):
def __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 | django_comments_tree/conf/__init__.py | sharpertool/django-comments-tree |
#!/usr/bin/python
# (C) 2015 Muthiah Annamalai, <ezhillang@gmail.com>
# Ezhil Language Foundation
#
from __future__ import print_function
import codecs
import json
import sys
import tamil
sys.stdout = codecs.getwriter("utf-8")(sys.stdout)
class WordList:
@staticmethod
def extract_words(filename):
... | [
{
"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 | solthiruthi/data/tamilvu_wordlist.py | aathi2002/open-tamil |
#!/usr/bin/env python
# encoding: utf-8
"""
palindrome_partition.py
Created by Shengwei on 2014-07-02.
"""
# https://oj.leetcode.com/problems/palindrome-partitioning/
# tags: medium, string, dp, palindrome, dfs
"""
Given a string s, partition s such that every substring of the partition is a palindrome.
Return all ... | [
{
"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_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"ans... | 3 | palindrome_partition.py | KevinLuo41/LeetCodeInPython |
from configparser import ConfigParser
import feedparser
import re
import requests
import tweepy
def get_id(xkcd_link: str) -> int:
"""
Exctract comic id from xkcd link
"""
match = re.search(r"\d+", xkcd_link)
if match:
return int(match.group())
else:
return 0
def get_xkcd_rss... | [
{
"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 | xkcd_feed/src/utils.py | lwittchen/twitter-bots |
from django.core.management.base import BaseCommand
# Third-Party
import requests
class Command(BaseCommand):
help = "Command to upload from dropbox."
def add_arguments(self, parser):
parser.add_argument(
'dropbox',
nargs='?',
)
def handle(self, *args, **options)... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answe... | 3 | project/apps/bhs/management/commands/upload_file.py | dbinetti/barberscore |
#!/usr/bin/env python3
#
# Author:
# Tamas Jos (@skelsec)
#
class CommentStreamA:
def __init__(self):
self.data = None
@staticmethod
def parse(dir, buff):
csa = CommentStreamA()
buff.seek(dir.Location.Rva)
csa.data = buff.read(dir.Location.DataSize).decode()
return csa
def __str__(self):
return 'Co... | [
{
"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 | minidump/streams/CommentStreamA.py | lucasg/minidump |
"""
tests.pytests.integration.cli.test_salt_cloud
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"""
import pytest
pytest.importorskip("libcloud", reason="salt-cloud requires >= libcloud 0.11.4")
def test_function_arguments(salt_cloud_cli):
ret = salt_cloud_cli.run("--function", "show_image", "-h")
assert ret... | [
{
"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/pytests/functional/cli/test_salt_cloud.py | babs/salt |
# License: BSD Style.
from ...utils import verbose
from ..utils import _data_path, _get_version, _version_doc
@verbose
def data_path(path=None, force_update=False, update_path=True, download=True,
verbose=None):
"""
Get path to local copy of the kiloword dataset.
This is the dataset from [... | [
{
"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 | mne/datasets/kiloword/kiloword.py | fmamashli/mne-python |
from django import forms
from .models import Transactions, GroupMembers,Group
class Bill_CreateForm(forms.ModelForm):
def __init__(self, user_list, *args, **kwargs):
super(Bill_CreateForm, self).__init__(*args, **kwargs)
self.fields['share_with'] = forms.MultipleChoiceField(widget=form... | [
{
"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 | blog/bills/forms.py | sivatoms/Blog_Posts |
import math
def vertical_to_horizontal_fov(
vertical_fov_in_degrees: float, height: float, width: float
):
assert 0 < vertical_fov_in_degrees < 180
aspect_ratio = width / height
vertical_fov_in_rads = (math.pi / 180) * vertical_fov_in_degrees
return (
(180 / math.pi)
* math.atan(ma... | [
{
"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 | allenact_plugins/ithor_plugin/ithor_util.py | klemenkotar/dcrl |
# coding=utf-8
# Copyright 2021 The Tensor2Robot Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... | [
{
"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 | research/vrgripper/mse_decoder.py | slowy07/tensor2robot |
from django.test import TestCase
from django.contrib.auth import get_user_model
from core import models
def sample_user(email='test@londonappdev.com', password='testpass'):
"""Create a sample user"""
return get_user_model().objects.create_user(email, password)
class ModelTests(TestCase):
def test_crea... | [
{
"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": true
}... | 3 | app/core/tests/test_models.py | arbilse/adv_django_api |
from devind_helpers.permissions import BasePermission, ModelPermission
from devind_notifications.models import Notice
AddNotice = ModelPermission('devind_notifications.add_notice')
class ChangeNotice(BasePermission):
"""Пропускает пользователей, которые могут изменять уведомление."""
@staticmethod
def ... | [
{
"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": true
}... | 3 | devind_notifications/permissions/notice_permissions.py | devind-team/devind-django-notifications |
def suma(a: int, b: int) -> int:
return a + b
def suma2(a: int, b: int) -> int:
return '12'
print(suma2(1, 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": "every_function_has_docstring",
"question": "Does every function in this file have a docs... | 3 | tipado.py | JaviMiot/pythoProfessional |
from flask import Flask, jsonify
from flask import render_template, request, redirect, url_for, make_response, session, flash
from werkzeug.security import generate_password_hash, check_password_hash
from werkzeug.datastructures import FileStorage
from master import master_text, master_image
from google_cloud_nlp impo... | [
{
"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 | flask_main.py | echeese03/Noteworthy |
import json
class Profile:
scales = {"720p": "-1:720", "1080p": "-1:1080"}
def __init__(self, profile):
self.profile = profile
def build_params(self):
bitrate = self.profile["bitrate"]
br_multiple = self.profile["br_variable"] / 100
params = ["-vf", "scale={scale}".forma... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},... | 3 | configuration.py | nicledomaS/Video-quality-analyzer |
from schemas import Event
from typing import Any, List, Union
# local imports
from extractors.SessionFeature import SessionFeature
from schemas.Event import Event
class SessionID(SessionFeature):
def __init__(self, name:str, description:str, sessionID:str):
SessionFeature.__init__(self, name=name, descript... | [
{
"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 | games/WAVES/extractors/SessionID.py | mjgm97/opengamedata-core |
import pytest
from vnc_api import vnc_api
from cvfm import services
@pytest.fixture
def dvs_service(vcenter_api_client, vnc_api_client, database):
return services.DistributedVirtualSwitchService(
vcenter_api_client, vnc_api_client, database
)
@pytest.fixture
def port_1():
port = vnc_api.Port("... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written ... | 3 | tests/unit/services/test_dvs_service.py | atsgen/tf-vcenter-fabric-manager |
from unittest import mock
import pytest
from oauthlib.common import Request as OAuthRequest
from h.oauth.tokens import BearerToken
class TestBearerToken:
@pytest.mark.parametrize(
"attr",
[
"request_validator",
"token_generator",
"expires_in",
"ref... | [
{
"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_multiple_inheritance",
"question": "Does any class in this file use multiple inherita... | 3 | tests/h/oauth/tokens_test.py | tgiardina/rpp-h |
import re
from typing import Dict
from opentrons.hardware_control.g_code_parsing.g_code_functionality_defs.g_code_functionality_def_base import ( # noqa: E501
GCodeFunctionalityDefBase,
)
class GetTempGCodeFunctionalityDef(GCodeFunctionalityDefBase):
RESPONSE_RE = re.compile(r"T:(?P<set_temp>.*?)C:(?P<curren... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer... | 3 | api/src/opentrons/hardware_control/g_code_parsing/g_code_functionality_defs/tempdeck/get_temp_g_code_functionality_def.py | knownmed/opentrons |
# Copyright (c) 2013 NEC Corporation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... | [
{
"point_num": 1,
"id": "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 | neutron_lib/tests/tools.py | pmichali/neutron-lib |
import unittest
from bqs.d_list import DList
class TestQueue(unittest.TestCase):
def test_dlist(self):
dlist = DList()
self.assertTrue(dlist.is_empty())
self.assertEqual(dlist.size(), 0)
self.assertTrue(dlist.is_empty())
def test_dlist2(self):
dlist = D... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
... | 3 | Python/test/test_bqs/test_d_list.py | mnk400/INFO6205 |
from integration.helpers.base_test import BaseTest
class TestBasicApplication(BaseTest):
"""
Basic AWS::Serverless::Application tests
"""
def test_basic_application_s3_location(self):
"""
Creates an application with its properties defined as a template
file in a S3 bucket
... | [
{
"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 | integration/single/test_basic_application.py | will-driven/serverless-application-model |
import os
import pytest
import opencell.database.utils as db_utils
def test_format_plate_design_id():
valid_plate_ids = [123, 'plate123', 'Plate 123', '0123']
for plate_id in valid_plate_ids:
assert db_utils.format_plate_design_id(plate_id) == 'P0123'
# plate number can be zero
valid_plate_i... | [
{
"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 | opencell/database/tests/test_utils.py | czbiohub/opencell-portal-pub |
# Copyright 2011 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer":... | 3 | util/functional.py | natduca/ndbg |
"""empty message
Revision ID: c8f4b08529a4
Revises: bbd324935815
Create Date: 2017-05-02 00:04:57.131824
"""
# revision identifiers, used by Alembic.
revision = 'c8f4b08529a4'
down_revision = 'bbd324935815'
from alembic import op
import sqlalchemy as sa
def upgrade():
# ### commands auto generated by Alembic ... | [
{
"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_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answe... | 3 | backend/migrations/versions/c8f4b08529a4_.py | Tobiaqs/realtime |
"""
Utility file to select GraphNN model as
selected by the user
"""
from nets.molecules_graph_regression.gated_gcn_net import GatedGCNNet
from nets.molecules_graph_regression.gcn_net import GCNNet
from nets.molecules_graph_regression.gat_net import GATNet
from nets.molecules_graph_regression.graphsage_net imp... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding se... | 3 | nets/molecules_graph_regression/load_net.py | MrRyschkov/LGP-GNN |
# -*- coding: utf-8 -*-
# Copyright (c) 2020, trava and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
# import frappe
from frappe.model.document import Document
import frappe
from frappe.utils import getdate
from frappe import _
class Agreement(Document):
def ... | [
{
"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 | trava_erpnext/agreement/doctype/agreement/agreement.py | trava-sport/trava_erpnext_13 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.