source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
"""Nbconvert exporter to inline css & js for collapsible_headings."""
from __future__ import print_function
from nbconvert.exporters.html import HTMLExporter
from traitlets import Dict
class ExporterInliner(HTMLExporter):
inliner_resources = Dict(
{'css': [], 'js': []}, config=True,
help='css a... | [
{
"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 | src/jupyter_contrib_nbextensions/nbconvert_support/exporter_inliner.py | WTRipper/jupyter_contrib_nbextensions |
# coding: utf-8
"""
Isilon SDK
Isilon SDK - Language bindings for the OneFS API # noqa: E501
OpenAPI spec version: 8
Contact: sdk@isilon.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import isi_sdk_8_2_1
from i... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answ... | 3 | isi_sdk_8_2_1/test/test_auth_group_extended.py | mohitjain97/isilon_sdk_python |
# Copyright 2019 FairwindsOps Inc
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | [
{
"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 | reckoner/yaml/handler.py | CroudTech/reckoner |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import re
import unittest
import traceback
from fasttest_selenium.common import *
class TestCase(unittest.TestCase):
def __getattr__(self, item):
try:
return self.__getattribute__(item)
except:
attrvalue = None
... | [
{
"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 | fasttest_selenium/runner/test_case.py | zym27187/fasttest_selenium |
import unittest
def linear_sum(S, n):
"""Return the sum of the first n numbers of sequence S."""
if n == 0:
return 0
else:
return linear_sum(S, n - 1) + S[n - 1]
class TestLinearSum(unittest.TestCase):
def test_linear_sum(self):
S = [4, 3, 6, 2, 8]
self.assertEqual(23,... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true... | 3 | algorithms/recursion/sum_of_sequence.py | zhijunsheng/tictactoe-py |
# Copyright (c) 2020-2021 Stefan Holdermans.
# Licensed under the MIT License.
"""Canvas-test utilities."""
import os
import unittest
import pyray
class TestCanvas(unittest.TestCase):
"""Test case that can assert whether a canvas' PPM-formatted string
representation matches the contents of a golden file.
... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true... | 3 | tests/acceptance/test_canvas.py | stefanholdermans/pyray |
from waldur_core.core import WaldurExtension
class PlaybookJobsExtension(WaldurExtension):
class Settings:
WALDUR_PLAYBOOK_JOBS = {
'PLAYBOOKS_DIR_NAME': 'ansible_playbooks',
'PLAYBOOK_ICON_SIZE': (64, 64),
}
@staticmethod
def django_app():
return 'waldur_a... | [
{
"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 | src/waldur_ansible/playbook_jobs/extension.py | opennode/waldur-ansible |
# -- api request for BTC and ETH cryptocurrencies --
import requests
import csv
API_KEY = 'A6I5R4BAUKN0Z9CU'
function = 'DIGITAL_CURRENCY_DAILY'
symbol = input("Please write the ticker symbol of the cryptocurrency: ")
market = 'USD'
def get_crypto_raw(API_KEY, function, symbol, market):
url = f'https://www.alp... | [
{
"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 | scripts/crypto_scraping.py | PedroGGBM/CUPreCollege-cryptenergy |
"""add default value to is_invited
Revision ID: 51387d8fda8d
Revises: 6779bebb64e6
Create Date: 2021-12-21 18:19:50.864781
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '51387d8fda8d'
down_revision = '6779bebb64e6'
branch_labels = None
depends_on = None
def... | [
{
"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 | migrations/versions/51387d8fda8d_add_default_value_to_is_invited.py | sicness9/BugHub |
from typing import Union
from diayn_rnn_seq_rnn_stepwise_classifier.networks.bi_rnn_stepwise_seqwise import \
BiRnnStepwiseSeqWiseClassifier
class RnnStepwiseSeqwiseClassifierObsDimSelect(BiRnnStepwiseSeqWiseClassifier):
def __init__(self,
*args,
input_size,
... | [
{
"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 | diayn_seq_code_revised/networks/bi_rnn_stepwise_seqwise_obs_dimension_selection.py | fgitmichael/SelfSupevisedSkillDiscovery |
"""Meta Table
Revision ID: 7bd1ee1840ca
Revises: 9ca5901af374
Create Date: 2020-01-30 01:13:40.069188
"""
from alembic import op
import sqlalchemy as sa
import app.model_types
# revision identifiers, used by Alembic.
revision = '7bd1ee1840ca'
down_revision = '9ca5901af374'
branch_labels = None
depends_on = None
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": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"... | 3 | migrations/versions/7bd1ee1840ca_meta_table.py | cowsarecool5/DailyNotes |
class Aluno():
def __init__(self,nome,curso,tempSdormir):
self.nome = nome
self.curso = curso
self.tempSdormir = tempSdormir
def Estudar(self,estudar):
self.tempSdormir = dormir+(self.tempSdormir)
return self.tempSdormir | [
{
"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 | ClassAluno/ClassAluno.py | vinicius-silvestre/LP2-Heranca |
"""
LeetCode Problem: 8. String to Integer (atoi)
Link: https://leetcode.com/problems/string-to-integer-atoi/
Language: Python
Written by: Mostofa Adib Shakib
Time complexity: O(n)
Space Complexity: O(1)
"""
class Solution:
def myAtoi(self, string: str) -> int:
# This gets rid of any white spaces
... | [
{
"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 | Leetcode/Python Solutions/Strings/StringToInteger.py | Mostofa-Najmus-Sakib/Applied-Algorithm |
import requests
import shutil
import json
import sys
def download_file(url, dest):
response = requests.get(url, stream = True)
response.raise_for_status()
with open(dest, 'wb') as out_file:
shutil.copyfileobj(response.raw, out_file)
def render_latex(output_format, latex, dest_filename, host = 'http://63.142.251.... | [
{
"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/simple_v2.py | classabbyamp/rtex |
import collections
import pytest
from precise_nlp.extract.cspy.cspy import CspyManager
from precise_nlp.extract.cspy.single_finding import SingleFinding
@pytest.mark.parametrize(('sections', 'expected_count'), [
(('A sessile polyp was found at 55 cm proximal to the anus.',
'The polyp was 7 mm in size.',
... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer":... | 3 | tests/test_single_finding.py | kpwhri/precise_nlp |
from matrix_calculus import *
from matrix_calculus.matrix_massage import massage2canonical
from matrix_calculus.show_latex import show_latex
def main():
A = Variable("A")
B = Variable("B")
C = Variable("C")
D = Variable("D")
Y = Variable("Y")
X = Variable("X")
expr = Tr(A*X*B)
wrt = ... | [
{
"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 | demo/test.py | tkerola/matrix_calculus |
"""general utility functions for HTML Map templates"""
def safe_quotes(text, escape_single_quotes=False):
"""htmlify string"""
if isinstance(text, str):
safe_text = text.replace('"', """)
if escape_single_quotes:
safe_text = safe_text.replace("'", "\'")
return safe... | [
{
"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 | cartoframes/viz/html/utils.py | CartoDB/cartoframes |
from flask import Blueprint, render_template
from config.config import mongo
from views.data import DataHarvest, DataContainer
from views.figures import ContainerFigures, HarvestFigures
dmod = Blueprint('dashboard', __name__)
@dmod.route('/')
def index():
dh = DataHarvest(mongo.db.harvest)
gf = HarvestFigure... | [
{
"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 | frontend/views/dashboard.py | WebarchivCZ/grainery |
import requests
import datetime
from dateutil.relativedelta import relativedelta
import json
from auth_handler import get_cj_api_auth
auth = get_cj_api_auth()
auth = (auth[0], auth[1])
base_url = 'http://api.cratejoy.com/v1/'
def get_date_key(endpoint):
if endpoint == 'shipments':
return 'adjusted_orde... | [
{
"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 | app/views/handlers/general_handlers.py | alightedlamp/CrayPI |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import threading
import time
g_num = 0
def work1(num):
global g_num
for i in range(num):
mutex.acquire() # 上锁
g_num += 1
mutex.release() # 解锁
# print("----in work1, g_num is %d---" % g_num)
def work2(num):
global g_num
fo... | [
{
"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 | multitask/thread/05_mutexlock.py | Leo-super/python_base |
# -*- coding: utf-8 -*-
"""
Created on Mon May 10 21:23:13 2021
@author: Administrator
"""
import sys
import os
sys.path.append(os.path.dirname(os.path.abspath(__file__)) + '/../')
from utils import SpiderFormat # noqa: E402
from spider_factory import SpiderFactory # noqa: E402
def test_onnxspider():
spider = 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": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?... | 3 | src/tests/spider_test.py | volvet/spider |
from flask import Flask, render_template, send_file, url_for
app = Flask(__name__)
@app.route('/', methods=['GET', 'POST'])
def main():
return render_template("items.html")
@app.route('/download')
def download():
return send_file('dummy.pdf')
| [
{
"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 | test/resources/requests/requests_app.py | kivipe/qweb |
import discord
from discord.ext import commands
# Set slash commands=True when constructing your bot to enable all slash commands
# if your bot is only for a couple of servers, you can use the parameter
# `slash_command_guilds=[list, of, guild, ids]` to specify this,
# then the commands will be much faster to upload.
... | [
{
"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 | examples/slash_commands.py | Astrea49/enhanced-discord.py |
# Initialize weights
from torch.nn import init, Conv3d, BatchNorm3d, Linear
def xavier(x):
"""Wrapper for torch.nn.init.xavier method.
Parameters
----------
x : torch.tensor
Input tensor to be initialized. See torch.nn.init.py for more information
Returns
-------
torch.tensor
... | [
{
"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 | nitorch/nitorch/initialization.py | derEitel/patch_individual_filter_layer |
from ted_sws.rml_to_html.resources import get_sparql_query
class QueryRegistry:
@property
def TRIPLE_MAP(self):
return get_sparql_query(query_file_name="get_triple_maps.rq")
@property
def LOGICAL_SOURCE(self):
return get_sparql_query(query_file_name="get_logical_source.rq")
@pro... | [
{
"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 | ted_sws/rml_to_html/resources/query_registry.py | meaningfy-ws/ted-xml-2-rdf |
# -*- coding: utf-8 -*-
'''
Grains for junos.
NOTE this is a little complicated--junos can only be accessed via salt-proxy-minion.
Thus, some grains make sense to get them from the minion (PYTHONPATH), but others
don't (ip_interfaces)
'''
__proxyenabled__ = ['junos']
__virtualname__ = 'junos'
def __virtual__():
... | [
{
"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 | salt/grains/junos.py | kaithar/salt |
from PyWebBrowserApp import PluginBase
from PyWebBrowserApp import register_plugin_op
class Plugin(PluginBase):
def __init__(self):
super(Plugin, self).__init__()
self.name = '${P}'
@register_plugin_op
def test_plugin_callback(self, op_data):
# self.info(op_data.get('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 | examples/custom_plugin/plugins/MyFirstPlugin/pwba_plugin.py | pxlc/PyWebBrowserApp |
import pandas as pd
class Reader:
ENGINE = None
@property
def engine(self):
return self.ENGINE.lower() if self.ENGINE else None
def execute(self, query, *ignore, accuracy: bool = False):
raise NotImplementedError("Execute must be implemented on the inherited class")
def _to_df(s... | [
{
"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 | sql/snsql/reader/base.py | opendifferentialprivacy/smartnoise-sdk |
from __future__ import absolute_import
from .activation_maximization import visualize_activation_with_losses
from .activation_maximization import visualize_activation
from .saliency import visualize_saliency_with_losses
from .saliency import visualize_saliency
from .saliency import visualize_cam_with_losses
from .sa... | [
{
"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 | vis/visualization/__init__.py | leelabcnbc/keras-vis |
from urllib.request import urlopen
import gocept.httpserverlayer.wsgi
import unittest
class SimpleApp:
def __call__(self, environ, start_response):
path = environ['PATH_INFO']
statuscode = '404 Not Found'
body = 'Not Found'
headers = []
if path == '/':
statusc... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answ... | 3 | src/gocept/httpserverlayer/wsgi/tests.py | gocept/gocept.httpserverlayer |
#coding=utf-8
#author@alingse
#2016.06.21
hdfs_schema = 'hdfs://'
file_schema = 'file://'
class hdfsCluster(object):
""" 一个hdfs 资源 hdfs uri,path,账户密码认证
"""
def __init__(self,host,port=9000,schema=hdfs_schema):
""" 目前只需要host和port """
self.host = host
self.port = port
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": "every_function_under_20_lines",
"question": "Is every function in this file shorter than... | 3 | hdfshell/cluster.py | alingse/hdfshell |
# coding: utf-8
"""
Octopus Server API
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: 2019.6.7+Branch.tags-2019.6.7.Sha.aa18dc6809953218c66f57eff7d26481d9b23d6a
Generated by: https://github.com/swagger-api... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
... | 3 | test/test_maintenance_configuration_api.py | cvent/octopus-deploy-api-client |
from pprint import pformat
from aiohttp import web
from servicelib.aiohttp.rest_responses import unwrap_envelope
async def assert_status(
response: web.Response, expected_cls: web.HTTPException, expected_msg: str = None
):
data, error = unwrap_envelope(await response.json())
assert (
response.st... | [
{
"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 | services/storage/tests/helpers/utils_assert.py | colinRawlings/osparc-simcore |
from torch import nn, Tensor
from typing import Any, Callable, Iterable, Sequence, Tuple, TypeVar, Union
from .utils.device import Device
try:
from typing import GenericMeta, NamedTupleMeta # type: ignore
class GenericNamedMeta(NamedTupleMeta, GenericMeta):
pass
except ImportError:
from typing i... | [
{
"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 | rainy/prelude.py | alexmlamb/blocks_rl_gru_setup |
import json
from .theExceptions import (CreationError, DeletionError, UpdateError)
class Index(object) :
"""An index on a collection's fields. Indexes are meant to de created by ensureXXX functions of Collections.
Indexes have a .infos dictionary that stores all the infos about the index"""
def __init__(self... | [
{
"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 | pyArango/index.py | jarvisav/pyArango |
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from nipype.testing import assert_equal
from nipype.interfaces.mipav.developer import JistLaminarVolumetricLayering
def test_JistLaminarVolumetricLayering_inputs():
input_map = dict(args=dict(argstr='%s',
),
environ=dict(nohash=True,
usedefault=True... | [
{
"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 | nipype/interfaces/mipav/tests/test_auto_JistLaminarVolumetricLayering.py | grlee77/nipype |
import os
import random
import threading
from time import sleep
from unittest import TestCase
import asn1tools
import wx
import asn1editor
from asn1editor.wxPython.ViewSelect import ViewType
from tests import testHelper
def actions(main_window: asn1editor.wxPython.MainWindow):
def get_children(window: wx.Window... | [
{
"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 | tests/test_MonkeyTest.py | Groops78/asn1editor |
from typing import Any, Dict
from pandas.core.series import Series
from ..caller_base import CallerBase
from ..error.illegal_attr_checker import IllegalAttrChecker
from .graph_object import Graph
class GraphExportRunner(CallerBase, IllegalAttrChecker):
def __call__(self, G: Graph, **config: Any) -> Series:
... | [
{
"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": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (exc... | 3 | graphdatascience/graph/graph_export_runner.py | neo4j/graph-data-science-client |
#!/usr/bin/env python
# coding=utf-8
# vim:ts=4:sts=4:sw=4:et
#
# Author: Hari Sekhon
# Date: 2019-02-26 18:30:53 +0000 (Tue, 26 Feb 2019)
#
# https://github.com/harisekhon/nagios-plugins
#
# License: see accompanying Hari Sekhon LICENSE file
#
# If you're using my code you're welcome to connect with me on Linke... | [
{
"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 | check_kubernetes_health.py | adolci/nagios-plugins |
from django.db import models
from django.utils import timezone
from django.urls import reverse
class Post(models.Model):
title = models.CharField(max_length=100)
body = models.TextField()
created = models.DateTimeField(default=timezone.now)
class Meta:
ordering = ['created']
def __str__(... | [
{
"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 | example/blog/models.py | zmrenwu/django-mptt-comments |
#!/usr/bin/env python
"""Helper functions for working with interfaces"""
__author__ = 'Seman Said, Michael Meisinger'
from pyon.ion.resregistry_standalone import ResourceRegistryStandalone
from yaml import load as yaml_load
from yaml.constructor import ConstructorError
def get_object_definition_from_datastore(sysn... | [
{
"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 | src/pyon/core/interfaces/interface_util.py | scionrep/scioncc_new |
import os
import yaml
import datetime
def checkOutputDirectoryAndCreate(output_folder):
if not os.path.exists('result/' + output_folder):
os.makedirs('result/' + output_folder)
def loadConfig(path):
f = open(path)
config = yaml.load(f, Loader=yaml.FullLoader)
tz = datetime.timezone(datetime.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_params_annotated",
"question": "Does every function parameter in this file have a ty... | 3 | module/config.py | a07458666/UncertaintyFlow |
"""LCM type definitions
This file automatically generated by lcm.
DO NOT MODIFY BY HAND!!!!
"""
import cStringIO as StringIO
import struct
class request_t(object):
__slots__ = ["utime"]
def __init__(self):
self.utime = 0
def encode(self):
buf = StringIO.StringIO()
buf.write(reque... | [
{
"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 | externals/libbot/bot2-param/lcmtypes/python/bot_param/request_t.py | ericmanzi/double_pendulum_lqr |
import json
import requests
HUE_NUPNP_URL = "https://www.meethue.com/api/nupnp"
class APIException(Exception):
pass
class HueAPI(object):
def __init__(self, username):
self.username = username
self.ip = self.discover_hub_ip()
@property
def base_url(self):
return "http://{}... | [
{
"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 | hue/hue_api.py | BenDoan/playground |
from django.shortcuts import render
from django.views import View
from django.http import HttpResponse
from django.utils.decorators import method_decorator
# Create your views here.
"""
类视图必须继承View
类视图中的方法名都必须是请求方法名小写
"""
def my_decorator(view_func):
"""定义装饰器"""
def wrapper(request, *args, **kwargs):
... | [
{
"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 | classview/views.py | SeshinWei/django24 |
import sys
import redis
from rdbtools import RdbCallback, JSONCallback, RdbParser
from rediscluster import RedisCluster
targethost = '127.0.0.1'
class MyCallback(RdbCallback):
_redisclient = None
def __init(self, string_escape=None):
super(MyCallback, self).__init__(string_escape)
def start_data... | [
{
"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 | rdbload.py | kealiu/aws-redis-rdb-loader |
# Comment it before submitting
# class Node:
# def __init__(self, value, next_item=None):
# self.value = value
# self.next_item = next_item
def solution(node, idx):
# Your code
# ヽ(´▽`)/
pass
def test():
node3 = Node("node3", None)
node2 = Node("node2", node3)
node1 ... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
... | 3 | python/sprint_12/tmp/code.py | Talgatovich/algorithms-templates |
class Logger(object):
def __init__(self, name):
self.name = name
def debug(self, msg):
print(':: {0} [debug] :: {1}'.format(self.name, msg))
def info(self, msg):
print(':: {0} [info] :: {1}'.format(self.name, msg))
def warn(self, msg):
print(':: {0} [warning] :: {1}'.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_has_docstring",
"question": "Does every function in this file have a docs... | 3 | util/logger.py | ethanlindley/lego.py |
import pytest
from django.urls import resolve, reverse
pytestmark = pytest.mark.django_db
def test_detail(user, client):
assert (
reverse("users:detail", kwargs={"username": user.username})
== f"/users/{user.username}/"
)
assert resolve(f"/users/{user.username}/").view_name == "users:deta... | [
{
"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 | django_quote_service/users/tests/test_urls.py | andrlik/django_quote_service |
import json
import logging
import requests
from kube_hunter.core.events import handler
from kube_hunter.core.events.types import Event, OpenPortEvent, Service
from kube_hunter.core.types import Discovery
class EtcdAccessEvent(Service, Event):
"""Etcd is a DB that stores cluster's data, it contains configuration ... | [
{
"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 | kube_hunter/modules/discovery/etcd.py | vipulgupta2048/kube-hunter |
from math import sqrt
from math import pi
import json
import tf
from geometry_msgs.msg import Quaternion
def dynamic_euclid_dist(a, b):
o = 0
for i in range(len(a)):
o += (a[i]-b[i])**2
return sqrt(o)
def quaternion_from_euler(roll, pitch, yaw):
'''
From HSR's utils.py
'''
q = tf.t... | [
{
"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 | src/nav/nav_tests/src/azmutils.py | APMMonteiro/european_robotic_league |
# -*- coding: utf-8 -*-
"""
Create a socket file in the Linux system
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2019 by rgb-24bit.
:license: MIT, see LICENSE for more details.
"""
import argparse
import os
import socket
DESCRIPTION = 'Create a socket file in the Linux system'
VERSION ... | [
{
"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 | py/makesocket.py | rgb-24bit/scripts |
# from .bert_graph import BERTGraph
import torch.nn as nn
from .bert import BERT
import pdb
import torch
class CORAL(nn.Module):
"""
CORAL: Code representation learning
"""
def __init__(self, bert: BERT, n_topics=5):
super(CORAL, self).__init__()
self.n_topics = n_topics
# ... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
}... | 3 | src/models/CORAL-LM/coral/model/coral.py | behavioral-data/multiverse |
import logging
import os
import select
import socket
from typing import Union, List
log = logging.getLogger(__name__)
class Receiver:
def __init__(self, irc_socket: socket.socket, socket_timeout: int) -> None:
self._irc_socket = irc_socket
self._socket_timeout = socket_timeout
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": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excludi... | 3 | src/receiver/receiver.py | LoLei/ircbot |
# coding: utf-8
"""
Machine fault diagnosis
List of top level server APIs # noqa: E501
OpenAPI spec version: 1.0.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import swagger_client
from api.model_flow_chart_node_... | [
{
"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 | API/client/python-client-generated/test/test_model_flow_chart_node_component_api.py | zhuofusong/machine-fault-diagnosis |
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from __future__ import unicode_literals
from ..utils import TCat
def test_TCat_inputs():
input_map = dict(args=dict(argstr='%s',
),
environ=dict(nohash=True,
usedefault=True,
),
ignore_exception=dict(deprecated='1.0.0',
nohash=True,
... | [
{
"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 | nipype/interfaces/afni/tests/test_auto_TCat.py | mfalkiewicz/nipype |
# coding: utf-8
"""
Swaggy Jenkins
Jenkins API clients generated from Swagger / Open API specification # noqa: E501
The version of the OpenAPI document: 1.1.2-pre.0
Contact: blah@cliffano.com
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import unitte... | [
{
"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 | clients/python-legacy/generated/test/test_queue_item_impl.py | cliffano/jenkins-api-clients-generator |
import numpy
# Normalization functions
class NormalizationNo():
def normalize(self, img, settings=None):
if settings is None:
settings = {}
return img
class NormalizationMean(NormalizationNo):
def normalize(self, img, settings=None):
if settings is None:
setti... | [
{
"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 | src/prostatex/normalization.py | piotrsobecki/PCa-CNNs2 |
from __future__ import unicode_literals
from pipeline.conf import settings
from pipeline.compilers import SubProcessCompiler
class LiveScriptCompiler(SubProcessCompiler):
output_extension = 'js'
def match_file(self, path):
return path.endswith('.ls')
def compile_file(self, infile, outfile, outd... | [
{
"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 | pipeline/compilers/livescript.py | jnis77diver/django-pipeline |
'''Autogenerated by xml_generate script, do not edit!'''
from OpenGL import platform as _p, arrays
# Code generation uses this
from OpenGL.raw.GLES2 import _types as _cs
# End users want this...
from OpenGL.raw.GLES2._types import *
from OpenGL.raw.GLES2 import _errors
from OpenGL.constant import Constant as _C
... | [
{
"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 | OpenGLWrapper_JE/venv/Lib/site-packages/OpenGL/raw/GLES2/EXT/texture_buffer.py | JE-Chen/je_old_repo |
# coding: utf-8
"""
Isilon SDK
Isilon SDK - Language bindings for the OneFS API # noqa: E501
OpenAPI spec version: 9
Contact: sdk@isilon.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import isi_sdk_8_2_2
from i... | [
{
"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 | isi_sdk_8_2_2/test/test_namespace_objects.py | mohitjain97/isilon_sdk_python |
from django.test import TestCase, Client
from django.contrib.auth import get_user_model
from django.urls import reverse
class AdminSiteTests(TestCase):
def setUp(self):
self.client = Client()
self.admin_user = get_user_model().objects.create_superuser(
email='admin@gmail.com',
... | [
{
"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 | app/core/tests/test_admin.py | SakibAbrar/food-recipe-app-api |
global_var = 10
def function_example(local_var_1, local_var_2):
print(local_var_1, local_var_2, global_var)
function_example(11, 12)
def function_example_1(local_var_1, local_var_2):
global global_var
global_var = 20
print(local_var_1, local_var_2, global_var, id(global_var))
function_example_1(11... | [
{
"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 | var_global_local.py | Spy142/python_lesson_4 |
from django.db import models
from djeneralize.models import BaseGeneralizationModel
from djeneralize.fields import SpecializedForeignKey
#{ General model
class WritingImplement(BaseGeneralizationModel):
name = models.CharField(max_length=30)
length = models.IntegerField()
holder = SpecializedForeignKe... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answ... | 3 | docs/source/example_models.py | 2degrees/djeneralize |
#!/usr/bin/env python
import unittest
def solution(H):
nblocks, blocks = 0, []
for h in H:
if not blocks or h >= blocks[-1]:
blocks.append(h)
continue
b = blocks[-1]
tmp = set()
while b > h:
tmp.add(b)
blocks.pop()
if ... | [
{
"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 | Lesson 7 - Stacks and Queues/StoneWall.py | amaslenn/Codility |
from __future__ import print_function
import os
from cmd3.console import Console
from cmd3.shell import command
from cloudmesh_numpy.command_numpy import command_numpy
class cm_shell_numpy:
def activate_cm_shell_numpy(self):
self.register_command_topic('mycommands', 'numpy')
@command
def do_num... | [
{
"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 | HW3/Add-command/cloudmesh_numpy/cloudmesh_numpy/plugins/cm_shell_numpy.py | futuresystems/465-git4hiroaki |
# -*- coding: utf-8 -*-
from irc3.plugins.command import command
@command
def echo(bot, mask, target, args):
"""Echo command
%%echo <words>...
"""
yield ' '.join(args['<words>'])
@command(permission='admin', public=False)
def adduser(bot, mask, target, args):
"""Add a user
%%adduse... | [
{
"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 | examples/mycommands.py | gtmanfred/irc3 |
import subprocess
import fnmatch
import os
try:
import netifaces
def network_interface_should_exist(name):
if name not in netifaces.interfaces():
raise Exception('Network interface {} not found.'.format(name))
def network_interface_should_be_up(name):
proc = subprocess.Popen([... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written... | 3 | src/Renode/RobotFrameworkEngine/helper.py | hcindyl/renode |
import unittest
from d07_the_treachery_of_whales.d01_the_treachery_of_whales import count_min_fuel_for_crab_moving, \
count_min_revised_fuel_consumption
class TheTreacheryOfWhalesTestCase(unittest.TestCase):
def test_minimal_movement(self):
crabs = [16, 1, 2, 0, 4, 2, 7, 1, 2, 14]
fuel = coun... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
... | 3 | 2021/d07_the_treachery_of_whales/d01_the_treachery_of_whales_test.py | ristvan/advent_of_code |
from datetime import datetime
from freezegun import freeze_time
from unittest.mock import Mock
import wrangler.wrangler as w
def test_validate_run_times():
valid_run_times = [
[(11, 23), (0, 0)],
[(1, 2), (23, 59)],
[(0, 60)]
]
for rt in valid_run_times:
conf = Mock(RUN_AT=... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"ans... | 3 | tests/test_wrangler.py | vikasgorur/ebooks_controller |
"""Tests for Closed-Form matting and foreground/background solver."""
import unittest
import cv2
import numpy as np
import closed_form_matting
class TestMatting(unittest.TestCase):
def test_solution_close_to_original_implementation(self):
image = cv2.imread('testdata/source.png', cv2.IMREAD_COLOR) / 255.... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
... | 3 | test_matting.py | Pandinosaurus/closed-form-matting |
import re
class HeadersFormat(object):
@staticmethod
def call(header):
return HeadersFormat.format(re.sub(r'^HTTP(?:_|-)', '', header, flags=re.I))
@staticmethod
def format(header):
return '-'.join([v.capitalize() for v in re.split(r'_|-', header)])
| [
{
"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 | castle/headers/format.py | castle/castle-python |
from django.test import TestCase
from blog.models import Entry
class EntryModelTest(TestCase):
def test_string_representation(self):
entry = Entry(title="My entry title")
self.assertEqual(str(entry), entry.title)
def test_verbose_name_plural(self):
self.assertEqual(str(Entry._meta.ve... | [
{
"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 | code/blog/tests/test_models.py | elinguiuriel/djangoTDD |
from flask import Flask
import log_config
app = Flask(__name__)
@app.route("/")
def hello():
return "Hello World!"
@app.route('/post/<int:post_id>')
def show_post(post_id):
# show the post with the given id, the id is an integer
return 'Post %d' % post_id | [
{
"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 | com/web/web_app.py | Alex-Ryj/amazon_backend |
"""Basic checks for HomeKit air quality sensor."""
from aiohomekit.model.characteristics import CharacteristicsTypes
from aiohomekit.model.services import ServicesTypes
from homeassistant.helpers import entity_registry as er
from tests.components.homekit_controller.common import setup_test_component
def create_air_... | [
{
"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 | tests/components/homekit_controller/test_air_quality.py | switschel/core |
from math import exp
def SmoothStep(time, Tnuc):
if time <= 0:
return 0
elif time < Tnuc:
return exp((time - Tnuc) ** 2 / (time * (time - 2.0 * Tnuc)))
else:
return 1.0
def GaussianSTF(time, Tnuc, dt):
if time > 0 and time < Tnuc:
Gnuc = SmoothStep(time, Tnuc) - Smoot... | [
{
"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 | preprocessing/science/kinematic_models/GaussianSTF.py | fabian-kutschera/SeisSol |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import re
from models.Regla import *
class MinMaxCaracteresRegla(Regla):
minCarac = 3
maxCarac = 20
def __init__(self):
pass
def run(self,tokens):
tokensAux = []
for token in tokens:
if len(token) >= self.minCa... | [
{
"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 | models/MinMaxCaracteresRegla.py | zamudio-fabian/recuperacion-informacion |
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
def convertBST(self, root: TreeNode) -> TreeNode:
def change(root, val):
if root:
... | [
{
"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 | Convert BST to Greater Tree.py | ngdeva99/Fulcrum |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'cnheider'
from collections import namedtuple
import numpy as np
class InitStateDistribution(object):
StateDist = namedtuple('StateDist', ('state', 'prob'))
def __init__(self):
self.state_tuples = []
def add(self, state, prob):
self.state_t... | [
{
"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 | utilities/curriculum/InitialStateDistribution.py | pyrateml/agent |
from beet import Context, Function, sandbox
from beet.contrib.render import render
def beet_default(ctx: Context):
ctx.data["demo:foo"] = Function(["say {{ ctx.meta.message }}"])
ctx.require(render_functions)
ctx.data["demo:bar"] = Function(["say {{ ctx.meta.message }}"])
ctx.require(sandbox(add_func... | [
{
"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 | tests/examples/code_sandbox_render/demo.py | misode/beet |
import math
def tfidf_calc(wordPerCat, numDocsWithTerm, totalDocs):
for i in wordPerCat:
for key, value in wordPerCat[i].items():
deted = int(numDocsWithTerm[key])
wordPerCat[i][key] = float(float(wordPerCat[i][key]) * (math.log(totalDocs/deted)))
return wordPerCat
def prior_pr... | [
{
"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/util/utils.py | rileymblaylock/bow_mnb |
class NoamOptimizer:
"""
This Hook implements the optimization strategy presented in the "Attention is all you need" paper
Section 5.3.
"""
timing = "pre"
name = "NoamOptimizerHook"
call_for_each_param = False
def __init__(self, num_warmup_steps, factor, model_size):
... | [
{
"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 | transformer/hooks/noam_hook.py | chainer/models |
# encryption.py
#
# Has been created to declutter script.py
# Holds functions related to encryptions and initializes modules needed
#
from flask_bcrypt import Bcrypt #install flask-bcrypt
# Set up bcrypt for password hashing
bcrypt = Bcrypt()
# Give a password to encrpyt by salting and hashing
def encrypt_passwor... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside... | 3 | encryption.py | Dayana20/eduquiz |
import torch.utils.data
def create_dataloader(dataset, dataset_opt):
phase = dataset_opt['phase']
if phase == 'train':
batch_size = dataset_opt['batch_size']
shuffle = dataset_opt['use_shuffle']
num_workers = dataset_opt['n_workers']
else:
batch_size = 1
... | [
{
"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 | codes/data/__init__.py | hellohawaii/BasicSR |
"""Define endpoints related to user reports."""
import logging
from typing import Any, Dict
from .helpers.report import Report
_LOGGER: logging.Logger = logging.getLogger(__name__)
class UserReport(Report):
"""Define a user report object."""
async def status_by_coordinates(
self, latitude: float, l... | [
{
"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_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer... | 3 | pyflunearyou/user.py | bachya/pyflunearyou |
# Copyright 2014 OpenStack Foundation
#
# 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 ... | [
{
"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 | neutron/db/migration/alembic_migrations/versions/1f71e54a85e7_ml2_net_seg_model.py | gampel/neutron |
from datetime import date
import pytest
from db.models.profile_state import ProfileState
from db.models.student import Student
@pytest.fixture
def student_valid_args(create_user, create_branch, create_job_type):
return {
'user': create_user,
'mobile': '0279929444',
'street': 'Teststrasse... | [
{
"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 | db/tests/fixtures/student.py | matchd-ch/matchd-backend |
# standard library
from subprocess import run, PIPE
from typing import List
RUN_CMD_ONFAIL_EXITCODE = 22
def run_cmd(cmd: List[str]):
"""A wrapper around subprocess.run that nicely fails on a non-zero exit code"""
if len(cmd) == 0:
raise ValueError('cmd has to be a non-empty list')
res = run(cm... | [
{
"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 | lib/utils.py | Titorat/SSrehab |
from django.conf import settings
def sentry_dsn(request):
return {
'SENTRY_DSN': settings.SENTRY_DSN
}
def commit_sha(request):
return {
'COMMIT_SHA': settings.COMMIT_SHA
}
| [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answe... | 3 | backend/common/context_processors.py | olegpobedynskyi/Boilerplate-React-Django |
"""Generated class for metadata_testing.json"""
from .metadata_testing_target import TargetTestingMetadata
class TestingMetadata:
"""Generated schema class"""
def __init__(self):
self.targets = None
@staticmethod
def from_dict(source):
if not source:
return None
result = TestingMetadata()
... | [
{
"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 | gencode/python/udmi/schema/metadata_testing.py | noursaidi/udmi |
# built in library
from abc import ABC
class TAMLoopReceiver(ABC):
def __init__(self, name):
self._name = name
self._running = True
self._receiver_settings = {}
def get_name(self):
"""
info: Will get the receiver name
:return: str
"""
return sel... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answ... | 3 | tamcolors/tam/tam_loop_receiver.py | cmcmarrow/tamcolors |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013 Midokura PTE LTD.
# 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/LICEN... | [
{
"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 | python-midonetclient/src/midonetclient/ip_addr_group.py | obino/midonet |
import argparse
class ParserClass:
def __init__(self):
self.parser = argparse.ArgumentParser(description="Crypto / Hash Translator", usage="\npython CryptoHashTranslator.py --translate --text textToTranslate --md5 \npython CryptoHashTranslator.py --generate --text textToGenerate --md5")
self.setAr... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer":... | 3 | src/Miscellaneous/Parser/ParserClass.py | edouard-lebas/CryptoGenerator |
from twisted.internet import reactor
from spyd.game.client.exceptions import InvalidPlayerNumberReference
class ClientPlayerCollection(object):
def __init__(self, cn):
self.cn = cn
self.players = {}
def has_pn(self, pn=-1):
if pn == -1:
pn = self.cn
return pn in ... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding sel... | 3 | src/spyd/game/client/client_player_collection.py | DanSeraf/spyd |
# -*- coding: utf-8 -*-
def command():
return "stop-all-instance"
def init_argument(parser):
parser.add_argument("--farm-no", required=True)
def execute(requester, args):
farm_no = args.farm_no
parameters = {}
parameters["FarmNo"] = farm_no
return requester.execute("/StopAllInstance", param... | [
{
"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 | src/pcc/api/instance/stop_all_instance.py | ymstmsys/pcc-cli |
from sqlalchemy.orm.exc import NoResultFound
from whoahqa.models import (
ClinicFactory,
User,
)
from whoahqa.constants import groups
from whoahqa.constants import permissions as perms
def get_request_user(request):
user_id = request.authenticated_userid
try:
return User.get(User.id == user_... | [
{
"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 | whoahqa/views/request_methods.py | onaio/who-adolescent-hqa |
import json
import os
import pandas
import redis
import types
def json2redis(data,r):
if isinstance(data, types.ListType):
for row in data:
channel = row['channel']
data_type = row['data_type']
rkey = 'channel_{}_{}'.format(channel,data_type)
r.lpush(rkey,ro... | [
{
"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 | train-app/helper_functions.py | pivotal-legacy/moves |
# Copyright 2019 The LUCI Authors. All rights reserved.
# Use of this source code is governed under the Apache License, Version 2.0
# that can be found in the LICENSE file.
from PB.recipes.recipe_engine.engine_tests import proto_properties
PYTHON_VERSION_COMPATIBILITY = 'PY2+3'
DEPS = [
'assertions',
'proper... | [
{
"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 | recipes/engine_tests/proto_properties.py | luci/recipes-py |
class Color:
WHITE = (255, 255, 255)
BLACK = (0, 0, 0 )
GRAY = (100, 100, 100)
RED = (220, 20, 60 )
GREEN = (50, 205, 50 )
YELLOW = (255, 255, 0 )
PURPLE = (218, 112, 214)
ALL = [WHITE, BLACK, GRAY, RED, GREEN]
# just for printing colors in terminal
class bcolo... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false... | 3 | enviorment/colors.py | JLMadsen/TetrisAI |
import io
import sys
import traceback
from userbot.utils import admin_cmd
@borg.on(admin_cmd("exec"))
async def _(event):
if event.fwd_from:
return
await event.edit("Processing ...")
cmd = event.text.split(" ", maxsplit=1)[1]
reply_to_id = event.message.id
if event.reply_to_msg_id:
... | [
{
"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 | userbot/plugins/exec.py | UserBotsMaker/indiauserbot |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.