source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
# compute nim values using negamax and a dictionary
# that holds values already computed RBH 2019
def get_piles():
while True:
raw = input('nim game pile sizes (eg. 3 5 7) ')
try:
dim = tuple( int(x) for x in raw.split() )
if len(dim) > 0 and all(d >= 0 for d in dim):
... | [
{
"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 | simple/nim/nimnega.py | feiooo/games-puzzles-algorithms |
from django.conf import settings
from rest_framework import fields
from rest_framework.exceptions import PermissionDenied
from rest_framework.mixins import RetrieveModelMixin, UpdateModelMixin
from rest_framework.viewsets import GenericViewSet
from rest_framework.serializers import ModelSerializer
from social_django.mo... | [
{
"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 | backend/tabby/app/api/user.py | WhitePrime/tabby-web |
import os
from genomepy.plugins import Plugin
from genomepy.utils import cmd_ok, mkdir_p, rm_rf, run_index_cmd
class Minimap2Plugin(Plugin):
def after_genome_download(self, genome, threads=1, force=False):
if not cmd_ok("minimap2"):
return
# Create index dir
index_dir = genom... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than clas... | 3 | genomepy/plugins/minimap2.py | tilschaef/genomepy |
import json
from urllib.request import urlopen
import atexit
import datetime
import dateutil
import sys
import tda
API_KEY = 'FON1HLNGRN0KOVR6UDTCF4RPEMPYIXOB@AMER.OAUTHAP'
REDIRECT_URI = 'http://localhost:8080/'
TOKEN_PATH = '../access_token'
def save_to_file(data):
"""
Save to file for testing
"""
with... | [
{
"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 | examples/my_get_tx_hist.py | dgl-dev/dgl-tda-api |
#!/usr/bin/python
#
# Copyright 2018 Google LLC
#
# 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 ag... | [
{
"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 | python/labs/quick-banking-app/starter-code/banking.py | ananci/cssi_stuffs |
from apitax.drivers.Driver import Driver
from apitax.utilities.Files import getAllFiles
from apitax.ah.Options import Options
from pathlib import Path
from apitax.ah.Credentials import Credentials
class ApitaxInfoDriver(Driver):
def isApiAuthenticated(self):
return False
def isTokenable(self):
... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
... | 3 | apitaxdrivers/ApitaxInfo.py | Apitax/Drivers |
from datetime import datetime
from django.db import models
from django.utils import timezone
class data(models.Model):
usedDate = models.DateTimeField('usedDate', default = datetime.now())
item = models.CharField('Item', max_length=20)
cost = models.IntegerField('cost')
memo = models.CharField('memo... | [
{
"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 | accounts/models.py | Inkaki/mysite |
class Node:
def __init__(self,data):
self.right=self.left=None
self.data = data
class Solution:
def insert(self,root,data):
if root==None:
return Node(data)
else:
if data<=root.data:
cur=self.insert(root.left,data)
root.lef... | [
{
"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 | Day-22/day-22.py | sirilalithaadapa/Hacker-Rank |
from django.urls import reverse
from ietf.group.factories import GroupFactory, GroupEventFactory
from ietf.group.models import Group, GroupEvent
from ietf.person.models import Person
from ietf.utils.test_utils import TestCase
SECR_USER='secretary'
def augment_data():
system = Person.objects.get(name="(System)")... | [
{
"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 | ietf/secr/areas/tests.py | hassanakbar4/ietfdb |
from hamcrest.core.base_matcher import BaseMatcher
from hamcrest.core.helpers.wrap_matcher import wrap_matcher
__author__ = "Jon Reid"
__copyright__ = "Copyright 2011 hamcrest.org"
__license__ = "BSD, see License.txt"
class HasString(BaseMatcher):
def __init__(self, str_matcher):
self.str_matcher = str_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 | src/hamcrest/library/object/hasstring.py | rbalint/PyHamcrest |
"""Added hiking locations
Revision ID: de73cdceee0e
Revises: 9d571b6c5ae7
Create Date: 2022-03-19 20:38:17.163601
"""
from alembic import op
import sqlalchemy as sa
import app
# revision identifiers, used by Alembic.
revision = 'de73cdceee0e'
down_revision = '9d571b6c5ae7'
branch_labels = None
depends_on = None
d... | [
{
"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/de73cdceee0e_.py | kajusK/HiddenPlaces |
# Add comments to explain what the output from this program will be and how you know.
def math1():
num1 = 50
num2 = 5
return num1 + num2
def math2():
num1 = 50
num2 = 5
return num1 - num2
def math3():
num1 = 50
num2 = 5
return num1 * num2
output_num = math2()
print(output_num)
'''
Add pr... | [
{
"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 | return_practice.py | Athenian-ComputerScience-Fall2020/functions-practice-21lsparks |
__about__ = """ Reverse a linked list using tail-end approach. """
class Node:
def __init__(self,data):
self.data = data
self.next = None
class LinkedList:
def __init__(self):
self.head = None
self.curr = self.head
def insert(self,data):
if self.head is None:
... | [
{
"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 | LinkedList/reverse-tail-end-approach.py | vit-shreyansh-kumar/DailyWorkAtHome |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 5/15/20 4:49 PM
# @File : grover.py
# qubit number=4
# total number=12
import cirq
import cirq.google as cg
from typing import Optional
import sys
from math import log2
import numpy as np
#thatsNoCode
from cirq.contrib.svg import SVGCircuit
# Symbols for... | [
{
"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 | data/p4VQE/R4/benchmark/startCirq675.py | UCLA-SEAL/QDiff |
# check that we can do certain things without allocating heap memory
import micropython
# Check for stackless build, which can't call functions without
# allocating a frame on heap.
try:
def stackless(): pass
micropython.heap_lock(); stackless(); micropython.heap_unlock()
except RuntimeError:
print("SKIP"... | [
{
"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 | tests/micropython/heapalloc.py | learnforpractice/micropython-cpp |
import sys
class CsvReader():
def __init__(self, file_name, sep=',', header=False, skip_top=0, skip_bottom=0):
self.file = open(file_name, 'r')
self.sep = sep
self.header = header
self.skip_top = skip_top
self.skip_bottom = skip_bottom
self.csv_lines = []
sel... | [
{
"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 | day02/ex03/csvreader.py | agelloz/42AI-python-bootcamp |
import numpy as np
from .base import Price
class GBM(Price):
"""Brownian motion."""
def __init__(self, T=1., sigma1=0.02, sigma2=0.01, s1=1., s2=1.,
drift1=0., drift2=0., n=100):
self.sigma1 = sigma1
self.sigma2 = sigma2
self.drift1 = drift1
self.drift2 = drift... | [
{
"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 | src/data/gbm.py | imanolperez/optimal-double-execution |
# To use this code, make sure you
#
# import json
#
# and then, to convert JSON from a string, do
#
# result = group_joined_event_from_dict(json.loads(json_string))
from dataclasses import dataclass
from typing import Any, Optional, TypeVar, Type, cast
T = TypeVar("T")
def from_str(x: Any) -> str:
asse... | [
{
"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/slack_types/rtm_api/group_joined_event.py | warrenseine/slack-types |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for `mvport` package."""
import unittest
import numpy as np
from mvport.stock import Stock
class TestStock(unittest.TestCase):
"""Tests for `mvport` package."""
def setUp(self):
"""SetUp."""
self.ticker = 'AAPL'
self.returns =... | [
{
"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": true
}... | 3 | tests/test_stock.py | condereis/mean-variance-portfolio |
"""Test variant normalization."""
from vgraph.norm import normalize_seq, trim_common_prefixes, trim_common_suffixes
def test_normalize_seq():
"""Test sequence normalization."""
assert normalize_seq('') == ''
assert normalize_seq('ACGT') == 'ACGT'
assert normalize_seq('ACGTNacgtNRYSWKMBDHV') == 'ACGTN... | [
{
"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 | tests/test_norm.py | mcgml/vgraph |
import gym
from metarl.envs import MetaRLEnv, normalize
class TestNormalizedGym:
def setup_method(self):
self.env = MetaRLEnv(
normalize(gym.make('Pendulum-v0'),
normalize_reward=True,
normalize_obs=True,
flatten_obs=True))
... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
}... | 3 | tests/metarl/envs/test_normalized_gym.py | neurips2020submission11699/metarl |
import os
import pytest
import sqlalchemy as sa
from libweasyl.configuration import configure_libweasyl
from libweasyl.models.meta import registry
from libweasyl.models.tables import metadata
from libweasyl.test.common import NotFound
from libweasyl.test.common import dummy_format_media_link
from libweasyl import cac... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fe... | 3 | libweasyl/libweasyl/conftest.py | akash143143/weasyl |
from flask import Blueprint, redirect, render_template, url_for, session, jsonify, request
from app.lib.authentication import login_required
bp = Blueprint('categories', __name__, url_prefix='/categories')
@bp.route('/')
@bp.route('/index')
@login_required
def index():
return render_template('categories/index.h... | [
{
"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 | app/modules/categories/categories_views.py | gurgy11/caffeinated |
from languages.predicate import Predicate
class Path(Predicate):
predicate_name = "path"
def __init__(self, source=None, destination=None, weight=None):
Predicate.__init__(self, [("source"),("destination")])
self.source = source
self.destination = destination
def get_source(self):... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a ty... | 3 | test/specialization/idlv/path.py | umuss/EmbASP-Python |
"""Unit tests for PolynomialModel class
"""
import os
import unittest
import pandas as pd
from stock_trading_backend.agent import PolynomialModel
class TestPolynomialModel(unittest.TestCase):
"""Unit tests for PolynomialModel class.
"""
def test_initializes(self):
"""Checks if model initializes ... | [
{
"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 | tests/agent/test_polynomial_model.py | iryzhkov/stock-trading-backend |
import logging
from spaceone.core import utils
from spaceone.core.manager import BaseManager
from spaceone.inventory.model.server_model import Server
from spaceone.inventory.lib.resource_manager import ResourceManager
from spaceone.inventory.error import *
_LOGGER = logging.getLogger(__name__)
class ServerManager(B... | [
{
"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 | src/spaceone/inventory/manager/server_manager.py | choonho/inventory |
import typing
import apache_beam as beam
class Coders:
TABLE = {
'bytes': 'Bytes',
'utf8': 'UTF-8',
'utf_8': 'UTF-8',
}
CODERS = {
'Bytes': beam.coders.coders.BytesCoder,
'UTF-8': beam.coders.coders.StrUtf8Coder,
}
@classmethod
def get_coder(cls, code... | [
{
"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 | bulq/core/coders.py | koji-m/bulq |
#
# @lc app=leetcode id=677 lang=python3
#
# [677] Map Sum Pairs
# https://leetcode.com/problems/map-sum-pairs/
# This problem is about the trie data structure. Each node keeps track of the sum of its children.
# A new key overrides the original values.
#
import unittest
from typing import Dict
# @lc code=s... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",... | 3 | 677.map-sum-pairs.py | y1zhou/leetcode |
from abc import ABC, abstractmethod
# abstract class
class FlyBehavior(ABC):
@staticmethod
@abstractmethod
def fly():
pass
# Concrete implementations
class FlyWithWings(FlyBehavior):
@staticmethod
def fly():
print("I'm flying!!")
class FlyNoWay(FlyBehavior):
@staticmethod
... | [
{
"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 | duck/FlyBehavior.py | rinman24/headfirst-python |
import pytest
import unittest
from modules.sfp_comodo import sfp_comodo
from sflib import SpiderFoot
from spiderfoot import SpiderFootEvent, SpiderFootTarget
@pytest.mark.usefixtures
class TestModuleIntegrationcomodo(unittest.TestCase):
def test_handleEvent_event_data_safe_internet_name_not_blocked_should_not_r... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answ... | 3 | test/integration/modules/test_sfp_comodo.py | khiemtq-cyber/spiderfoot |
#!/usr/bin/env python3
from fboss_link_test_case import FbosslinkTestCase
class FbossLinkQsfpTests(FbosslinkTestCase):
"""
Tests that focus on qsfp-service functionality.
"""
def setUp(self) -> None:
super().setUp()
def test_fetch_all_DOM_data(self):
qsfp_dom_info_map = self.get_... | [
{
"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 | fboss/qsfp_service/link_test/fboss_link_qsfp_tests.py | TomMD/fboss |
from configparser import SafeConfigParser
import logging
import os
class Config:
def __init__(self, configFile):
if os.path.isfile(configFile):
self.Config = SafeConfigParser()
self.Config.read(configFile)
logging.info(self.Config.sections())
else:
p... | [
{
"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 | src/util/Config.py | saledouble/gitcproc |
# Copyright (c) 2018 NEC, Corp.
#
# 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 agr... | [
{
"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 | ironic/tests/unit/cmd/test_status.py | yanndegat/ironic |
# python tests.py ../source test.test_modules.test_init
from modules import remove_line_with, remove_new_lines
from . import TestCaseModule
class TestCaseInit(TestCaseModule):
def test_remove_line_with(self):
source = "Test text\nLine one\nLine two"
result = "Test text\nLine two"
self.ass... | [
{
"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 | obsolete/tests/test_init.py | telegrambotdev/telegram.email.notify |
import os
import re
import setuptools
def long_description():
with open('README.md') as f:
return f.read()
def install_requires():
with open('requirements.txt') as f:
return f.read().splitlines()
def version():
with open(os.path.join('exemplary', '__init__.py')) as f:
regex = r... | [
{
"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 | setup.py | jvs/exemplary |
import datetime
import pytest
import unittest
from quickbooks import QuickBooks
from quickbooks.objects.preferences import Preferences
def check_valid_date(date_text):
try:
datetime.datetime.strptime(date_text, '%Y-%m-%d')
return True
except ValueError:
raise ValueError("Incorrect data form... | [
{
"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/unit/objects/test_preferences.py | divipayhq/python-quickbooks |
from fabric.api import local
from jinja2 import Environment, FileSystemLoader
template_env = Environment(loader=FileSystemLoader('.'))
def build():
#template = template_env.get_template('source/index.html')
# Template to generate the presentation
template = template_env.get_template('mobile_test_automat... | [
{
"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 | fabfile.py | shusso/mobile_test_automation_talk |
import pytest
import app
@pytest.fixture
def client():
app.app.config['TESTING'] = True
client = app.app.test_client()
yield client
def test_client_page(client):
rv = client.get('/')
# Main page (instructions)
assert b'<p class="lead">A Pusher-powered chat application built using Flask</p>' ... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",... | 3 | test_app.py | john-lock/chatter |
# coding: utf-8
import json
from requests.auth import HTTPBasicAuth
from tapioca import (
TapiocaAdapter, generate_wrapper_from_adapter, JSONAdapterMixin)
from .resource_mapping import RESOURCE_MAPPING
class NessusClientAdapter(JSONAdapterMixin, TapiocaAdapter):
api_root = None
resource_mapping = RESOUR... | [
{
"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": true
},
... | 3 | tapioca_nessus/tapioca_nessus.py | siteblindado/tapioca-nessus |
import torch
import torch.nn as nn
import torch.nn.functional as F
def initial_bounds(x0, epsilon):
'''
x0 = input, b x c x h x w
'''
upper = x0+epsilon
lower = x0-epsilon
return upper, lower
def weighted_bound(layer, prev_upper, prev_lower):
prev_mu = (prev_upper + prev_lower)/2
prev_... | [
{
"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 | DQN/ibp.py | rohitsanjay/radial_rl |
"""Tests for the to_primitives transformation."""
import unittest
from tt.errors import InvalidArgumentTypeError
from tt.expressions import BooleanExpression
from tt.transformations import to_primitives
class TestToPrimitives(unittest.TestCase):
def assert_to_primitives_tranformation(self, original, expected):... | [
{
"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 | tt/tests/unit/transformations/test_bexpr_to_primitives.py | fkromer/tt |
"""empty message
Revision ID: c552235f6967
Revises: ef3c58af741e
Create Date: 2022-03-21 14:53:58.715602
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "c552235f6967"
down_revision = "ef3c58af741e"
branch_labels = None
depends_on = None
def upgrade():
# ... | [
{
"point_num": 1,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answe... | 3 | services/showcase/api/db/migrations/versions/c552235f6967_.py | bcgov/traction |
from huobi.connection.restapi_sync_client import RestApiSyncClient
from huobi.constant import *
from huobi.model.etp.etp_creation_redemption_history import ETPCreationRedemptionHistory
class GetETPCreationRedemptionHistoryService:
def __init__(self, params):
self.params = params
def request(self, **... | [
{
"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 | huobi/service/etp/redemption_creation_history.py | Reactive-Capital/huobi_Python |
# coding=utf-8
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
from azure.core.pipeline.policies import ContentDecodePolicy
from azure.core.pipeline.policies import SansIOHTTPPolicy, HTTPPolicy
from ._models import T... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/c... | 3 | sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_policies.py | anuchandy/azure-sdk-for-python |
#!/usr/bin/env python
import numpy
class Point:
"""Represents a point in 2D."""
def __init__(self, x, y):
self.x = x
self.y = y
def euclidean_dist(p1, p2):
"""Euclidean distance of two 2D points."""
from math import sqrt
return sqrt((p1.x-p2.x)**2 + (p1.y-p2.y)**2)
def get_min... | [
{
"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 | documents/math-minimal-distance-to-cubic-function/calcMinDist.py | RalfGuder/LaTeX-examples |
import io
import base64
import requests
from nbt import nbt
from .errors import *
from .errors import _get_response_exception
def decode_item_bytes(item_bytes: bytes) -> nbt.NBTFile:
return nbt.NBTFile(fileobj=io.BytesIO(base64.b64decode(item_bytes)))
def request_endpoint(endpoint: str, args: dict[str, str] | N... | [
{
"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 | pyblock/utils.py | EmuMan/pyblock |
from git import Repo
import logging
from wily.archivers import BaseArchiver, Revision
logger = logging.getLogger(__name__)
class DirtyGitRepositoryError(Exception):
def __init__(self, untracked_files):
self.untracked_files = untracked_files
self.message = "Dirty repository, make sure you commit/... | [
{
"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 | wily/archivers/git.py | wcooley/wily |
from threading import Semaphore
class CustomBarrier():
def __init__(self, parties: int) -> None:
self.turnstile = Semaphore(0)
self.turnstile2 = Semaphore(0)
self.mutex = Semaphore(1)
self.count = 0
self.parties = parties
def phase1(self):
# Rendezvous
... | [
{
"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 | custom_barrier.py | debemdeboas/mmwb |
import uuid
from django.db import models
from django.contrib.auth.models import AbstractBaseUser, BaseUserManager
class UserManager(BaseUserManager):
def create_user(self, email, username, password):
"""
Created user with given email username and password
:param: email
:param: use... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},... | 3 | savedots/savedots_api/models.py | kelj0/GPGdotgetter |
import random
from django.db import models
from user.models import User
TEAM_ID_LENGTH = 13
def generate_team_id():
s = "abcdefghijklmnopqrstuvwxyz01234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ"
pass_len = TEAM_ID_LENGTH
return "".join(random.sample(s, pass_len))
class Team(models.Model):
team_code = mode... | [
{
"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 | teams/models.py | noahbarnette/ugahacks5 |
# static linked list
class StaticNode:
def __init__(self,value):
self.next = -1
self.value = value
class StaticLinkedList:
def __init__(self,numNodes):
self.head = -2
self.array = [Node(-1)]*numNodes
def push(self,node):
if self.head == -2:
self.head = 0
node.next = 1
else:
cu... | [
{
"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_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": ... | 3 | practice_problems/StaticLinkedList.py | smenon8/practice_scripts |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may... | [
{
"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 | nuvem-parallel/nuvem/put.py | isabella232/nuvem |
# -*- coding: utf-8 -*-
"""
mslib.mscolab._tests.test_utils
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tests for mscolab/utils
This file is part of mss.
:copyright: Copyright 2019 Shivashis Padhi
:copyright: Copyright 2019-2020 by the mss team, see AUTHORS.
Licensed under the Apache License, Ver... | [
{
"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 | mslib/mscolab/_tests/test_utils.py | gisi90/MSS |
from datetime import datetime
import cv2
import re
import base64
from flask import Flask, render_template, request, jsonify
from flask_cors import CORS
import numpy as np
from io import BytesIO
from PIL import Image, ImageOps
import os,sys
import requests
from graphpipe import remote
from matplotlib import pylab as pl... | [
{
"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 | mnist/app/app/mnist.py | scpepper69/ml |
#===----------------------------------------------------------------------===##
#
# The LLVM Compiler Infrastructure
#
# This file is dual licensed under the MIT and the University of Illinois Open
# Source Licenses. See LICENSE.TXT for details.
#
#===-----------------------------------------... | [
{
"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": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (exc... | 3 | contracts/libc++/upstream/utils/libcxx/test/tracing.py | cubetrain/CubeTrain |
import argparse
import asyncio
import logging
from coolqbot.bot import bot
from coolqbot.config import init_logger
from coolqbot.utils import plugin_manager, scheduler
def main(debug=False):
init_logger(bot.logger)
if debug:
bot.logger.setLevel(logging.DEBUG)
bot.logger.debug('Initializing...')
... | [
{
"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 | src/coolqbot/main.py | JacobFX/CoolQBot |
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... | [
{
"point_num": 1,
"id": "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 | x2paddle/optimizer/fusion/dygraph/trace_fc_fuse_pass.py | aiyasin/X2Paddle |
'''
This file is a part of Test Mile Arjuna
Copyright 2018 Test Mile Software Testing Pvt Ltd
Website: www.TestMile.com
Email: support [at] testmile.com
Creator: Rahul Verma
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 ... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/c... | 3 | arjuna/engine/unitee/selection/rules/tags.py | test-mile/arjuna |
#!/usr/bin/env python
'''
gabor_threads.py
=========
Sample demonstrates:
- use of multiple Gabor filter convolutions to get Fractalius-like image effect (http://www.redfieldplugins.com/filterFractalius.htm)
- use of python threading to accelerate the computation
Usage
-----
gabor_threads.py [image filename]
'''
#... | [
{
"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 | samples/python/gabor_threads.py | snosov1/opencv |
from ..wallet import *
from _coin import *
from ..bip32 import Bip32
from blockchain._insight import InsightBlockchainInterface
from blockchain._interface import MultiBlockchainInterface
from impl._segwitcoin import *
class BTC(SegwitCoin):
def __init__(self,is_testnet=False):
#self.supported=True
if(not is_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_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
... | 3 | python/coffer/coins/btc.py | Steve132/wallet_standard |
from game_screen import *
class App:
def __init__(self, width, height):
self.width = width
self.height = height
self.window = pygame.display.set_mode((self.width, self.height))
pygame.display.set_caption('VersuSpace')
self.running = True
self.quit_listener = AppQuit... | [
{
"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 | app.py | Dijereo/VersuSpace |
from django.db import models
from django.utils import timezone
class BaseQuerySet(models.QuerySet):
def restore(self):
self.update(deleted_at=None)
return self
def soft_delete(self):
self.update(deleted_at=timezone.now())
return self
class UserQuerySet(BaseQuerySet):
def... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
... | 3 | backend/db/query.py | AppCraftTeam/appcraft-logs |
# coding: utf-8
"""
Isilon SDK
Isilon SDK - Language bindings for the OneFS API # noqa: E501
OpenAPI spec version: 7
Contact: sdk@isilon.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import isi_sdk_8_2_0
from i... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"... | 3 | isi_sdk_8_2_0/test/test_zones_summary_api.py | mohitjain97/isilon_sdk_python |
from paddle import nn
from paddle.nn import functional as F
from maskrcnn_benchmark.modeling import registry
from maskrcnn_benchmark.modeling.poolers import Pooler
from maskrcnn_benchmark.layers import Conv2d
@registry.ROI_KEYPOINT_FEATURE_EXTRACTORS.register("KeypointRCNNFeatureExtractor")
class KeypointRCNNFeatur... | [
{
"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 | maskrcnn_benchmark/modeling/roi_heads/keypoint_head/roi_keypoint_feature_extractors.py | cxq1/paddle_VinVL |
"""
TODO: Add doc what this file is doing
"""
from marshmallow import Schema, post_dump
class RootSchema(Schema):
SKIP_VALUES = [None]
@post_dump
def remove_skip_values(self, data, many, **kwargs):
return {
key: value for key, value in data.items()
if value not in self.SKI... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/... | 3 | kubi_ecs_logger/models/root_schema.py | kumina/kubi_ecs_logger |
import matplotlib.pyplot as plt
import pandas as pd
from numpy import arange, array
import os
import logging
logging.basicConfig()
logger = logging.getLogger('PlotTimeCost')
logger.setLevel('INFO')
class PlotTimeCostBar:
def __init__(self, data, path, show=False):
self.data = data
self.path = pa... | [
{
"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 | visualizer/plot_mf_param_opt/plot_time_cost_bar.py | buctlab/NIO |
from typing import Dict, List
from gramat.expressions import RuleExp, ReferenceExp
class LinkContext:
def __init__(self):
self.rule_map: Dict[str, RuleExp] = {}
self.rule_hits: Dict[str, int] = {}
self.references: List[ReferenceExp] = []
def register_rule(self, rule: RuleExp):
... | [
{
"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 | gramat/linking/link_context.py | gramat-lang/python-gramat |
import requests
class KongClient:
def __init__(self, url):
self._endpoint = url
self._session = requests.session()
def create_service(self, name, upstream_url):
url = "{}/services".format(self._endpoint)
payload = {
"name": name,
"url": upstr... | [
{
"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 | test/docker/integration/kong_client.py | coolersport/kong-oidc |
import unittest
import doctest
class Example(unittest.TestCase):
def test(self):
self.assertTrue(True)
def load_tests(loader, tests, pattern):
tests.addTests(doctest.DocTestSuite())
return tests
if __name__ == '__main__':
unittest.main()
| [
{
"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 | test.py | invokerrrr/autogame-python |
import openface
import cv2
class FaceFinder:
def __init__(self):
self.align = openface.AlignDlib("models/dlib/shape_predictor_68_face_landmarks.dat")
self.net = openface.TorchNeuralNet("models/openface/nn4.small2.v1.t7", 96)
def getFaces(self, imgPath):
bgrImg = cv2.imread(imgPath)
... | [
{
"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 | import_faces.py | vignettist/image-import |
from shallowflow.api.source import AbstractListOutputSource
from shallowflow.api.config import Option
class ForLoop(AbstractListOutputSource):
"""
Outputs an integer from the specified range.
"""
def description(self):
"""
Returns a description for the actor.
:return: the act... | [
{
"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 | base/src/shallowflow/base/sources/_ForLoop.py | waikato-datamining/shallow-flow |
"""
Copyright 2013 Rackspace
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
dist... | [
{
"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 | cloudroast/compute/burn_in/test_rescue_server_burn_in.py | lmaycotte/cloudroast |
# -*- coding: utf-8 -*-
class Solution:
def exist(self, board, word):
visited = set()
for i in range(len(board)):
for j in range(len(board[0])):
if self.startsHere(board, word, visited, 0, i, j):
return True
return False
def startsHere(s... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside... | 3 | leetcode/0079_word_search.py | jacquerie/leetcode |
from django.test import RequestFactory, TestCase, Client
from .models import Project, Category
from .views import portfolio, portfolio_detail
class PortfolioViewTests(TestCase):
def setUp(self):
# Every test needs access to the request factory.
self.factory = RequestFactory()
self.client ... | [
{
"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 | portfolio/tests.py | tiagocordeiro/mulhergorila-website |
class Solution(object):
def maxProfit(self, prices):
"""
:type prices: List[int]
:rtype: int
"""
length = len(prices)
if length <= 1:
return 0
v = 0
prev = prices[0]
for num in prices[1:]:
if num > prev:
... | [
{
"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/greedy/0122_best_time_to_buy_and_sell_stock_ii.py | linshaoyong/leetcode |
import os
import pwd
import re
import subprocess
import sys
if sys.version_info[0] == 3:
import http.client as httpclient
elif sys.version_info[0] == 2:
import httplib as httpclient
WIRESERVER_ENDPOINT_FILE = '/var/lib/waagent/WireServerEndpoint'
VERSIONS_PATH = '/?comp=versions'
AGENT_CONFIG_FILE = '/etc/wa... | [
{
"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 | dcr/scenarios/agent-bvt/check_firewall.py | ce-bu/WALinuxAgent |
from .find_maximum_value_binary_tree import find_maximum_value, BST
def test_find_maximum_value_tree_with_one_value():
one_value = BST([5])
assert find_maximum_value(one_value) == 5
def test_find_maximum_value_tree_with_two_values():
one_value = BST([10, 2])
assert find_maximum_value(one_value) == 1... | [
{
"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 | challanges/find_maximum_value_binary_tree/test_find_maximum_value_binary_tree.py | Patricia888/data-structures-and-algorithms |
import pytest
from tests.torch_tests.functional import BaseFunctionalTest, TORCH_AVAILABLE, MODEL, DATA
from unittest import mock
class TestTorchInference(BaseFunctionalTest):
def test_get_acc(self):
from deeplite.torch_profiler.torch_inference import get_accuracy
assert get_accuracy(MODEL, DATA['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_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
... | 3 | tests/torch_tests/functional/test_torch_inference.py | Deeplite/deeplite-profiler |
# Definition for singly-linked list.
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
class Solution:
def removeElements(self, head, val):
"""
:type head: ListNode
:type val: int
:rtype: ListNode
"""
while head:
if... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docst... | 3 | src/main/python/leetcode-python/easy/203.Remove Linked List Elements.py | sonymoon/algorithm |
from django.db import models
from django.urls import reverse
from parler.models import TranslatableModel, TranslatedFields
class Category(TranslatableModel):
translations = TranslatedFields(
name=models.CharField(max_length=200,
db_index=True),
slug=models.SlugField(m... | [
{
"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 | shop/models.py | Speccy-Rom/SberMazon |
import torch
from networks.detector import DNet
from networks.loss import *
def load_DNet_for_test(cfg, dict_DB):
if cfg.run_mode == 'test_paper':
checkpoint = torch.load(cfg.paper_weight_dir + 'checkpoint_DNet_paper')
else:
# select ckpt from output_dir
checkpoint = torch.load(cfg.wei... | [
{
"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 | Reflection_symmetry_axes_detection/DNet/code/libs/load_model.py | dongkwonjin/Semantic-Line-DRM |
import heapq
from typing import Iterable
class HeapQueue:
def __init__(self, init_h: Iterable):
self.h = [(-val, index) for index, val in init_h]
heapq.heapify(self.h)
def replace_largest(self, new_val):
heapq.heapreplace(self.h, (-new_val, self.max_index))
def pop(self):
... | [
{
"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 | utils/heap_queue.py | yeshwanthv5/PruneFL |
"""Base Module for Simple Username Data Diggers."""
import abc
import logging
import hashlib
import os
from configparser import ConfigParser
from typing import Dict, Optional, Tuple
from OSIx.core.base_module import BaseModule
from OSIx.core.http_manager import HttpNavigationManager
from OSIx.core.temp_file import Te... | [
{
"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 | OSIx/core/base_username_data_digger.py | guibacellar/OSIx |
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
# For details: https://github.com/PyCQA/pylint/blob/master/COPYING
from pylint.reporters.base_reporter import BaseReporter
class CollectingReporter(BaseReporter):
"""collects messages"""
name = "collector"
def __init__(sel... | [
{
"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 | env/Lib/site-packages/pylint/reporters/collecting_reporter.py | aammjian/cotton |
import os
import pyconll
from ufal.udpipe import Model, Pipeline, ProcessingError
class UDPipeToken:
def __init__(self, ud_token, upos=None, tags=None):
self.id = ud_token.id
self.form = ud_token.form
self.upos = ud_token.upos if upos is None else upos
self.lemma = ud_token.lemma
... | [
{
"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 | py/generative_poetry/udpipe_parser.py | Koziev/verslibre |
from ixnetwork_restpy.base import Base
from ixnetwork_restpy.files import Files
class POP_RETR_1(Base):
__slots__ = ()
_SDM_NAME = 'POP_RETR_1'
_SDM_ATT_MAP = {
'Request command': 'POP_RETR_1.REQUESTX.Request command',
'Space7': 'POP_RETR_1.REQUESTX.Space7',
'Request parameter': 'P... | [
{
"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 | ixnetwork_restpy/testplatform/sessions/ixnetwork/traffic/trafficitem/configelement/stack/POP_RETR_1_template.py | Vibaswan/ixnetwork_restpy |
#!coding:utf8
#author:yqq
#date:2020/4/30 0030 17:11
#description:
import os
import pymysql
SQL_PASSWD = os.environ.get('SQL_PWD')
def open(host : str,usr : str, passwd : str,db_name : str):
conn = pymysql.connect(host=host, user=usr,
password=passwd, db=db_name,
charset='utf8', ... | [
{
"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 | Python3/Tornado/apps/pg/PG_Wallet/src/lib/sql.py | youngqqcn/QBlockChainNotes |
# encoding: utf-8
# module gi._gi
# from /usr/lib/python3/dist-packages/gi/_gi.cpython-35m-x86_64-linux-gnu.so
# by generator 1.145
# no doc
# imports
import _gobject as _gobject # <module '_gobject'>
import _glib as _glib # <module '_glib'>
import gi as __gi
import gobject as __gobject
class RegisteredTypeInfo(__gi... | [
{
"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 | pyy1/.pycharm_helpers/python_stubs/-1550516950/gi/_gi/RegisteredTypeInfo.py | pyy1988/pyy_test1 |
#!/usr/bin/python
from ctypes import CDLL
from ctypes import c_char_p, c_uint16, c_uint32
import copy
import os
__libasdd_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'libasdd.so')
__libasdd = CDLL(__libasdd_path)
def __init_fn(name, res, args):
getattr(__libasdd, name).restype = res
getat... | [
{
"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 | idk/libasdd/disarm.py | Samsung/ADBI |
"""
.. autoclass:: ppci.arch.arch.Architecture
:members:
.. autoclass:: ppci.arch.arch_info.ArchInfo
:members:
.. autoclass:: ppci.arch.arch.Frame
:members:
.. autoclass:: ppci.arch.isa.Isa
:members:
.. autoclass:: ppci.arch.registers.Register
:members: is_colored
.. autoclass:: ppci.arch.e... | [
{
"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 | ppci/arch/__init__.py | kl4w3i/ppci |
from curses_tools import draw_frame
from explosion import explode
class Obstacle:
def __init__(self, canvas, init_x, frame, speed):
self.canvas = canvas
self.x = init_x
self.y = 0
self.frame = frame
self.height = len(frame.splitlines())
self.width = max(map(len, fra... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/... | 3 | obstacle.py | FrCln/SpaceGarbage |
# -*- coding: utf-8 -*-
"""
时间: 2019/11/24 16:29
作者: lyf
更改记录:
重要说明:
"""
# 关键指令:
# # 1.导入包
# import paho.mqtt.client as mqtt
# # 2.创建client对象
# client = mqtt.Client(id)
# # 3.连接
# client.connect(host, post)
# # 4.订阅
# client.subscribe(topic)
# client.on_message=func #接收到信息后的处理函数
# # 5.发布
# client.publish(topic... | [
{
"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 | pro_mqtt/mqtt_le1.py | yongfang117/pro_useful_code |
import time
from functools import wraps
class EventHandlerRepo(type):
handlers = []
def __init__(cls, name, bases, attrs):
if name != "EventHandler":
EventHandlerRepo.handlers.append(cls)
class EventHandler(metaclass=EventHandlerRepo):
MASK = 0
def __init__(self, disp, root, co... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false... | 3 | dowut/handler.py | csams/dowut |
from nexpose_rest.nexpose import _GET
def getReportInstances(config, id):
getParameters=[]
code, data = _GET('/api/3/reports/' + str(id) + '/history', config, getParameters=getParameters)
return data
def getReport(config, id):
getParameters=[]
code, data = _GET('/api/3/reports/' + str(id) + '', ... | [
{
"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 | nexpose_rest/nexpose_report.py | Patralos/nexpose-rest |
import os
import tensorflow as tf
from keras.layers import LSTM, Dense, Dropout
from keras.models import Sequential
from Source.config import Model
from Source.driver import Driver
tf.logging.set_verbosity(tf.logging.ERROR)
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
def run():
dataset = Driver()
n_time_step... | [
{
"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 | Source/lstm.py | SamanKhamesian/Human-Activity-Recognition-Time-Series-Classification |
from collections import defaultdict
from functools import wraps
from time import time
from typing import Callable
class CallMetrics(object):
def __init__(self):
self.start_time = time()
self.execution_time = defaultdict(lambda: 0.)
self.execution_count = defaultdict(lambda: 0)
def res... | [
{
"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 | rlmolecule/tree_search/metrics.py | NREL/rlmolecule |
import re
from typing import TypeVar
import questionary
EnumType = TypeVar("EnumType")
# 驼峰命名转蛇形命名
def camel_to_snake(text: str) -> str:
return re.sub(r"(?<!^)(?=[A-Z])", "_", text).lower()
# 蛇形命名转驼峰命名
def snake_to_camel(text: str) -> str:
return text.split('_')[0] + "".join(x.title() for x in text.split('... | [
{
"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 | fastapi_builder/helpers.py | fmw666/fastapi-cli |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
"""Argument parser functions."""
import argparse
import sys
from configs.defaults import get_cfg_defaults
def parse_args():
"""
Parse the following arguments for a default parser for PySlowFast users.
Args:
... | [
{
"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 | state-change-localization-classification/slowFast-perceiver/utils/parser.py | EGO4D/hands-and-objects |
import os
import sys
import subprocess as sp
from genomepy.plugin import Plugin
from genomepy.utils import mkdir_p, cmd_ok, run_index_cmd
class BwaPlugin(Plugin):
def after_genome_download(self, genome):
if not cmd_ok("bwa"):
return
# Create index dir
index_dir = genom... | [
{
"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 | genomepy/plugins/bwa.py | dohlee/genomepy |
import os
import shutil
import os
from glob import glob
import pandas as pd
import random
from collections import defaultdict
from PIL import Image
from torch.utils.data import Dataset, DataLoader
def get_all_images(dir):
types = ["jpeg", "jpg", "png"]
files = []
for t in types:
path = os.path.join(dir, "**... | [
{
"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 | mfr2.py | HeegyuKim/face_recognition |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.