source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
import cv2
def SIFT(imgname1, imgname2):
sift = cv2.xfeatures2d.SIFT_create()
img1 = cv2.imread(imgname1)
img2 = cv2.imread(imgname2)
kp1, des1 = sift.detectAndCompute(img1, None)
kp2, des2 = sift.detectAndCompute(img2, None)
FLANN_INDEX_KDTREE = 0
index_params = dict(algorithm=FLANN_IND... | [
{
"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 | MultiMediaAnalyse/Task2/main.py | wsh-nie/Assignments |
# Automatically generated by pb2py
# fmt: off
from .. import protobuf as p
if __debug__:
try:
from typing import Dict, List # noqa: F401
from typing_extensions import Literal # noqa: F401
except ImportError:
pass
class CosiCommit(p.MessageType):
MESSAGE_WIRE_TYPE = 71
def _... | [
{
"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 | monero_glue/messages/CosiCommit.py | ph4r05/monero-agent |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import re
from pypinyin import phonetic_symbol
from pypinyin.constants import RE_TONE2
# 用于向后兼容,TODO: 废弃
from pypinyin.seg.simpleseg import simple_seg # noqa
def _replace_tone2_style_dict_to_default(string):
regex = re.compil... | [
{
"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 | pypinyin/utils.py | jamessa/python-pinyin |
def cuda(x):
if isinstance(x, list):
return [xi.cuda() for xi in x]
elif isinstance(x, dict):
return {key: x[key].cuda() for key in x}
else:
return x.cuda()
def cpu(x):
if isinstance(x, list):
return [xi.cpu() for xi in x]
elif isinstance(x, dict):
return {k... | [
{
"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 | ivory/torch/utils.py | daizutabi/ivory |
"""Barebones reader plugin example, using imageio.imread"""
from napari_plugin_engine import napari_hook_implementation
from imageio import formats, imread
readable_extensions = tuple(set(x for f in formats for x in f.extensions))
@napari_hook_implementation
def napari_get_reader(path):
"""A basic implementatio... | [
{
"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 | examples/reader_plugin.py | mkitti/napari |
def coding_problem_10():
"""
Implement a job scheduler which takes in a function f and an integer n, and calls f after n milliseconds.
Example:
>>> coding_problem_10()
Before
Hello from thread
After
"""
from threading import Thread
import time
def delayed_execution(f, ms):
... | [
{
"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 | problems/10/solution_10.py | r1cc4rdo/daily_coding_problem |
# -*- coding: utf-8 -*-
from django.db import models, migrations
from pybb.models import create_or_check_slug
def fill_slugs(apps, schema_editor):
Category = apps.get_model("pybb", "Category")
Forum = apps.get_model("pybb", "Forum")
Topic = apps.get_model("pybb", "Topic")
for category in Category.ob... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inherit... | 3 | pybb/migrations/0003_slugs_fill.py | shubhanshu02/pybbm |
from openbiolink.graph_creation.file_processor.fileProcessor import FileProcessor
from openbiolink.graph_creation.metadata_infile import InMetaOntoUberonPartOf
from openbiolink.graph_creation.types.infileType import InfileType
from openbiolink.graph_creation.types.readerType import ReaderType
class OntoUberonPartOfPr... | [
{
"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/openbiolink/graph_creation/file_processor/onto/ontoUberonPartOfProcessor.py | cthoyt/OpenBioLink |
import time
class StopWatch(object):
before = 0
after = 0
def start(self):
self.before = time.time() * 1000
def stop(self):
self.after = time.time() * 1000
def reset(self):
self.before = 0
def currentValue(self):
return (time.time() * 1000) - self.before
... | [
{
"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 | Outros/StopWatch.py | BlackDereker/Universidade |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (C) 2020 MBI-Division-B
# MIT License, refer to LICENSE file
# Author: Luca Barbera / Email: barbera@mbi-berlin.de
from tango import AttrWriteType, DevState, DebugIt, ErrorIt, InfoIt, DeviceProxy
from tango.server import Device, attribute, command, device_... | [
{
"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 | EnvironmentAM2315MuxSensor.py | MBI-Div-B/pytango-EnvironmentAM2315Mux |
# -*- coding: utf-8 -*-
from django import forms
from django.forms.widgets import RadioSelect
from .models import Rating
class FlagForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
self.user = kwargs.pop('user')
self.object = kwargs.pop('object')
super().__init__(*args, **kwargs)
if not self.inst... | [
{
"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 | rating/forms.py | lesspointless/Shakal-NG |
import os.path
import sys
def get_test_file_path(file):
pre_path = os.path.join(os.path.dirname(__file__), 'test_data')
return os.path.join(pre_path, file)
def get_text_from_test_data(file):
file_path = get_test_file_path(file)
with open(file_path, mode='r', encoding="utf-8") as f:
... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"ans... | 3 | text_summary/project_folder/textrank/test/utils.py | pdmorale/Summarization |
"""
Author: Peratham Wiriyathammabhum
"""
import numpy as np
import pandas as pd
import scipy as sp
import matplotlib.pyplot as plt
import scipy.sparse.linalg as linalg
def naivebayes(X):
"""
Perform spectral clustering on an input row matrix X.
mode \in {'affinity','neighborhood','gaussian'}
See: http://www.... | [
{
"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 | text/naivebayes.py | perathambkk/ml-techniques |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import json
import os
ANSIBLE_SSH_PORT = '2222'
def get_args():
from argparse import ArgumentParser
parser = ArgumentParser()
parser.add_argument('--list', action='store_true')
parser.add_argument('--host')
return parser.parse_args()
def wd_to_scrip... | [
{
"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 | terraform/terraform-swarm-inventory.py | swipswaps/hcloud_swarm |
# coding: utf-8
"""
Isilon SDK
Isilon SDK - Language bindings for the OneFS API # noqa: E501
OpenAPI spec version: 6
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_1_1
from i... | [
{
"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 | isi_sdk_8_1_1/test/test_settings_access_time_settings.py | mohitjain97/isilon_sdk_python |
from abc import abstractmethod
import rastervision as rv
from rastervision.core import (Config, ConfigBuilder)
class AugmentorConfig(Config):
def __init__(self, augmentor_type):
self.augmentor_type = augmentor_type
@abstractmethod
def create_augmentor(self):
"""Create the Augmentor that ... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inherit... | 3 | rastervision/augmentor/augmentor_config.py | Yochengliu/raster-vision |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@author: Pieter Huycke
email: pieter.huycke@ugent.be
GitHub: phuycke
"""
#%%
def message_check(message = str):
if len(message) < 160:
return message
else:
return message[:160]
longer = message_check("In certain chat programs or ... | [
{
"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 | Part 3/Chapter 06/Exercises/exercise_15.py | phuycke/Practice-of-computing-using-Python |
from tir import Webapp
import unittest
class GFEA069(unittest.TestCase):
@classmethod
def setUpClass(inst):
inst.oHelper = Webapp()
inst.oHelper.Setup("SIGAGFE", "29/12/2020", "T1", "D MG 01", "78")
inst.oHelper.Program("GFEA069")
def test_GFEA069_CT001(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 | Protheus_WebApp/Modules/SIGAGFE/GFEA069TESTCASE.py | 98llm/tir-script-samples |
# Last Updated: 2.2
from datetime import datetime
from util.diagMessage import DiagMessage
# Logger class
# Buffers and writes messages to a file
class Logger:
BUFFER_MAX = 10
DEFAULT_FN = "../log.txt"
# Constructor for logger class
# Params: fn - file name to use or leave default
# log -... | [
{
"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 | duckbot/util/logger.py | NicholasMarasco/duckbot |
import os.path
import os
import shutil
from dbt.task.base_task import BaseTask
class CleanTask(BaseTask):
def __is_project_path(self, path):
proj_path = os.path.abspath('.')
return not os.path.commonprefix(
[proj_path, os.path.abspath(path)]
) == proj_path
def __is_prote... | [
{
"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 | dbt/task/clean.py | cwkrebs/dbt |
import hashlib
import pytest
from dagster import String
from dagster.core.errors import DagsterInvalidDefinitionError
from dagster.core.types.config_schema import dagster_type_loader
def test_dagster_type_loader_one():
@dagster_type_loader(String)
def _foo(_, hello):
return hello
def test_dagster_t... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside... | 3 | python_modules/dagster/dagster_tests/core_tests/runtime_types_tests/config_schema_tests/test_config_schema.py | dbatten5/dagster |
from copy import deepcopy
from typing import Type
from pydfs_lineup_optimizer.constants import PlayerRank
from pydfs_lineup_optimizer.sites.fanduel.classic.importer import FanDuelCSVImporter
def build_fanduel_single_game_importer(mvp=True, star=False, pro=False) -> Type[FanDuelCSVImporter]:
class FanDuelSingleGam... | [
{
"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 | pydfs_lineup_optimizer/sites/fanduel/single_game/importer.py | BenikaH/pydfs-lineup-optimizer |
import pytest
from MidiCompose.logic.rhythm.beat import Beat
from MidiCompose.logic.rhythm.measure import Measure
from MidiCompose.logic.rhythm.part import Part
@pytest.fixture
def part_1():
m1 = Measure([Beat([1,2,1,2]),
Beat([1,0,0,1])])
m2 = Measure([Beat([2,2,1,1]),
... | [
{
"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/test_logic/test_rhythm/test_Part.py | aParthemer/MidiCompose |
# Beispielprogramm für das Buch "Python Challenge"
#
# Copyright 2020 by Michael Inden
import pytest
from ch05_datastructures.solutions.ex11_list_add import list_add_improved, list_add_with_iter, list_add, \
list_add_inverse
@pytest.mark.parametrize("values1, values2, expected",
[([1, 2... | [
{
"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 | Python/zzz_training_challenge/Python_Challenge/solutions/tests/ch05_datastructures/ex11_list_add_test.py | Kreijeck/learning |
from flask import Flask, Response
from camera import Camera
import cv2
app = Flask(__name__)
camera = Camera().start()
def gen(camera):
while True:
frame = camera.read()
_, jpeg = cv2.imencode('.jpg', frame)
yield (b'--frame\r\n'
b'Content-Type: image/jpeg\r\n\r\n' + jpeg.... | [
{
"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 | chapter4/main.py | takapat/training-kit-3 |
import sympy as sp
from dataclasses import dataclass
import numpy.typing as npt
from typing import Optional
@dataclass
class Metric:
"""Generic Metric class used to represent Metrics in General Relativity"""
components: npt.ArrayLike
symbols: Optional[sp.symbols] = sp.symbols("t x y z")
def __abs__... | [
{
"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 | src/PyOGRe/Metric.py | JaredWogan/PyOGRe |
import asyncio
from aiotasks import build_manager
loop = asyncio.get_event_loop()
loop.set_debug(True)
manager = build_manager(loop=loop)
@manager.task()
async def task_01(num):
print("Task 01 starting: {}".format(num))
await asyncio.sleep(2, loop=loop)
print("Task 01 stopping")
ret... | [
{
"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 | examples_old/run_executable_redis/basic_wait.py | shepilov-vladislav/aiotasks |
import torch.nn as nn
import torch
class ProtoNetBig(nn.Module):
def __init__(self, x_dim=23433, hid_dim=[2000, 1000, 500, 250], z_dim=100):
super(ProtoNetBig, self).__init__()
self.linear0 = nn.Linear(x_dim, hid_dim[0])
self.bn1 = nn.BatchNorm1d(hid_dim[0])
self.linear1 = nn.Linear... | [
{
"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 | model/protonet.py | ashblib/protocell |
# coding: utf-8
"""
UltraCart Rest API V2
UltraCart REST API Version 2
OpenAPI spec version: 2.0.0
Contact: support@ultracart.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
import unittest
import ultracart
f... | [
{
"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 | test/test_coupon_percent_off_retail_price_items.py | gstingy/uc_python_api |
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
# Also available under a BSD-style license. See LICENSE.
import copy
from typing import Any
import torch
from torch_mli... | [
{
"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 | python/torch_mlir_e2e_test/torchscript/configs/torchscript.py | sogartar/torch-mlir |
from django.shortcuts import render
from django.http import HttpResponse
from .forms import CarForm
from .models import NewCar
# Creates form
def index(request):
form = CarForm() #asign model and form to a variable
NewCarModel = NewCar.objects.all()
if request.method == "POST":
form = CarForm(reque... | [
{
"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 | car/carApp/views.py | cs-fullstack-2019-spring/django-validation-cw-PorcheWooten |
import argparse
import logging
import os
from faim_robocopy.starter import run_robocopy_gui
logging.basicConfig(
level=logging.INFO,
format='[%(asctime)s] (%(name)s) [%(levelname)s]: %(message)s',
datefmt='%d.%m.%Y %H:%M:%S')
def parse():
'''parse command line arguments.
'''
parser = argpar... | [
{
"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 | FAIM-robocopy.pyw | fmi-basel/python-scripts |
from jd.api.base import RestApi
class KplOpenSkuQueryinfoRequest(RestApi):
def __init__(self,domain='gw.api.360buy.com',port=80):
RestApi.__init__(self,domain, port)
self.skuQuery = None
def getapiname(self):
return 'jd.kpl.open.sku.queryinfo'
| [
{
"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 | jd/api/rest/KplOpenSkuQueryinfoRequest.py | fengjinqi/linjuanbang |
# Copyright (c) 2009-2014 Upi Tamminen <desaster@gmail.com>
# See the COPYRIGHT file for more information
from __future__ import annotations
from twisted.conch.ssh.common import getNS
from cowrie.ssh import userauth
# object is added for Python 2.7 compatibility (#1198) - as is super with args
class ProxySSHAuthSe... | [
{
"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 | src/cowrie/ssh_proxy/userauth.py | uwacyber/cowrie |
"""
Official page for Nigeria COVID figures:
https://covid19.ncdc.gov.ng/
"""
import logging
import os
import re
from bs4 import BeautifulSoup
import requests
from .country_scraper import CountryScraper
logger = logging.getLogger(__name__)
class Nga(CountryScraper):
def fetch(self):
url = 'https... | [
{
"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 | covid_world_scraper/nga.py | biglocalnews/covid-world-scraper |
import sys
from pathlib import Path
def mainwin32():
if len(sys.argv) < 2:
print(f'to use run: python set_activate_alias.py $profile')
return
profile = sys.argv[1]
profile = Path(profile)
# makr parent directory if not exist
if not profile.parent.exists():
profile.pare... | [
{
"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 | rapidenv/misc/set_activate_alias.py | innoviz-sw-infra/rapid-env |
#!/usr/bin/env python
"""
Example of ttree usage to generate recursive tree of directories.
It could be useful to implement Directory Tree data structure
2016 samuelsh
"""
import ttree
import random
from hashlib import blake2b
from string import digits, ascii_letters
MAX_FILES_PER_DIR = 10
def get_random_string(l... | [
{
"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 | examples/recursive_dirtree_generator.py | vovanbo/treelib |
"""empty message
Revision ID: 2cc127c4ea12
Revises:
Create Date: 2020-05-12 20:18:08.387848
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '2cc127c4ea12'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto gene... | [
{
"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 | migrations/versions/2cc127c4ea12_.py | Atienodolphine01/Flaskblog |
'''
Contains PidFd() class
Reads the /proc/<pid>/fd directory and resolves symbolic links
NB requires sudo
'''
from contextlib import suppress
from logging import getLogger
from os import listdir, readlink, path as ospath
from .readfile import ReadFile
LOGGER = getLogger(__name__)
class PidFd(ReadFile):
'... | [
{
"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 | lnxproc/pidfd.py | eccles/lnxproc |
import pytest
from unittest.mock import MagicMock
from django_ontruck.notifiers import AsyncNotifier, Notifier
from ..test_app.notifiers import DummySegmentNotifier, DummySegmentWithIdentityNotifier
@pytest.fixture
def mock_user():
user = MagicMock()
user.uuid = 'uuid'
return user
def test_segment_notif... | [
{
"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/notifiers/test_segment_notifier.py | ontruck/django-ontruck |
# 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": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self... | 3 | aliyun-python-sdk-cloudphoto/aliyunsdkcloudphoto/request/v20170711/GetThumbnailsRequest.py | xiaozhao1/aliyun-openapi-python-sdk |
from locust import HttpLocust, TaskSet, between
import json
def login(l):
headers = {'content-type': 'application/vnd.api+json'}
l.client.post(
"/api/v1/realms/PLAYGROUND/auth-session",
data=json.dumps({
"data": {
"type":"auth-session",
"attributes"... | [
{
"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 | tests/locust.py | geru-br/keyloop |
# Matthieu Brucher
# Last Change : 2007-08-26 19:43
import numpy
class BacktrackingSearch(object):
"""
The backtracking algorithm for enforcing Armijo rule
"""
def __init__(self, rho = 0.1, alpha_step = 1., alpha_factor = 0.5, **kwargs):
"""
Can have :
- a coefficient for the Armijo rule (rho =... | [
{
"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 | PyDSTool/Toolbox/optimizers/line_search/backtracking_search.py | yuanz271/PyDSTool |
from gilded_rose import GildedRose, Sulfuras
def test_update_sell_in():
sulfuras_item = Sulfuras("Sulfuras, Hand of Ragnaros", 2, 10)
items = [sulfuras_item]
GildedRose(items).update_quality()
assert sulfuras_item.sell_in == 2
def test_update_quality():
sulfuras_item = Sulfuras("Sulfuras, Hand o... | [
{
"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 | ddd_driven/test_sulfuras.py | Neppord/bdd-ddd-gilded-rose |
from unittest import TestCase
from unittest.mock import patch
with patch('serial.Serial'):
from controls.valloxcontrol import ValloxControl
from valloxserial import vallox_serial
class TestValloxControl(TestCase):
@patch('serial.Serial')
def setUp(self, _):
self.vc = ValloxControl()
@patch.o... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (exclud... | 3 | tests/test_controls/test_valloxcontrol.py | jussike/kuappi |
# encoding: utf-8
import logging
from marrow.mailer import Mailer
class MailHandler(logging.Handler):
"""A class which sends records out via e-mail.
This handler should be configured using the same configuration
directives that Marrow Mailer itself understands.
Be careful how many notific... | [
{
"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": fals... | 3 | marrow/mailer/logger.py | digiturtle/mailer |
# -*- encoding: utf-8 -*-
"""
Flask Boilerplate
Author: AppSeed.us - App Generator
"""
from flask import json
from app import app, db
from .common import *
# build a Json response
def response(data):
return app.response_class(response=json.dumps(data),
status=200,
... | [
{
"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 | app/util.py | mkhumtai/6CCS3PRJ |
import matplotlib.pyplot as plt, streamlit as st
from typing import Iterable, Union
from sklearn.metrics import classification_report
from sklearn.metrics import roc_curve, auc, RocCurveDisplay
def train(estimator: object, X: Iterable[Union[int, float]], y: Iterable):
"""
Train custom classifier model... | [
{
"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": tru... | 3 | ml.py | Fennec2000GH/Poly-Finance |
from utils import create_newfig, create_moving_polygon, create_still_polygon, run_or_export
func_code = 'aq'
func_name = 'test_one_moving_one_stationary_distlimit_touch_at_limit'
def setup_fig01():
fig, ax, renderer = create_newfig('{}01'.format(func_code), ylim=(-1, 7))
create_moving_polygon(fig, ax, render... | [
{
"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 | imgs/test_geometry/test_extrapolated_intersection/aq_test_one_moving_one_stationary_distlimit_touch_at_limit.py | devilcry11/pygorithm |
# -*- coding: utf-8 -*-
from abc import ABCMeta, abstractmethod
from pyfr.backends.base.kernels import BaseKernelProvider, MPIKernel
class BasePackingKernels(BaseKernelProvider, metaclass=ABCMeta):
def _sendrecv(self, mv, mpipreqfn, pid, tag):
# If we are an exchange view then extract the exchange matri... | [
{
"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 | pyfr/backends/base/packing.py | tjcorona/PyFR |
#! /usr/bin/env python
# encoding: utf-8
# WARNING! Do not edit! https://waf.io/book/index.html#_obtaining_the_waf_file
import sys
from waflib.Tools import ccroot,ar,gxx
from waflib.Configure import conf
@conf
def find_icpc(conf):
cxx=conf.find_program('icpc',var='CXX')
conf.get_cc_version(cxx,icc=True)
conf.env.CX... | [
{
"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/third_party/angle/third_party/glmark2/src/waflib/Tools/icpc.py | goochen/naiveproxy |
"""
Unit tests for the sas_gen
"""
import os.path
import warnings
warnings.simplefilter("ignore")
import unittest
import numpy as np
from sas.sascalc.calculator import sas_gen
def find(filename):
return os.path.join(os.path.dirname(__file__), 'data', filename)
class sas_gen_test(unittest.TestCase):
def ... | [
{
"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 | test/sascalculator/utest_sas_gen.py | llimeht/sasview |
#!/usr/bin/env python
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
#
# Copyright (c) 2018 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
#
from sm_client.common import base
class SmcNode(base.Resource):
def __repr__(self):
return "<SmcNode %s>" % self._info
class SmcNodeManager(base... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answ... | 3 | service-mgmt-client/sm-client/sm_client/v1/smc_service_node.py | starlingx-staging/stx-ha |
import cv2
import dropbox
import time
import random
start_time = time.time()
def take_snapshot():
number = random.randint(0,100)
#initializing cv2
videoCaptureObject = cv2.VideoCapture(0)
result = True
while(result):
#read the frames while the camera is on
ret,frame = videoCapture... | [
{
"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 | capture_and_uploadImage.py | khushmax/automation |
from audio import Stream, AudioSettings
class PhraseRecognizer(object):
def __init__(self, config, audio_settings: AudioSettings):
self._config = config
self._audio_settings = audio_settings
def get_config(self):
return self._config
def get_audio_settings(self) -> AudioSettings:
... | [
{
"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_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?"... | 3 | recognition/base.py | ReanGD/smart-home |
import pygame
from pygame.sprite import Sprite
class UFO(Sprite):
"""A class to represent a single alien in the fleet."""
def __init__(self, ai_settings, screen):
"""Initialize the alien and set its starting position."""
super(UFO, self).__init__()
self.screen = screen
self.ai_... | [
{
"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 | ufo.py | Steven-Kha/Space-Invasion |
def BinaryTree(r):
"""Create a new binary tree."""
return [r, [], []]
def insertLeft(root, newBranch):
"""Insert a new left node."""
t = root.pop(1) # get the left child
if len(t) > 1:
# add new left child to root and
# make old left child it's left child.
root.insert(1, [newBranch, t, []])
el... | [
{
"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 | tree.py | carlb15/Python |
#! /usr/bin/env python
# Thomas Nagy, 2011
# Try to cancel the tasks that cannot run with the option -k when an error occurs:
# 1 direct file dependencies
# 2 tasks listed in the before/after/ext_in/ext_out attributes
from waflib import Task, Runner
Task.CANCELED = 4
def cancel_next(self, tsk):
if not isinstance(t... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer"... | 3 | .mywaflib/waflib/extras/smart_continue.py | tobiasraabe/crypto |
from collections import namedtuple
import numpy as np
import talib
from numba import njit
from jesse.helpers import get_candle_source
from jesse.helpers import slice_candles
DamianiVolatmeter = namedtuple('DamianiVolatmeter', ['vol', 'anti'])
def damiani_volatmeter(candles: np.ndarray, vis_atr: int = 13, vis_std: ... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a t... | 3 | jesse/indicators/damiani_volatmeter.py | noenfugler/jesse |
import pygame
from jumper.entities.bullet import Bullet
from math import pi, sin, cos
class BBWaveBullet(Bullet):
def __init__(self, environment, position, angle, speed=1000):
super().__init__(environment, position)
self.speed = speed
self.angle = angle
self.wave_acc = 0.0
... | [
{
"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 | jumper/entities/bullets/bb_wave_bullet.py | ccmikechen/Jumper-Game |
# задание 13
from sys import maxsize
class Group:
def __init__(self, name=None, header=None, footer=None, id =None):
self.name = name
self.header = header
self.footer = footer
self.id = id
def __repr__(self):
return "%s:%s:%s:%s" % (self.id, self.name, self.header, sel... | [
{
"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 | model/group.py | DariaMagarshak/python_training |
import pytest
from barista.models import Match
def test_both_trigger_and_triggers():
with pytest.raises(ValueError):
Match.parse_obj(
{
"replace": "asd",
"trigger": "asd",
"triggers": ["asd", "abc"],
}
)
def test_neither_tr... | [
{
"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 | tests/test_verify.py | JeppeKlitgaard/barista |
from Test import Test, Test as test
'''
Complete the solution so that it returns true if the first argument(string) passed in ends with the 2nd argument (also a string).
Examples:
solution('abc', 'bc') # returns true
solution('abc', 'd') # returns false
'''
def solution(string, ending):
return True if string[-l... | [
{
"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 | codewars/7 kyu/string-ends-with.py | sirken/coding-practice |
# -*- coding:utf-8 -*-
# Author: hankcs
# Date: 2021-05-20 16:25
from typing import Union, List, Callable
from elit.common.dataset import TransformableDataset
from elit.utils.io_util import read_cells
STS_B_TRAIN = 'http://ixa2.si.ehu.es/stswiki/images/4/48/Stsbenchmark.tar.gz#sts-train.csv'
STS_B_DEV = 'http://ixa2.... | [
{
"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 | elit/datasets/sts/stsb.py | emorynlp/stem-cell-hypothesis |
#
# This file is part of PCAP BGP Parser (pbgpp)
#
# Copyright 2016-2017 DE-CIX Management GmbH
# Author: Tobias Hannaske <tobias.hannaske@de-cix.net>
#
# 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 Lic... | [
{
"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 | pbgpp/Output/Filters/MACDestinationFilter.py | antoine-blin/pbgp-parser |
import unittest
import requests_mock
from podman import PodmanClient, tests
from podman.domain.volumes import Volume, VolumesManager
FIRST_VOLUME = {
"CreatedAt": "1985-04-12T23:20:50.52Z",
"Driver": "default",
"Labels": {"BackupRequired": True},
"Mountpoint": "/var/database",
"Name": "dbase",
... | [
{
"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 | podman/tests/unit/test_volume.py | kevinwylder/podman-py |
def path_hack():
import os, sys, inspect
currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
parentdir = os.path.dirname(currentdir)
sys.path.insert(0,parentdir)
# print('path added:', sys.path[0])
path_hack()
import traceback
import sys
import urllib.request
fr... | [
{
"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 | apis/authentication.py | n-ryan/spotify-genius |
from tamarco.resources.basic.metrics.reporters.base import CarbonBaseHandler
def test_base_handler_creation_no_metric_prefix():
base_handler = CarbonBaseHandler()
assert base_handler.metric_prefix == ""
def test_base_handler_creation_metric_prefix():
base_handler = CarbonBaseHandler("test")
assert b... | [
{
"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 | tests/unit/resources/basic/metrics/reporters/test_base.py | System73/tamarco |
import requests
obis_baseurl = "https://api.obis.org/v3/"
class NoResultException(Exception):
pass
def obis_GET(url, args,ctype, **kwargs):
out = requests.get(url, params=args, **kwargs)
out.raise_for_status()
stopifnot(out.headers['content-type'], ctype)
return out.json()
def obis_write_disk(url, path,... | [
{
"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 | pyobis/obisutils.py | MathewBiddle/pyobis |
import logging
import requests
import urllib
class AzkabanScheduler:
def __init__(self, url: str, port: str, environment: str, session_id: str):
self._url = f"https://{url}:{port}/schedule"
self._environment = environment
self._session_id = session_id
self._logger = logging.getLog... | [
{
"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 | azkaban_zip_uploader/scheduler.py | dwp/aws-azkaban |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# (c) Copyright 2013 Hewlett-Packard Development Company, L.P.
#
# 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.apa... | [
{
"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 | cinder/brick/executor.py | cloudbau/cinder |
from sys import stdout, stderr
from subprocess import check_call
from os import path, remove
from base64 import b64encode
from cryptography.hazmat.primitives.serialization import Encoding, PublicFormat, PrivateFormat, NoEncryption
from cryptography.hazmat.primitives.asymmetric import rsa
from cryptography.hazmat.back... | [
{
"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 | terraform/nginx/shared/tls-function/tls.py | cicdenv/cicdenv |
import wx
import os
import imagebrowser
import Utils
#------------------------------------------------------------------------------------------------
class SetGraphicDialog( wx.Dialog ):
def __init__( self, parent, id = wx.ID_ANY, graphic = None ):
super().__init__( parent, id, "Set Graphic",
style=wx.DEFAUL... | [
{
"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 | SprintMgr/SetGraphic.py | esitarski/CrossMgr |
from pathlib import Path
import unittest
from saw_client import *
from saw_client.llvm import Contract, array, array_ty, void, i32
class ArraySwapContract(Contract):
def specification(self):
a0 = self.fresh_var(i32, "a0")
a1 = self.fresh_var(i32, "a1")
a = self.alloc(array_ty(2, i32),
... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"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 | saw-remote-api/python/tests/saw/test_llvm_array_swap.py | msaaltink/saw-script |
from typing import List, Literal, Union, Callable, Tuple
from dataclasses import dataclass, replace
from .config_types import (
TWInterface,
TWSettingStorage, TWSettingBool, TWSetting,
WrapType, Fields, AnkiModel, LabelText, WhichField, Tags, Falsifiable,
)
ScriptKeys = Literal[
'enabled',
'name'... | [
{
"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 | src/lib/interface.py | hgiesel/anki_text_wrapper |
#!/usr/bin/env python3
'''
Return a list of items without any elements with the same value next to each other and preserve the original order of elements.
'''
def unique_in_order(a):
newlist = []
for i in a:
if len(newlist) < 1 or not i == newlist[len(newlist) -1]:
newlist.append(i)
retu... | [
{
"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 | CodeWars/2019/UniqueInOrder-6k.py | JLJTECH/TutorialTesting |
import logging
import sys
try:
import obd
except ImportError:
import subprocess
subprocess.run([
'pip',
'install',
'git+https://github.com/SLR8/py-obd'
])
import obd
# connection = obd.OBD()
# command = obd.commands.SPEED
# response = connection.query(command)
# print(res... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/... | 3 | src/executor.py | SLR8/core |
from django.test import TestCase, Client
from django.contrib.auth import get_user_model
from django.urls import reverse
class AdminSiteTests(TestCase):
def setUp(self):
self.client = Client()
self.admin_user = get_user_model().objects.create_superuser(
email='admin@gmail.com',
... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
... | 3 | app/core/tests/test_admin.py | NikolasK88/recipe-app-api |
import pytest
from datasets import Dataset
from pathlib import Path
from typing import Dict
from copy import deepcopy
from tio import Task
__all__ = [
"DummyTask"
]
EXPECTED_DUMMY_DATA = {
"idx" : [0, 1, 2],
"input" : ["The comment section is ", "The butcher of ", "Get "],
"output": ["out of control... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
... | 3 | test_fixtures/dummy_objects.py | gabeorlanski/taskio |
import os
import torch
def accuracy(output, target, topk=(1,)):
"""Computes the precision@k for the specified values of k"""
maxk = max(topk)
batch_size = target.size(0)
_, pred = output.topk(maxk, 1, True, True) # first position is score; second position is pred.
pred = pred.t() # .t() is T of m... | [
{
"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 | Code/util.py | bryant1410/Emotion-FAN |
# Copyright (c) Kuba Szczodrzyński 2021-5-6.
import os
from .primes import PRIMES
class DiffieHellman:
_prime: int
_private_key: int
_public_key: int
_shared_key: int
@staticmethod
def _to_bytes(a: int) -> bytes:
return a.to_bytes((a.bit_length() + 7) // 8, byteorder="big")
de... | [
{
"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 | diffiehellman/diffie_hellman.py | TOPDapp/py-diffie-hellman |
import pytest
from django.urls import reverse
from soduko.users.models import User
pytestmark = pytest.mark.django_db
class TestUserAdmin:
def test_changelist(self, admin_client):
url = reverse("admin:users_user_changelist")
response = admin_client.get(url)
assert response.status_code ==... | [
{
"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 | soduko/users/tests/test_admin.py | idannik/soduko_django |
import uuid
from turkit2.common import TextClassification
from turkit2.qualifications import Unique, Locale, AcceptRate
from utils import get_client
client = get_client()
quals = [Locale(), AcceptRate()]
task = TextClassification(client, 'Test3', '0.01', 'test test', 600, 6000, ['positive', 'negative'], question='Wh... | [
{
"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/text_classification_nonsync.py | anthliu/turkit2 |
"""Error handling for the tilesets CLI"""
class TilesetsError(Exception):
"""Base Tilesets error
Deriving errors from this base isolates module development
problems from Python usage problems.
"""
exit_code = 1
def __init__(self, message):
"""Error constructor
Parameters
... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": true
},
{
... | 3 | mapbox_tilesets/errors.py | bozdoz/tilesets-cli |
# -*- coding: utf-8 -*-
# Copyright 2021 Cohesity Inc.
class PVCInfo_PVCSpec_Resources_RequestsEntry(object):
"""Implementation of the 'PVCInfo_PVCSpec_Resources_RequestsEntry' model.
Attributes:
key (string): TODO: Type description here.
value (string): TODO: Type description here.
"""... | [
{
"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 | cohesity_management_sdk/models/pvc_info_pvc_spec_resources_requests_entry.py | cohesity/management-sdk-python |
import pandas as pd
from test_importer import Importer
from functools import lru_cache
class Analyzer:
def __init__(self, *args, **kwargs):
self._importer = Importer(database_name=kwargs["database_name"])
self.data = self._importer.create_dataframe()
# Without maxsize the cache will preserve ... | [
{
"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/test_analyzer.py | Quiltomics/godseye |
import threading
try:
from .grab import Image
except:pass
def grab_bytes():
return Image().asbytes
def send(s,a):
s.post(b's'+grab_bytes(),a)
def show_bytes(r):
if not r.startswith('s'):return
Image(r[1:]).show()
def conf(s,a):
def _conf():
while True:
send(s,a)
threading... | [
{
"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 | openctrl/display.py | openctrl-python/openctrl |
# Time: ctor: O(n), n is number of words in the dictionary.
# lookup: O(1)
# Space: O(k), k is number of unique words.
class ValidWordAbbr(object):
def __init__(self, dictionary):
"""
initialize your data structure here.
:type dictionary: List[str]
"""
self.lookup... | [
{
"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 | Python/unique-word-abbreviation.py | bssrdf/LeetCode-5 |
# coding: utf-8
"""
Translator Knowledge Beacon Aggregator API
This is the Translator Knowledge Beacon Aggregator web service application programming interface (API) that provides integrated access to a pool of knowledge sources publishing concepts and relations through the Translator Knowledge Beacon API. Th... | [
{
"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 | client/test/test_client_statement_object.py | NCATS-Tangerine/kba-reasoner |
import torch
from torch import nn
from torch.distributions import MultivariateNormal
class Normal(nn.Module):
def __init__(self, num_vars=100):
super(Normal, self).__init__()
self.num_vars = num_vars
self.means = nn.Parameter(torch.zeros(num_vars))
self.std = nn.Parameter(torch.ey... | [
{
"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 | core/learnable_priors/normal_prior.py | insilicomedicine/TRIP |
# NOTE: Must be before we import or call anything that may be synchronous.
from gevent import monkey
monkey.patch_all()
import sys
import os
sys.path.append(os.path.join(os.path.dirname(__file__), "../"))
import logging
from Crypto import Random
from util.log import logfile_path
from util.workers import get_worker... | [
{
"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 | conf/gunicorn_secscan.py | sferich888/quay |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.11.3
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
i... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answ... | 3 | kubernetes/test/test_logs_api.py | woqer/python |
from dataclasses import dataclass
from typing import Generator
@dataclass
class Execution:
action: type
params: object
class Action:
@classmethod
def can_execute(cls, p):
return True
@classmethod
def execute(cls, p):
pass
@classmethod
def record_undo(cls, p) -> Gene... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{... | 3 | vfio_isolate/action/action.py | spheenik/vfio-isolate |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.9.4
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
im... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer":... | 3 | kubernetes/test/test_apiregistration_v1beta1_api.py | craigtracey/python |
from collections import defaultdict
from apps.configuration.models import Environment
class MapConfigValues(object):
def __init__(self, values, env_id):
environments = Environment.query.all()
sort_environments = sorted([x for x in environments if x.id != env_id], key=lambda x: x.priority)
... | [
{
"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 | spug_api/apps/apis/utils.py | showsmall/spug |
import utils
class Model:
def __init__(self, file_path):
with open(file_path, 'r', encoding="utf8") as model_file:
self.model_tree = {}
for line in model_file:
chars, minus_log_p = utils.parse_model_file_line(line)
n_1_gram = ''.join(chars[:-1])
last_char = chars[-1]
if n_1_gram not in self... | [
{
"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": false... | 3 | model.py | OrBin/N-Gram-Language-Model |
from pandas import DataFrame, Series
from sklearn.svm import SVR
from bender.trained_model.interface import TrainedRegressionModel
class SupportVectorRegression(TrainedRegressionModel):
model: SVR
input_features: list[str]
def __init__(self, model: SVR, input_features: list[str]) -> None:
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_return_types_annotated",
"question": "Does every function in this file have a return... | 3 | bender/trained_model/support_vector.py | otovo/bender |
from typing import Optional
from thyme.types.blockchain_format.coin import Coin
from thyme.types.blockchain_format.program import Program
from thyme.types.blockchain_format.sized_bytes import bytes32
from thyme.wallet.puzzles.load_clvm import load_clvm
MOD = load_clvm("genesis-by-coin-id-with-0.clvm", package_or_requ... | [
{
"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": "all_return_types_annotated",
"question": "Does every function in this file have a return t... | 3 | thyme/wallet/puzzles/genesis_by_coin_id_with_0.py | yuanliuus/thyme-blockchain |
from django.conf import settings
from django.core import signing
from django.core.signing import BadSignature, SignatureExpired, TimestampSigner
class Registrations:
@staticmethod
def generate_registration_token(email):
return TimestampSigner().sign(signing.dumps({'email': email}))
@staticmethod
... | [
{
"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 | lego/apps/users/registrations.py | andrinelo/lego |
#!/usr/bin/env python3
# encoding: utf-8
import dis
class MyObject:
"""Example for dis."""
CLASS_ATTRIBUTE = 'some value'
def __str__(self):
return 'MyObject({})'.format(self.name)
def __init__(self, name):
self.name = name
dis.dis(MyObject)
| [
{
"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 | PyMOTW/source/dis/dis_class.py | axetang/AxePython |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.