source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import six
from sentry.api.serializers import serialize
from sentry.models import EventUser, GroupTagValue, TagValue
from sentry.testutils import TestCase
class GroupTagValueSerializerTest(TestCase):
def test_with_user(self):
user = self.cr... | [
{
"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 | tests/sentry/api/serializers/test_grouptagvalue.py | seukjung/sentry-custom |
from rest_framework.authtoken.views import ObtainAuthToken
from rest_framework.authtoken.models import Token
from rest_framework.response import Response
from django.shortcuts import get_object_or_404
from django.http import Http404
from rest_framework.views import APIView
from rest_framework.response import Response... | [
{
"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 | Login/views.py | Carlos-Caballero/cs01 |
import data
import rally_api
from typing import List, Optional
from fastapi import APIRouter, Query
from .models import CoinPrice, CoinPrices
router = APIRouter(prefix="/coins", tags=["coins"])
@router.get("/{coin}/price", response_model=CoinPrice)
async def read_price(coin: str, include_24hr_change: Optional[bool... | [
{
"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 | rallyrolebot/api/price_data.py | Ju99ernaut/RallyRoleBot |
import math
from time import perf_counter
def is_prime(num):
if num == 2:
return True
if num <= 1 or not num % 2:
return False
for div in range(3,int(math.sqrt(num)+1),2):
if not num % div:
return False
return True
def benchtest():
... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"... | 3 | Python/pybenchmark.py | magnopaz/benchmarks |
import gc
from adastra_analysis.common.dataset import Dataset
from adastra_analysis.common.run import Run
from adastra_analysis.runs.util import tfidf_utils
from adastra_analysis.runs.util import wordcloud_utils
class Wordcloud(Run):
"""
"""
def __init__(
self,
name,
file,
... | [
{
"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 | adastra_analysis/runs/wordcloud.py | jayckaiser/adastra-analysis |
import sys
import argparse
import logging
from typing import List
from pacos2.mock.best_effort_actor import BestEffortActor
from pacos2.mock.impulses import PeriodicImpulse, IDiscreteImpulse, IClock
from pacos2.message import Message, Address
from pacos2.impul_discr_evt_engine import (
ImpulsiveDiscreteEventEngine,... | [
{
"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 | pacos3/examples/besteffort/dropping.py | jadnohra/PaCoS |
from http import HTTPStatus
from unittest import TestCase
from pyrdf4j.api_graph import APIGraph
from pyrdf4j.errors import URINotReachable
from pyrdf4j.rdf4j import RDF4J
from tests.constants import AUTH, RDF4J_BASE_TEST
class TestEmpty(TestCase):
def setUp(self):
self.rdf4j = RDF4J(RDF4J_BASE_TEST)
... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
... | 3 | tests/test_empty_repo.py | BB-Open/datenadler_rdf4j |
import json
import requests
from requests.adapters import HTTPAdapter
from requests.packages.urllib3.util.retry import Retry
class APIClient:
__API_URL = 'https://api.1inch.exchange/v2.0/'
def __init__(self, api_url=__API_URL):
self.api_url = api_url
self.request_timeout = 60
self.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_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
... | 3 | py1inch/py1inch.py | hmallen/py1inch |
import arrow
def getCurrentTime(obj, eng):
obj['data']['currentTime'] = arrow.now().to('Asia/Kolkata').format('DD-MMM-YYYY HH:mm:ss ZZ')
def getZoneTime(obj, eng):
obj['data']['zonedTime'] = arrow.now().to(obj['tz']).format('DD-MMM-YYYY HH:mm:ss ZZ') | [
{
"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 | engine/library/clock.py | rudimk/celery-workflow-experiments |
from appium.webdriver.common.mobileby import MobileBy
from app_APPium_test.src.BasePage import BasePage
from app_APPium_test.src.Manual_add import Manual_add
class Add_Member(BasePage):
def go_to_Manual_add(self):
# self.driver.find_element(MobileBy.XPATH, '//*[@text="手动输入添加"]').click()
self.clic... | [
{
"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 | app_APPium_test/src/Add_Member.py | XuXuClassMate/My_Test_PyProject |
import aiokafka
from aiokafka.helpers import create_ssl_context
from service import config
from service.entities import Event
async def kafka_producer_factory(config):
if config["ssl_context"]:
config = dict(config, ssl_context=create_ssl_context(**config["ssl_context"]))
producer = aiokafka.AIOKafka... | [
{
"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 | service/kafka.py | tbicr/sites-availability-checker |
from queue_interface import QueueInterface
from src.list.node import Node
class LinkedQueueImproved(QueueInterface):
""" implementation of a queue using a linked list """
def __init__(self):
""" create an empty queue """
self.length = 0
self.head = None
self.tail = None
def isEmpty(self):
"... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answ... | 3 | python/src/queues/linked_queue_improved.py | marioluan/abstract-data-types |
# Python program for Bitonic Sort. Note that this program
# works only when size of input is a power of 2.
# The parameter dir indicates the sorting direction, ASCENDING
# or DESCENDING; if (a[i] > a[j]) agrees with the direction,
# then a[i] and a[j] are interchanged.
def compAndSwap(a, i, j, dire):
if (dire == ... | [
{
"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 | sorts/bitonic_sort.py | sourcery-ai-bot/Python |
from datetime import datetime
from celery.signals import task_postrun, task_prerun
from arcusd.contracts import Contract
from arcusd.data_access.tasks import save_task_info, update_task_info
@task_prerun.connect
def task_before_run(task_id, task, *args, **kwargs):
request_id = task.request.kwargs.get('request_i... | [
{
"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 | arcusd/daemon/arcusd_signals.py | cuenca-mx/arcusd |
from discord.ext import commands
import datetime
from discord.ext.commands.errors import MissingRequiredArgument, CommandNotFound
class Manager(commands.Cog):
""" Manage the bot """
def __init__(self, bot):
self.bot = bot
@commands.Cog.listener()
async def on_ready(self):
print(f'E... | [
{
"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 | Zephyrus/manager.py | MateusCohuzer/Zephyrus-Discord-Bot |
import sys
def inputli():
return list(map(int,input().split()))
def inputls():
return input().split()
def inputlf():
return list(map(float,input().split()))
N = 500003
tree = [0] * (2 * N)
def make_tree(arr) :
for i in range(n) :
tree[n + i] = arr[i]
for i in range(n - 1, 0, -1) :
... | [
{
"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 | Classes/Class-06/contest-06/B.py | CristianLazoQuispe/ITMO-Training-Camp-2021 |
import os
import pytest
import sqlalchemy as sa
from libweasyl.configuration import configure_libweasyl
from libweasyl.models.meta import registry
from libweasyl.models.tables import metadata
from libweasyl.test.common import NotFound
from libweasyl.test.common import media_link_formatter
from libweasyl import cache
... | [
{
"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 | libweasyl/libweasyl/conftest.py | hyena/weasyl |
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import sys
import recipe_util # pylint: disable=F0401
# This class doesn't need an __init__ method, so we disable the warning
# pylint: disable=W0232
cla... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/c... | 3 | recipes/mojo.py | azunite/chrome_build |
#
# Copyright (c) 2019 UAVCAN Development Team
# This software is distributed under the terms of the MIT License.
# Author: Pavel Kirienko <pavel.kirienko@zubax.com>
#
from __future__ import annotations
import abc
import typing
class CRCAlgorithm(abc.ABC):
"""
Implementations are default-constructible.
"... | [
{
"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 | pyuavcan/transport/commons/crc/_base.py | pcarranzav2/pyuavcan |
from pycontacts.managers import BaseManager
from conftest import ExtenedBaseModel
class ExampleManager(BaseManager):
cls = ExtenedBaseModel
def test_new_manager(address_book):
examples = ExampleManager(address_book)
assert examples.book == address_book
def test_manager_create(address_book):
examp... | [
{
"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 | tests/test_base_manager.py | kibernick/pycontacts |
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from sauce_searcher_server.api import (
get_anime,
get_doujin,
get_light_novel,
get_manga,
get_visual_novel,
)
from sauce_searcher_server.models import Anime, Doujin, LightNovel, Manga, VisualNovel
app = FastAPI()
app.a... | [
{
"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 | server/sauce_searcher_server/main.py | f4str/sauce-searcher |
"""
https://leetcode.com/problems/average-of-levels-in-binary-tree/description/
Given a non-empty binary tree, return the average value of the nodes on each level in the form of an array.
Example 1:
Input:
3
/ \
9 20
/ \
15 7
Output: [3, 14.5, 11]
Explanation:
The average value of nodes on level 0 ... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{... | 3 | solutions/637.py | abawchen/leetcode |
from node import Node
class LinkedList:
"""
This class is the one you should be modifying!
Don't change the name of the class or any of the methods.
Implement those methods that current raise a NotImplementedError
"""
def __init__(self):
self.__root = None
def get_root(self):
... | [
{
"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 | 1_linked_list/linkedlist.py | PythonPostgreSQLDeveloperCourse/Section13 |
from django.db import models
from django.utils.translation import ugettext_lazy as _
from .feedback import Feedback
class SearchResultFeedback(Feedback):
"""
Database model representing feedback about search results (e.g. empty results).
"""
search_query = models.CharField(max_length=1000, verbose_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_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
... | 3 | integreat_cms/cms/models/feedback/search_result_feedback.py | Carlosbogo/integreat-cms |
import textwrap
import pytest
from .common import (
precollected,
researcher,
researchers,
some_other_paper,
some_paper,
)
def test_bibtex(some_paper):
expected = textwrap.dedent(
"""
@inproceedings{merrienboer2018-differentiation97,
author = {Bart van Merrienboer... | [
{
"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_papers.py | notoraptor/paperoni |
# SPDX-License-Identifier: MIT
from pytest_mock.plugin import MockerFixture as MockFixture
import pytest
from upkeep import CONFIG_GZ, KernelConfigError, rebuild_kernel
def test_rebuild_kernel_no_config_yes_gz(mocker: MockFixture) -> None:
def isfile(x: str) -> bool:
if x == '.config':
return... | [
{
"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": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?"... | 3 | tests/test_rebuild_kernel.py | Tatsh/upkeep |
import re
from collections import defaultdict
from datetime import datetime
from elasticsearch_dsl import Keyword, Text
from protean import BaseAggregate, BaseValueObject
from protean.core.model import BaseModel
from protean.fields import DateTime, Integer, String
from protean.fields import Text as ProteanText
from ... | [
{
"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 | tests/adapters/model/elasticsearch_model/elements.py | mpsiva89/protean |
import pytest
import flopt
from flopt import Variable, Problem, Solver
from flopt.performance import CustomDataset
@pytest.fixture(scope='function')
def a():
return Variable('a', lowBound=2, upBound=4, cat='Continuous')
@pytest.fixture(scope='function')
def b():
return Variable('b', lowBound=2, upBound=4, ca... | [
{
"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 | tests/test_Performance.py | nariaki3551/flopt |
import time
import socket
import random
from subprocess import run, PIPE
test_dir = '"/Users/oliver/Google Drive/Cambridge/CST_II/project/testing/gtspeed"'
def test_git():
with open('test_strings.txt') as f:
for line in f:
p = run(['gitmaildir_cli', 'deliver', '--dir='+test_dir], stdout=PIPE, ... | [
{
"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 | evaluation/scripts/data_generation/deliver_many.py | odnh/gitmaildir |
from operator import itemgetter
from .. import support_utils as sup
def print_stats(log, conformant, traces):
print('complete traces:', str(len(traces)),
', events:', str(len(log.data)), sep=' ')
print('conformance percentage:',
str(sup.ffloat((len(conformant) / len(traces)) * 100, 2)) + ... | [
{
"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 | src/simod/log_repairing/conformance_checking.py | AdaptiveBProcess/SiMo-Discoverer |
from flexlmtools import parse_query, is_valid_server_name
import pytest
APP_FEATURES = {'feat1': (2, 0), 'feat2': (5, 1),
'feat6': (3, 3), 'feat-add': (2, 0),
'feat_opt': (1, 1)}
def test_parse_query():
with open('./test/app-features.txt', 'r') as f:
lines = f.read()
... | [
{
"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 | test/flexlmtools_test.py | shohirose/flexlm-python-scripts |
# Problem 35: Circular primes
# https://projecteuler.net/problem=35
def prime_sieve(n):
primes = set(range(2, n+1))
for i in range(2, (n+1) // 2):
if i in primes:
m = 2
while i*m <= n:
primes.discard(i*m)
m += 1
return primes
... | [
{
"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 | p035.py | yehnan/project_euler_python |
import unittest
import score
class Testquadratic_weighted_kappa(unittest.TestCase):
def test_confusion_matrix(self):
conf_mat = score.confusion_matrix([1,2],[1,2])
self.assertEqual(conf_mat,[[1,0],[0,1]])
conf_mat = score.confusion_matrix([1,2],[1,2],0,2)
self.assertEqual(... | [
{
"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 | Evaluation_Metrics/Python/score/test/test_score.py | Teeefa/AES-Benchmark |
# -*- coding: utf-8 -*-
import sys
import os
import re
sys.path.append('../') # noqa
from jinja2 import Template
from cli_bdd.core.steps import (
command,
environment,
file as file_steps,
)
BASE_PATH = os.path.dirname(os.path.normpath(__file__))
TEMPLATES_PATH = os.path.join(BASE_PATH, 'templates')
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 | docs/generator.py | chibisov/cli-bdd |
# -*- coding: utf-8 -*-
import requests
import hashlib
import json
import os
def saveNewData():
with open(fn, 'w') as f:
json.dump(TargetData.json(), f,ensure_ascii=False)
def saveHashvalue():
with open(fnHash, 'w') as hashread:
hashread.write(NewHash)
def CalHashvalue():
data = hashl... | [
{
"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 | 03302020.py | igiscy/ForPy-automatic-update-JSON |
import tkinter as tk
class App(tk.Tk):
def __init__(self):
super().__init__()
self.title("Basic canvas")
self.canvas = tk.Canvas(self, bg="white")
self.label = tk.Label(self)
self.canvas.bind("<Motion>", self.mouse_motion)
self.canvas.pack()
self.label.pac... | [
{
"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 | Chapter07/code/chapter7_01.py | sTone3/Tkinter-GUI-Application-Development-Cookbook |
# -*- coding: utf-8 -*-
# Python imports
# 3rd Party imports
# App imports
from .individual import Individual
class Crossover:
parent_a: Individual
parent_b: Individual
individual_class: type
def __init__(self, individual_class: type = Individual):
self.individual_class = individual_class
... | [
{
"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/GenPro/genetic_algorithm/crossover.py | Hispar/procedural_generation |
from werkzeug.security import safe_str_cmp
from user import User
users = [
User(1, 'bob', '1234')
]
username_mapping = {u.username: u for u in users}
userid_mapping = {u.id: u for u in users}
def authenticate(username, password):
user = User.find_by_username(username)
if user and safe_str_cmp(user.password, passw... | [
{
"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 | Session 5/security.py | valdirsalustino/python-rest-api |
# Copyright 2014 ARM Limited
#
# Licensed under the Apache License, Version 2.0
# See LICENSE file for details.
# standard library modules, , ,
from __future__ import print_function
from collections import defaultdict
import logging
# validate, , validate things, internal
from yotta.lib import validate
def addOption... | [
{
"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 | yotta/licenses.py | microbit-foundation/yotta |
from typing import List, Any
import os
def searchFiles(keyword: str , path: str):
"""Search for files"""
files: List[Any] = []
for root, dirs, files in os.walk(path):
for file in files:
if keyword in file:
files.append(root + '\\' + str(file))
return files
... | [
{
"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 | py_everything/search.py | Morgan-Phoenix/py_everything |
from django.contrib.auth import views as auth_views
from django.urls import reverse_lazy
from django.views.generic import FormView
from .. import forms, mails
from ..tokens import password_reset_token_generator
class PasswordReset(FormView):
form_class = forms.PasswordResetForm
template_name = 'django_auth2/... | [
{
"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 | django_auth2/views/reset_password.py | Nick1994209/django-auth2 |
'''
Created on 01 gen 2018
@author: Andrea Graziani - matricola 0189326
@version: 1.0
'''
from GraphNode import GraphAdjacencyListNode
from AcyclicDirectGraph import AcyclicDirectGraph
class AdjacencyListGraph(AcyclicDirectGraph):
'''
This class represents a graph rappresented with adjacency list.
'''
... | [
{
"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 | AdjacencyListGraph.py | AndreaG93/Visibility-Degree-Graph |
from django.contrib.auth.base_user import BaseUserManager
from django.utils.translation import ugettext_lazy as _
class CustomUserManager(BaseUserManager):
def create_user(self, nick, email, password, first_name, last_name, **extra_fields):
"""
Create and save a User with the given nickname, email... | [
{
"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 | calc/managers.py | BAcode-X/webCalc |
from flask import jsonify
from flask_api import status
def ok(json_data: dict) -> tuple:
return json_data, status.HTTP_200_OK
def created(json_data: dict) -> tuple:
return json_data, status.HTTP_201_CREATED
def bad_request(message: dict) -> tuple:
return jsonify(message), status.HTTP_400_BAD_REQUEST
... | [
{
"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 | utils/responses.py | pablobascunana/your-locations-flask-mongo |
"""
Revision ID: 0122_add_service_letter_contact
Revises: 0121_nullable_logos
Create Date: 2017-09-21 12:16:02.975120
"""
import sqlalchemy as sa
from alembic import op
from sqlalchemy.dialects import postgresql
revision = "0122_add_service_letter_contact"
down_revision = "0121_nullable_logos"
def upgrade():
o... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
... | 3 | migrations/versions/0122_add_service_letter_contact.py | cds-snc/notifier-api |
def destructure(obj, *params):
import operator
return operator.itemgetter(*params)(obj)
def greet(**kwargs):
year, day, puzzle = destructure(kwargs, 'year', 'day', 'puzzle')
print('Advent of Code')
print(f'-> {year}-{day}-{puzzle}')
print('--------------')
def load_data(filename):
with fil... | [
{
"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 | core/functions/__init__.py | annapoulakos/advent-of-code |
__author__ = 'Gobin'
from redditcli.api import base
class Account(base.Resource):
resource_name = 'Account'
class AccountManager(base.ResourceManager):
resource_class = Account
def me(self):
return self._get('/api/v1/me')
def getkarma(self):
return self._get('/api/v1/me/karma')
... | [
{
"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 | redditcli/api/account.py | gobins/python-oauth2 |
#!/usr/bin/env python3
import subprocess
import os
import sys
sys.path.append("../lib/")
import json_parser
import ibofos
import cli
import test_result
import MOUNT_ARRAY_BASIC_1
def clear_result():
if os.path.exists( __file__ + ".result"):
os.remove( __file__ + ".result")
def set_result(detail):
cod... | [
{
"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 | test/system/array/MOUNT_ARRAY_ALD_MOUNTED_ERROR.py | mjlee34/poseidonos |
# O(n^2)
def arithmetic_series(n: int) -> int:
if n < 0:
raise ValueError('Argument n is not a natural number')
return int((n + 1) * n * 0.5)
def arithmetic_series_loop(n: int) -> int:
if n < 0:
raise ValueError('Argument n is not a natural number')
s: int = 0
while n > 0:
... | [
{
"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 | math/arithmetic-series.py | src24/algos |
import praw
import passwords
import calendar, datetime, time
# Version!
version = "0.1"
with_version = lambda msg: msg + "\n\nI'm using Ploverscript v{}. Learn more [here](https://github.com/codingJWilliams/Ploverscript).".format(version)
# Formatting stuff.
small_indent = " | "
big_indent = " | "
def w... | [
{
"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 | util.py | Cysioland/Ploverscript |
from . import Link
def iterate_words(lines):
for line in lines:
words = line.split()
if len(words) == 0:
continue
for word in words[:-1]:
yield word, is_stop_word(word)
yield words[-1], True # EOL is considered a stop word
def is_stop_word(word):
return... | [
{
"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 | pymk/tokenize.py | calzoneman/MarkovBot |
import logging
import requests
import time
import urllib.parse
OSMO_HISTORICAL_NODE = "https://api-osmosis.imperator.co"
class OsmoHistoricalAPI:
@classmethod
def get_symbol(cls, ibc_address):
uri = "/search/v1/symbol?denom={}".format(urllib.parse.quote(ibc_address))
data = cls._query(uri)
... | [
{
"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 | src/osmo/api_historical.py | johnny-wang/staketaxcsv |
# import sharpy.utils.settings as settings
# import sharpy.utils.exceptions as exceptions
# import sharpy.utils.cout_utils as cout
import numpy as np
import importlib
import unittest
import os
import sharpy.utils.cout_utils as cout
class TestCoupledPrescribed(unittest.TestCase):
"""
"""
@classmethod
... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",... | 3 | tests/coupled/prescribed/prescribed_test.py | ACea15/sharpy |
# not to use sys and use python packages
from .control_task_base import ControlTaskBase
""" This test control task demonstrates how to set and read info from the SFR"""
class TestControlTask(ControlTaskBase):
def __init__(self):
pass
def default(self):
self.sfr.set("test", True)
def ex... | [
{
"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 | src/ControlTasks/test_control_task.py | CornellDataScience/self-driving-car |
import abc
class My_ABC_Class(metaclass=abc.ABCMeta):
@abc.abstractmethod
def set_val(self, val):
return
@abc.abstractmethod
def get_val(self):
return
class MyClass(My_ABC_Class):
def set_val(self, input):
self.val = input
def hello(self):
print("\nCalli... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
... | 3 | PythonAndOop/N35_abstractclasses_2.py | jiauy/before_work |
from BaseModel.BaseModel import BaseModel
from django.db import models
from levels.models import Level
class FilmCategory(models.Model):
"""电影类别表"""
name = models.CharField(max_length=50, verbose_name='名称')
class Meta:
db_table = 'tb_film_category'
verbose_name = '电影类别'
verbose_n... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"ans... | 3 | recommendation/recommendation/apps/films/models.py | WillionLei/recommendation |
import pytest
from django.db import models
from rest_framework import serializers
from datahub.dbmaintenance.utils import parse_choice
class SampleTextChoice(models.TextChoices):
"""Example text choices."""
ONE = ('one', 'One')
class SampleIntegerChoice(models.IntegerChoices):
"""Example integer choic... | [
{
"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_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": true
},
... | 3 | datahub/dbmaintenance/test/test_utils.py | Staberinde/data-hub-api |
from django.shortcuts import render
from flightApp.models import Flight, Passenger, Reservation
from flightApp.serializers import FlightSerializer, PassengerSerializer, ReservationSerializer
from rest_framework import viewsets
from rest_framework.response import Response
from rest_framework.decorators import api_view
f... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{... | 3 | flightServices/flightApp/views.py | saibottrenham/djangorest |
import http3
def test_status_code_as_int():
assert http3.codes.NOT_FOUND == 404
assert str(http3.codes.NOT_FOUND) == "404"
def test_lowercase_status_code():
assert http3.codes.not_found == 404
def test_reason_phrase_for_status_code():
assert http3.codes.get_reason_phrase(404) == "Not Found"
def ... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",... | 3 | tests/test_status_codes.py | ambrozic/http3 |
from .lookup_provider import LookupProvider
class MerriamProvider(LookupProvider):
'''Concrete provider which provides web results from Merriam-Webster
dictionary.
'''
def lookup(self, word, limit=0):
'''Yield str results for `word` up to `limit`. When `limit == 0`,
return all results.... | [
{
"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 | word_tools/merriam_provider.py | ncdulo/word_tools |
from django.contrib import admin
from .models import *
class SaleInvHrdModelAdmin(admin.ModelAdmin):
list_display = ["id", "doc_no", "doc_dt", "party_id_name",
"doctor_id_name", "mode", "net_amount", "session_id"]
list_display_links = ["doc_no"]
list_filter = ["doc_dt"]
search_fields = ["doc... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (... | 3 | src/sales/admin.py | vishalhjoshi/croma |
from typing import TypeVar, AsyncIterator, Sequence
from chris.common.types import PluginUrl
from chris.common.client import AuthenticatedClient
from chris.common.search import get_paginated, to_sequence
import chris.common.decorator as http
from chris.cube.types import ComputeResourceName, PfconUrl
from chris.cube.des... | [
{
"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 | chris/cube/client.py | FNNDSC/chrisomatic |
import json
def add_to_map(data_map, key):
if key in data_map:
data_map[key] += 1
elif key not in data_map:
data_map[key] = 1
return data_map
def get_json(line, headers):
sample_data = {}
for i, val in enumerate(line):
sample_data[headers[i]] = val
return sample_data... | [
{
"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 | charts/data_utils.py | Illumina/SMNCopyNumberCaller |
import face_recognition
def compare_faces(original_face, captured_face):
same_person = False
original_face_encoding = get_image_encoding(original_face)
captured_face_encoding = get_image_encoding(captured_face)
if len(captured_face_encoding) > 0 and len(original_face_encoding) > 0:
... | [
{
"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 | face_recgonition/face_recognition_api.py | lab-03/face_recognition |
# -*- coding: utf-8 -*- #
# Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... | [
{
"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 | lib/surface/kms/keys/versions/list.py | bshaffer/google-cloud-sdk |
"""
Aqualink API documentation
The Aqualink public API documentation # noqa: E501
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
"""
import sys
import unittest
import aqualink_sdk
from aqualink_sdk.model.user_location import UserLocation
class TestUserLoc... | [
{
"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 | sdk/test/test_user_location.py | aqualinkorg/aqualink-sdk |
import cv2
from app.Model.Model_cascades import Cascades
class FaceDetection:
def __init__(self):
self.type_cascade = Cascades.FACECASCADE
def get_type_cascade(self):
return self.type_cascade
def detection_rectangle_dimensions(self):
scaleFactor = 1.3
minNeighbors = 5
... | [
{
"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 | app/Model/Model_facedetection.py | Renanrbsc/System_Face_Recognition |
from unittest import TestCase
import elegy
import jax.numpy as jnp
import pytest
class MetricTest(TestCase):
def test_basic(self):
class MAE(elegy.Metric):
def call(self, y_true, y_pred):
return jnp.abs(y_true - y_pred)
y_true = jnp.array([1.0, 2.0, 3.0])
y_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": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inherita... | 3 | elegy/metrics/metric_test.py | sooheon/elegy |
import torch
import torch.nn.functional as F
import numpy as np
import matplotlib.pyplot as plt
import torch.nn as nn
import torch.optim as optim
x = torch.unsqueeze(torch.linspace(-1, 1, 100), dim=1)
y = x.pow(2) + 0.2 * torch.rand(x.size())
# plt.scatter(x.numpy(), y.numpy())
# plt.show()
class Net(nn.Module):
... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/... | 3 | Basics/Regression.py | Fyy10/ML-DL_Practice |
import argparse
from .greet import greet
def parse_args():
parser = argparse.ArgumentParser(
description='Create automated github reports'
)
parser.add_argument('name', metavar='NAME', type=str,
help='name to greet')
return parser.parse_args()
def main():
args ... | [
{
"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 | tako/cli.py | gr0und-s3ct0r/github-reports |
import numpy as np
class LogisticRegression:
def __init__(self, lr = 0.001, n_iters = 1000):
self.lr = lr
self.n_iters = n_iters
self.weights = None
self.bias = None
def fit(self, X, y):
#init parameters
n_samples, n_features = X.shape
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 | ML from sratch/logistic_regression.py | nane121/HacktoberFest2020 |
"""posts table
Revision ID: 5c80010c853a
Revises: 6ca7139bbbf2
Create Date: 2018-06-25 17:18:29.165993
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '5c80010c853a'
down_revision = '6ca7139bbbf2'
branch_labels = None
depends_on = None
def upgrade():
# ##... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"an... | 3 | migrations/versions/5c80010c853a_posts_table.py | ChanForPres/Social-Blogging-App |
# coding: utf-8
import numpy as np
import chainer
import chainer.functions as F
import testtools
import numpy as np
class A(chainer.Chain):
def forward(self):
y1 = np.zeros((3, 4), dtype=np.float32)
return y1
# ======================================
def main():
testtools.generate_testcase(... | [
{
"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 | elichika/tests/node/ndarray/NpZeros.py | disktnk/chainer-compiler |
class GameStats():
"""跟踪游戏的统计信息"""
def __init__(self, ai_settings):
"""初始化统计信息"""
self.ai_settings = ai_settings
self.reset_stats()
# 游戏刚启动时出于活跃状态
self.game_active = True
# 让游戏一开始处于非活动状态
self.game_active = False
# 在任何情况下都不应重置最高得分
self.high_score = 0
def reset_stats(self):
"""初始化在游戏运行期间可能变化的统计... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
... | 3 | alien_invasion/game_stats.py | turoDog/LearningPython |
import os
import pathlib
import random
import socket
def create_producer_data_file(name):
no_of_integers_in_a_file = 100;
f = open(os.getcwd() + "/Output/Producer_Socket/" + name + ".txt", "w")
for no_of_lines in range(no_of_integers_in_a_file):
f.write(str(random.randint(1, no_of_integers_in_a_fil... | [
{
"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 | IPC_PythonScripts/IPC3/Client.py | pooja-n1424/CEG4350-6350 |
import random
from pygame import Color
from pygame.image import load
from pygame.math import Vector2
from pygame.mixer import Sound
def load_sprite(name, with_alpha=True):
path = f"assets/sprites/{name}.png"
loaded_sprite = load(path)
if with_alpha:
return loaded_sprite.convert_alpha()
else:... | [
{
"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 | space_rocks/utils.py | frenesoto/spacerocks |
import os
import pytest
import asyncio
from jina import __default_host__
from daemon.clients import AsyncJinaDClient
cur_dir = os.path.dirname(os.path.abspath(__file__))
CLOUD_HOST = 'localhost:8000' # consider it as the staged version
success = 0
failure = 0
client = AsyncJinaDClient(host=__default_host__, port=... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"ans... | 3 | tests/distributed/test_workspaces/test_nonblocking.py | vishalbelsare/jina |
from django.shortcuts import render
from core.forms.ContatoForm import ContatoForm
from core.components.GerenciadorEmail import Email
def enviarEmailAluno(form):
contexto = {
"aluno":form.cleaned_data['nome'],
"email":form.cleaned_data['email'],
"assunto":form.cleaned_data['assunto'],
... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (exclud... | 3 | core/views/Contato.py | roimpacta/exemplos |
from __future__ import with_statement
import unittest
import flask
from healthcheck import HealthCheck, EnvironmentDump
class BasicHealthCheckTest(unittest.TestCase):
def setUp(self):
self.path = '/h'
self.app = flask.Flask(__name__)
self.hc = self._hc()
self.client = self.app.te... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",... | 3 | tests/test_unit/test_healthcheck.py | jab/healthcheck |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import absolute_import, division, print_function, unicode_literals
import numpy as np
from ..utils.compat.odict import OrderedDict
from ..utils.misc import isiterable
__all__ = ['FlagCollection']
class FlagCollection(OrderedDict):
... | [
{
"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 | astropy/nddata/flag_collection.py | xiaomi1122/astropy |
#!/usr/bin/env python
"""
:Author Patrik Valkovic
:Created 30.03.2018 16:35
:Licence MIT
Part of grammpy
"""
from unittest import main, TestCase
from grammpy import *
from grammpy.parsers import cyk
from grammpy.transforms import ContextFree, InverseContextFree
class S(Nonterminal): pass
class My:
def __init_... | [
{
"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 | tests/parsers_test/CYK/CorrectSimpleTerminalsTest.py | PatrikValkovic/grammpy |
import numpy as np
from .attributes_incrementally import StandardDeviation, LengthOfDiagonal, \
FirstHuMoment, Area
from ..utils.data_types import Pixel
def construct_area_matrix(image: np.ndarray) -> np.ndarray:
matrix = np.ones(image.shape, dtype=Area)
image_width = image.shape[1]
for index, _ in en... | [
{
"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 | python_research/preprocessing/attribute_profiles/max_tree/attribute_matrix_construction.py | myychal/hypernet |
import sys
from string import String
from matrix import *
from math import *
def display_key(key):
lines = 0
cols = 0
while lines != key.lines:
cols = 0
while cols != key.cols:
print (key.matrice[lines][cols], end = '')
if cols + 1 != key.cols:
print (" ", end = '')
cols = cols + 1
print ()
lin... | [
{
"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 | encrypted.py | FlorianMarcon/103cipher |
import cv2
import numpy
from pathlib import Path
from scandir import scandir
def get_folder(path):
output_dir = Path(path)
# output_dir.mkdir(parents=True, exist_ok=True)
return output_dir
def get_image_paths(directory):
return [x.path for x in scandir(directory) if x.name.endswith('.... | [
{
"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 | todo/[Keras]DeepFakes_FaceSwap/faceswap-master/lib/utils.py | tonyhuang84/notebook_dnn |
import sys, signal
from PyQt5.QtWidgets import QApplication, QWidget, QLabel
from PyQt5.QtGui import QIcon, QPixmap
from PyQt5.QtCore import Qt
class Application(QWidget):
def __init__(self):
super().__init__()
self.setWindowFlags(Qt.CustomizeWindowHint | Qt.FramelessWindowHint | Qt.WindowStaysOnTopHint | Qt.Tool... | [
{
"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 | iconQt.py | EGobi/icon-corner |
import os
import sys
import time
import signal
import logging
import argparse
class BaseApp:
def __init__(self, desc, ver_num):
signal.signal(signal.SIGINT, self.sig_handler)
signal.signal(signal.SIGTERM, self.sig_handler)
self.quit_flag = False
sfile = sys.argv[0]
ver = ("... | [
{
"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 | baseapp.py | loblab/lightctrl |
import pytest
import bionic as bn
def test_pyplot_no_parens(builder):
@builder
@bn.pyplot
def plot(pyplot):
ax = pyplot.subplot()
ax.plot([1, 2, 3], [1, 3, 9])
img = builder.build().get("plot")
assert img.width > 0
assert img.height > 0
def test_pyplot_no_args(builder):
... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excludi... | 3 | tests/test_flow/test_plotting.py | IDl0T/bionic |
# coding: utf-8
"""
LogicMonitor REST API
LogicMonitor is a SaaS-based performance monitoring platform that provides full visibility into complex, hybrid infrastructures, offering granular performance monitoring and actionable data and insights. logicmonitor_sdk enables you to manage your LogicMonitor account... | [
{
"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_aws_ec2_reserved_instance_collector_attribute.py | JeremyTangCD/lm-sdk-python |
""" Step Scheduler
Basic step LR schedule with warmup, noise.
Hacked together by / Copyright 2020 Ross Wightman
"""
import math
import torch
from .scheduler import Scheduler
class StepLRScheduler(Scheduler):
"""
"""
def __init__(self,
optimizer: torch.optim.Optimizer,
... | [
{
"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 | timm/scheduler/step_lr.py | xuritian317/pytorch-image-models |
from account import Account
from person import Person
class CurrentAccount(Account):
def __init__(self, nombre, apellido, numeroCuenta, cantidad, tipo = 0.0, tarjetaDebito = False, tarjetaCredito = False, cuota = 0.0):
Account.__init__(self, numeroCuenta, cantidad)
self.__tipoInteres = 1 + float(tipo)
self.__ta... | [
{
"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 | currentAccount.py | thebigyovadiaz/poo_account_py |
from typing import Callable
def joinThread(treadId: str) -> None:
"""Ожидает завершения указанного потока.
Параметры
---------
treadId: :class:`str`
id потока
"""
raise NotImplementedError
def killThread(treadId: str) -> None:
"""Заканчивает исполнение указанного потока.
Па... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docs... | 3 | trik/Treading.py | m1raynee/trikset.py-typehint |
class CyclicDependencyError(ValueError):
pass
def topological_sort_as_sets(dependency_graph):
"""
Variation of Kahn's algorithm (1962) that returns sets.
Take a dependency graph as a dictionary of node => dependencies.
Yield sets of items in topological order, where the first set contains
al... | [
{
"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 | django/utils/topological_sort.py | ni-ning/django |
import sys
import os
import copy
import json
import datetime
opt = dict()
opt['dataset'] = '../data/citeseer'
opt['hidden_dim'] = 16
opt['input_dropout'] = 0.5
opt['dropout'] = 0
opt['optimizer'] = 'adam'
opt['lr'] = 0.01
opt['decay'] = 5e-4
opt['self_link_weight'] = 1.0
opt['pre_epoch'] = 2000
opt['epoch'] = 100
opt... | [
{
"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 | SS-GMNN-GraphMix/GraphMix-par/run_citeseer_ss.py | TAMU-VITA/SS-GCNs |
"""Parse Warren2020 fluxes.
Fluxes from https://zenodo.org/record/3952926 (DOI:10.5281/zenodo.3952926)
See https://arxiv.org/abs/1902.01340 and https://arxiv.org/abs/1912.03328
for description of the models.
"""
import h5py
from sntools.formats import gamma, get_starttime, get_endtime
flux = {}
def parse_input(in... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answ... | 3 | sntools/formats/warren2020.py | arfon/sntools |
# encoding: utf-8
"""
@author: liaoxingyu
@contact: liaoxingyu2@jd.com
"""
import math
import random
class RandomErasing(object):
""" Randomly selects a rectangle region in an image and erases its pixels.
'Random Erasing Data Augmentation' by Zhong et al.
See https://arxiv.org/pdf/1708.04896.pdf... | [
{
"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": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true... | 3 | data/transforms/transforms.py | nodiz/reid-strong-baseline |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.13.5
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
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 | kubernetes/test/test_v1beta1_custom_resource_column_definition.py | Scalr/kubernetes-client-python |
def demo():
"""Output:
---------⌝
----------
----?????-
----------
----------
--!!!-----
--!!!-----
----------
----------
⌞---------
"""
n = 10
# Construction is easy:
grid = {}
# Assignment is easy:
grid[(0, 0)] = "⌞"
grid[(n - 1, n - 1)] = "⌝"... | [
{
"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 | examples/grids/python/grid.py | ssangervasi/examples |
#!/usr/bin/env python
import rospy
from nav_msgs.msg import Odometry
from uf_common.msg import PoseTwistStamped
from neural_control.nn_controller import NN_controller
from geometry_msgs.msg import PoseStamped
def odom_callback(odom_msg):
controller.give_new_state(odom_msg.pose.pose, odom_msg.twist.twist, odom_msg.hea... | [
{
"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 | gnc/navigator_controller/nodes/run_nn_controller.py | saltyan007/kill_test |
from flask import render_template, request
from flask_script import Manager, Server
from app import app
from model import Content, Summary, Article
import app.static.summ as summarizationModel
import os, json, logging
@app.route('/', endpoint='ACCESS')
@app.route('/index.html', endpoint='ACCESSFILE')
def index():
... | [
{
"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 | WebDemo/flask_app/main.py | silenceliang/Cascading-agents-hybridSum |
import os
from os.path import dirname as _dir
import logging
def get_logger(name):
return logging.getLogger('conftest.%s' % name)
def pytest_sessionstart(session):
BASE_FORMAT = "[%(name)s][%(levelname)-6s] %(message)s"
FILE_FORMAT = "[%(asctime)s]" + BASE_FORMAT
root_logger = logging.getLogger('con... | [
{
"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 | tests/hooks.py | j-mechacorta/atoolbox |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.