source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
from calculator import dodawanie
import pytest
@pytest.mark.parametrize("input_1, input_2, result", [(1,1,2),(1.5, 1.5, 3), (-1, -1, -2)])
def test_dodawanie(input_1, input_2, result):
assert dodawanie(input_1, input_2) == result
@pytest.mark.parametrize("input_1, input_2", [([1,2,3], [1,2,3]), ("Ala", "kota"), (... | [
{
"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 | test_calculator.py | SzymczykMarcin/SzkoleniePython2020 |
import re
import random
import itertools
import math
from collections import defaultdict
from src.utilities import *
from src import channels, users, debuglog, errlog, plog
from src.functions import get_players, get_all_players, get_main_role, get_reveal_role, get_target
from src.decorators import command, event_liste... | [
{
"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 | src/roles/villagedrunk.py | the5thEmperor/lykos |
from . import services
from cartola import sysexits
from firenado import service
import functools
from getpass import getpass, getuser
import sys
def authenticated(method):
""" Decorates a method to continue only if the user is authenticated
"""
@service.served_by(services.UserService)
@functools.wra... | [
{
"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 | sctr/cli.py | candango/sctr |
from __future__ import print_function
import sys
def hello(what):
print('Hello, {}!'.format(what))
def say_what():
return 'what?'
def main():
hello(say_what())
return 0
def new_func():
pass
if __name__ == '__main__':
sys.exit(main())
| [
{
"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 | hello.py | dskrzyns/python-example |
# Given a binary tree, find its maximum depth.
# The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.
# Definition for a binary tree node
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
cla... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": ... | 3 | python/Depth_of_BinaryTree.py | samael65535/LeetCode_Kata |
# (c) 2005 Ian Bicking and contributors; written for Paste (http://pythonpaste.org)
# Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
def asbool(obj):
if isinstance(obj, str):
obj = obj.strip().lower()
if obj in ['true', 'yes', 'on', 'y', 't', '1']:
r... | [
{
"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 | ita/web/beaker/converters.py | Tezar/Assigment-generator |
# qubit number=2
# total number=11
import pyquil
from pyquil.api import local_forest_runtime, QVMConnection
from pyquil import Program, get_qc
from pyquil.gates import *
import numpy as np
conn = QVMConnection()
def make_circuit()-> Program:
prog = Program() # circuit begin
prog += H(0) # number=1
pr... | [
{
"point_num": 1,
"id": "every_function_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 | data/p2DJ/New/program/pyquil/startPyquil160.py | UCLA-SEAL/QDiff |
# Copyright 2022, Kay Hayen, mailto:kay.hayen@gmail.com
#
# Part of "Nuitka", an optimizing Python compiler that is compatible and
# integrates with CPython, but also works on its own.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in complianc... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excl... | 3 | nuitka/codegen/Indentation.py | sthagen/Nuitka-Nuitka |
import configparser
import psycopg2
from sql_queries import create_table_queries, drop_table_queries
def drop_tables(cur, conn):
'''
Drop the existing tables
'''
for query in drop_table_queries:
cur.execute(query)
conn.commit()
def create_tables(cur, conn):
'''
Crea... | [
{
"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 | create_tables.py | RammySekham/Creating-Cloud-Datawarehouse |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
from os import getenv
from decorator import decorator
from language_formatters_pre_commit_hooks.utils import run_command
_DEFAULT_MESSAGE_TEMPLATE = '{required_tool} is requir... | [
{
"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 | language_formatters_pre_commit_hooks/pre_conditions.py | c4dt/language-formatters-pre-commit-hooks |
from __future__ import absolute_import
from celery.exceptions import SecurityError
from celery.security.serialization import SecureSerializer
from celery.security.certificate import Certificate, CertStore
from celery.security.key import PrivateKey
from . import CERT1, CERT2, KEY1, KEY2
from .case import SecurityCase... | [
{
"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 | celery/tests/test_security/test_serialization.py | amplify-education/celery |
###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013-2016, John McNamara, jmcnamara@cpan.org
#
import unittest
from ...compatibility import StringIO
from ...styles import Styles
class TestWriteStyleSheet(unittest.TestCase):
"""
Test... | [
{
"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 | xlsxwriter/test/styles/test_write_style_sheet.py | totdiao/XlsxWriter |
def latin() -> [str]:
"""[A-Z]"""
return list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
def safe_latin() -> [str]:
"""[A-Z] excluding (O, I, L)"""
return list("ABCDEFGHJKMNPQRSTUVWXYZ")
| [
{
"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 | ticket_universe/charsets.py | lotify/ticket_universe |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from marionette.by import By
from gaiatest import GaiaTestCase
from gaiatest.apps.marketplace.app import Marketplace
fro... | [
{
"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 | tests/python/gaia-ui-tests/gaiatest/tests/functional/marketplace/test_marketplace_login.py | BReduardokramer/gaia |
import decirhora
import unittest
class ProbarDecirHora(unittest.TestCase):
def setUp(self):
self.nums = list(range(11))
def test_numbers(self):
# Asegurar la conversion de numeros a letras correctamente
letras = (
'cero', 'uno', 'dos', 'tres', 'cuatro', 'cinco',
... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": ... | 3 | Introduccion_Python/04_depuracion_codigo/probar-decirhora.py | iarielduarte/Python |
"""
Tests for the server configuration. Run via configtest_dev.py
Tests are standard python unittest tests.
"""
import unittest
import flask
import os
class TestConfig(unittest.TestCase):
"""
This class implements configuration checks for the GA4GH server. It is
structured as a set of unit tests, and re... | [
{
"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 | candig/server/configtest.py | haoyuanli/candig-server |
def nextDay(year, month, day):
"""Simple version: assume every month has 30 days"""
if day < 30:
return year, month, day + 1
else:
if month == 12:
return year + 1, 1, 1
else:
return year, month + 1, 1
def dateIsBefore(year1, month1, day1, year2, month... | [
{
"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 | test_for_daysBetweenDates.py | serglit72/Python_exercises |
def clear_console():
for _ in range(10):
print()
def print_list_of_moving_boxes(moving_boxes):
print("ID\t|\tContent\t|\tPlace\t|\tAdded")
for box in moving_boxes:
print("{0[0]}\t|\t{0[1]}\t|\t{0[2]}\t|\t{0[3]}".format(box))
def print_moving_box(moving_box):
print("ID\t|\tContent\t|\... | [
{
"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 | movingBoxesInventory/utility.py | emilrowland/movingBoxesInventory |
from sklearn.preprocessing import StandardScaler, MinMaxScaler
import torch
import torch.nn as nn
from torch.autograd import Variable
# https://cnvrg.io/pytorch-lstm/
class LSTM1(nn.Module):
def __init__(self, num_classes, input_size, hidden_size, num_layers, seq_length):
super(LSTM1, self).__init__()
... | [
{
"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 | LSTM.py | superporchetta/tide_prediction |
from src.katas import fizz_buzz
import unittest
class FizzBuzzTest(unittest.TestCase):
def test_it_return_fizz_for_multiples_of_three(self):
converter = fizz_buzz.FizzBuzz()
for number in [3, 6, 9, 12]:
self.assertEqual('Fizz', converter.convert(number))
def test_it_return_buzz_... | [
{
"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 | tests/fizz_buzz_test.py | Thavarshan/python-code-katas |
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
import pytest
import string
import random
import uuid
@pytest.fixture(scope="session")
def random_string_factory():
def factory_function(length=64):
... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (e... | 3 | python/sdk_e2e/content_fixtures.py | Azure/iot-sdk-longhaul |
from pybeerxml.parser import Parser
from .picobrew_recipe import PicoBrewRecipe
from .picobrew_program_step import PicoBrewProgramStep
from xml.etree import ElementTree
class PicoBrewParser(Parser):
def parse(self, xml_file):
# Parse the BeerXML file
recipes = super(PicoBrewParser, self).parse(xm... | [
{
"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 | beerxml/picobrew_parser.py | rryanburton/PicobrewServerDjango |
import pytest
import pandas as pd
import os
from distutils import dir_util
@pytest.fixture()
def valid_df():
check_data = [["jjety", "AB9960", "response1", "response2", "Sun Nov 19 23:59:59 2018", pd.to_datetime("2018-11-20 00:00:00")],
["jjety", "AB9958", "response1", "response2", "Sun Nov 19 23:56:59 2018... | [
{
"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 | data_analytics_tools/tests/conftest.py | rpwils/data-analytics-tools |
import dlib
class HogDetector:
def __init__(self):
self.detector = dlib.get_frontal_face_detector()
def detect(self, frame):
bboxes = []
# landmarks = []
dets = self.detector(frame, 1)
for k, d in enumerate(dets):
bboxes.append(
(d.left(), d... | [
{
"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 | src/detection/HogDetector.py | ShivangMathur1/Face-Recognition-System |
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the Li... | [
{
"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 | pyvit/tests/vcsim/test_exceptions.py | hartsock/pyvmomi-integration-tests |
from typing import List
from pathlib import Path
from skimage.io import imread as gif_imread
from torch.utils.data import Dataset
from catalyst import utils
class SegmentationDataset(Dataset):
"""Dataset for segmentation tasks
Returns a dict with ``image``, ``mask`` and ``filename`` keys
"""
def _... | [
{
"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/_tests_cv_segmentation/dataset.py | denyhoof/catalyst |
import logging
from airflow.hooks.base_hook import BaseHook
from dateutil.parser import parse
from datetime import timezone
from etl_utils.airflow import get_connection
from exceptions import SettingFieldMissingError
from full_incidents.thehive_to_dwh.extract import extract
from postgresql_utils.session import create... | [
{
"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 | full_incidents/thehive_to_dwh/main.py | Infosecurity-LLC/ETL |
"""
This file represents the interface for a cost function
"""
from abc import ABC, abstractmethod
import numpy as np
class AbstractCostFunction(ABC):
@abstractmethod
def compute(self, y_pred: np.array, y_labels: np.array) -> float:
"""
:param y_pred:
:param y_labels:
: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": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (exc... | 3 | pystork/costs/abstract_cost.py | yassineameur/pystork |
# -*- coding: utf-8 -*-
"""Basic tests for state and entity relationships in dork"""
import dork.types as types
import dork.game_utils.factory_data as factory_data
# pylint: disable=protected-access
def test_confirm_method_blank(capsys, mocker):
"""confirm should do things"""
mocked_input = mocker.patch('b... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docs... | 3 | tests/test_types.py | ddejohn/dork |
from flask_restful import Resource, reqparse
from flask import Flask,request, make_response
from passlib.hash import pbkdf2_sha256 as sha256
users_list = []
class User():
def __init__(self, email, password):
self.user_id = len(users_list)+1
self.email = email
self.password = password
... | [
{
"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 | app/api/v1/models/user_models.py | Deekerubo/Store-Manager-API |
from torch import nn as nn
from torch.nn import functional as F
from ..utils import get_fine_tuning_parameters
from .backbone import make_encoder
from .modules import squash_dims, unsquash_dim
class MultiFrameBaseline(nn.Module):
"""Simple baseline that runs a classifier on each frame independently and averages ... | [
{
"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 | pytorch_toolkit/action_recognition/action_recognition/models/multi_frame_baseline.py | AnastasiaaSenina/openvino_training_extensions |
def show_fib_series(n):
a, b = 0, 1
while a < n:
print(a, end=' ')
a, b = b, a+b
print()
def return_fib_series(n):
result = []
a, b = 0, 1
while a < n:
result.append(a)
a, b = b, a+b
return result
| [
{
"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 | topicos/16_modulos/respostas/fibonacci.py | erosvitor/python-fundamentos-curso |
#!/usr/bin/env python3
# Copyright (c) 2016 The Bitcoin Core developers
# Copyright (c) 2017 The Whiff Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test RPC commands for signing and verifying messages."""
fro... | [
{
"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 | test/functional/signmessages.py | Whiff-dev/WhiffV2.0 |
"""
Programming for linguists
Implementation of the data structure "Queue"
"""
from typing import Iterable
# pylint: disable=invalid-name
class Queue_:
"""
Queue Data Structure
"""
def __init__(self, data: Iterable = (), capacity: int = 50):
self.data = list(data)
self._capacity = ca... | [
{
"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 | queue_/queue_.py | ashirka/programming-2021-19fpl |
#!/usr/bin/python3
"""Visualise three-dimensional integer data using heatmaps.
To create a heatmap, pass data formatted as HeatmapPoints (at most one for each
(x, y) coordinate of the heatmap, any more will be ignored) to the
HeatmapDataSet constructor. Pass the heatmap through a ColorMap subclass's
color_heatmap met... | [
{
"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 | visualise/heatmap.py | TimoWilken/scworldedit |
from typing import List
from arm_prosthesis.models.gesture_action import GestureAction
class Gesture:
def __init__(self, uuid: str, name: str, last_time_sync: int, iterable: bool, repetitions: int,
actions: List[GestureAction]):
self._uuid = uuid
self._name = name
... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self... | 3 | arm_prosthesis/models/gesture.py | paulrozhkin/arm_prosthesis_raspberry |
import unittest
from typing import Any, List, Tuple
from unittest.mock import MagicMock, patch
from io import StringIO
from nix_review.cli import main
from .cli_mocks import (
CliTestCase,
Mock,
MockCompletedProcess,
build_cmds,
read_asset,
IgnoreArgument,
)
def rev_command_cmds() -> List[Tu... | [
{
"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 | nix_review/tests/test_rev.py | zimbatm/nix-review |
import socket
from http import HTTPStatus
from urllib.request import Request, urlopen, ProxyHandler, build_opener
from urllib.parse import urlencode, unquote_plus, quote, quote_plus
from urllib.error import HTTPError, URLError
class ClientBase:
def __init__(self, nacos_host: str, api_level: str = 'v1'):
s... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"ans... | 3 | nacos/base.py | hubertshelley/nacos_client_python |
# Third party imports
from gmprocess.metrics.transform.transform import Transform
from gmprocess.stationstream import StationStream
from gmprocess.stationtrace import StationTrace
class Differentiate(Transform):
"""Class for computing the derivative."""
def __init__(self, transform_data, damping=None, period=... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true... | 3 | gmprocess/metrics/transform/differentiate.py | norfordb/groundmotion |
def setup():
size(500, 500)
smooth()
background(0)
strokeWeight(1)
i = 205
k = 1
flug = 1
def draw ():
global i, k, flug
stroke(i, 20)
if (flug == 1):
line(mouseX , mouseY , 500, random(0,500))
else:
line(mouseX , mouseY , 0, random(0,500))
i = i + k... | [
{
"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 | new2.0/sketch_191205g/sketch_191205g.pyde | klimenkodasha/2019-fall-polytech-cs |
import re
import urllib
from django import template
register = template.Library()
@register.filter
def thumbnail_format(path):
match = re.search(r'\.\w+$', path)
if match:
ext = match.group(0)
if ext.lower() in ['.gif', '.png']:
return 'PNG'
return 'JPEG'
@register.filter
de... | [
{
"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 | topnotchdev/files_widget/templatetags/files_widget_tags.py | redwerk/django-files-widget |
from decimal import Decimal
from typing import Optional, Union
from ..asset import Asset
from ..exceptions import ValueError, TypeError
from ..keypair import Keypair
from ..muxed_account import MuxedAccount
from ..price import Price
from ..strkey import StrKey
_LOWER_LIMIT = "0"
_UPPER_LIMIT = "922337203685.4775807"
... | [
{
"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 | stellar_sdk/operation/utils.py | bantalon/py-stellar-base |
# -*- coding: utf-8 -*-
import h5py
import pyre
from ..Base import Base
from .Identification import Identification
class SLC(Base, family='nisar.productreader.slc'):
'''
Class for parsing NISAR SLC products into isce structures.
'''
productValidationType = pyre.properties.str(default='SLC')
pr... | [
{
"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 | python/packages/pybind_nisar/products/readers/SLC/SLC.py | piyushrpt/isce3 |
import unittest
from space_age import SpaceAge
# Tests adapted from `problem-specifications//canonical-data.json` @ v1.2.0
class SpaceAgeTest(unittest.TestCase):
def test_age_on_mercury(self):
self.assertEqual(SpaceAge(2134835688).on_mercury(), 280.88)
def test_age_on_venus(self):
self.asse... | [
{
"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 | space-age/space_age_test.py | ikostan/python |
#!/usr/bin/env python
from multipledispatch import dispatch as Override
import rospy
import threading
from std_msgs.msg import Float64
from araig_msgs.msg import BoolStamped
from base_classes.base_calculator import BaseCalculator
"""Compare data from one topic with one param
pub_list = {"out_bool": "BoolStamped"}... | [
{
"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 | araig_calculators/src/comparators/comp_param.py | ipa-kut/araig_test_stack |
"""
To understand why this file is here, please read:
http://cookiecutter-django.readthedocs.io/en/latest/faq.html#why-is-there-a-django-contrib-sites-directory-in-cookiecutter-django
"""
from django.conf import settings
from django.db import migrations
def update_site_forward(apps, schema_editor):
"""Set site d... | [
{
"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 | company_search_engine/company_search_engine/contrib/sites/migrations/0003_set_site_domain_and_name.py | shimakaze-git/company-search-engine |
from django.shortcuts import render, redirect, get_object_or_404
from django.core.urlresolvers import reverse
from django.contrib.admin.views.decorators import staff_member_required
from .models import Order, Product
from .forms import OrderCreateForm
from .tasks import order_created
# Create your views here.
def ord... | [
{
"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 | orders/views.py | pauljherrera/avantiweb |
from django.db import models
from django.contrib.auth.models import User
from martor.models import MartorField
class Challenge(models.Model):
id = models.AutoField(
primary_key=True,
help_text="A challenge ID, automatically generated by Postgres.",
)
class ChallengeType(models.TextChoices... | [
{
"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 | TWT/apps/challenges/models/challenge.py | KrishnaKanth1729/twtcodejam.net |
import sys
sys.path.append("../")
from appJar import gui
def drag(widget):
app.info("Dragged from:" + str(widget))
def drop(widget):
app.info("Dropped on:" + str(widget))
def externalDrop(data):
app.info("External drop:" + str(data))
app = gui("dnd Demo")
app.setFont(20)
app.setBg("SlateGrey")
app.set... | [
{
"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/dnd_external.py | tgolsson/appJar |
from project.album import Album
class Band:
def __init__(self, name):
self.name = name
self.albums = []
def add_album(self, album: Album):
if album in self.albums:
return f"Band {self.name} already has {album.name} in their library."
self.albums.append(album)
... | [
{
"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 | 3. Python Advanced (September 2021)/3.2 Python OOP (October 2021)/04. Exercise - Classes and Objects/07_spoopify/project/band.py | kzborisov/SoftUni |
"""
Blekko (Images)
@website https://blekko.com
@provide-api yes (inofficial)
@using-api yes
@results JSON
@stable yes
@parse url, title, img_src
"""
from json import loads
from searx.url_utils import urlencode
# engine dependent config
categories = ['images']
paging = True
safesearch = ... | [
{
"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 | Toolkits/Discovery/meta/searx/searx/engines/blekko_images.py | roscopecoltran/SniperKit-Core |
"""
A user-facing wrapper around the neural network models for solving the cube.
"""
import models
from typing import Optional
class CubeModel:
_model = None # type: Optional[models.BaseModel]
def __init__(self):
pass
def load_from_config(self, filepath: Optional[str] = None) -> ():
""... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": ... | 3 | cube_model.py | jasonrute/puzzle_cube_code |
from pathlib import Path
basename = "test_all_items_role"
html_filename = basename + ".html"
def test_base_name_in_html(app):
app.build()
html = Path(app.outdir / html_filename).read_text()
assert basename in html
def test_all_items_html_contains_value(app):
app.build()
html = Path(app.outdir / ... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"ans... | 3 | tests/test_all_items_role.py | sixty-north/added-value |
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import QDialog, QApplication, QWidget, QVBoxLayout, QHBoxLayout, QGroupBox
from PyQt5 import uic
from os.path import join, dirname, abspath
from qtpy.QtCore import Slot, QTimer, QThread, Signal, QObject, Qt
#from PyQt5 import Qt
_ST_DLG = join(... | [
{
"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 | startdialog.py | jibonaronno/Rhythm |
import numpy as np
from scipy import optimize
def f(x, a): return x**3 - a
def fder(x, a): return 3 * x**2
rng = np.random.default_rng()
x = rng.standard_normal(100)
a = np.arange(-50, 50)
vec_res = optimize.newton(f, x, fprime=fder, args=(a, ), maxiter=200)
print(vec_res) | [
{
"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 | global_motion_estimation/test scripts/gradient descent tests/dummy.py | Samaretas/global-motion-estimation |
import numpy as np
import scipy.integrate.quadrature as integrator
"""
An 1-dimensional linear problem is used to describe the FEM process
reference:
[1] https://www.youtube.com/watch?v=rdaZuKFK-4k
"""
class OneDimensionalProblem:
def __init__(self):
self.Nod... | [
{
"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 | 1D_example.py | AndrewWangJZ/pyfem |
#!/usr/bin/python3
import sys
import getopt
import os
from configobj import ConfigObj
import xml.etree.ElementTree as ET
import mysql.connector
import datetime
import kratoslib
def delete_da_prices(connection, date):
sql = ("DELETE FROM dayahead WHERE pricedate='%s'")
data = (date.strftime('%Y-%m-%d'))
print(dat... | [
{
"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 | kratos/parse_da.py | HaakonKlausen/kratos |
#!/usr/bin/env python3
#
# Generate USB string include files from text source
#
# Input format is one USB string per line. If it starts with '!{', then
# it's loaded as a json dict and indexed with the board name, with the
# empty string being used as default value.
#
# Copyright (C) 2019-2021 Sylvain Munaut <tnt@246t... | [
{
"point_num": 1,
"id": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 lines?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
... | 3 | fw/usb_gen_strings.py | no2fpga/no2usb |
from models import *
class MockEpubArchive(EpubArchive):
'''Mock object to expose some protected methods for testing purposes, and use
overridden mock related classes with different storage directories.'''
def get_author(self, opf):
self.authors = self._get_authors(opf)
return self.autho... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)... | 3 | bookworm/library/testmodels.py | srilatha44/threepress |
import h5py
import numpy as np
def loading_data(path):
print('******************************************************')
print('dataset:{0}'.format(path))
print('******************************************************')
file = h5py.File(path,'r')
images = file['images'][:].transpose(0,3,2,1)
labels = file['LAll'][... | [
{
"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": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a doc... | 3 | load_data.py | SincereJoy/SSAH_CVPR2018 |
from django import forms
from django.contrib.auth.models import User
from django.contrib.auth.forms import UserCreationForm
from .models import Profile
class UserOurRegistration(UserCreationForm):
email = forms.EmailField(required=True)
class Meta:
model = User
fields = ['email', 'username', ... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
}... | 3 | app/users/forms.py | Nilsen11/django-training-CBV |
class DictDiffer(object):
"""
Calculate the difference between two dictionaries as:
(1) items added
(2) items removed
(3) keys same in both but changed values
(4) keys same in both and unchanged values
from:
https://github.com/hughdbrown/dictdiffer
"""
def __init__(self, curre... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": ... | 3 | python/byteport/utils.py | gebart/byteport-api |
from __future__ import print_function
import sys
from io import StringIO
import os
import csv
import json
import numpy as np
import pandas as pd
from sklearn.externals import joblib
from sagemaker_containers.beta.framework import (
content_types, encoders, env, modules, transformer, worker)
feature_columns_name... | [
{
"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 | 04_deploy_model/sklearn_source_dir/inference.py | Niobiumkey/amazon-sagemaker-build-train-deploy |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2018/1/14 12:38
# @Author : WIX
# @File : NumberOf1InBinary.py
"""
题目:请实现一个函数,输入一个整数,输出该数二进制表示中1的个数。例如把9表示成二进制是1001,有2位是1。因此如果输入9,该函数输出2。
"""
"""
总结:
把一个整数减1后在和原来的整数做位的与运算,得到的结果相当于把整数的二进制表示中最右边的1变成0
"""
import unittest
class Solution(object):
def nu... | [
{
"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 | target_offer/015-二进制中一的个数/NumberOf1InBinary.py | lesywix/oh-my-python |
import numpy as _np
from .moments import immoment3D as _immoment3D
def getSphere(side):
"""Create a 3D volume of sideXsideXside, where voxels representing a
sphere are ones and background is zeros.
Keyword arguments:
side -- the number of voxels the 3D volume should have on each side.
Returns:
... | [
{
"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 | pydescriptors/helpers.py | c-martinez/compactness |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class ScheduleConfigItem(object):
def __init__(self):
self._config_name = None
self._date = None
self._id = None
@property
def config_name(self):
return self._c... | [
{
"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 | alipay/aop/api/domain/ScheduleConfigItem.py | antopen/alipay-sdk-python-all |
#Arithmetics
#Addition
def add(a,b,c):
d=a+b+c
return d
res_add=add(10,20,30)
print(res_add)
#Subtraction
def sub(a,b,c):
d=a-b-c
return d
res_sub=sub(10,20,30)
print("1.Normal result 2.Absolute result")
choice=int(input("Enter your choice:"))
if(choice=="1"):
print(res_sub)
else:
print(abs(re... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docst... | 3 | Arithmetics.py | youngtech515/PythonScripts |
__all__ = ["int_to_bytes", "bytes_to_int"]
def int_to_bytes(value: int):
byte_length = (value.bit_length() + 7) // 8
byte_length = (byte_length + 3) // 4 * 4
byte_length = 4 if byte_length == 0 else byte_length
return value.to_bytes(byte_length, "big")
def bytes_to_int(data: bytes):
return int.f... | [
{
"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 | psi/serialize/int.py | delta-mpc/python-psi |
"""empty message
Revision ID: f025f89b250b
Revises: 37eabcbbb8fb
Create Date: 2019-10-19 18:12:48.976655
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'f025f89b250b'
down_revision = '37eabcbbb8fb'
branch_labels = None
depends_on = None
def upgrade():
# ... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"ans... | 3 | migrations/versions/f025f89b250b_.py | Misschl/flask-fresh |
from disco import Disco
class Config:
def __init__(self):
self._numero_discos = int(input("\nInforme a quantidade de discos: "))
def adiciona_discos(self, torre_inicial):
discos = self.add_disco()
for ix in range(self._numero_discos):
torre_inicial.empilha(discos[ix])
... | [
{
"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 | config.py | vabarboza/Torre-de-Hanoi |
def get_metrics(response):
"""
Extract asked metrics from api response
@list_metrics : list of dict
"""
list_metrics = []
for i in response['reports'][0]['columnHeader']['metricHeader']['metricHeaderEntries']:
list_metrics.append(i['name'])
return list_metrics
def get_dimensions(re... | [
{
"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 | pyganalytics/extract.py | dacker-team/pyganalytics |
from typing import Optional
import pytorch_lightning as pl
import torchvision
import torchvision.transforms as transforms
from torchvision.datasets import CIFAR10
from torch.utils.data import DataLoader, random_split
class CIFARDataModule(pl.LightningDataModule):
def __init__(self, data_dir: str = "./data", batch... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": ... | 3 | test_models/data.py | OleguerCanal/transplanter |
import base64
from datetime import datetime
from socket import gethostname
from threading import Thread
import scapy.layers.inet as scapy
from util import send_traceroute
class TracerouteThread(Thread):
def __init__(self, destination, traceroute_info):
super().__init__()
print(f"TracerouteThread... | [
{
"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 | workers/TracerouteThread.py | chuckablack/quokka-prime |
"""Helper classes for easy recording of videos and images. The classes automatically
find a suitable name for the output file given a specific pattern.
"""
from abc import ABC, abstractmethod
import cv2
import os
from glob import glob
class Recorder(ABC):
def __init__(self, path, file_pattern):
existing =... | [
{
"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 | Source Codes/Assignment1/record.py | amir-souri/ML-Exam2020 |
from flask import request, make_response, jsonify
from flask_restplus import Namespace, Resource, cors
from flask_jwt_oidc import AuthError
__all__ = ['api']
api = Namespace('NameProcessing', description='Name Processing Service - Used by Namex API')
@api.errorhandler(AuthError)
def handle_auth_error(ex):
resp... | [
{
"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 | solr-synonyms-api/synonyms/endpoints/name_processing.py | sumesh-aot/namex |
'''
Created on 2021-08-19
@author: wf
'''
from unittest import TestCase
import time
import getpass
import os
class BaseTest(TestCase):
'''
base test case
'''
def setUp(self,debug=False,profile=True):
'''
setUp test environment
'''
TestCase.setUp(self)
self.... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
... | 3 | tests/basetest.py | WolfgangFahl/pyOnlineSpreadSheetEditing |
import unittest
from app import db
from app.models import Posts, User, Comments
class TestComment(unittest.TestCase):
"""
Class that holds all test cases for the Comment model
"""
def setUp(self):
self.new_comment = Comments(comment='awesome')
def test_instance(self):
... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},... | 3 | tests/test_comments.py | valentine-ochieng/Personal-blogging-website- |
import numpy as np
from ..builder import SCALAR_SCHEDULERS
from .base import BaseScalarScheduler
@SCALAR_SCHEDULERS.register_module()
class StepScalarScheduler(BaseScalarScheduler):
def __init__(self, scales, num_iters, by_epoch=False):
super(StepScalarScheduler, self).__init__()
self.by_epoch =... | [
{
"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 | mmseg/models/scalar_schedulers/step.py | evgeniya-egupova/mmsegmentation |
import numpy as np
def partition(arr, low, high):
i = (low-1) # index of smaller element
pivot = arr[high] # pivot
for j in range(low, high):
# If current element is smaller than the pivot
if arr[j] < pivot:
# increment index of smaller element
i = i+... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": fals... | 3 | 10.Algorithms_Data_Structure/Searching_n_Sorting/QuickSort.py | cuicaihao/Data_Science_Python |
import json
import os
import time
import testinfra.utils.ansible_runner
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
os.environ['MOLECULE_INVENTORY_FILE']
).get_hosts('instance')
def test_health(host):
args = (
"http",
"--ignore-stdin",
"--check-status",
"-... | [
{
"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 | molecule/https/tests/test_default.py | yabusygin/ansible-role-gitlab |
# -*- coding: utf-8 -*-
# @Author: 何睿
# @Create Date: 2019-02-02 09:56:05
# @Last Modified by: 何睿
# @Last Modified time: 2019-02-02 12:40:56
from collections import deque
# 实现一个单调非递增队列,继承于deque
class MonotonicQueue(deque):
def __init__(self):
self.queue = deque()
def push(self, n... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)... | 3 | LeetCode/2019-02-02-239-Sliding-Window-Maximum.py | HeRuivio/-Algorithm |
import numpy as np
import matplotlib.pyplot as plt
from scipy import optimize
def eggholder(x):
return (-(x[1] + 47) * np.sin(np.sqrt(abs(x[0]/2 + (x[1] + 47))))
-x[0] * np.sin(np.sqrt(abs(x[0] - (x[1] + 47)))))
bounds = [(-512, 512), (-512, 512)]
x = np.arange(-512, 513)
y = np.arange(-512, 513)
... | [
{
"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 | doc/source/tutorial/examples/optimize_global_1.py | jake-is-ESD-protected/scipy |
from __future__ import annotations
from spark_auto_mapper_fhir.fhir_types.uri import FhirUri
from spark_auto_mapper_fhir.value_sets.generic_type import GenericTypeCode
from spark_auto_mapper.type_definitions.defined_types import AutoMapperTextInputType
# This file is auto-generated by generate_classes so do not edi... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": true
},
{
... | 3 | spark_auto_mapper_fhir/value_sets/medication_administration_category_codes.py | imranq2/SparkAutoMapper.FHIR |
from typing import Dict
from starkware.cairo.lang.compiler.identifier_definition import (
IdentifierDefinition, MemberDefinition, OffsetReferenceDefinition, ReferenceDefinition)
from starkware.cairo.lang.compiler.identifier_manager import (
IdentifierManager, IdentifierSearchResult)
from starkware.cairo.lang.c... | [
{
"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": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (exclu... | 3 | examples/starkex-cairo/starkware/cairo/lang/compiler/identifier_utils.py | LatticeLabVentures/BeamNet |
import numpy as np
from tqdm import tqdm
def monte_carlo_execute(func, bounds, dtype, n=100):
# print(bounds)
rnd = [np.random.uniform(b_l, b_h+0.01*b_h, n).tolist() for b_l, b_h in bounds]
rnd_choices = [
[rnd[i][np.random.randint(0, n)] for i in range(len(bounds))]
for _ in range(n)
]... | [
{
"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 | hfutils/monte_carlo.py | drunkcoding/huggingface-utils |
from __future__ import division, absolute_import, print_function
import os
import sys
from distutils.command.build import build as old_build
from distutils.util import get_platform
from numpy.distutils.command.config_compiler import show_fortran_compilers
class build(old_build):
sub_commands = [('config_cc', ... | [
{
"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 | numpy/distutils/command/build.py | gmabey/numpy |
import sys
import warnings
# import time warnings don't interfere with warning's tests
import pytest
with warnings.catch_warnings(record=True):
from nistats import _py34_deprecation_warning
from nistats import _py2_deprecation_warning
from nistats import _python_deprecation_warnings
def test_py2_deprec... | [
{
"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 | nistats/tests/test_init.py | PeerHerholz/nistats |
import pytest
from noscrapy.selectors import HtmlSelector
GET_DATA = {
'single':
(HtmlSelector('a', css='p', many=False), '<p>a<b>b</b>c</p><p>d<b>e</b>f</div>',
[{'a': 'a<b>b</b>c'}]),
'many':
(HtmlSelector('a', css='p'), '<p>a<b>b</b>c</p><p>d<b>e</b>f</div>',
[{'a': 'a<b>b... | [
{
"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 | noscrapy/tests/test_html_selector.py | hwms/noscrapy |
# TODO: import
# REQUIRES: num_items >= 0, capacity >= 0,
# size of item_values >= num_items,
# size of item_weights >= num_items,
# item_values are all >= 0, item_weights are all >= 0
# EFFECTS: Computes the max value that can be obtained by picking
# from a set of num_items items without exceed... | [
{
"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 | 7_dynamic_programming/med/knapsack_recursive_med.py | itsEmShoji/TCScurriculum |
import unittest
from urwid.compat import B
from urwid.escape import str_util
class DecodeOneTest(unittest.TestCase):
def gwt(self, ch, exp_ord, exp_pos):
ch = B(ch)
o, pos = str_util.decode_one(ch,0)
assert o==exp_ord, " got:%r expected:%r" % (o, exp_ord)
assert pos==exp_pos, " go... | [
{
"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 | base/lib/pythonbin/urwid/tests/test_str_util.py | threefoldtech/sandbox_osx |
import io
filename = r'C:\Users\Administrator\Desktop\holder\reqs_new.txt'
# one huge string
# print(fin.read())
def read_data(fin):
lines = [l.strip('\n') for l in fin.readlines()]
print(lines)
for line in lines:
print(line.strip('\n'))
# with open(filename, 'r', encoding='utf-8') as fin:
# ... | [
{
"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 | ch02_file_io/text.py | mikeckennedy/gk_python_demos |
class Solution(object):
def search(self, nums, target):
"""
:type nums: List[int]
:type target: int
:rtype: bool
"""
def get(start, end):
if start > end:
return False
mid = (start + end) / 2
# handle dupli... | [
{
"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 | python/081_Search_in_Rotated_Sorted_Array_II.py | JerryCatLeung/leetcode |
import ast
import json
import readline
from cliff.command import Command
import call_server as server
class EnvironmentShell(Command):
def get_parser(self, prog_name):
parser = super(EnvironmentShell, self).get_parser(prog_name)
parser.add_argument(dest='env_name',
h... | [
{
"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 | client/fmcmds/env_shell.py | AlexRogalskiy/caastle |
"""Package Setup"""
import os
import re
from distutils.core import setup
from setuptools import find_packages
CURRENT_DIR = os.path.dirname(__file__)
def read(path):
with open(path, "r") as filep:
return filep.read()
def get_version(package_name):
with open(os.path.join(os.path.dirname(__file__), ... | [
{
"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 | setup.py | awslabs/lorien |
from contextlib import contextmanager
from sqlalchemy.orm.session import Session
from sqlalchemy.engine import create_engine
class Marcotti(object):
def __init__(self, config):
self.engine = create_engine(config.DATABASE_URI)
self.connection = self.engine.connect()
def create_db(self, base)... | [
{
"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 | interface.py | soccermetrics/marcotti-light |
# salimt
# Import libraries
# Import libraries
import numpy as np
from scipy import optimize
# First we define the functions, YOU SHOULD IMPLEMENT THESE
def f (x, y) :
return - np.exp(x - y**2 + x*y)
def g (x, y) :
return np.cosh(y) + x - 2
def dfdx (x, y) :
return (1 + y) * f (x, y)
def dfdy ... | [
{
"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 | Imperial College London - Mathematics for Machine Learning Specialization/Imperial College London - Mathematics for Machine Learning Multivariate Calculus/lagrange-multipliers.py | illumi-Zoldyck/Courses- |
import os
from base64 import urlsafe_b64encode, urlsafe_b64decode
from django.contrib.auth import get_user_model
from django.utils.deprecation import MiddlewareMixin
from urllib.parse import urlencode
from phraseless.certificates import get_name
from phraseless.certificates import verify_challenge, verify_certificate... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inherit... | 3 | phraseless/contrib/django/__init__.py | jocke-l/phraseless |
import tensorflow as tf
import numpy as np
from itertools import permutations
from tensorflow.python.ops import weights_broadcast_ops
EPS = 1e-8
def cal_abs_with_pit(
source, estimate_source, source_lengths, C, method=tf.abs
):
# estimate_source = B, T, S, D
# source = B, S, T, D
# estimate_source =... | [
{
"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": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a t... | 3 | malaya_speech/train/model/fastsplit/loss.py | ishine/malaya-speech |
from ctypes import *
class PyObject(Structure):
_fields_ = [('ob_refcnt', c_size_t),
('ob_type', py_object)]
class PseudoTypeType(object):
def __getattribute__(self, name):
if name == '__repr__':
raise Exception()
elif name == '__name__':
retu... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
}... | 3 | Python/Tests/TestData/DebuggerProject/EvalPseudoType.py | nanshuiyu/pytools |
#
# Copyright (c) 2008-2016 Citrix Systems, 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 l... | [
{
"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 | nitro-python/nssrc/com/citrix/netscaler/nitro/resource/config/dns/dnssoarec_args.py | culbertm/NSttyPython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.