source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
# Package Control
import os
import sublime
PCKGCTRL_SETTINGS = "Package Control.sublime-settings"
TABLE_PACKAGE = "Table Editor"
PS_PACKAGE = "PowerShell"
# support the languages and grammars we support.
def IsInstalled(pkg):
settings = sublime.load_settings(PCKGCTRL_SETTINGS)
return pkg in set(sett... | [
{
"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 | packagecon.py | Sinamore/orgextended |
from enum import Enum
from sensors.ph_sensor import PhSensor
class SensorType(Enum):
Undefined = 0,
TDS = 1,
Ph = 2,
WaterLevel = 3,
Voltage = 4
class TriggerType(Enum):
Undefined = 0,
NutrientDose = 1,
PhDose = 2,
WaterPumpCutout = 3
class Hydriot():
sensors = dict()
tri... | [
{
"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_class_has_docstring",
"question": "Does every class in this file have a docstring?... | 3 | Hydriot.PiAgent/hydriot.py | mariusvrstr/hydriot |
from aoc_cas.aoc2020 import day7 as aoc
def testPart1():
data = """
light red bags contain 1 bright white bag, 2 muted yellow bags.
dark orange bags contain 3 bright white bags, 4 muted yellow bags.
bright white bags contain 1 shiny gold bag.
muted yellow bags contain 2 shiny gold bags, 9 faded blue bags.
shiny g... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
... | 3 | test/2020/test_2020_day7.py | TedCassirer/advent-of-code |
#!usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Pilot pen adapters module.
"""
__author__ = 'Ziang Lu'
from friend import PilotPen
from myself.adapters.adapter import Adapter
from myself.assignment_work import Pen
class _PilotPenAsPen(Pen):
"""
Concrete PilotPenAsPen class that works as "Adapter".
N... | [
{
"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 | 3-Structural Patterns/8-Adapter Pattern/Runtime Implementation/Python/myself/adapters/pilot_pen_adapter.py | Ziang-Lu/Design-Patterns |
#!/usr/bin/env python3
import os
import sys
from vmaf.core.quality_runner import QualityRunner
from vmaf.core.result_store import FileSystemResultStore
from vmaf.routine import run_remove_results_for_dataset
from vmaf.tools.misc import import_python_file
__copyright__ = "Copyright 2016-2020, Netflix, Inc."
__license__... | [
{
"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/script/run_cleaning_cache.py | aachenmax/vmaf |
import os
import random
import BaseHTTPServer
PORT = os.getenv('PORT', 8080)
cats = [
'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTz7DnepEt9HKWgFwpdU1U-EkBh_BVyGyl_L2xBA8Maaa3mTQ5E',
'https://thepawington.com/wp-content/uploads/2014/02/kitten.png',
'https://ih0.redbubble.net/image.474690746.707... | [
{
"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 | services/cat-service/server.py | codefresh-io/azure-demo-helm-chart |
# -*- coding: utf-8 -*-
from sqlalchemy import Column, Integer, String, Text, DateTime
from flaski.database import Base
from datetime import datetime
class WikiContent(Base):
__tablename__ = 'wikicontents'
id = Column(Integer, primary_key = True)
title = Column(String(128), unique = True)
body = Column(Text)
de... | [
{
"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 | webui/flaski/models.py | jphacks/NG_1703 |
# Copyright 2019 The FastEstimator Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... | [
{
"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 | fastestimator/op/numpyop/univariate/expand_dims.py | gaurav272333/fastestimator |
from flask import Flask, jsonify, request
from flask_jwt_extended import JWTManager, jwt_required, \
create_access_token, get_jwt_identity
app = Flask(__name__)
app.secret_key = 'super-secret' # Change this!
# Setup the Flask-JWT-Extended extension
jwt = JWTManager(app)
# This is a simple example of a complex ... | [
{
"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 | examples/tokens_from_complex_objects.py | ZebraLan/sanic-jwt-extended |
from pykfs.git.hook.hookobj import PostReceive, CommitMsg, PreReceive
def pre_receive(settings={}):
hook = PreReceive(settings=settings)
return hook()
def post_receive(settings={}):
hook = PostReceive(settings=settings)
return hook()
def commit_msg(settings={}):
hook = CommitMsg(settings=setti... | [
{
"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 | pykfs/git/hook/__init__.py | drekels/pykfs |
from dataclasses import dataclass, field
from itertools import accumulate
from typing import Tuple, Set
from veniq.ast_framework import ASTNode
Statement = ASTNode
@dataclass
class StatementSemantic:
used_objects: Set[str] = field(default_factory=set)
used_methods: Set[str] = field(default_factory=set)
... | [
{
"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": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer"... | 3 | veniq/baselines/semi/_common_types.py | lyriccoder/veniq |
from pymongo import ReturnDocument
from lib.model import Model
from lib.mongodb import db
class UserSentTracking(Model):
collection = db.user_sent
@classmethod
def inc_queued(cls, uid):
return cls(cls.collection.find_one_and_update(
{'uid': uid},
{'$inc': {'last_queued': ... | [
{
"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 | lib/sent_tracking.py | wdr-data/sportsfreund |
# This file is initialized with a code version of this
# question's sample test case. Feel free to add, edit,
# or remove test cases in this file as you see fit!
import program
import unittest
class LinkedList(program.LinkedList):
def addMany(self, values):
current = self
while current... | [
{
"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 | 010 Remove Duplicates From Linked List/Remove_Duplicates_From_Linked_List_sandbox.py | Iftakharpy/AlgoExpert-Questions |
import tensorflow as tf
import tensorflow.keras.backend as K
from tensorflow.keras.layers import Layer, Dropout
class SparseDropout(Layer):
def __init__(self, p=0.5):
super().__init__()
self.p = p
def call(self, x, training=None):
if training is None:
training ... | [
{
"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 | graphgallery/nn/layers/tensorflow/dropout/dropout.py | EdisonLeeeee/GraphGallery |
from core.himesis import Himesis, HimesisPreConditionPatternLHS
import uuid
class HContractUnitR03_ConnectedLHS(HimesisPreConditionPatternLHS):
def __init__(self):
"""
Creates the himesis graph representing the AToM3 model HContractUnitR03_ConnectedLHS
"""
# Flag this instance as compiled now
self.is_compil... | [
{
"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 | UML2ER/contracts/unit/HContractUnitR03_ConnectedLHS.py | levilucio/SyVOLT |
from abc import abstractmethod
from ...kernel.agent.Agent import Agent
from .exceptions import DelegatorException
class Delegator(Agent):
def __init__(self, agentID):
self.__agentList = []
super().__init__(agentID)
def setUp(self):
self._social = True
# Defines the agent s... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inherit... | 3 | pbesa/social/delegator/delegator_agent.py | akenfactory/pbesa |
import sublime_plugin
from .statusbar import StatusMessage
class ClassNavigatorBaseCmd(sublime_plugin.TextCommand):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.status = StatusMessage(sublime_view=self.view)
def save_start_position(self):
self.start_po... | [
{
"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 | naviclass/basecmd.py | malexer/SublimeClassNavigator |
# Copyright 2020 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file acc... | [
{
"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 | src/sagemaker/metadata_properties.py | eitansela/sagemaker-python-sdk |
import sys
sys.path.insert(0, "../") # our fake sigrokdecode lives one dir upper
from pd import Decoder
class DS1307():
def __init__(self):
self.sigrokDecoder = Decoder()
def get_capabilities(self):
settings = {}
for option in self.sigrokDecoder.options :
settingType = ''
choices = ... | [
{
"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 | logic2_analyzers/DS1307/Hla.py | martonmiklos/sigrokdecoders_to_logic2_analyzers |
# Copyright © 2019 Javier Ayres
# This work is free. You can redistribute it and/or modify it under the
# terms of the Do What The Fuck You Want To Public License, Version 2,
# as published by Sam Hocevar. See the LICENSE file for more details.
import re
from function_pipe import FunctionNode
VALID_NON_LETTER_SYMBOL... | [
{
"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 | parser/clean.py | lufte/festejen |
#!/usr/bin/env python3
# Copyright (c) 2016-2017 The QQcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test using named arguments for RPCs."""
from test_framework.test_framework import QQcoinTestFramework
f... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},... | 3 | test/functional/rpcnamedargs.py | wolfoxonly/qqc |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from sqlalchemy import Column, DateTime, Integer, String, func
from sqlalchemy.ext.declarative import declarative_base
from eve_sqlalchemy.config import DomainConfig, ResourceConfig
from eve_sqlalchemy.tests import TestMinimal
Base = declarative_base()
... | [
{
"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 | eve_sqlalchemy/tests/integration/get_none_values.py | Alan01252/eve-sqlalchemy |
# GENERATED BY KOMAND SDK - DO NOT EDIT
import komand
import json
class Input:
FORCE = "force"
ID = "id"
LINK = "link"
V = "v"
class Output:
SUCCESS = "success"
class ContainerRemoveInput(komand.Input):
schema = json.loads("""
{
"type": "object",
"title": "Variables",
"pro... | [
{
"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 | docker_engine/komand_docker_engine/actions/container_remove/schema.py | xhennessy-r7/insightconnect-plugins |
import numpy as np
def sigmoid(x):
return 1 / (1 + np.exp(-x))
def identity_function(x):
return x
def init_network():
network = {}
network['W1'] = np.array([[0.1, 0.3, 0.5], [0.2, 0.4, 0.6]])
network['b1'] = np.array([0.1, 0.2, 0.3])
network['W2'] = np.array([[0.1, 0.4], [0.2, 0.5], [0.3, 0.6]])
netwo... | [
{
"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 | 3/nn.py | Terfno/learn_DL |
# -*- coding: utf-8 -*-
import glob
import csv
import tkinter as tk
import pymysql.cursors
def fsync():
root = tk.Tk()
root.geometry("300x100")
entry = tk.Entry()
entry.place(x=20, y=30)
button = tk.Button(text="OK")
button.place(x=150, y=26)
word = ""
def click():
global word
word = e... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
... | 3 | MainProject/dist/main/server/attendlist_im.py | stuayu/team6 |
import contextlib
import os
from typing import Optional, cast, Callable, Generator, IO, Any
from pathlib import Path
from pacu import settings
get_active_session: Optional[Callable] = None
class PacuException(Exception):
pass
def strip_lines(text: str) -> str:
out = []
for line in text.splitlines():
... | [
{
"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 | pacu/core/lib.py | damienjburks/pacu |
import pytest
import os
import RaveEngine.projectManager as projectManager
import RaveEngine.botManager as botManager
import RaveEngine.configManager as configManager
import Utils.commandManager as commandManager
from flaky import flaky
import Utils.sad as sad
import Utils.utils as utils
@pytest.fixture(autouse=True)
... | [
{
"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 | tests/test_botManager.py | mytab0r/RaveGen-Telegram-bot-generator |
import csv
import os
import numpy as np
class evaluation:
def __init__(self, dest_folder="graphs"):
self.dest_folder = dest_folder
self.metrics_keys = []
self.metrics_values = []
def set_keys(self, keys):
self.metrics_keys = keys
def add_value(self, values):
... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docst... | 3 | evaluation.py | pouyaAB/Accept_Synthetic_Objects_as_Real |
from keras.preprocessing import image
from tqdm import tqdm
def path_to_tensor(img_path):
img = image.load_img(img_path, target_size=(224, 224))
x = image.img_to_array(img)
return np.expand_dims(x, axis=0)
def paths_to_tensor(img_paths):
list_of_tensors = [path_to_tensor(img_path) for img_path in tqd... | [
{
"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 | src/tensor.py | andres-root/ai23d |
# -*- coding: utf-8 -*-
import os
import yaml
basedir = os.path.abspath(os.path.dirname(__file__))
# Load ACL Action file
_ACL_ACTIONS = None
with open(basedir + '/acl-actions.yaml') as _f:
_ACL_ACTIONS = yaml.load(_f.read())
class Config(object):
ADMIN_USERNAME = os.environ.get('ADMIN_USERNA... | [
{
"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 | config.py | pastgift/web-app-template-py |
from __future__ import absolute_import, division, print_function
import pytest
from scitbx import matrix
from .utils import is_approximate_integer_multiple
from .utils import vector_group, group_vectors
def test_is_approximate_integer_multiple():
v1 = matrix.col((34, 50, 20))
v2 = 2.1 * v1.rotate_around_or... | [
{
"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 | algorithms/indexing/basis_vector_search/test_utils.py | jbeilstenedmands/dials |
"""is_sqllab_view
Revision ID: 130915240929
Revises: f231d82b9b26
Create Date: 2018-04-03 08:19:34.098789
"""
import sqlalchemy as sa
from alembic import op
from sqlalchemy.ext.declarative import declarative_base
from rabbitai import db
# revision identifiers, used by Alembic.
revision = "130915240929"
down_revisio... | [
{
"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 | rabbitai/migrations/versions/130915240929_is_sqllab_viz_flow.py | psbsgic/rabbitai |
import paramiko
import os
class MySFTPClient(paramiko.SFTPClient):
def put_dir(self, source, target):
""" Uploads the contents of the source directory to the target path. The
target directory needs to exists. All subdirectories in source are
created under target.
"... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},... | 3 | pythonutils/sftpNode.py | ucguy4u/Utilities |
#!/usr/bin/env python
"""Utilities for globexc project."""
import os
from fabric.api import local
def clean():
"""Remove temporary .pyc and pyo files, env and dist directories."""
clean_py()
local('rm env -rf')
local('rm dist -rf')
def sdist():
"""Make a source distribution."""
local('python setup.py sdist... | [
{
"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 | fabfile.py | mjem/globexc |
import pytest
from PyBall import PyBall
from PyBall.models.config import SituationCode
@pytest.fixture(scope='module')
def test_situation_codes():
pyball = PyBall()
return pyball.get_situation_codes()
def test_get_situation_codes_returns_situation_codes(test_situation_codes):
assert isinstance(test_situ... | [
{
"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 | test/test_situation_code.py | a-hacker/PyBall |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import grpc
import time
from concurrent import futures
import data_pb2
import data_pb2_grpc
_ONE_DAY_IN_SECONDS = 60 * 60 * 24
_HOST = '0.0.0.0'
_PORT = '8888'
class FormatData(data_pb2_grpc.FormatDataServicer):
def DoFormat(self, request, context):
str = re... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": fals... | 3 | grpc/server.py | coreseekdev/mitmproxy |
import torch
import torch.backends.cudnn as cudnn
from collections import OrderedDict
from .modules.utils import yaml_loader, create_model_for_provider
from .modules.craft import CRAFT
def copy_state_dict(state_dict):
if list(state_dict.keys())[0].startswith("module"):
start_idx = 1
else:
sta... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fe... | 3 | src/text_detector/load_model.py | jakartaresearch/receipt-ocr |
import pytest
from robocop.rules import RuleSeverity, Rule
def get_severity_enum(value):
for sev in RuleSeverity:
if sev.value == value:
return sev
return RuleSeverity.INFO
def get_message_with_id_sev(rule_id, sev):
for char in RuleSeverity:
rule_id = rule_id.replace(char.val... | [
{
"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/utest/test_thresholds.py | wagnerd/robotframework-robocop |
#!/usr/bin/env python3
from env import env
from run_common import AWSCli
from run_common import print_session
aws_cli = AWSCli('us-east-1')
ses = env['ses']
def terminate_config_set():
for cs in ses['CONFIGURATION_SETS']:
name = cs['NAME']
cmd = ['ses', 'delete-configuration-set',
... | [
{
"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 | run_terminate_ses.py | HardBoiledSmith/johanna |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.test import TestCase, override_settings
from django.contrib.auth import get_user_model
import json
import responses
## responses:
def kong_login_success():
responses.add(
responses.POST,
'https://kong:8443/test/oauth2/toke... | [
{
"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 | api/tests.py | toast38coza/KongOAuth |
import os
import shutil
def setup_vscode():
def _get_vscode_cmd(port):
executable = "code-server"
if not shutil.which(executable):
raise FileNotFoundError("Can not find code-server in PATH")
# Start vscode in CODE_WORKINGDIR env variable if set
# If not, start ... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 lines?",
"answer": true
... | 3 | jupyter_vscode_proxy/__init__.py | sylus/vscode-binder |
import logging
from esphome.const import (
CONF_INPUT,
CONF_MODE,
CONF_NUMBER,
)
import esphome.config_validation as cv
_ESP_32S3_SPI_PSRAM_PINS = {
26: "SPICS1",
27: "SPIHD",
28: "SPIWP",
29: "SPICS0",
30: "SPICLK",
31: "SPIQ",
32: "SPID",
}
_ESP_32_ESP32_S3R8_PSRAM_PINS = {... | [
{
"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 | esphome/components/esp32/gpio_esp32_s3.py | OttoWinter/esphomeyaml |
import torch
import torch.nn as nn
use_cuda = torch.cuda.is_available()
class CNNClassifier(nn.Module):
def __init__(self, channel, SHHS=False):
super(CNNClassifier, self).__init__()
conv1 = nn.Conv2d(1, 10, (1, 200))
pool1 = nn.MaxPool2d((1, 2))
if channel == 1:
conv2 =... | [
{
"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 | network/cnn.py | hgKwak/SeriesSleepNet- |
# -*- coding: utf-8 -*-
from .processor import QueryProcessor
class MySqlQueryProcessor(QueryProcessor):
def process_insert_get_id(self, query, sql, values, sequence=None):
"""
Process an "insert get ID" query.
:param query: A QueryBuilder instance
:type query: QueryBuilder
... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},... | 3 | eloquent/query/processors/mysql_processor.py | KarthickNamakkalKrishnan/eloquent |
"""
Helper functions for calculating correlation coefficients between lists of
items.
Check the function docs, they expect specific preconditions.
"""
# Placeholders for the fast functions implemented in C.
def symmetric_diff_count(xs, ys):
return len(set(xs).symmetric_difference(ys))
def similarity(xs, ys):
... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (ex... | 3 | lib/recommend/__init__.py | clouserw/olympia |
#!/usr/bin/env python
# ===--- runner.py --------------------------------------------------------===
#
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library Exception
#
# See ht... | [
{
"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 | runner.py | kishikawakatsumi/swift-source-compat-suite |
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community
Edition) available.
Copyright (C) 2017-2020 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in co... | [
{
"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 | auth_backend/tests/resources/base/test_action_collection.py | ZhuoZhuoCrayon/bk-sops |
import os
from data import mstrainsrdata
class Flickr2K(mstrainsrdata.MSSRData):
def __init__(self, args, name='Flickr2K', train=True, benchmark=False):
data_range = [r.split('-') for r in args.data_range.split('/')]
if train:
data_range = data_range[0]
else:
if args... | [
{
"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 | src/data/msflickr2k.py | Merle314/BiSR |
def palindromo(palabra):
palabra = palabra.replace(' ', '')
palabra = palabra.lower()
palabra_invertida = palabra[::-1]
if palabra == palabra_invertida:
return True
else:
return False
def run():
palabra = input("escirbe una palabra: ")
es_palindromo = palindromo... | [
{
"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 | Project1-palindromo.py | KRISX01/Python-Basic-platzi- |
"""The runserver command"""
from __future__ import print_function
from os_tornado.commands import Command
from os_tornado.component_manager import ComponentManager
from os_tornado.exceptions import UsageError
from os_tornado.runner import Runner
class RunserverCommand(Command):
"""Command for starting server"""
... | [
{
"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 | src/os_tornado/commands/runserver.py | cfhamlet/os-tornado |
# -*- coding: utf-8 -*-
"""\
Tests against <https://github.com/mnooner256/pyqrcode/issues/17>
"""
from __future__ import unicode_literals
from nose.tools import eq_
from segno_mimos import pyqrcode
def test_umlaut():
s = 'Märchenbuch'
code = pyqrcode.create(s, error='M')
eq_('binary', code.mode)
eq_(s... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": tru... | 3 | tests/pyqrcode/test_issue17.py | heuer/segno-mimos |
from libs import reaction as reactioncommand
class Reaction(reactioncommand.AdminReactionAddCommand):
'''Retries a text command
**Usage**
React to the message you want to re-run with the retry emoji
(The emoji is server-defined; ask your fellow server members for the correct emoji)'''
def matches(self, react... | [
{
"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 | retry.py | IdeaBot/dev-addons |
# Antes de mais nada install o flask = pip install flask
from flask import Flask
app = Flask(__name__)
@app.route('/')
def homepage():
return 'Essa é minha HomePage'
@app.route('/contatos')
def contatos():
return 'Essa são os meus contatos'
app.run() | [
{
"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 | 17.05.2022/POO/parte3/webBonus/meu_site.py | N0N4T0/python-codes |
"""
Locate origin nodes
Inputs:
originNode: (point3d) position of origin node in form diagram
originNodeID: (integer) index of corresponding node
Outputs:
N: (origin-nodes) The assigned origin nodes
Remarks:
This generates a new instance of origin nodes
"""
import Rhino
... | [
{
"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 | CEM_180/CEM_180_Source/CEM_180_Origin_Node.py | OleOhlbrock/CEM |
import torch
from torch.autograd import Variable
from torch import nn, optim
import torch.nn.functional as F
from transformers import BertForSequenceClassification, BertModel
class BertClassification(nn.Module):
def __init__(self, model="bert-base-uncased"):
super().__init__()
self.bert = BertFor... | [
{
"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 | base/bert.py | luxrck/ML-and-DL-course-work |
# -*- coding: utf-8 -*-
from __future__ import print_function
import pytest
def test_200_success(petstore):
result = petstore.user.deleteUser(username='bozo').result()
assert result is None
@pytest.mark.xfail(reason="Can't get this to 404")
def test_404_user_not_found(petstore):
result = petstore.user.... | [
{
"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 | tests/petstore/user/deleteUser_test.py | andriis/bravado |
from django import template
register = template.Library()
@register.filter
def model_name(obj):
try:
return obj._meta.model_name
except AttributeError:
return None
@register.filter
def filter_course_id(obj, filter_):
return obj.filter(course_id=filter_) | [
{
"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 | courses/templatetags/course_tags.py | pauljherrera/avantiweb |
from django.contrib.auth.models import BaseUserManager
from django.utils.translation import gettext
from django.utils.translation import gettext_lazy as _
class MyUserManager(BaseUserManager):
def create_user(self, email, firstname=None, lastname=None, username=None, password=None):
if not email:
... | [
{
"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 | accounts/managers.py | Zadigo/twitter_template |
import importlib
from types import ModuleType
from typing import Any, Dict
import click
from comeback import plugins
from comeback.utils import verbose_echo
def call(module: ModuleType,
**plugin_params: Dict[str, Any]) -> None:
try:
success, err = module.run_plugin(**plugin_params)
except T... | [
{
"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_return_types_annotated",
"question": "Does every function in this file have a return... | 3 | comeback/plugin_manager.py | agamm/comeback |
"""Various input/output utility functions"""
from typing import Any, Optional
import os
import re
from io import BytesIO
import cloudpickle
import pandas as pd
from zstandard import ZstdCompressor, ZstdDecompressor
COMPRESSION_MAX_OUTPUT_SIZE = 10 ** 9 # 1GB
def pickle_dumps(variable: object) -> bytes:
pickl... | [
{
"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 | ai_inspector/io_utils.py | Giskard-AI/ai-inspector |
from selenium import webdriver
import datetime
import random
import time
from webdriver_manager.chrome import ChromeDriverManager #1st changer
driver = webdriver.Chrome(ChromeDriverManager().install()) #2nd change
driver.get('https://www.instagram.com')
time.sleep(1)
#auto login information
def login():
... | [
{
"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 | Instafollowbot.py | palahsu/Insta-follow-bot |
class Sources:
'''
Source class that defines source objects
'''
def __init__(self,id,name,description,url,category,language,country):
self.id = id
self.name = name
self.description = description
self.url = url
self.category = category
self.language = langu... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"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 | app/models.py | osman2491/News-highlights |
import pytest
from wecs.core import Entity, System, Component, World
from wecs.core import and_filter
# Absolute basics
@pytest.fixture
def world():
return World()
@pytest.fixture
def entity(world):
return world.create_entity()
# Null stuff
@Component()
class NullComponent:
pass
@pytest.fixture
d... | [
{
"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/fixtures.py | owlen/wecs |
from blogapi import db
def is_user_exists(email):
cur = db.connection.cursor()
cur.execute("SELECT email FROM users WHERE email=%s", [email])
res = cur.rowcount
cur.close()
if res == 0:
return False
return True
def is_post_exists(post_id):
cur = db.connection.cursor()
cur... | [
{
"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 | flaskblog/db_util.py | csimpson320/dvpa-api |
import cv2
from dbr import DynamsoftBarcodeReader
dbr = DynamsoftBarcodeReader()
import time
import os
import sys
sys.path.append('../')
import config
def get_time():
localtime = time.localtime()
capturetime = time.strftime("%Y%m%d%H%M%S", localtime)
return capturetime
def read_barcode():
vc = cv2... | [
{
"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 | examples/video/rtsp.py | yushulx/python |
from vg.compat import v2 as vg
from .._common.shape import check_shape_any
__all__ = ["project_point_to_line", "coplanar_points_are_on_same_side_of_line"]
def project_point_to_line(points, reference_points_of_lines, vectors_along_lines):
"""
Project a point to a line, or pairwise project a stack of points to... | [
{
"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 | polliwog/line/_line_functions.py | lace/polliwog |
import sys
from functools import partial
import numpy as np
from .util import generate_uniform_data_set
from .util import generator_from_helper
from .util import poly
koza_func1 = partial(poly, i=4)
def koza_func2(x):
return x ** 5 - 2.0 * x ** 3 + x
def koza_func3(x):
return x ** 6 - 2.0 * x ** 4 + x *... | [
{
"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 | reg_bench/symbolic_regression/koza.py | Ohjeah/regression-benchmarks |
class Matcher(object):
def __init__(self, df=None, metric=None):
pass
def match(self, pair):
self.features = []
self.tsim = None
@classmethod
def normalize(cls, s, df):
return s, 1
def features(self):
try:
return self._features
except AttributeError:
return [self.tsim]
def names(self):
try... | [
{
"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 | matteautils/match/__init__.py | mattea/mattea-utils |
"""
Sizun - Software Quality Inspection
MIT License
(C) 2015 David Rieger
"""
from flask import current_app as app
from .externalexecutor import ExternalExecutor
from sizun.errorhandlers.concrete_error import LineNotFoundError
class LineGrabber:
"""
Provides operations to catch lines from files
by line ... | [
{
"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 | sizun/controllers/linegrabber.py | FrontSide/Sizun |
"""
conftest.py pytest_fixtures can be accessed by multiple test files
test function has fixture func name as param, then fixture func called and result
passed to test func
added localhost.localdomain to /etc/hosts
"""
import pytest
from cnf.main import setup_app
import pymongo
config_name = 'testing'
the_app = setup... | [
{
"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 | cnf/tests/conftest.py | nyck33/my_cnf |
#!/home/jepoy/anaconda3/bin/python
class Duck:
sound = 'Quack quack.'
movement = 'Walks like a duck.'
def quack(self):
print(self.sound)
def move(self):
print(self.movement)
def main():
donald = Duck()
donald.quack()
donald.move()
if __name__ == '__main__':
main() | [
{
"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 | Chapter09/class-working.py | JeffreyAsuncion/PythonEssentialTraining |
"""
This module contains utilities which are shared between other modules.
"""
from typing import Any, Callable
class cached_property: # pylint: disable=invalid-name
"""Descriptor that transforms a class method into a property whose value is
computed once and then cached for subsequent accesses.
Args:
... | [
{
"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 | xcc/util.py | BastianZim/xanadu-cloud-client |
# Copyright 2018 Seth Michael Larson
#
# 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 wr... | [
{
"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 | mashpack/__init__.py | ColmMathews/mashpack |
from datetime import datetime, timedelta
from typing import Dict, Any, Optional
from jose import jwt, JWTError
from app.config import JWT_TOKEN_EXPIRE_MINUTES, SECRET_KEY, JWT_ALGORITHM
from app.modules.auth.use_cases.interfaces import IJwtService
def _added_exp_to_data(data: Dict[str, Any], minutes: int) -> Dict[s... | [
{
"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 | app/modules/auth/use_cases/jwt_service.py | Bloodielie/todo-backend |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2018 Onchere Bironga
#
# 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 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": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/... | 3 | scripts/utils.py | onchere/whack |
"""
aav.utils
~~~~~~~~~
:copyright: (c) 2018 Sander Bollen
:copyright: (c) 2018 Leiden University Medical Center
:license: MIT
"""
from typing import Optional
def comma_float(val: str) -> float:
"""
Get float for a string that may contain commas in stead of dots
:param val: the value to be casted to floa... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true... | 3 | src/array_as_vcf/utils.py | LUMC/array-as-vcf |
import sys
import shutil
import getpass
import time
from tqdm import tqdm as pb
import py_telegram
import os
args = sys.argv
class module_uninstaller:
class FNFE0(OSError):
pass
def uninstall():
print("Telegram Bot Library Module Uninstaller")
print("*********************************... | [
{
"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 | __main__.py | programmer372/python-telegram-api |
from flask import jsonify
from . import api
def bad_request(message):
response = jsonify({'error': 'bad request', 'message': message})
response.status_code = 400
return response
def unauthorized(message):
response = jsonify({'error': 'unauthorized', 'message': message})
response.status_code = 40... | [
{
"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 | app/api/errors.py | Piusdan/todo |
from __future__ import absolute_import, unicode_literals
from django.utils.translation import ugettext_lazy as _
from .base import Block
__all__ = ['StaticBlock']
class StaticBlock(Block):
"""
A block that just 'exists' and has no fields.
"""
def render_form(self, value, prefix='', errors=None):
... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self... | 3 | wagtail/wagtailcore/blocks/static_block.py | patphongs/wagtail |
from ..utils import Object
class UpdateMessageMentionRead(Object):
"""
A message with an unread mention was read
Attributes:
ID (:obj:`str`): ``UpdateMessageMentionRead``
Args:
chat_id (:obj:`int`):
Chat identifier
message_id (:obj:`int`):
Message ... | [
{
"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 | pytglib/api/types/update_message_mention_read.py | iTeam-co/pytglib |
import csv
import logging
import os
from flask import Blueprint, render_template, abort, url_for,current_app
from flask_login import current_user, login_required
from jinja2 import TemplateNotFound
from app.db import db
from app.db.models import Song
from app.songs.forms import csv_upload
from werkzeug.utils import s... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
... | 3 | app/songs/__init__.py | jg-725/IS219-FlaskAppProject |
# -*- coding:utf-8 -*-
# Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the MIT License.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the ... | [
{
"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 | vega/quota/valid_filter.py | jie311/vega |
import clr
def process_input(func, input):
if isinstance(input, list): return [func(x) for x in input]
else: return func(input)
def WSSessionLoadDuration(wssess):
if wssess.__repr__() == 'WorksharingSession': return wssess.GetLoadDuration()
else: return None
OUT = process_input(WSSessionLoadDuration,IN[0]) | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docs... | 3 | python/WorksharingSession.LoadDuration.py | BIMpraxis/Journalysis |
import argparse
from pdm.cli import actions
from pdm.cli.commands.base import BaseCommand
from pdm.cli.options import packages_group, save_strategy_group, update_strategy_group
from pdm.project import Project
class Command(BaseCommand):
"""Add package(s) to pyproject.toml and install them"""
def add_argumen... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 2... | 3 | pdm/cli/commands/add.py | nasyxx/pdm |
import numpy as np
from scipy.optimize import minimize
def QPfun(ud):
def fun(u):
return (u[0] - ud[0])**2 / 2
return fun
def constrains(State):
'''
State[0] = Xp
State[1] = Yp
State[2] = th_p (rad)
State[3] = Xe
State[4] = Ye
State[5] = th_e (rad)
S... | [
{
"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 | omni_diff_rl/scripts/TD3-master/CBF.py | CHH3213/two_loggers |
# ••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
# Copyright (c) 2018, S.J.M. Steffann. This software is licensed under the BSD
# 3-Clause License. Please see the LICENSE file in the project root directory.
# •••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••... | [
{
"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 | measurements/utils.py | nat64check/zaphod_backend |
#!/usr/bin/env python3
import picamera
import rospy
import os
from sensor_msgs.msg import CompressedImage
class CamBuffer:
def __init__(self, width=640, height=480):
self.width = width
self.height = height
self.data = None
def write(self, s):
self.data = s
d... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding... | 3 | src/uwrov_cams/scripts/pi_cam.py | uwrov/nautilus_pi |
import logging
import threading
import time
import traceback
import warnings
from ..machine.machine import TlMachine
LOG = logging.getLogger(__name__)
class Invoker:
def __init__(self, data_controller):
self.data_controller = data_controller
self.exception = None
threading.excepthook = s... | [
{
"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/hark_lang/executors/thread.py | krrome/teal-lang |
#!/usr/bin/python
#+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
#|R|a|s|p|b|e|r|r|y|P|i|.|c|o|m|.|t|w|
#+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
# Copyright (c) 2014, raspberrypi.com.tw
# All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
# Author : sosorr... | [
{
"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 | camera-python/05-streaming/stream_pi.py | ReemDAlsh/camera-python-opencv |
import abc
from autovirt.structs import Message
class MailGateway(abc.ABC):
@abc.abstractmethod
def get_messages_by_subject(self, subject: str) -> list[Message]:
pass
@abc.abstractmethod
def delete_messages(self, messages: list[Message]):
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 | autovirt/mail/interface/mail.py | xlam/autovirt |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
from alipay.aop.api.domain.Institution import Institution
class MybankPaymentTradeBankRootQueryResponse(AlipayResponse):
def __init__(self):
super(MybankPaymentTradeBankRootQueryRe... | [
{
"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 | alipay/aop/api/response/MybankPaymentTradeBankRootQueryResponse.py | antopen/alipay-sdk-python-all |
# Copyright 1999-2020 Alibaba Group Holding Ltd.
#
# 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 a... | [
{
"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 | mars/learn/utils/core.py | ueshin/mars |
# 15. 3Sum
from collections import defaultdict
class Solution:
# TLE at test # 312 out of 313
def threeSum(self, nums):
n = len(nums)
dic = defaultdict(set)
nums.sort()
mini = nums[0]
# d = {}
for i in range(n):
dic[nums[i]].add(i)
# d.setd... | [
{
"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 | leetcode/0-250/175-15. 3Sum.py | palash24/algorithms-and-data-structures |
# coding:utf8
from flask import request
routes = dict()
class ApiServiceBase(type):
def __new__(cls, name, base, attrs):
# super(type, obj) require isinstance(obj, type)
return super(ApiServiceBase, cls).__new__(cls, name, base, attrs)
def __init__(self, name, base, attrs):
if name == 'ApiService':
pas... | [
{
"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 | flask/api_service.py | qzlzwhx/flask |
# File: msadgraph_view.py
#
# Copyright (c) 2022 Splunk 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 applicab... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined insid... | 3 | msadgraph_view.py | splunk-soar-connectors/msadgraph |
# coding: utf-8
"""
AVACloud API 1.17.3
AVACloud API specification # noqa: E501
OpenAPI spec version: 1.17.3
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import avacloud_client_python
from avacloud_client_python.... | [
{
"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 | test/test_service_specification_group_dto.py | Dangl-IT/avacloud-client-python |
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from ax.service.utils import early_stopping as early_stopping_utils
from ax.utils.common.testutils import TestCase
from ax.utils.testing.cor... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer"... | 3 | ax/service/tests/test_early_stopping.py | mpolson64/Ax-1 |
"""``cupy``-based implementation of the random module
"""
__author__ = "Taro Sekiyama"
__copyright__ = "(C) Copyright IBM Corp. 2016"
import numpy.random as r
import cupy as cp
def _to_gpu(a):
arr = cp.empty_like(a)
arr.set(a)
return arr
class RandomState:
def __init__(self, seed):
self._... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inherit... | 3 | src/pydybm/arraymath/dycupy/random.py | rraymondhp/dybm |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations
def update_site_forward(apps, schema_editor):
"""Set site domain and name."""
Site = apps.get_model("sites", "Site")
Site.objects.update_or_create(
id=settings.SITE_ID... | [
{
"point_num": 1,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answe... | 3 | project2/contrib/sites/migrations/0002_set_site_domain_and_name.py | joannex/django_2- |
def mergeSort(arr):
n= len(arr)
if n > 1:
mid = int(n/2)
left = arr[0:mid]
right = arr[mid:n]
mergeSort(left)
mergeSort(right)
Merge(left, right, arr)
def Merge(left, right, arr):
i = 0
j = 0
k = 0
while i < len(left) and j < len(right):
if... | [
{
"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 | merge-sort/merge_sort/merge_sort.py | doaa-1996/Data-structures-and-algorithms1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.