source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
# -*- coding: utf-8 -*-
# Copyright 2010 Yefe<yefe@ichuzhou.cn>
from os import path
import codecs
class Hanzi2Pinyin(object):
def __init__(self):
self.table = {}
try:
fp = codecs.open(path.join(path.dirname(
__file__), 'pinyin.txt'), 'r', 'utf-8')
except IOError... | [
{
"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 | 031902327/change_to_pinyin.py | wu372620060/031902327 |
from AbstractObject import *
class ConstantObject(AbstractObject):
def __init__(self, value):
super(ConstantObject, self).__init__(value._value)
def generate(self, out_code):
out_code.append(PUSH(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 | src/fecc_object/ConstantObject.py | castor91/fecc |
from rest_framework import permissions
class UpdateOwnProfile(permissions.BasePermission):
"""Allow users to edit their own profile"""
def has_object_permission(self, request, view, obj):
"""Check user is trying to edit their own profile"""
if request.method in permissions.SAFE_METHODS:
... | [
{
"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 | profiles_api/permissions.py | sergio-alforov/profile-rest-api |
#-*- coding: utf-8 -*-
from .ActionEnum import *
from .Position import Position
class Action(object):
def __init__(self, action, position, value, organism):
self.__action = action
self.__position = position
self.__value = value
self.__organism = organism
# getters & setters
... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than clas... | 3 | virtualworld/model/Action.py | mborzyszkowski/VirtualWorldPython |
def part1(fileName):
counter = 0
prev_number = 999999999
with open(f'data/{fileName}') as f:
lines = f.read().splitlines()
lines = [int(x) for x in lines]
for number in lines:
if number > prev_number:
counter +=1
prev_num... | [
{
"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 | 1.py | rigerta/aoc21 |
# Copyright 2019 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from hashlib import sha256
from recipe_engine import recipe_test_api
class CloudBuildHelperTestApi(recipe_test_api.RecipeTestApi):
def build_success_out... | [
{
"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 | recipes/recipe_modules/cloudbuildhelper/test_api.py | allaparthi/monorail |
from redis import StrictRedis
from datetime import datetime
from pprint import pprint
from serpent.config import config
import json
class AnalyticsClientError(BaseException):
pass
class AnalyticsClient:
def __init__(self, project_key=None):
if project_key is None:
raise AnalyticsClien... | [
{
"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 | serpent/analytics_client.py | nanpuhaha/SerpentAI |
from pyopenproject.business.principal_service import PrincipalService
from pyopenproject.business.services.command.principal.find_all import FindAll
class PrincipalServiceImpl(PrincipalService):
def __init__(self, connection):
super().__init__(connection)
def find_all(self, filters=None):
re... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
}... | 3 | pyopenproject/business/services/principal_service_impl.py | webu/pyopenproject |
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin as BaseUserAdmin
from django.contrib.auth.models import User
from .models import Profile,OAuthRelationship
class ProfileInline(admin.StackedInline):
model = Profile
can_delete = False
class UserAdmin(BaseUserAdmin):
... | [
{
"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 | user/admin.py | cxq1/c |
from __future__ import absolute_import, division, print_function, unicode_literals
from wowp.actors.special import Splitter, Chain
from wowp.schedulers import NaiveScheduler
from wowp.actors import FuncActor
from wowp.util import ConstructorWrapper
def test_splitter():
splitter = Splitter(multiplicity=2, inport_n... | [
{
"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 | wowp/tests/test_special_actors.py | coobas/wowp |
import pygeos as pg
import pandas as pd
import numpy as np
def connect_points(start, end):
"""Convert a series or array of points to an array or series of lines.
Parameters
----------
start : Series or ndarray
end : Series or ndarray
Returns
-------
Series or ndarray
"""
is_... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/c... | 3 | analysis/prep/barriers/lib/points.py | astutespruce/sarp |
class Debt:
def __init__(self, id_nbr, principal, rate, minimum, frequency=12):
self.id = id_nbr
self.principal = principal
self.rate = rate
self.minimum = minimum
self.frequency = frequency
def calculate_compound(self, periods):
new_principal = self.principal * ... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than ... | 3 | src/freed/debt_class.py | Luigi-PastorePica/FreeD |
from datetime import datetime
from itsdangerous import TimedJSONWebSignatureSerializer as Serializer
from itsdangerous import BadSignature, SignatureExpired
from flask import current_app
from app import db, login_manager
from flask_login import UserMixin
@login_manager.user_loader
def load_user(user_id):
return U... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": ... | 3 | web/app/models.py | apemann/concordia |
# coding: utf-8
"""
Cost Management
The API for Project Koku and OpenShift cost management. You can find out more about Cost Management at [https://github.com/project-koku/](https://github.com/project-koku/). # noqa: E501
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-gener... | [
{
"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 | test/test_cost_model_out_all_of.py | chargio/using-koku-api-test |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# Copyright 2011-2021, Nigel Small
#
# 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
#
# Unle... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": ... | 3 | py2neo/timing.py | VitalyRomanov/py2neo |
import os
import utils
import pytest
from utils import argo_utils
def compile_and_run_pipeline(
client,
experiment_id,
pipeline_definition,
input_params,
output_file_dir,
pipeline_name,
):
pipeline_path = os.path.join(output_file_dir, pipeline_name)
utils.run_command(
f"dsl-co... | [
{
"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 | components/aws/sagemaker/tests/integration_tests/utils/kfp_client_utils.py | Intellicode/pipelines |
# Copyright (C) Authors and contributors 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 applic... | [
{
"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 | tests/test_utils.py | cornelius-muhatia/flask-resource-chassis |
from sqlalchemy.orm import Session
from . import models, schemas
def get_user(db: Session, user_id: int):
return db.query(models.User).filter(models.User.id == user_id).first()
def get_users(db: Session, skip: int = 0, limit: int = 100):
return db.query(models.User).offset(skip).limit(limit).all()
def crea... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"... | 3 | python/fastapi/my_super_project/sql_app/crud.py | Pearcee/mac-m1-ash |
"""Interface for AlphaGo self-play"""
from AlphaGo.go import PASS, WHITE, GameState
class play_match(object):
"""Interface to handle play between two players."""
def __init__(self, player1, player2, save_dir=None, size=19):
# super(ClassName, self).__init__()
self.player1 = player1
se... | [
{
"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 | interface/Play.py | ShellyDong/AlphaGo |
import pytest
import tinydb
# pylint: disable = singleton-comparison
TESTSET = [
(
# simple selector
{'name': 'bob'},
tinydb.Query().name == 'bob',
True
), (
# compounded selector
{'status.gameover': False},
tinydb.Query().status.gameover == False,
... | [
{
"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 | tests/test_field_select.py | daitakahashi/tinydb-query |
import time
import numpy as np
import torch
import torch.nn as nn
import pixelssl
def add_parser_arguments(parser):
pixelssl.criterion_template.add_parser_arguments(parser)
def deeplab_criterion():
return DeepLabCriterion
class DeepLabCriterion(pixelssl.criterion_template.TaskCriterion):
def __init_... | [
{
"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 | task/sseg/criterion.py | charlesCXK/PixelSSL |
# 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_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 | aliyun-python-sdk-ons/aliyunsdkons/request/v20190214/OnsTopicListRequest.py | liumihust/aliyun-openapi-python-sdk |
# -*- coding: utf-8 -*-
import os
from hamcrest import *
from test.base import BaseTestCase, container_test
from amplify.agent.common.util import container
from amplify.agent.common.context import context
__author__ = "Grant Hulegaard"
__copyright__ = "Copyright (C) Nginx, Inc. All rights reserved."
__license__ = ""... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answ... | 3 | test/unit/agent/common/util/container.py | dp92987/nginx-amplify-agent |
from collections import OrderedDict
from utility.printable import Printable
# Inheritance Printable
class Transaction(Printable):
"""
A transaction which can be added to a block in the blockchain.
Attributes:
:sender: The sender of the coins.
:recipient: The recipient of the coins.
... | [
{
"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 | transaction.py | jdacode/Blockchain_voting_system |
"""Implementation of special members of sys."""
from pytype import abstract
from pytype import overlay
class SysOverlay(overlay.Overlay):
"""A custom overlay for the 'sys' module."""
def __init__(self, vm):
member_map = {
"version_info": build_version_info
}
ast = vm.loader.import_name("sys"... | [
{
"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 | pytype/sys_overlay.py | jjedele/pytype |
"""Exception classes for jenkins_jobs errors"""
import inspect
def is_sequence(arg):
return (not hasattr(arg, "strip") and
(hasattr(arg, "__getitem__") or
hasattr(arg, "__iter__")))
class JenkinsJobsException(Exception):
pass
class ModuleError(JenkinsJobsException):
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": "all_function_names_snake_case",
"question": "Are all function names in this file written ... | 3 | jenkins_jobs/errors.py | kei-yamazaki/jenkins-job-builder |
import numpy as np
def _pad_data(x, length):
_pad = 0
assert x.ndim == 1
return np.pad(
x, (0, length - x.shape[0]), mode='constant', constant_values=_pad)
def prepare_data(inputs):
max_len = max((len(x) for x in inputs))
return np.stack([_pad_data(x, max_len) for x in inputs])
def _pa... | [
{
"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 | TTS/utils/data.py | vigilancetrent/chatbot-advanced |
import unittest
from metrics.WebResource import WebResource
import logging
logging.basicConfig(
level=logging.DEBUG,
format="[%(asctime)s] {%(filename)s:%(lineno)d} %(levelname)-8s %(message)s",
datefmt="%Y-%m-%d %H:%M:%S",
)
class WebResourceTestCase(unittest.TestCase):
@classmethod
def tearDown... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
... | 3 | tests/test_web_resource.py | IFB-ElixirFr/FAIR-checker |
# coding=utf-8
import sys
import signal
import time
from multiprocessing import Process
from allocator import Allocator, Event
class Manager(object):
"""A manager manage multi allocators, when told to stop, manager would tell the allocator to stop."""
def __init__(self, cfg_list):
self.allocator_li... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cl... | 3 | manager.py | Hugh-wong/hydra |
from fastapi import Body, FastAPI
from pydantic import BaseModel
app = FastAPI()
class Item(BaseModel):
name: str
description: str = None
price: float
tax: float = None
class User(BaseModel):
username: str
full_name: str = None
@app.put("/items/{item_id}")
async def update_item(
*,
... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{... | 3 | async/asgi/fastapi/body.py | decaun/easy-python-study |
from .Section import *
class SectionParagraph(Section):
def __init__(self, api, data):
"""
Internal use only: initialize section object
"""
if (not(data==None) & (type(data) == dict) &
("sectionType" in data.keys())
):
if data["sectio... | [
{
"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 | elabjournal/elabjournal/SectionParagraph.py | matthijsbrouwer/elabjournal-python |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import signal, os
import time
def handler(signum, frame):
print ("Signal handler called with signal: " +str(signum))
print ("complete operations needed when alarm received")
def main():
signal.signal(signal.SIGALRM, handler)
print ("set alarm signal")
si... | [
{
"point_num": 1,
"id": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 lines?",
"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 | py/signal.py | jzhou/ai |
import unittest
class Solution:
def judgeCircle(self, moves):
"""
:type moves: str
:rtype: bool
"""
lr = ud = 0
for move in moves:
if move == 'L':
lr += 1
elif move == 'R':
lr -= 1
elif move == '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_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": fals... | 3 | problems/test_0657.py | chrisxue815/leetcode_python |
from typing import Callable
import pandas as pd
from oolearning.transformers.TransformerBase import TransformerBase
class StatelessColumnTransformer(TransformerBase):
"""
Provides a way to pass functions (i.e. custom transformations) that do not need to save any type of
state, so transformations are lim... | [
{
"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 | oolearning/transformers/StatelessColumnTransformer.py | shane-kercheval/oo-learning |
#!/usr/bin/env python3
class Solution:
def reversePairs(self, nums) -> int:
def merge(src, dst, lo, hi):
if lo >= hi:
return 0
mi = lo+(hi-lo)//2
l, r, ret = merge(dst, src, lo, mi), merge(dst, src, mi+1, hi), 0
i, j, rp = lo, mi+1, lo
... | [
{
"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": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (exc... | 3 | interview/leet/493_Reverse_Pairs.py | eroicaleo/LearningPython |
# qubit number=4
# total number=11
import pyquil
from pyquil.api import local_forest_runtime, QVMConnection
from pyquil import Program, get_qc
from pyquil.gates import *
import numpy as np
conn = QVMConnection()
def make_circuit()-> Program:
prog = Program() # circuit begin
prog += H(0) # number=1
pr... | [
{
"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 | data/p4VQE/R4/benchmark/startPyquil677.py | UCLA-SEAL/QDiff |
# coding=utf-8
# Copyright 2020 The Google Research 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 applicab... | [
{
"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 | task_set/tasks/fixed/fixed_text_rnn_classification_test.py | egonrian/google-research |
import logging
from common_lib.backend_service.generated.backend_service_v1_pb2_grpc import BackendServiceServicer
import common_lib.backend_service.generated.service_types_v1_pb2 as service_messages
from common_lib.grpc import GrpcExceptionHandler
logger = logging.getLogger(__name__)
class BackendService(BackendServ... | [
{
"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 | backend-service/backend_service/service.py | dgildeh/otel-python-cloud-run |
from bouncingball import BouncingBall, BouncingBox
balls = []
boxes = []
def setup():
size(600, 600)
for _ in range(60):
if random(10) < 5:
balls.append(BouncingBall())
else:
boxes.append(BouncingBox())
def draw():
background("#2b3e50")
for ball in balls:
... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 lines?",
"answer": false
}... | 3 | sketches/Bouncing_Ball_Simulator_Stage_5/Bouncing_Ball_Simulator_Stage_5.pyde | kantel/processingpy |
# coding: utf-8
"""
Copyright 2018 OSIsoft, LLC
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 o... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding s... | 3 | osisoft/pidevclub/piwebapi/models/pi_stream_values_links.py | inselbuch/pwap2 |
import click
from typing import Optional
from ..utils.session import read_session
def _validate_session_and_build_name(session: Optional[str], build_name: Optional[str]):
if session and build_name:
raise click.UsageError(
'Only one of --build or --session should be specified')
if session ... | [
{
"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 | launchable/commands/helper.py | takanabe/cli |
#Program to plot a point
from cg_algorithms.circle_algorithms import circle_algorithms
from OpenGL.GL import *
from OpenGL.GLU import *
from OpenGL.GLUT import *
import sys
import math
import time
def init():
glClearColor(0.0, 0.0, 0.0, 0.0)
gluOrtho2D(-250.0, 250.0, -250.0, 250.0)
def plot_points():
g... | [
{
"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 | tests/test_circle.py | Siddharths8212376/cg_algorithms |
class Const:
"""
常量
"""
class ConstError(TypeError):pass
def __setattr__(self, name, value):
if name in self.__dict__:
raise self.ConstError("Can't rebind const (%s)" %name)
self.__dict__[name]=value
LAYOUT = Const()
"""
布局
"""
LAYOUT.SCREEN_WIDTH = 500
LAYOUT.SCREEN_HEIGHT = 600
LAYOUT.SIZE = ... | [
{
"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 | src/const.py | thales-ucas/wumpus |
# Josh Aaron Miller 2021
# VenntDB methods for Characters
import venntdb
from constants import *
# VenntDB Methods
def character_exists(self, username, char_id):
return self.get_character(username, char_id) is not None
def get_character(self, username, char_id):
self.assert_valid("accounts",... | [
{
"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 | db_characters.py | JackNolanDev/vennt-server |
from variables import *
def printAt(x, y, text):
print(f"\033[{y};{x}H{text}")
def printCube():
for z in range(len(cube)):
for y in range(len(cube[z])):
row = ""
for x in range(len(cube[z][y])):
if cube[z][y][x] == 6:
row += f"🔳"
... | [
{
"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 | functions/prints.py | theyadev/Python-Rubik-s-Cube |
from logging import Logger
from time import sleep
from fixtures.constants import Errors, Objects
from fixtures.models.register import RegisterData
import pytest
import logging
logger: Logger = logging.getLogger("moodle")
class TestRegistration:
def test_registration_with_valid_data(self, app, user_data):
... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer":... | 3 | tests/registration/test_registration.py | Gabrieldelamer/moodle_ui_test-main-2 |
import json
import os
import unittest
import yaml
from cerberus import Validator
types_dir = os.path.join(os.path.dirname(__file__), "..", "types")
class ConditionUtilsTest(unittest.TestCase):
@classmethod
def setUpClass(cls):
with open(os.path.dirname(__file__)+'/TypeSpecSchema.yaml') as in_file:
... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
... | 3 | validation/tests.py | qzzhang/narrative_method_specs_ci |
import boto3
class DynamoDB(object):
def __init__(self, table_name):
self.resource = self._resource()
self.client = self._client()
self.table = self.resource.Table(table_name)
self.table_name = table_name
def _resource(self):
return boto3.resource('dynamodb')
def ... | [
{
"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 | storages/dynamodb.py | cofablab/tokenscan |
import re
import pytest
from zipfile_deflate64.deflate64 import Deflate64
@pytest.fixture
def deflate64():
return Deflate64()
def test_instantiate():
deflate64 = Deflate64()
assert isinstance(deflate64, Deflate64)
@pytest.mark.parametrize(
'content_file_name',
[
'10_lines.deflate64',... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excludi... | 3 | tests/test_deflate64.py | sarthakpati/zipfile-deflate64 |
# Copyright 2019 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.
class CodeGenAccumulator(object):
"""
Accumulates a variety of information and helps generate code based on the
information.
"""
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": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding sel... | 3 | third_party/blink/renderer/bindings/scripts/bind_gen/codegen_accumulator.py | sarang-apps/darshan_browser |
import unittest
from selenium import webdriver
class Typos(unittest.TestCase):
def setUp(self):
self.driver = webdriver.Chrome(executable_path = r'./chromedriver.exe')
driver = self.driver
driver.get('http://the-internet.herokuapp.com/')
driver.find_element_by_link_text('Typos').cl... | [
{
"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 | typos.py | Ulzahk/Practica-Selenium-Python |
# -*- coding: utf-8 -*-
# --------------------------------------------------------
# Licensed under the terms of the BSD 3-Clause License
# (see LICENSE for details).
# Copyright © 2018-2021, A.A Suvorov
# All rights reserved.
# --------------------------------------------------------
"""Tests prototype.py"""
from patt... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excludi... | 3 | tests/test_creational/test_prototype.py | smartlegionlab/python-patterns |
__author__ = 'jchugh'
class Token(object):
"""
A class representing a token
"""
def __init__(self, token, secret):
"""
Get an instance of Token
:param token: the oauth token value
:type token: str
:param secret: the oauth token secret
:type secret: str
... | [
{
"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 | simple_oauth/oauth_token.py | joychugh/learning-kafka |
class Events:
def __getattr__(self, name):
if hasattr(self.__class__, '__events__'):
assert name in self.__class__.__events__, \
"Event '%s' is not declared" % name
self.__dict__[name] = ev = _EventSlot(name)
return ev
def __repr__(self):
retu... | [
{
"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_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": ... | 3 | Modules/tobii/eye_tracking_io/utils/events.py | ATUAV/ATUAV_Experiment |
"""
Gripper for Franka's Panda (has two fingers).
"""
import numpy as np
from robosuite.utils.mjcf_utils import xml_path_completion
from robosuite.models.grippers.gripper import Gripper
class PandaGripperBase(Gripper):
"""
Gripper for Franka's Panda (has two fingers).
"""
def __init__(self, path=None... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excludi... | 3 | robosuite/models/grippers/panda_gripper.py | quantumiracle/robolite |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer... | 3 | test/vanilla/Expected/AcceptanceTests/NonStringEnums/nonstringenums/models/_non_string_enums_client_enums.py | tasherif-msft/autorest.python |
from uuid import uuid4
from api.core import Mixin
from .base import db as DB
class User(Mixin, DB.Model):
"""User model."""
__tablename__ = "users"
id = DB.Column(
DB.Integer,
nullable=False,
primary_key=True
)
uuid = DB.Column(
DB.String(32),
unique=True... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": ... | 3 | flask/api/models/user.py | mktung/tvgs-crm |
from __future__ import absolute_import, division, print_function, \
with_statement
import sys
import os
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '../'))
from shadowsocksr.crypto import rc4_md5
from shadowsocksr.crypto import openssl
from shadowsocksr.crypto import sodium
from shadowsocksr.cryp... | [
{
"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 | shadowsocksr/encrypt_test.py | hcaijin/ssrspeedtest |
# -*- coding: utf-8 -*-
def isBadVersion(n):
return n >= 3
class Solution:
def firstBadVersion(self, n):
first, last = 1, n
while first <= last:
mid = (first + last) // 2
if isBadVersion(mid):
last = mid - 1
else:
first = m... | [
{
"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 | leetcode/0278_first_bad_version.py | jacquerie/leetcode |
from flask_pymongo import PyMongo
class TeachersMongoDBRepository():
def __init__(self, application):
self.mongo = PyMongo(application)
def create(self, teacher):
uid = self.mongo.db.teachers.insert_one({
"username": teacher.username,
"password": teacher.password
}).inserted_id
teache... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},... | 3 | src/repositories/MongoDB/TeachersMongoDBRepository.py | claclacla/Fill-a-minimal-API-server-with-Flask-and-Celery-one-drop-at-a-time |
from alembic import op
import sqlalchemy as sa
"""empty message
Revision ID: dc58763db4a8
Revises: 9b1bedfa916b
Create Date: 2017-11-01 15:43:41.695937
"""
# revision identifiers, used by Alembic.
revision = 'dc58763db4a8'
down_revision = '9b1bedfa916b'
def upgrade():
# ### commands auto generated by Alembic ... | [
{
"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 | portal/migrations/versions/dc58763db4a8_.py | ivan-c/truenth-portal |
import os
import taichi as ti
def get_benchmark_dir():
return os.path.join(ti.core.get_repo_dir(), 'benchmarks')
class Case:
def __init__(self, name, func):
self.name = name
self.func = func
self.records = {}
def __lt__(self, other):
return self.name < other.name
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": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding ... | 3 | benchmarks/run.py | kxxt/taichi |
import discord, datetime, time
from discord.ext import commands
start_time = time.time()
class Uptime:
def __init__(self, bot):
self.bot = bot
@commands.command()
async def uptime(self):
"""
Get the time the bot has been active
"""
current_time = time.time()
... | [
{
"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 | cogs/uptime.py | MUEDEV/MUE-Discord-Tips |
class Fan():
"""Default Device with ON / OFF Functions"""
deviceID = None
def __init__(self, deviceID):
if deviceID is None:
print("Provide a Device ID")
return
self.deviceID = deviceID
def setSpeed(self):
pass
def getSpeed(self):
pass
| [
{
"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 | biot/core/fan.py | AroliantBIoT/biot-orangepi-client |
#!/usr/bin/env python
def divisors(number):
return [n for n in range(1, number+1) if number % n == 0]
def is_prime(number):
if number % 2 == 0 or number == 1:
print(f"{number} is not prime")
else:
divisors_list = divisors(number)
if len(divisors_list) > 2:
print(f"{number} is not prime, here the divisor... | [
{
"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 | wily/3.py | zejuniortdr/lightning-talks |
import hashlib
import json
import sys
from logbook import Logger, StreamHandler
from pycoin.coins.bitcoin.networks import BitcoinMainnet
import pycoin.ui.key_from_text
import pycoin.key
import socket
script_for_address = BitcoinMainnet.ui.script_for_address
log = Logger(__name__)
class Connection:
def __init_... | [
{
"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 | tools/client.py | gitter-badger/electrs |
#!/usr/bin/python
# -*- encoding: utf-8; py-indent-offset: 4 -*-
# check_mk is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation in version 2. check_mk is distributed
# in the hope that it will be useful, but... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?... | 3 | src/hmm/checks/huawei_hmm_mezz16_check.py | Huawei/Server_Management_Plugin_Check_MK |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.13.1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
i... | [
{
"point_num": 1,
"id": "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 | kubernetes/test/test_v1_scale_io_volume_source.py | iguazio/python |
# 不变的魔术师
def show_magicians(magicians):
for magician in magicians:
print('magician\'s name is ' + magician)
def make_great(magicians):
for item in magicians:
magicians[magicians.index(item)] = 'The Great ' + item
return magicians
magicians = ['singi', 'sunjun']
magicians2 = make_great(... | [
{
"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 | 8/8.11/invariant_magician.py | singi2016cn/python-scaffold |
from __future__ import absolute_import, division, print_function, unicode_literals
import six
def call(f):
return f() if six.callable(f) else f
def call_recursive(f):
while six.callable(f):
f = f()
return f
| [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?... | 3 | code/python/echomesh/util/Call.py | rec/echomesh |
#!/Users/joshuabrummet/workspace/senior-design/LISPAT/lispat_app/lispat/bin/python3
# $Id: rst2odt_prepstyles.py 5839 2009-01-07 19:09:28Z dkuhlman $
# Author: Dave Kuhlman <dkuhlman@rexx.com>
# Copyright: This module has been placed in the public domain.
"""
Fix a word-processor-generated styles.odt for odtwriter us... | [
{
"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 | lispat_app/lispat/bin/rst2odt_prepstyles.py | ZugNZwang/LISPAT |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | [
{
"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 | keystonemiddleware/tests/unit/audit/test_logging_notifier.py | mahak/keystonemiddleware |
#!/usr/bin/env python
from .utils import *
# This struct's endianness is of the "target"
class TargetStruct(Struct):
a = u16(0xAABB)
# while this struct's endianness is always big.
class SpecificStruct(Struct):
a = u16_be(0xAABB)
class SettingsTests(HydrasTestCase):
def test_priority(self):
s... | [
{
"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 | tests/test_settings.py | Gilnaa/Hydra |
class CompressedGene:
def __init__(self, gene:str)->None:
self._compress(gene)
def _compress(self,gene:str):
self.bit_string : int = 1
for nucleotide in gene.upper():
self.bit_string<<=2
if nucleotide=="A":
self.bit_string |=0b00
elif ... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": ... | 3 | trivialCompression.py | NabinKatwal/DNA-Compression |
class Node:
def __init__(self, data):
self.data = data
self.next = None
class LinkedList:
def __init__(self):
self.head = None
def add(self, data):
node = Node(data)
if not self.head:
self.head = node
else:
current = self.hea... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true... | 3 | challenges/hashmap_left_join/hashmap_left_join/linked_list.py | odai1990/data-structures-and-algorithms |
from engine.steps.IStep import IStep
from sklearn.preprocessing import LabelBinarizer
import numpy as np
import os
class step_prepare(IStep):
"""Calculate or parse the config file to determine the count of classess"""
def __init__(self, output_channel, name=None ):
super().__init__(self, output_channel... | [
{
"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 | source/engine/steps/prepare.py | Borrk/DeepLearning-Engine |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 Nebula, 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
#
# ... | [
{
"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 | openstack_dashboard/dashboards/admin/auditlog/tabs.py | shhui/horizon |
from ._abstract import AbstractScraper
class BowlOfDelicious(AbstractScraper):
@classmethod
def host(cls):
return "bowlofdelicious.com"
def title(self):
return self.schema.title()
def total_time(self):
return self.schema.total_time()
def yields(self):
return 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": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",... | 3 | recipe_scrapers/bowlofdelicious.py | chrisbubernak/recipe-scrapers |
"""agent config table
Revision ID: 571892d95516
Revises: 7d9abd1be32c
Create Date: 2019-02-12 15:56:16.843184
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "571892d95516"
down_revision = "7d9abd1be32c"
branch_labels = None
depends_on = None
def upgrade():
... | [
{
"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 | natlas-server/migrations/versions/571892d95516_agent_config_table.py | pryorda/natlas |
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, VARCHAR, FLOAT, Integer, TIMESTAMP, DateTime
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from contextlib import contextmanager
engine = create_engine('sqlite:///backend/internal.db')
#engine = creat... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{... | 3 | backend/dbengine.py | grzegorzcode/dash-analytics-framework |
import paho.mqtt.client as mqtt
import paho.mqtt.publish as publish
import paho.mqtt.subscribe as subscribe
from flask import current_app as app
MQTT_USERNAME = "admin"
MQTT_PWD = "admin"
MQTT_ID = "SERVERADMIN"
def set_switch_state(device, state):
"""Publish 0 to MQTT broker
:@state: '0' or '1'
... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
... | 3 | src/app/API/utils.py | 3omer/zelite |
from django.test import TestCase
from django.contrib.auth.models import User
from users.models import Profile
class UserModelTests(TestCase):
def setUp(self):
# Create a test user
self.test_user = User.objects.create_user(
id=1,
first_name="Ron",
last_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": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer":... | 3 | users/tests/test_models.py | D-Bits/devroastproject |
import os
import re
import unittest
import json
from troposphere.template_generator import TemplateGenerator
try:
u = unicode
except NameError:
u = str
class TestTemplateGenerator(unittest.TestCase):
maxDiff = None
# those are set by create_test_class
filename = None
expected_output = None
... | [
{
"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 | tests/test_examples_template_generator.py | jpvowen/troposphere |
'''Autogenerated by xml_generate script, do not edit!'''
from OpenGL import platform as _p, arrays
# Code generation uses this
from OpenGL.raw.GL import _types as _cs
# End users want this...
from OpenGL.raw.GL._types import *
from OpenGL.raw.GL import _errors
from OpenGL.constant import Constant as _C
import ctypes
_... | [
{
"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 | deep-rl/lib/python2.7/site-packages/OpenGL/raw/GL/ARB/map_buffer_range.py | ShujaKhalid/deep-rl |
import sys
def setPrintToFile(filename):
stdout_original = sys.stdout
f = open(filename, 'w')
sys.stdout = f
return f,stdout_original
def closePrintToFile(f, stdout_original):
sys.stdout = stdout_original
f.close()
def load_data(file):
words = []
tags_1 = []
tags_2 = []
... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding sel... | 3 | crf_baseline/code/utils.py | dhlab-epfl/LinkedBooksDeepReferenceParsing |
from flask import Flask, jsonify, abort, make_response, request, url_for, render_template, redirect
from . import app, auth
@app.route('/')
def root():
return redirect(url_for('.home'), code=302)
@app.route('/home')
def home():
example = request.args.get('example') or 'Example text'
return render_template... | [
{
"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 | MyBluePrint/web.py | dirkesquire/DirkRo |
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Base class for a stock configuration.
@author: rajsaswa
"""
class StockConfig:
def __init__(self):
pass
def get_stock_url(self):
pass
| [
{
"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 | stock_notifier/stock_config/stock_config.py | saswatraj/stock_notifier |
from screws.freeze.base import FrozenOnly
class _3dCSCG_SF_dofs_FIND(FrozenOnly):
""""""
def __init__(self, dofs):
self._dofs_ = dofs
self._freeze_self_()
def dof_at_corner_of_region(self, region_name, which_corner):
"""We find the dof as a _3dCSCG_SF_DOF instance on the `which_c... | [
{
"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 | objects/CSCG/_3d/forms/standard/base/dofs/do/find.py | mathischeap/mifem |
import logging
import pathlib
from multiprocessing import freeze_support
from typing import Dict
from beer.consensus.constants import ConsensusConstants
from beer.consensus.default_constants import DEFAULT_CONSTANTS
from beer.full_node.full_node import FullNode
from beer.full_node.full_node_api import FullNodeAPI
from... | [
{
"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 | beer/server/start_full_node.py | petrus-hanks/flax-blockchain |
# coding: utf-8
"""
Hydrogen Nucleus API
The Hydrogen Nucleus API # noqa: E501
OpenAPI spec version: 1.9.5
Contact: info@hydrogenplatform.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import nucleus_api
from nu... | [
{
"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 | atom/nucleus/python/test/test_page_question.py | AbhiGupta03/SDK |
import limits
import limits.storage
import limits.strategies
import ipaddress
class RateLimitExceeded(Exception):
pass
class Limiter:
def __init__(self):
self.storage = None
self.limiter = None
self.rate = None
self.subnet = None
self.rate_limit_subnet = True
def ... | [
{
"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 | core/admin/mailu/limiter.py | soriyath/Mailu |
from cec2013lsgo.cec2013 import Benchmark
import numpy as np
from jmetal.core.problem import FloatProblem, S
class CEC2013LSGO(FloatProblem):
def __init__(self, function_type: int = 0, number_of_variables: int = 1000):
super(CEC2013LSGO, self).__init__()
self.number_of_objectives = 1
sel... | [
{
"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 | jmetal/problem/singleobjective/CEC2013LSGO.py | pedronarloch/jMetalPy_phD |
from pathlib import Path
from unittest import TestCase
import numpy as np
import pytest
from cassa.classification_pipeline import (
eigen_decomposition,
get_affinity_matrix,
get_clusters_spectral,
)
from cassa.distance_matrix import DistanceMatrix
path = Path(__file__)
class TestDistMatrix(TestCase):
... | [
{
"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/test_classification_pipeline.py | giorgiosavastano/casa |
'''
Created by auto_sdk on 2015.06.23
'''
from aliyun.api.base import RestApi
class Mts20140618QueryAnalysisJobListRequest(RestApi):
def __init__(self,domain='mts.aliyuncs.com',port=80):
RestApi.__init__(self,domain, port)
self.AnalysisJobIds = None
def getapiname(self):
return 'mts.aliyuncs.com.QueryAnalysisJ... | [
{
"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 | aliyun/api/rest/Mts20140618QueryAnalysisJobListRequest.py | francisar/rds_manager |
import pandas as pd
from dash_app import show_dashboard
def read_data():
data = pd.read_csv('Womens Clothing E-Commerce Reviews.csv', index_col=0)
return data
def main():
data = read_data()
show_dashboard(data)
if __name__ == '__main__':
main()
| [
{
"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 | main.py | angelikakw/e-commerce-reviews |
# Copyright 2018, Kay Hayen, mailto:kay.hayen@gmail.com
#
# Python tests originally created or extracted from other peoples work. The
# parts were too small to be protected.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the ... | [
{
"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_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"ans... | 3 | tests/basics/Unpacking35.py | Mortal/Nuitka |
#!/usr/bin/python
# -*- coding:utf-8 -*-
'''
Created on 2015/04/13
@author: drumichiro
'''
import numpy as np
import matplotlib.mlab as mlab
def generateSample(baseLength, mu, sigma, distFunc):
x = np.empty([])
np.random.seed(0)
for i1 in range(len(mu)):
data = distFunc(mu[i1], sigma[i1], baseLen... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/... | 3 | src/src/engine/myutil/sampler.py | XidaoW/iFac |
def is_palindrome(num):
if str(num) == (str(num)[::-1]):
return True
else:
return False
def to_binary(num):
bin = ""
while num != 0:
bin += str(num % 2)
num //= 2
return bin[::-1]
sum = 0
for i in range(1,1000000):
if is_palindrome(i) and is_palindrom... | [
{
"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 | ProjectEuler/Python/DoubleBasePalindromes.py | dfm066/Programming |
from mesa import Agent
class Gagent(Agent):
def __init__(self, pos, model, stepcount=0, score=0):
super().__init__(pos, model)
self.pos = pos
self.stepCount = stepcount
self.score = score
def some_function(self):
a = 2 + 2
return a
def step(self):
... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
... | 3 | pdpython_model/generic_model/agents.py | seifely/pdpython |
import os, sys
inf = 2**31
def all_pair_shortest_path(matrix, printing=None):
n = len(matrix)
p_cache = [[None] * n for i in range(n)]
for mid in range(n):
for start in range(n):
for end in range(n):
temp = matrix[start][mid] + matrix[mid][end]
if temp < ... | [
{
"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 | ALGO/graph/dp__floyd_warshall__all_pair_shortest_path.py | jainrocky/LORD |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.