source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
import discord
from discord.ext import commands
class Sample(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.Cog.listener()
async def on_guild_join(self, guild):
"""
This event receives the the guild when the bot joins.
"""
print(f'Joined {guild.n... | [
{
"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 | cogs/sample.py | SourSpoon/Discord.py-Template |
import unittest
import pymongo
import logging
logging.basicConfig(level=logging.DEBUG)
from mongomodels import connections, MongoModel, String, Integer, \
Column, or_, ValidationError, Boolean, belongs_to
class Category(MongoModel):
name = Column(String, required=True)
belongs_to('category', rel_column='... | [
{
"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": false... | 3 | test/test_self_ref.py | ybrs/mongomodels |
import pyomo.environ as pe
import pyutilib.th as unittest
import romodel as ro
class TestUncParam(unittest.TestCase):
def test_simple_uncparam(self):
m = pe.ConcreteModel()
m.p = ro.UncParam()
m.pnom = ro.UncParam(nominal=3)
self.assertEqual(m.pnom.nominal, 3)
self.assertEq... | [
{
"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 | romodel/tests/test_uncparam.py | tsaycal/romodel |
from rest_framework.permissions import BasePermission
class IsCreator(BasePermission):
def has_object_permission(self, request, view, obj):
user = request.user
creator = obj.created_by
return user == creator
class HasChangePermissions(BasePermission):
def has_object_permission(self, ... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true... | 3 | irekua_rest_api/permissions/sampling_events.py | IslasGECI/irekua-rest-api |
from core.actionModule import actionModule
from core.keystore import KeyStore as kb
class crackPasswordHashJohnTR(actionModule):
def __init__(self, config, display, lock):
super(crackPasswordHashJohnTR, self).__init__(config, display, lock)
self.title = "Attempt to crack any password hashes"
... | [
{
"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 | modules/action/crackPasswordHashJohnTR.py | Marx314/apt2 |
import time
from flask import Flask
import whigo
app = Flask(__name__)
whigo.wrap_flask_app(app, 'test-flask-app')
def yolo():
time.sleep(3)
@app.route('/')
def hello_world():
yolo()
return 'Hello, World!'
if __name__ == '__main__':
app.run(port=9199) | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"ans... | 3 | test/foo.py | ankitarora121/whigo |
"""Support for KNX/IP binary sensors."""
from typing import Any, Dict, Optional
from xknx.devices import BinarySensor as XknxBinarySensor
from homeassistant.components.binary_sensor import DEVICE_CLASSES, BinarySensorEntity
from .const import ATTR_COUNTER, DOMAIN
from .knx_entity import KnxEntity
async def async_s... | [
{
"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 | homeassistant/components/knx/binary_sensor.py | tbarbette/core |
from appdirs import user_config_dir
import logging
import configparser
import os
from dodo.default_conf import default_conf
conf_dir = user_config_dir("dodo")
conf_file = os.path.join(conf_dir, "dodo.conf")
logfile = os.path.join(conf_dir, "dodo.log")
def write_default_config(conf_file=None):
print("writing defa... | [
{
"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 | dodo/config.py | peerchemist/dodo |
"""
This is a wrapper for a JSON http response specific to the massenergize API.
It ensures that the data retrieved is in a json format and adds all possible
errors to the caller of a particular route
"""
from django.http import JsonResponse
from collections.abc import Iterable
import json
class MassenergizeResponse... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},... | 3 | src/_main_/utils/massenergize_response/__init__.py | gregory-chekler/api |
class LastProducts:
# TODO: Implement homework here
def __init__(self, max_number_of_products: int = 3) -> None:
...
def add_watched_product(self, product_name: str, product_category: str) -> None:
...
def print_last_products_in_order(self) -> None:
...
| [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or few... | 3 | Part_3_advanced/m11_collections_I/ordereddict/homework_1_start/shop/last_products.py | Mikma03/InfoShareacademy_Python_Courses |
from obj_model import Class, Instance, TYPE, OBJECT
def test_creation():
test_attribute()
test_subclass()
test_callmethod()
def test_attribute():
# Python Code
class A(object):
pass
obj = A()
obj.a = 1
assert obj.a == 1
obj.b = 2
assert obj.b == 2
obj.a = 3
... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer":... | 3 | smalltalk_like/tests.py | loucq123/object_model |
#
# Copyright 2019 The FATE Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | [
{
"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_class_has_docstring",
"question": "Does every class in this file have a docstring?"... | 3 | federatedml/framework/homo/sync/is_converge_sync.py | peiyong86/FATE |
import random
import app.calculator.assign as assign
import app.calculator.filters as filters
import app.calculator.tech_abilities as tech_abilities
def bombard_roll(val, options, jolnar_commander):
x = random.randint(1, 10)
if options["def_bunker"]:
x -= 4
if x >= val:
return 1
# Jol... | [
{
"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 | app/calculator/bombard.py | systemicsmitty/TI4_battle_sim |
import unittest
from arithmetic_slices_ii_subsequence import Solution
class Test(unittest.TestCase):
def test_1(self):
solution = Solution()
self.assertEqual(solution.numberOfArithmeticSlices([2, 4, 6, 8, 10]), 7)
def test_2(self):
solution = Solution()
self.assertEqual(solut... | [
{
"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 | exercises/0446-ArithmeticSlicesIISubsequence/arithmetic_slices_ii_subsequence_test.py | tqa236/leetcode-solutions |
#!/usr/bin/env python
import unittest
from weblogo.seq_io._nexus import Nexus
from . import data_stream
class test_nexus(unittest.TestCase):
def test_create(self):
n = Nexus()
self.assertNotEqual(n, None)
def test_parse_f0(self):
f = data_stream("nexus/test_Nexus_input.nex")
... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true... | 3 | tests/test_nexus.py | ghuls/weblogo |
class UnionFind:
def __init__(self, n):
self.n = n
self.parent = [i for i in range(n + 2)]
def find(self, a):
path = []
while self.parent[a] != a:
path.append(a)
a = self.parent[a]
for p in path:
self.parent[p] = a
... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cl... | 3 | Lintcode/G_Practice/Tag_Matrix/1628. Driving problem.py | ctc316/algorithm-python |
"""
Provides an extra question and configuration ``docs_semver_over_calver``
to :mod:`doc` to determine whether Semantic or Calendar Versioning is wanted.
"""
from mold import Tool, Question, templates_from_directory
from ...domains import python, module
from ...face.doc import interface as doc, Provides as DocVars
fro... | [
{
"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 | src/mold/plugins/tools/sphinx/__init__.py | felix-hilden/mold |
def julian_is_leap(year):
return year % 4 == 0
def gregorian_is_leap(year):
return year % 400 == 0 or (year % 4 == 0 and year % 100 != 0)
def solve(year):
month = '09'
day = '13'
if year <= 1917:
is_leap_year = julian_is_leap(year)
elif year == 1918:
day = '26'
is_le... | [
{
"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 | algorithms/implementation/day_of_the_programmer.py | avenet/hackerrank |
# Advent of Code 2020
# Day 2
from pathlib import Path
# input
with open(Path(__file__).parent / "input.txt") as f:
inp = f.readlines()
# part 1
# Find how many passwords are valid according to the policy of at_least-at_most char : password.
import re
def part_1():
count = 0
for pwd_policy in inp:
... | [
{
"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 | day-2/solution.py | DallogFheir/aoc-2020 |
import asyncio
import aiosnmp
async def handler(host: str, port: int, message: aiosnmp.SnmpV2TrapMessage) -> None:
print(f"got packet from {host}:{port}")
for d in message.data.varbinds:
print(f"oid: {d.oid}, value: {d.value}")
async def main():
p = aiosnmp.SnmpV2TrapServer(
host="127.0... | [
{
"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 | examples/trap.py | fthyssen/aiosnmp |
from typing import Tuple
import numpy as np
from . import modulus, inverse
def gcd_poly(poly1: np.poly1d, poly2: np.poly1d, p: int) -> np.poly1d:
"""Seek the gcd of two polynomials over Fp.
Args:
poly1 (np.poly1d): A polynomial.
poly2 (np.poly1d): A polynomial.
p (int): A prime numb... | [
{
"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... | 4 | galois_field/core/gcd.py | syakoo/galois-field |
# Copyright 2013 Red Hat, 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 required by... | [
{
"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 | cinderclient/tests/v2/test_snapshot_actions.py | Acidburn0zzz/python-cinderclient |
# HIDClass.py
#
import struct
from .USB import *
from .USBClass import USBClass
#
# FIXME: This should actually parse HID and subordinate descriptors e.g.
# for easy parsing during MITM attacks. To make things easy for now we just
# provide basic support for replaying these.
#
#
# FIXME: This should also implement a... | [
{
"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 | facedancer/HIDClass.py | HclX/Facedancer |
# -*- coding: utf-8 -*-
"""
Created on Tue Oct 13 20:12:58 2020
@author: ninjaac
"""
#############using the formate function
def print_full_name(a, b):
print("Hello {a} {b} ! You just delved into python.")
if __name__ == '__main__':
first_name = input()
last_name = input()
print_full_na... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding se... | 3 | Python_challege/formate_and_string.py | pavi-ninjaac/HackerRank |
class Student(object):
def __init__(self, name, age):
self.name = name
self.age = age
# self别忘记写了
def __str__(self):
return "姓名:%s,年龄:%s" % (self.name, self.age)
lisi = Student("李四", 22)
print(lisi) | [
{
"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 | python/2.OOP/1Encapsulation/1.3.__str__.py | dunitian/BaseCode |
import re
from commons.logger import log
class Template(object):
"""
Template class handles:
1. one-to-one variable to value mapping.
2. multi-value variables can be mapped via '...' convention.
3. delimiters can be enabled as configurable in future.
"""
def __init__(self, template_str):
... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
... | 3 | messenger/utils/response/ResponseTypes/Template.py | functioncall/rescue-habit |
import os, sys
import json
import os.path
import numpy
class DemandProfile:
def __init__(self):
cwd = os.getcwd()
self.fname = cwd + '/demand-profile.json'
def get_data(self):
demand={}
with open(self.fname) as demand_info:
demand = json.load(demand_info)
... | [
{
"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 | application/DemandSideNew/Building/DemandProfile.py | FrancisDinh/Smart-Energy-Project |
from abc import ABCMeta, abstractmethod
class _Response(metaclass=ABCMeta):
multi_line: bool
@abstractmethod
async def from_stream(self, stream: None) -> "_Response":
...
class GREETING(_Response):
multi_line = False
async def from_stream(self, stream: None) -> "GREETING":
retu... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
... | 3 | xplonk/protocol/response.py | CodeMouse92/xplonk |
import yaml
class CConfig:
def __init__(self, configfile):
self._conf = None
self.loadConfig(configfile)
def loadConfig(self, configfile):
if not configfile:
configfile = "config.yaml"
try:
with open(configfile, "r") as ymlfile:
conf = y... | [
{
"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 | awsanalysis/c_config.py | benjah1/aws-analysis |
input_signals =[]
weights =[]
''' Synapses - Mathematically, the synapse is represented as a weight vector
empty list of weights and input signals'''
signals_v =(int(input('type number of input signals')))
for i in range(0, signals_v): # for each input signal we will store a weight
signals_list = (int(input... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (ex... | 3 | Rosenblatt_Basics.py | BinaryLeo/ANN_Perceptron |
class UnoError(Exception):
def __init__(self,valor):
self.valorError = valor
def __str__(self):
print("no se puede dividir entre 1 el numero",self.valorError)
print("Hola")
e= 5
h=1
n=2
try:
print(0/n)
if(n==2):
raise UnoError(e) #Lanzar el error creado
except ... | [
{
"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 | Ejercicios/Excepciones.py | dannieldev/Fundamentos-de-Python |
import pytest
from sources.hdlc import hdlc_code
@pytest.fixture()
def own_3257():
hdlc = b'\x10\x02\x00\x01\x02\x00\x00\x00\x1c\x00\x04\xfb\x00\x0e2Wt\x04\xc1\x81/2Wv\xfb>~\xf5`-\x10\x83'
source = "0x0 0x1 0x2 0x0 0x0 0x0 0x1C 0x0 0x4 0xFB 0x0 0xE 0x32 0x57 0x74 0x4 0xC1 0x81 0x2F 0x32 0x57 0x76 0xFB 0x3E 0x... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"ans... | 3 | test_chk_hdlc.py | vpalex999/testing_eha |
#!/usr/bin/env python3
import sys
from conll2t9corpus import mapping
def mb_escape(s):
if '"' in s or ',' in s:
replaced = s.replace('"', '""')
return f'"{replaced}"'
return s
def process(fd):
for line in fd:
line = line.rstrip('\n\r')
if line.startswith("#"):
... | [
{
"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 | scripts/conll2minicorpus.py | eiennohito/jumanpp-t9 |
import keras
import keras.backend as K
class Shape(keras.layers.Layer):
def call(self, inputs):
return K.shape(inputs)
def compute_output_shape(self, input_shape):
return (len(input_shape),)
class Cast(keras.layers.Layer):
def __init__(self, dtype, **kwargs):
self.dtype = dtype
... | [
{
"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 | convnet3d/layers/misc.py | yecharlie/convnet3d |
from __future__ import unicode_literals
import logging
import os
from mopidy import config, ext
__version__ = '0.2.0'
logger = logging.getLogger(__name__)
class Extension(ext.Extension):
dist_name = 'Mopidy-MQTT'
ext_name = 'mqtthook'
version = __version__
def get_default_config(self):
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": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
... | 3 | mopidy_mqtt/__init__.py | miesli/mopidy-mqtt |
from cement import Controller, ex
from ..utils import controllerUtils
class ExportController(Controller):
class Meta:
label = 'export controls'
@ex(
help='export active collection as a file',
arguments=[
(
['-p', '--path'],
{
... | [
{
"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 | poetcli/controllers/exportController.py | jkerola/poetcli |
class _GLUECLAMP_:
_imports_ = (
'_root:os',
'_root:webbrowser',
)
default_doc_file = 'guppy.html'
def doc(self, subject=None, *args, **kwds):
"""\
This doesnt work well or at all
There are painful were where-to-find the files issues
for the distributed ... | [
{
"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 | guppy/gsl/Help.py | EhsanKia/guppy3 |
from typing import Dict, List
from overrides.overrides import overrides
from datasets.dataset_base import DatasetBase
class DocumentDatasetBase(DatasetBase):
def __init__(self):
super().__init__()
def get_indices_per_document(self) -> Dict[int, List[int]]:
return {}
def use_collate_func... | [
{
"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 | datasets/document_dataset_base.py | ktodorov/historical-ocr |
# coding: utf-8
"""
Harbor API
These APIs provide services for manipulating Harbor project. # noqa: E501
OpenAPI spec version: 2.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import harbor
from api.repository_api... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer"... | 3 | test/test_repository_api.py | angeiv/python-harbor |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""pytests for :class:`dead_sfs.keygen`"""
import argparse
import os
from tempfile import TemporaryDirectory
import nacl.secret
import pytest
from dead_sfs.keygen import get_parser, main
def test_get_argparser():
parser = get_parser()
assert parser
assert ... | [
{
"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 | test/unit/test_keygen.py | nklapste/deadSFS |
def transpose(grid):
return [''.join(line) for line in zip(*grid)]
def chk_hori(grid):
for line in grid:
if all(c in 'XT' for c in line):
return 'X won'
if all(c in 'OT' for c in line):
return 'O won'
def chk_diag(grid):
if all(grid[i][i] in 'XT' for i in range(len(... | [
{
"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 | codejam/13/0q/a-tic-tac-toe-tomek.py | neizod/problems |
from . import base
class Section(base.SectionBase):
@base.returns_single_item
def wantlist(self, peer=None, **kwargs):
"""Returns blocks currently on the bitswap wantlist.
.. code-block:: python
>>> client.bitswap.wantlist()
{'Keys': [
'QmeV6C6XVt1wf7V7as7Yak3mxPma8jzpqyhtRtCvpKcfBb',
'QmdCW... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answ... | 3 | ipfshttpclient4ipwb/client/bitswap.py | ibnesayeed/py-ipfs-http-client |
import logging
import warnings
from rest_framework import serializers
from rest_framework.authtoken.models import Token
from django.contrib.auth import get_user_model
l = logging.getLogger(__name__)
class OAuth2InputSerializer(serializers.Serializer):
provider = serializers.CharField(required=False)
code =... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class 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": false
},
{... | 3 | rest_social_auth/serializers.py | silverlogic/django-rest-social-auth |
class Solution(object):
def numIslands2(self, m, n, positions):
"""
:type m: int
:type n: int
:type positions: List[List[int]]
:rtype: List[int]
"""
## union-find
h = m
w = n
t = [None for x in range(h * w)]
res=[]
... | [
{
"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 | LC/305.py | szhu3210/LeetCode_Solutions |
from turtle import Turtle
import random
COLORS = ['red', 'orange', 'yellow', 'green', 'blue', 'purple']
STARTING_MOVE_DISTANCE = 5
MOVE_INCREMENT = 10
class CarManager:
def __init__(self):
self.all_cars = []
self.car_speed = STARTING_MOVE_DISTANCE
def create_car(self):
random_chance... | [
{
"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 | Day_23/car_manager.py | johnsons-ux/100-days-of-python |
import os
from .installer import Installer
class NodeInstaller(Installer):
versions = ('14', '15', '16', '17')
__source_file_path = '/etc/apt/sources.list.d/nodesource.list'
def install(self, version: str) -> None:
if version not in self.versions:
self.ctx.fail('Invalid node version')... | [
{
"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 | sutler/installers/node.py | joeladam518/sutler |
import six
if six.PY3:
import unittest
else:
import unittest2 as unittest
from datetime import date
from mock import Mock
from six import u
from twilio.rest.resources import Messages
DEFAULT = {
'From': None,
'DateSent<': None,
'DateSent>': None,
'DateSent': None,
}
class MessageTest(unittes... | [
{
"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 | tests/test_messages.py | felixcheruiyot/twilio-python |
"""
面试题 18(一):在 O (1) 时间删除链表结点
题目:给定单向链表的头指针和一个结点指针,定义一个函数在 O (1) 时间删除该结点。
"""
class Node:
def __init__(self, val):
self.val = val
self.next = None
def list2link(lst):
root = Node(None)
ptr = root
for i in lst:
ptr.next = Node(i)
ptr = ptr.next
return root.next
d... | [
{
"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 | CodingInterview2/18_01_DeleteNodeInList/delete_node_in_list.py | hscspring/TheAlgorithms-Python |
import pytest
from IPython.testing.globalipapp import start_ipython
@pytest.fixture(scope="session")
def session_ip():
return start_ipython()
@pytest.fixture(scope="function")
def ip(session_ip):
session_ip.run_line_magic(magic_name="load_ext", line="jupyter_spaces")
yield session_ip
session_ip.run_... | [
{
"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/conftest.py | davidesarra/jupyter_spaces |
#!/usr/bin/env python3
import yaml
import numpy as np
def read_evals(fyml):
with open(fyml, 'r') as f:
evd = yaml.safe_load(f)
elist = evd['evals']
return np.array(elist)
def main():
from argparse import ArgumentParser
parser = ArgumentParser()
parser.add_argument('nup', type=int)
parser.add_argumen... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"ans... | 3 | examples/02_min-h4/eri/diff_evals.py | Paul-St-Young/eried |
"""users table
Revision ID: 4b83761bf52a
Revises: 0d3bdf63aacc
Create Date: 2029-12-29 17:17:20.500426
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '4b83761bf52a'
down_revision = '0d3bdf63aacc'
branch_labels = None
depends_on = None
def upgrade():
# ### ... | [
{
"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 | Lms/migrations/versions/4b83761bf52a_users_table.py | stsl256/LMS_for_tinkoff |
class PrinterError(RuntimeError):
pass
class Printer:
def __init__(self, pages_per_s: int, capacity: int):
self.pages_per_s = pages_per_s
self._capacity = capacity
def print(self, pages):
if pages > self._capacity:
raise PrinterError('Printer does not have enough c... | [
{
"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 | 20_unit_testing/lectures/7_more_printer_tests/printer.py | gdia/The-Complete-Python-Course |
# -*- coding: utf-8 -*-
import requests
from webs.api.exceptions.customs import ServerError, InvalidAPIRequest, RecordNotFound, RecordAlreadyExists
class RequestMixin(object):
CODE_EXCEPTION_MSG = {
400: InvalidAPIRequest,
404: RecordNotFound,
409: RecordAlreadyExists,
422: Inva... | [
{
"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_function_names_snake_case",
"question": "Are all function names in this file writte... | 3 | services/engine/webs/core/requests/request.py | huang-zp/crawloop |
from typing import cast, Generic, TypeVar, Union
from intervals.infinity import Infinity
from intervals.comparable import Comparable
T = TypeVar('T', bound=Comparable)
class Endpoint(Generic[T]):
value: Union[T, Infinity]
open: bool
def __init__(self,
value: Union[T, Infinity],
... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cl... | 3 | intervals/endpoint.py | kitsuyui/python-intervals |
import scrapy, re
from alleco.objects.official import Official
class ross_t(scrapy.Spider):
name = "ross_t"
muniName = "ROSS"
muniType = "TOWNSHIP"
complete = True
def start_requests(self):
urls = ['https://www.ross.pa.us/245/Board-of-Commissioners',
'https://www.ross.pa.us/225/Other-Elected-Offic... | [
{
"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 | alleco/spiders/ross_t.py | crocojim18/alleco |
from ctre import WPI_TalonSRX
class Shooter:
motor: WPI_TalonSRX
def __init__(self):
self.ref_velocity = 0
def enable(self):
self.ref_velocity = 1
def disable(self):
self.ref_velocity = 0
def ready(self):
return self.motor.getQuadratureVelocity() > 4500
def e... | [
{
"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 | robot/components/shooter.py | frc1418/robotpy-slides |
class Solution(object):
def isValidSudoku(self, board):
"""
:type board: List[List[str]]
:rtype: bool
"""
def is_valid(arr):
dict = {}
tmp = []
for el in arr:
if el != '.':
tmp.append(el)
... | [
{
"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 | solutions/0036_ValidSudoku.py | alexwawl/leetcode-solutions-javascript-python |
# -*- coding: utf-8 -*-
"""
951. Flip Equivalent Binary Trees
For a binary tree T, we can define a flip operation as follows:
choose any node, and swap the left and right child subtrees.
A binary tree X is flip equivalent to a binary tree Y if and only if we can make X equal to Y
after some number of flip operations.... | [
{
"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 | solutions/python3/problem951.py | tjyiiuan/LeetCode |
"""
Spadille is the nickname for the Ace of Spades in some games
(see `Webster 1913`_)
>>> beer_card = Card('7', Suite.diamonds)
>>> beer_card
Card('7', Suite.diamonds)
>>> spadille = Card('A', Suite.spades, long_rank='Ace')
>>> spadille
Card('A', Suite.spades)
>>> print(spadille)
Ace ... | [
{
"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 | attic/objects/cards.py | banjin/FluentPython-example |
"""
Copyright (C) 2006 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, softwa... | [
{
"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 | kml/wms.py | rayvnekieron/regionator |
###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013-2021, John McNamara, jmcnamara@cpan.org
#
from ..excel_comparison_test import ExcelComparisonTest
import codecs
from ...workbook import Workbook
class TestCompareXLSXFiles(ExcelComparison... | [
{
"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 | xlsxwriter/test/comparison/test_optimize10.py | eddiechapman/XlsxWriter |
#!/usr/bin/env python3
# SPDX-FileCopyrightText: © 2022 Decompollaborate
# SPDX-License-Identifier: MIT
from __future__ import annotations
import dataclasses
import struct
@dataclasses.dataclass
class Elf32RelEntry:
offset: int # address # 0x00
info: int # word # 0x04
#... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": fals... | 3 | spimdisasm/elf32/Elf32Rels.py | Decompollaborate/py-mips-disasm |
from dataclasses import fields
from warnings import warn
__all__ = ['dataslots', 'with_slots']
def with_slots(*args, **kwargs):
warn("Use dataslots decorator instead of with_slots", category=PendingDeprecationWarning, stacklevel=2)
return dataslots(*args, **kwargs)
def dataslots(_cls=None, *, add_dict=Fals... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 lines?",
"answer": true
... | 3 | dataslots/__init__.py | cl0ne/dataslots |
from utils import*
from random import*
formattedProxies = []
def chooseProxy(tasknum):
if tasknum + 1 <= len(proxieslines):
proxy = proxieslines[tasknum].rstrip()
if tasknum + 1 > len(proxieslines):
if len(proxieslines) > 1:
a = randint(1, len(proxieslines) - 1)
if len(proxieslines) == 1:
a = 0
proxy... | [
{
"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 | proxymanager.py | PrototypeSapien/OWExcelsiorRaffle |
import os
from importlib import import_module
def get_providers():
for provider_file in os.listdir(os.path.dirname(os.path.abspath(__file__))):
if provider_file[0] != '$':
continue
provider = provider_file.replace('.py', '')
yield import_module(f'{__package__}.{provider}')
d... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"... | 3 | src/providers/__init__.py | abdellatifLabr/social-media-stocks-tracker |
from datetime import datetime, date
from marqeta.response_models import datetime_object
import json
import re
class CommandoModeNestedTransition(object):
def __init__(self, json_response):
self.json_response = json_response
def __str__(self):
return json.dumps(self.json_response, default=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": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer"... | 3 | marqeta/response_models/commando_mode_nested_transition.py | marqeta/marqeta-python |
class AdminCatalogHelper:
def __init__(self, app):
self.app = app
def go_though_each_product_and_print_browser_log(self):
for i in range(len(self.app.wd.find_elements_by_css_selector('.dataTable td:nth-of-type(3) a[href*="&product_id="]'))):
self.app.wd.find_elements_by_css_selecto... | [
{
"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 | v_python/fixture/admin_catalog.py | spcartman/selenium_full_course |
import requests
import platform
import os
sys = platform.system()
dataset_cmd = "python dataset/prepare_data.py -fold=1 -num_folds=1024 -base_fn=dataset/tf/data_1024 -input_fn=dataset/data -max_seq_length=1024 > tf.log"
train_cmd = "python train/train1.py --config_file=configs/mega.json --input_file=dataset/tf/data_10... | [
{
"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 | utils/util.py | lahu2046/textAI |
import unittest
from maritest.response import Response
class TestHttpResponse(unittest.TestCase):
def test_http_response_format(self):
response = Response(
method="GET",
url="https://jsonplaceholder.typicode.com/posts",
headers={"some_key": "some_value"},
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 | tests/test_response.py | sodrooome/maritest |
# Copyright 2021 Torsten Mehnert
#
# 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 wri... | [
{
"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 | test/fixtures/teststream.py | tmehnert/complate-cpp-for-python |
import subprocess
import sys
import threading
class SubprocessThread(threading.Thread):
def __init__(
self,
args,
stdin_pipe=subprocess.PIPE,
stdout_pipe=subprocess.PIPE,
stderr_pipe=subprocess.PIPE,
timeout=2,
):
threading.Thread.__init__(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 | pcm/interactive_runner.py | kojinho10/pcm |
#!/usr/bin/env python3
# Copyright (c) 2017-2020 The Finalcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test deprecation of RPC calls."""
from test_framework.test_framework import FinalcoinTestFramework
c... | [
{
"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 | test/functional/rpc_deprecated.py | republic-productions/finalcoin |
"""This example demonstrates the usage of Optuna with Ray Tune.
It also checks that it is usable with a separate scheduler.
"""
import time
import ray
from ray import tune
from ray.tune.suggest import ConcurrencyLimiter
from ray.tune.schedulers import AsyncHyperBandScheduler
from ray.tune.suggest.optuna import Optuna... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docs... | 3 | python/ray/tune/examples/optuna_example.py | firebolt55439/ray |
#!/usr/bin/env python
from circuits import Component
from circuits.web import JSONRPC, Controller
from .helpers import urlopen
from .jsonrpclib import ServerProxy
class App(Component):
def eval(self, s):
return eval(s)
class Root(Controller):
def index(self):
return "Hello World!"
def t... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": ... | 3 | tests/web/test_jsonrpc.py | spaceone/circuits |
"""
This file contains tests for the cluster module's Cluster class.
"""
# Obviously we want to test 'private' attributes.
# pylint: disable=protected-access
import numpy as np
from local_stats.cluster import Cluster
def test_init():
"""
Classic test to blow up if attribute names change.
"""
cluste... | [
{
"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_cluster.py | RBrearton/local_stats |
from os import startfile
from base_functions import base_functions
from markdown import markdownFromFile
class markdown_functionality(base_functions):
"""Seperate Class to hold markdown methods"""
def __init__(self):
super(markdown_functionality, self).__init__()
def compileAndDisplayMarkdown(self, label_index)... | [
{
"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 | Sticky-Notes/markdown_functionality.py | v2thegreat/sticky-notes |
import auditory_stream
import chainer
import visual_stream
### MODEL ###
class ResNet18(chainer.Chain):
def __init__(self):
super(ResNet18, self).__init__(
aud = auditory_stream.ResNet18(),
vis = visual_stream.ResNet18(),
fc = chainer.links.Linear(512, 5, initialW = chai... | [
{
"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 | audiovisual_stream.py | yagguc/deep_impression |
from django.db import models
class Person(models.Model):
name = models.TextField()
def __str__(self):
return "{} ({})".format(self.name, self.pk)
class PersonContent(models.Model):
person = models.ForeignKey(Person, on_delete=models.CASCADE)
language = models.TextField()
text = models.T... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": ... | 3 | djangocms_versioning/test_utils/people/models.py | webbyfox/djangocms-versioning |
# !/usr/bin/env python
# coding: utf-8
'''
Description:
Given a binary tree, return all root-to-leaf paths.
For example, given the following binary tree:
1
/ \
2 3
\
5
All root-to-leaf paths are: ["1->2->5", "1->3"]
Tags: Tree, Depth-first Search
'''
... | [
{
"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 | python/Tree/257_binary_tree_paths.py | Jan-zou/LeetCode |
# coding=utf-8
import time
import os
class CreateID:
def __init__(self, rpapp):
self.rpapp = rpapp
def create_docs(self):
driver = self.rpapp.driver
driver.find_element_by_xpath(
"(.//*[normalize-space(text()) and normalize-space(.)='ti'])[1]/following::button[6]").click(... | [
{
"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 | fixture/create_identity_docs.py | bancone/test |
#!/bin/python3
# author: Jan Hybs
class Singleton(type):
"""
Singleton metaclass pattern
A metaclass is the class of a class; that is, a class is an instance of its metaclass
https://stackoverflow.com/questions/6760685/creating-a-singleton-in-python
"""
_instances = {}
def __call__(cls, ... | [
{
"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 | src/cihpc/core/extensions/singleton.py | janhybs/ci-hpi |
# Copyright (c) 2010-2020, sikuli.org, sikulix.com - MIT license
#
# 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 b... | [
{
"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 | API/src/main/resources/Lib/robot/utils/markuputils.py | TagExpress/SikuliX1 |
"""
Command-line script to process text files
"""
import sys
import argparse
from typing import List
from pii_manager import VERSION
from pii_manager.api import process_file
def parse_args(args: List[str]) -> argparse.Namespace:
parser = argparse.ArgumentParser(
description=f"Perform PII processing on ... | [
{
"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 | pii-manager/src/pii_manager/app/manage.py | raineydavid/data_tooling |
import pandas as pd
import numpy as np
def distance_calculation (df):
df['Time'] = pd.to_datetime(df['Time'])
df['Pace'] = pd.to_datetime(df['Pace'])
time = pd.to_timedelta(df['Time'].dt.strftime("%H:%M:%S")).dt.total_seconds().astype(int).to_numpy()
# convert %H:%M to %M:%S by dividing by 60
pace ... | [
{
"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 | src/my_package/data_cleanup.py | ShiNik/marathon_machine_learning |
# BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE
import pytest # noqa: F401
import numpy as np # noqa: F401
import awkward as ak # noqa: F401
def test_unknown_type():
array = ak._v2.Array({"x": np.arange(10)})
array = ak._v2.operations.with_field(base=array, what=Non... | [
{
"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/v2/test_0879-non-primitive-with-field.py | jpivarski/awkward-1.0 |
#######################################################
#
# __chat.py
# Python implementation of the Class __chat
# Generated by Enterprise Architect
# Created on: 11-Feb-2020 11:08:10 AM
# Original author: Corvo
#
#######################################################
from chatgrp import chatgrp
class __chat:... | [
{
"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 | Old/Model/__chat.py | tma5/FreeTakServer |
from server import app
from flask import Response, request
from prometheus_client import generate_latest, Counter
from functools import wraps
# route to display configured Prometheus metrics
# note that you will need to set up custom metric observers for your app
@app.route('/metrics')
def prometheus_metrics():
M... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answ... | 3 | server/routes/prometheus.py | sadiejay/Open-Sentencing-Model |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.12.4
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
i... | [
{
"point_num": 1,
"id": "has_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 | kubernetes/test/test_policy_v1beta1_run_as_user_strategy_options.py | TomasTomecek/kubernetes-python |
import builtins
from pyecore.ecore import EValue
def has_attribute(obj, name: str) -> bool:
# give a default "nothing_found" since None can be the actual returned value
result = get_attribute(obj, name, "nothing_found")
return False if result is "nothing_found" else True
def get_attribute(obj, name: st... | [
{
"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 | esdlvalidator/validation/functions/utils.py | ESDLMapEditorESSIM/ESDLValidator |
from tqdm import tqdm
import numpy as np
import torch
import torch.nn as nn
def build_mlp(input_dim, output_dim, hidden_units=[64, 64],
hidden_activation=nn.Tanh(), output_activation=None):
layers = []
units = input_dim
for next_units in hidden_units:
layers.append(nn.Linear(units, ne... | [
{
"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 | utils.py | zhaohengyin/irgail_example |
import pytest
from ai.backend.client.exceptions import BackendAPIError
from ai.backend.client.session import Session
# module-level marker
pytestmark = pytest.mark.integration
@pytest.mark.asyncio
async def test_list_images_by_admin():
with Session() as sess:
images = sess.Image.list()
image = 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": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"... | 3 | tests/integration/test_image.py | youngjun0627/backend.ai-client-py |
def count_by_weekday(start_date, end_date):
"""
returns a list of length 7 with the number of occurrences of each day over a given period
:param start_date: first day of the period
:type start_date: datetime.datetime
:param end_date: first day after the period
:type end_date: datetime.datetim... | [
{
"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 | syspy/syspy_utils/daycount.py | systragroup/quetzal |
import unittest
import os
from kali_extractor.custom_xml_parser import CustomXmlParser
from xml.etree import ElementTree
dirname = os.path.dirname(__file__)
xml_path = os.path.join(dirname, 'fixtures/KALITEXT_STRUCT_1.xml')
class CustomXmlParserTests(unittest.TestCase):
def test_2099_parsing(self):
with... | [
{
"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 | kali_extractor/kali_extractor/tests/custom_xml_parser_tests.py | adipasquale/kali_dumps_scripts |
from enum import Enum
class Card:
card_type = None
territory_name = ''
def __init__(self, territory_name, card_type):
self.territory_name = territory_name
self.card_type = card_type
def __str__(self):
return f'Card of {self.territory_name} with {self.card_type} type'
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": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
... | 3 | card.py | yehudareisler/risky-game |
import argparse
import sys
from pathlib import Path
# from ml_volatility.algos.extractor import Extractor
# from ml_volatility.algos.extractor import ExtractorWithJumps
from ml_volatility.algos.extractor import FinalExtractor
# Default paths for intermediate output files, meta paths
DATA_PATH: Path = Path(__file__).p... | [
{
"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_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"a... | 3 | ml_volatility/ml_volatility/cli.py | JacobGrig/ML-volatility |
from typing import Callable
from pyrogram import Client
from pyrogram.types import Message
from VCPlayBot.config import SUDO_USERS
from VCPlayBot.helpers.admins import get_administrators
def errors(func: Callable) -> Callable:
async def decorator(client: Client, message: Message):
try:
retur... | [
{
"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 | VCPlayBot/helpers/decorators.py | UdayBindal2312/TG-VCMusicRobot |
# Copyright 2020 Xilinx Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | [
{
"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 | python/pyxir/contrib/target/components/DPUCADX8G/external_quantizer_tools.py | pankajdarak-xlnx/pyxir |
from hazelcast.serialization.bits import *
from hazelcast.protocol.client_message import ClientMessage
from hazelcast.protocol.custom_codec import *
from hazelcast.protocol.codec.map_message_type import *
REQUEST_TYPE = MAP_GETENTRYVIEW
RESPONSE_TYPE = 111
RETRYABLE = True
def calculate_size(name, key, thread_id):
... | [
{
"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 | hazelcast/protocol/codec/map_get_entry_view_codec.py | buraksezer/hazelcast-python-client |
import pika
import uuid
class FibonacciRpcClient(object):
def __init__(self):
self.connection = pika.BlockingConnection(
pika.ConnectionParameters(host='192.168.101.129',
credentials=pika.PlainCredentials(username='admin', password='admin')))
se... | [
{
"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 | python/message_queues/pika_rpc_client.py | edgells/dev_coms |
"""The client and server for a basic ping-pong style heartbeat.
"""
#-----------------------------------------------------------------------------
# Copyright (C) 2008-2010 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING, distributed as pa... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answe... | 3 | IPython/zmq/heartbeat.py | tinyclues/ipython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.