source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
from __future__ import absolute_import, unicode_literals
from django import forms
class PasswordPageViewRestrictionForm(forms.Form):
password = forms.CharField(label="Password", widget=forms.PasswordInput)
return_url = forms.CharField(widget=forms.HiddenInput)
def __init__(self, *args, **kwargs):
... | [
{
"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 | wagtail/wagtailcore/forms.py | kurtrwall/wagtail |
"""This module implements an abstract base class for datasets.
It also contain some common transformation menthod for subclasses,which can be later used"""
from abc import ABC, abstractmethod
import torch.utils.data as data
import torchvision.transforms as transforms
class BaseDataset(data.Dataset, ABC):
"""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": true
... | 3 | data/base_dataset.py | littlebaba/SF_MFIF |
import unittest
from main import intersection_of_chars
class TestIntersectionOfChars(unittest.TestCase):
def test_empty(self):
self.assertEqual(intersection_of_chars([]), set())
def test_one_string(self):
self.assertEqual(intersection_of_chars(['abc']), set(list('abc')))
def test_many_st... | [
{
"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 | day06/test_main.py | aschmied/advent-of-code-2020 |
import unittest
from quince.components import Card
class TestCard(unittest.TestCase):
def test_info(self):
"""Returns a tuple containing suit and value"""
c = Card(4, "basto")
self.assertEqual(4, c.value)
self.assertEqual("basto", c.suit)
# Check that an error is raised on... | [
{
"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 | test/components/test_card.py | garroadran/quince |
from fastapi import FastAPI, Path
from typing import Optional
from pydantic import BaseModel
app = FastAPI()
class Item(BaseModel):
name: str
price: float
brand: Optional[str] = None
class UpdateItem(BaseModel):
name: Optional[str] = None
price: Optional[float] = None
brand: Optional[str] = N... | [
{
"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 | main.py | wmcgee3/imguber |
##
# API KEY AIzaSyAY1aatbdVCglJhXI0HFddm5pEkPTUpBFU
#python3.6
# importing required libraries
import sys
"""
using Google Maps API to get directions from \
- start point to end end_point
- purpose is
- - to grab the distance in miles from start to end_point
- - to grab time in hours and minutes from start to end po... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},... | 3 | contents/google_maps_utility.py | joeyster/Travel-Planner |
from dagger.pipeline.io import IO
from dagger.utilities.config_validator import Attribute
class AthenaIO(IO):
ref_name = "athena"
@classmethod
def init_attributes(cls, orig_cls):
cls.add_config_attributes(
[
Attribute(
attribute_name="schema", comme... | [
{
"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 | dagger/pipeline/ios/athena_io.py | jorgetagle/dagger |
import logging
import unittest
import numpy as np
from cave.utils.statistical_tests import paired_permutation, paired_t_student
class TestStatisticalTests(unittest.TestCase):
def setUp(self):
self.logger = logging.getLogger("TestStatisticalTests")
def test_paired_permutation(self):
""" Tes... | [
{
"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 | test/test_utils/test_statistical_tests.py | deslay1/CAVE |
from routes.band import write_comment
class Help:
def __init__(self, get_all_post):
self.get_all_post = get_all_post
self.help_information()
def help_information(self):
get_all_post = self.get_all_post
post_response_content = get_all_post['result_data']['items']
for 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_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false... | 3 | commands/help.py | DevStrikerTech/Clash-of-Clans-Band-Bot |
from abc import ABC, abstractmethod
# Abstract class for ROOM listener
# class is just an interface of functions to handle the Room events received
# from DataFeed see Real Time Events in REST API documentation for more
# details. The developer will handle actual event logic in your implementation
# of this abstract c... | [
{
"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 | sym_api_client_python/listeners/room_listener.py | 3tilley/symphony-api-client-python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'Yue-Wen FANG'
__maintainer__ = "Yue-Wen FANG"
__email__ = 'fyuewen@gmail.com'
__license__ = 'Apache License 2.0'
__creation_date__= 'Dec. 26, 2018'
"""
Here, I rewrote the example dog.py in the book
of Python Crash Couse.
This example is not exactly same to ... | [
{
"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 | machine-learning/Matthes-crash-course/chapt09/scripts/dog_01.py | yw-fang/MLreadingnotes |
import numpy as np
def truncate(x, n):
k = -int(np.floor(np.log10(abs(x))))
# Example: x = 0.006142 => k = 3 / x = 2341.2 => k = -3
k += n - 1
if k > 0:
x_str = str(abs(x))[:(k+2)]
else:
x_str = str(abs(x))[:n]+"0"*(-k)
return np.sign(x)*float(x_str)
def solve_reduced_monic_cu... | [
{
"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 | opymize/tools/__init__.py | Room-10/Opymize |
import threading
from typing import NoReturn, Union, no_type_check
class AutoResetEvent(threading.Event):
"""Like threading.Event, except that wait() resets the event automatically."""
@no_type_check # I don't know why MyPy refuses to believe that threading.Event has properties self._cond and self._flag.
... | [
{
"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 | puma/primitives/auto_reset_event.py | gift-surg/puma |
def trunc_whitespace(app, doctree, docname):
from docutils.nodes import Text, paragraph
if not app.config.japanesesupport_trunc_whitespace:
return
for node in doctree.traverse(Text):
if isinstance(node.parent, paragraph):
newtext = node.astext()
for c in "\n\r\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": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fe... | 3 | handywedge-documents/developper-guide/japanesesupport.py | cstudioteam/csfw |
# Ronschool.py
class Student:
def __init__(self,name): # self คือคำพิเศษเพื่อใช้แทนตัวมันเอง / ต้องใส่ทุกฟังชั่นของ class
self.name = name
# student1.name
# self = student1
self.exp = 0
self.lesson = 0
def Hello(self):
print('สวัสดีจ้าาาา ผมชื่อ{}'.format(self.name))
def Coding(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": "more_functions_than_classes",
"question": "Does this file define more functions than cla... | 3 | Ronnakornschool/Ronschool.py | plug8955/Ronnakornschool |
#!/usr/bin/python
"""
path_stat.py - Functions from os.path that import 'stat'.
We want to keep bin/osh_parse free of I/O. It's a pure stdin/stdout filter.
"""
import posix
import stat
def exists(path):
"""Test whether a path exists. Returns False for broken symbolic links"""
try:
posix.stat(path)
... | [
{
"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 | pylib/path_stat.py | ariabuckles/oil |
# coding: utf-8
"""
Prisma Cloud Compute API
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
The version of the OpenAPI document: 21.04.439
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_impor... | [
{
"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/test_runtime_container_capabilities.py | hi-artem/twistlock-py |
'''
Created on Nov 12, 2018
@author: yangzh
'''
from . import helpers
def say_hi():
"""Get a thought."""
return 'Hi, my friend ...'
def saySomething():
"""Contemplation..."""
if helpers.get_answer():
print(say_hi()) | [
{
"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 | OS_Script/core.py | yunleopard/data_py |
from django.core.cache import cache
def set_cache(user_no, token):
cache.set('token:userno:' + user_no, token, timeout=None)
cache.set('token:value:'+ token, user_no, timeout=None)
def get_token_from_cache(user_no):
try:
token = cache.get('token:userno:' + user_no)
except:
tok... | [
{
"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 | users/auth/token_cache.py | sevenstar77/coin_dev |
from fmcapi.api_objects.apiclasstemplate import APIClassTemplate
import logging
import warnings
class CertEnrollments(APIClassTemplate):
"""
The CertEnrollments Object in the FMC.
"""
VALID_JSON_DATA = ["id", "name", "type"]
VALID_FOR_KWARGS = VALID_JSON_DATA + []
URL_SUFFIX = "/object/certen... | [
{
"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 | fmcapi/api_objects/object_services/certenrollments.py | realvitya/fmcapi |
def resumo(n, credito, debito, brasao='R$', conversao=False):
moeda(n, brasao)
print('-'*60)
print('RESULTADO'.center(60))
print('-'*60)
print(f'O juros de {credito}% sobre {moeda(n, brasao)} corresponde a \t{aumentar(n, credito, brasao, conversao)}')
print(f'O desconto de {debito}% sobre {moed... | [
{
"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 | Defs/ex111/utilidadesCeV/funcao/__init__.py | Dioclesiano/Python |
# -*- coding: utf-8 -*-
__author__ = 'lundberg'
from django import forms
from . import common
from apps.noclook.models import Dropdown
class NewSiteForm(common.NewSiteForm):
name = forms.CharField()
country_code = forms.CharField(widget=forms.widgets.HiddenInput,
initial='... | [
{
"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 | src/niweb/apps/noclook/forms/sunet.py | emjemj/ni |
from uuid import uuid4
from telegram import (
Update,
InlineKeyboardButton,
InlineKeyboardMarkup,
InlineQueryResultArticle,
InlineQueryResultDocument
)
from subtitle import (
BASE_URL,
get_lang,
search_sub
)
def button(update, context):
query = update.callback_query
query.ans... | [
{
"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 | inline/__init__.py | Muhammedns/subtitlesbotv2 |
from __future__ import annotations
from abc import abstractmethod
from typing import Protocol, TypeVar
from .components import Arithmetic, MemoryInfo
Number = TypeVar("Number", int, float)
Numeric = TypeVar("Numeric", int, float, bool)
class TensorLike(Arithmetic, MemoryInfo, Protocol):
"""
TensorLike is a... | [
{
"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 | koila/interfaces/tensorlike.py | techthiyanes/koila |
from django import template
from helper.quick_stat_template import quick_stat_helper_template
from helper.icon import Icon
register = template.Library()
from blogs.models import Blog
from bookings.models import Booking
from recipes.models import Recipe
@register.simple_tag
def model_entry_count():
blog_count = ... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"ans... | 3 | administrators/templatetags/administrators_tags.py | asis2016/momo-ristorante-v1 |
import unittest
from src.google_foobar.P008_carrotland.solution_01 import answer
class TestSolution(unittest.TestCase):
def testcase_001(self):
vertices = [[2, 3], [6, 9], [10, 160]]
expected = 289
self.assertEqual(answer(vertices), expected)
def testcase_002(self):
vertices ... | [
{
"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 | src/google_foobar/P008_carrotland/solution_01_tests.py | lakshmikanth-tesla/ProgrammingProblems |
from typing import Any, Callable, Optional
from reactivex import Observable, abc, typing
from reactivex.disposable import Disposable
def from_callback_(
func: Callable[..., Callable[..., None]],
mapper: Optional[typing.Mapper[Any, Any]] = None,
) -> Callable[[], Observable[Any]]:
"""Converts a callback f... | [
{
"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": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer":... | 3 | reactivex/observable/fromcallback.py | christiansandberg/RxPY |
import os
import json
import logging
import sys
from django.db import transaction
from django.apps import apps
from scripts import utils as script_utils
from scripts.populate_preprint_providers import update_or_create
from osf.models import PreprintProvider, Subject
from website.app import init_app
from website impor... | [
{
"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 | scripts/add_taxonomies_to_paleoarxiv.py | gaybro8777/osf.io |
from database import db_session, init_db
from schema import schema
from graphql_server import (HttpQueryError, default_format_error,
encode_execution_results, json_encode,load_json_body, run_http_query)
class App():
def __init__(self):
init_db()
def query(self, request):
da... | [
{
"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 | examples/nameko_sqlalchemy/app.py | sww/graphene-sqlalchemy |
# Copyright 2008-2012 Nokia Siemens Networks Oyj
#
# 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... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": ... | 3 | src/robotide/lib/robot/libraries/dialogs_ipy.py | veryl-technologies/t24-tests-ide |
from gym import spaces
import multiprocessing.dummy as mp
import multiprocessing
import numpy as np
import os
import torch
import torch
import torch.nn as nn
from torch.nn import Parameter, ModuleList
import torch.nn.functional as F
from evkit.rl.utils import init, init_normc_
from evkit.utils.misc import is_cuda
fr... | [
{
"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 | evkit/models/forward_inverse.py | jozhang97/Side-tuning |
"""
Module: 'usocket' on esp32_LoBo 3.2.9
"""
# MCU: (sysname='esp32_LoBo', nodename='esp32_LoBo', release='3.2.9', version='ESP32_LoBo_v3.2.9 on 2018-04-12', machine='ESP32 board with ESP32')
# Stubber: 1.1.2
AF_INET = 2
AF_INET6 = 10
IPPROTO_IP = 0
IPPROTO_TCP = 6
IPPROTO_UDP = 17
IP_ADD_MEMBERSHIP = 3
SOCK_DGRAM = 2... | [
{
"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 | stubs/loboris-esp32_lobo-3_2_9/usocket.py | RonaldHiemstra/micropython-stubs |
"""
chromeをアプリモードで起動するためのコマンドを生成する
"""
import sys, os
from moray.exception import SupportError
name = 'chrome'
def create_command(path, url, cmdline_args):
"""
起動コマンド生成
Attributes:
path (str): chromeコマンドのパス
url (str): 接続先のURL
cmdline_args (list<str>): コマンドライ... | [
{
"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 | moray/_browser/chrome.py | hirorich/moray |
import torch
from vltk.inspection import collect_args_to_func
class Processor:
_type = None
_keys = ()
@property
def keys(self):
if isinstance(self._keys, str):
return set([self._keys])
return set(self._keys)
def __init__(self, **kwargs):
for k, v in kwargs.it... | [
{
"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 | vltk/abc/processor.py | eltoto1219/vltk |
# coding: utf-8
"""
Copyright 2017 Square, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable la... | [
{
"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 | test/test_source_application.py | shaminmeerankutty/connect-python-sdk |
# -*- coding: utf-8 -*-
from django.db import models
class PostManager(models.Manager):
def all_published(self):
return self.filter(status_id=self.model.STATUS_PUBLISHED)
def all_draft(self):
return self.filter(status_id=self.model.STATUS_DRAFT)
class CommentManager(models.Manager):
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 | tuticfruti_blog/posts/managers.py | tuticfruti/tuticfruti_blog |
import pytest
from pca.utils.serialization import load_ini_from_filepath
@pytest.fixture
def contents():
ini_contents = "\n".join(
(
"[pytest]",
"python_files =",
" pca/**/tests/**/*.py",
" pca/**/tests/*.py",
" devops/**/tests/*.py",
... | [
{
"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 | pca/utils/serialization/tests/test_ini.py | pcah/python-clean-architecture |
'''
$Author: partho.bhowmick@hp.com $
$Date: 2013-05-13 08:42:32 -0500 (Mon, 13 May 2013) $
$Header: https://svn02.atlanta.hp.com/local/ic4vc-dev/server/trunk/src/util/testlogs.py 5376 2013-05-13 13:42:32Z partho.bhowmick@hp.com $
$Revision: 5376 $
'''
import logging
class testlogger:
def __init__(self,... | [
{
"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 | workspaces/voyage/server/src/util/testlogs.py | raychorn/svn_hp-projects |
#coding:utf8
import visdom
import time
import numpy as np
class Visualizer(object):
def __init__(self, env='default', **kwargs):
self.vis = visdom.Visdom(env=env, **kwargs)
self.index = {}
self.log_text = ''
def reinit(self,env='default',**kwargs):
self.vis = visdom.V... | [
{
"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 | utils/visualize.py | podismine/BrainAgeReg |
# -*- coding: utf-8 -*-
__author__ = 'dorota'
from sys import maxsize
class Contact:
def __init__(self, first_name=None, middle_name=None, last_name=None, nickname=None, title=None, company=None,
address=None, home_number=None, mobile_number=None, work_number=None, fax=None, first_email=None,
... | [
{
"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": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding... | 3 | model/contact.py | dorotan/pythontraining |
from contextlib import nullcontext as does_not_raise
from typing import Any
import pytest
from _mock_data.window_handles import WINDOW_HANDLE_1_ID, WINDOW_HANDLE_4_ID
from browserist.exception.window_handle import WindowHandleIdNotFoundError, WindowHandleIdNotValidError
from browserist.model.window.controller import ... | [
{
"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/browser/window/controller/remove_handle_by_id_test.py | jakob-bagterp/browserist |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
from scrapy.spiders import Spider
from scrapy.spiders import Request
import json
from hexun.items import HexunItem
from utils.urlUtils import UrlUtils
from utils.dateTimeUtils import DateTimeUtils
class PPSpider(Spider):
name = 'pp'
urlTemplate = 'http://webftcn.herme... | [
{
"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 | hexun/hexun/spiders/ppSpider.py | judypol/pytonStudy |
"""Convenience functions for dealing with objects' fully qualified names."""
# Copyright Aaron Hosford, 2018
# MIT License
import inspect
import sys
def find_object(name: str, *, auto_import: bool = True):
"""Look up an object by fully qualified name, e.g. module.submodule.class.object."""
if name in sys.mo... | [
{
"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 | zippity/names.py | hosford42/zippity |
from typing import Any, List
from fastapi import APIRouter, Depends, HTTPException
from sqlalchemy.orm import Session
from app import models, schemas, services
from app.api import deps
router = APIRouter()
@router.get("/", response_model=List[schemas.User])
def read_users(
db: Session = Depends(deps.get_db),
... | [
{
"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 | backend/app/api/api_v1/endpoints/users.py | BartlomiejRasztabiga/Rentally |
import torch.nn as nn
class Residual(nn.Module):
"""
Adds the input of a module to it's output.
"""
def __init__(self,
module,
residual_index=None,
model_output_key=None):
"""
:param module: The module to wrap.
:param residual... | [
{
"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": true... | 3 | pytorch_wrapper/modules/residual.py | skatsaounis/pytorch-wrapper |
#coding:utf-8
"""The Google Translate Implementation."""
from bs4 import BeautifulSoup
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait
from selenium.common.exceptions i... | [
{
"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 | translate/google.py | linyuy/ngzk |
import sys
def sol():
input = sys.stdin.readline
N = int(input())
node = [[] for i in range(N)]
for i in range(N):
vector = list(map(int, input().split(" ")))
for j in range(N):
if vector[j] == 1:
node[i].append(j)
for i in range(N):
visited = ["... | [
{
"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 | 11403/solution.py | bossm0n5t3r/BOJ |
# Copyright 2021-2022 VMware, Inc.
# SPDX-License-Identifier: Apache-2.0
"""
Custom Types.
"""
import copy
import logging
from typing import Any
from typing import Callable
from typing import Dict
from typing import Tuple
from typing import TYPE_CHECKING
import attr
from typing_extensions import Protocol
from pytests... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},... | 3 | src/pytestshellutils/customtypes.py | saltstack/pytest-shell-utilities |
import unittest
from cert_issuer.models import validate_issuance_date
class UnitValidationV3 (unittest.TestCase):
def test_validate_issuance_date_invalid_RFC3339 (self):
candidate = '20200202'
try:
validate_issuance_date(candidate)
except:
assert True
re... | [
{
"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/v3_certificate_validation/test_unit_issuance_date.py | KhoiUna/cert-issuer |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
OpenAPI spec version: v1.14.7
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import unittest
import kube... | [
{
"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_asyncio/test/test_v1beta1_role_ref.py | aK0nshin/kubernetes_asyncio |
from unittest import TestCase
from brain.models.sqlobjects import Job
class TestModelsJob(TestCase):
def setUp(self):
self.scan_id = "scan_id"
self.filename = "filename"
self.probename = "probename"
def test___init__(self):
job = Job(self.scan_id, self.filename, self.probenam... | [
{
"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 | brain/tests/models/test_sqlobjects_Job.py | krisshol/bach-kmno |
import pandas as pd
import numpy as np
import time
from datetime import timedelta, date, datetime
class TransformData(object):
def __init__(self):
pass
# get data and preprocessing
def format_timestamp(self, utc_datetime):
now_timestamp = time.time()
offset = datetime.fromtimestamp... | [
{
"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 | utils/transform.py | yasirabd/deployment-notebook-prescriptive |
from ninja.errors import ConfigError
class SecuritySchema(dict):
def __init__(self, type: str, **kwargs):
super().__init__(type=type, **kwargs)
class AuthBase:
def __init__(self):
if not hasattr(self, "openapi_type"):
raise ConfigError("If you extend AuthBase you need to define o... | [
{
"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 | ninja/security/base.py | Stamper/django-ninja |
from integration.helpers.base_test import BaseTest
class TestBasicLayerVersion(BaseTest):
"""
Basic AWS::Serverless::StateMachine tests
"""
def test_basic_state_machine_inline_definition(self):
"""
Creates a State Machine from inline definition
"""
self.create_and_veri... | [
{
"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": true... | 3 | integration/single/test_basic_state_machine.py | will-driven/serverless-application-model |
#!/usr/bin/env python
import argparse
import rospy
from std_msgs.msg import Int32
from geometry_msgs.msg import PoseStamped, TwistStamped
from styx_msgs.msg import Lane, Waypoint
from dbw_mkz_msgs.msg import BrakeCmd
import math
import sys
import numpy as np
import csv
MPS = 0.44704
class FakeGreenLight():
def _... | [
{
"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 | ros/src/tools/fakeGreenLight.py | cedricxie/SDC-System-Integration |
from bitarray import bitarray
import os
parentdir = 'data'
directory = 'wordFiles'
def _wordFile(word, flags):
"""Returns the requested word file"""
return open('{0}\{1}\{2}'.format(parentdir, directory, word), flags)
def setDirectory(newdir):
"""Sets the directory used my this module, residing under [parentdir]"... | [
{
"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 | bitarray_io.py | danaugrs/sdr-generator |
#!/usr/bin/env python
import pygame
from pygame.locals import *
import sys
SCR_RECT = Rect(0, 0, 640, 480)
class MySprite(pygame.sprite.Sprite):
def __init__(self, filename, x, y, vx, vy):
pygame.sprite.Sprite.__init__(self)
self.image = pygame.image.load(filename).convert_alpha()
width = ... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding s... | 3 | basic/sprite_test/sprite_test.py | manzyun/pygame |
from rest_framework import permissions
class UpdateOwnProfile(permissions.BasePermission):
"""Allow user to edit their own profile"""
def has_object_permission(self, request, view, obj):
"""Check user is trying to edit their own profile"""
if request.method in permissions.SAFE_METHODS:
... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",... | 3 | profiles_api/permissions.py | JonathanOzsvath/profile-rest-ap |
#!/usr/bin/python
# -*- encoding=utf-8 -*-
# author: Ian
# e-mail: stmayue@gmail.com
# description:
def list_to_dict(in_list):
return dict((i, in_list[i]) for i in range(0, len(in_list)))
def exchange_key_value(in_dict):
return dict((in_dict[i], i) for i in in_dict)
def main():
pass
if __name__ == ... | [
{
"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 | utility.py | sahabi/opt |
# coding: utf-8
"""
Mux Python - Copyright 2019 Mux Inc.
NOTE: This class is auto generated. Do not edit the class manually.
"""
from __future__ import absolute_import
import unittest
import mux_python
from mux_python.models.track import Track # noqa: E501
from mux_python.rest import ApiException
class TestTra... | [
{
"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 | test/test_track.py | moaazsidat/mux-python |
import csv
def ClassFactory(class_name, dictionary):
return type(class_name, (object,), dictionary)
class CsvReader:
data = []
def __init__(self, filepath):
self.data.clear()
with open(filepath) as text_data:
csv_data = csv.DictReader(text_data, delimiter=',')
fo... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},... | 3 | src/CsvReader.py | Erikalizth27/project2practice |
from typing import Any, Dict, Union
import httpx
from ...client import Client
from ...types import UNSET, Response, Unset
def _get_kwargs(
*,
client: Client,
common: Union[Unset, None, str] = UNSET,
) -> Dict[str, Any]:
url = "{}/common_parameters".format(client.base_url)
headers: Dict[str, Any... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"a... | 3 | end_to_end_tests/golden-record/my_test_api_client/api/default/get_common_parameters.py | kmray/openapi-python-client |
import torch
import misc.utils as utils
import numpy as np
from misc.rewards import init_scorer, get_self_critical_reward, get_arsk_loss_cuda
class LossWrapper(torch.nn.Module):
def __init__(self, model, opt):
super(LossWrapper, self).__init__()
self.opt = opt
self.model = model
if ... | [
{
"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 | misc/loss_wrapper.py | Zhendong-Wang/arsm_image_captioning |
from models.Pruneable import Pruneable
from models.networks.assisting_layers.ResNetLayers import resnet18
class ResNet18(Pruneable):
def __init__(self, device="cuda", output_dim=2, input_dim=(1, 1, 1), **kwargs):
super(ResNet18, self).__init__(device=device, output_dim=output_dim, input_dim=input_dim, **k... | [
{
"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 | models/networks/ResNet18.py | MorganeAyle/SNIP-it |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (C) 2013 PolyBeacon, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless... | [
{
"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 | ripcord/db/sqlalchemy/migrate_repo/versions/002_Rename_subscriber_table.py | kickstandproject/ripcord |
import pytest
from anyio import (
create_task_group, create_event, wait_all_tasks_blocked, get_running_tasks, get_current_task)
@pytest.mark.anyio
async def test_get_running_tasks():
async def inspect():
await wait_all_tasks_blocked()
new_tasks = set(await get_running_tasks()) - existing_task... | [
{
"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 | tests/test_debugging.py | tjstum/anyio |
import torch
import numpy as np
class ExperienceReplay:
def __init__(self, psi_dim, x_dim, y_dim, device, sphere_cut=False):
self._psi_dim = psi_dim
self._x_dim = x_dim
self._y_dim = y_dim
self._device = device
self._sphere_cut = sphere_cut
self._y = torch.zeros(0, s... | [
{
"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 | lgso/experience_replay.py | yandexdataschool/inverse-problem-intensive |
# -*- coding: utf-8 -*-
#
# Copyright 2017-2018 - Swiss Data Science Center (SDSC)
# A partnership between École Polytechnique Fédérale de Lausanne (EPFL) and
# Eidgenössische Technische Hochschule Zürich (ETHZ).
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in c... | [
{
"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 | renku/cli/_git.py | jsam/renku-python |
import numpy as np
from keras.models import load_model
import MeCab
import re
def calc_humor_score(text, model, word_index):
(words, reading) = morph(text)
if not is_dajare(reading):
return 0
return predict(words, model, word_index)
def morph(text):
words = [] # 単語の原形
reading = ""... | [
{
"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 | src/humorcalc.py | tomoino/GagRocket |
# content of test_sample.py
from vps_backup_utils import VPSBackupUtils
def inc(x):
return x + 1
def test_answer():
assert inc(3) == 4
| [
{
"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 | tests/test_sample.py | lyh543/webapp_backup_utils |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# class for windows getch
class _GetchWindows:
def __init__(self):
import msvcrt
def __call__(self):
import msvcrt
return msvcrt.getch()
getch = _GetchWindows()
# print instruction
print ("Please enter something: ")
# read user input an... | [
{
"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 | take_single_user_input/c_windows_only.py | hafiz-kamilin/python_example_program |
#!/usr/bin/env python
from Utils.WAAgentUtil import waagent
import Utils.HandlerUtil as Util
ExtensionShortName = "SampleExtension"
def main():
#Global Variables definition
waagent.LoggerInit('/var/log/waagent.log','/dev/stdout')
waagent.Log("%s started to handle." %(ExtensionShortName))
operation =... | [
{
"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 | SampleExtension/install.py | shridpant/azure-linux-extensions |
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from ..featuredetection import CannySegmentationLevelSetImageFilter
def test_CannySegmentationLevelSetImageFilter_inputs():
input_map = dict(
advectionWeight=dict(argstr="--advectionWeight %f",),
args=dict(argstr="%s",),
cannyThreshold=... | [
{
"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 | nipype/interfaces/semtools/filtering/tests/test_auto_CannySegmentationLevelSetImageFilter.py | dPys/nipype |
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Simple echo server that echoes back client input.
You can run this .tac file directly with:
twistd -ny telnet_echo.tac
This demo sets up a listening port on 6023 which accepts telnet connections.
No login for the telnet server is require... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},... | 3 | docs/conch/examples/telnet_echo.tac | neberej/twisted |
import math
import torch
from ganslate.nn.losses import cyclegan_losses
class HX4CycleGANBalancedLosses(cyclegan_losses.CycleGANLosses):
""" Modified to make Cycle-consitency account for only
FDG-PET images (in domain A) and HX4-PET images (in domain B),
and ignore CT components """
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": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answ... | 3 | projects/maastro_hx4_pet_translation/modules/hx4_cyclegan_balanced_losses.py | ibro45/a |
class Player():
def __init__(self, colour):
self.cnt = 0;
self.movingPhase = True;
return;
def action(self, turns):
self.cnt = self.cnt + 1;
if (self.cnt > 12):
self.movingPhase = False;
paction = None;
if self.movingPhase:
pos = input("Placing Phase White Player:");
# tmplist = ();
pos =... | [
{
"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 | part-B test/WhitePlayer.py | BlackAIUnimelb/comp300024 |
from sympy import Range
def is_composite(a: int, d: int, n: int, s: int) -> bool:
if pow(a, d, n) == 1:
return False
for i in Range(s):
if pow(a, 2 ** i * d, n) == n - 1:
return False
# n is definitely composite
return True
def is_prime(number: int, rounds: int = 128) ->... | [
{
"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 | Codes/Math/huge_number_miller-rabin_primality_test.py | datta-agni/python-codes |
import numpy as np
import logging
from app.functions.integrate_trajectory import integrate_next_step
from app.models.scan_maps.sign_change import SignChangeSparseMap
from app.models.job_metadata import JobMetadata
from app.utils.heartbeat import Heartbeat
# sign as in the partial derivative's sign
def scan_sign_chan... | [
{
"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 | app/functions/scan_phase_space/sign_change.py | victor-gp/tfg-H16b |
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.cuda import amp
from torchvision.models import resnet50
class Identity(nn.Module):
def __init__(self):
super(Identity, self).__init__()
def forward(self, x):
return x
class Model(nn.Module):
def __init__(self, f... | [
{
"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 | simclr/model.py | k-stacke/ssl-pathology |
# Copyright (c) 2019 Georgia Tech Robot Learning Lab
# Licensed under the MIT License.
from abc import ABC, abstractmethod
class OnlineLearner(ABC):
""" An abstract interface of iterative algorithms. """
@abstractmethod
def update(self, *args, **kwargs):
""" Update the state given feedback. """
... | [
{
"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 | rl/core/online_learners/online_learner.py | gtrll/librl |
import jwt
import datetime
from jwt import exceptions
def createToken(payload, timeout=20) -> str:
"""
:param payload: 例如:{'user_id':1,'username':'whw'}用户信息
:param timeout: token的过期时间,默认20分钟
:return:
"""
headers = {
'typ': 'jwt',
'alg': 'HS256'
}
payload['exp'] = datet... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding s... | 3 | tool/JwtAuth.py | bw98/webservice-1 |
class Domain(Enum,IComparable,IFormattable,IConvertible):
"""
Enumeration of connector domain types
enum Domain,values: DomainCableTrayConduit (4),DomainElectrical (2),DomainHvac (1),DomainPiping (3),DomainUndefined (0)
"""
def __eq__(self,*args):
""" x.__eq__(y) <==> x==yx.__eq__(y) <==> x==yx.__eq... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 lines?",
"answer": false
},
... | 3 | release/stubs.min/Autodesk/Revit/DB/__init___parts/Domain.py | htlcnn/ironpython-stubs |
from django.contrib.auth import get_user_model
from django.test import TestCase, Client
from django.shortcuts import reverse
from .models import Tag
class TagModelTestCase(TestCase):
def setUp(self):
self.tag = Tag.objects.create(name='example')
def test_model_created_object(self):
tags = Ta... | [
{
"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 | tags/tests.py | joshua-hashimoto/molecule-django |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
def ensure_dir(path):
if not os.path.exists(path):
os.makedirs(path)
def get_instance(module, name, config, *args):
return getattr(module, config[name]['type'])(*args, **config[name]['args'])
| [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/... | 3 | utils/util.py | daili0015/ModelFeast |
from pycroft.lib import user as UserHelper
from tests import FactoryDataTestBase, UserFactory
class UserEditsTestCase(FactoryDataTestBase):
def create_factories(self):
super().create_factories()
self.user = UserFactory()
def test_correct_new_name(self):
new_name = "A new name"
... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
... | 3 | tests/lib/user/test_edits.py | agdsn/pycroft |
from datetime import datetime
import logging as log
class p4Logging(object):
def __init__(self, file_name = None):
self.log = log
date = datetime.now()
str_date = date.strftime('%Y-%m-%d.%H:%M:%S')
self.file_name = "log/p4Controler-" + str_date
log.basicConfig(filename=self... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written ... | 3 | controller/p4_log.py | gustavo978/helpful |
import taichi as ti
@ti.func
def _inside(p, c, r):
return (p - c).norm_sqr() <= r * r
@ti.func
def taichi_logo(pos, scale=1 / 1.11):
p = (pos - 0.5) / scale + 0.5
ret = -1
if not (p - 0.50).norm_sqr() <= 0.52**2:
if ret == -1:
ret = 0
if not (p - 0.50).norm_sqr() <= 0.495**2:... | [
{
"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 | python/taichi/tools/patterns.py | Jack12xl/taichi |
import socket
import psutil
def find_ip_form_interface(family=socket.AF_INET):
for interface, snics in psutil.net_if_addrs().items():
for snic in snics:
if snic.family == family:
yield (interface!='lo', snic.address)
def get_ip():
ipv4s = list(find_ip_form_interface())
... | [
{
"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 | i2c/ip.py | Weemy96/raspberry-pi-i2c-python-script |
from .api import APIItems
class Scenes(APIItems):
"""Represents Hue Scenes.
https://developers.meethue.com/documentation/scenes-api
"""
def __init__(self, raw, request):
super().__init__(raw, request, 'scenes', Scene)
class Scene:
"""Represents a Hue Scene."""
def __init__(self, id... | [
{
"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 | aiohue/scenes.py | azogue/aiohue |
import json
from django.test import TestCase
from django.test import Client
class TestHealthCheck(TestCase):
def setUp(self):
self.c = Client()
def test_is_service_online_route(self):
resp = self.c.get("/health/")
self.assertEquals(json.loads(resp.content), {"status": "online"})
| [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answ... | 3 | app/health/tests.py | fuzz88/photo_stock |
#!/usr/bin/python
import requests, time
from flask import Flask, Response, stream_with_context
app = Flask(__name__)
START = time.time()
def elapsed():
running = time.time() - START
minutes, seconds = divmod(running, 60)
hours, minutes = divmod(minutes, 60)
return "%d:%02d:%02d" % (hours, minutes, se... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
... | 3 | edge/app.py | datawire/hello-forge-network |
import cyscs as scs
import pytest
import cyscs.examples as ex
import scipy.sparse as sp
import numpy as np
def test_simple_lp():
data, cone = ex.simple_lp()
sol = scs.solve(data, cone)
def test_extra_arg():
data, cone = ex.simple_lp()
sol = scs.solve(data, cone, eps=1e-9, alpha=.1, nonsense_arg='nons... | [
{
"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 | cyscs/test/test_solve.py | ajfriend/cyscs |
import nlmod
import test_001_model
def test_get_recharge():
# model with sea
model_ds = test_001_model.test_get_model_ds_from_cache('sea_model_grid')
# add knmi recharge to the model dataset
model_ds.update(nlmod.read.knmi.get_recharge(model_ds))
return model_ds
def test_get_recharge_steady_... | [
{
"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 | tests/test_005_external_data.py | ArtesiaWater/nlmod |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | [
{
"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 | src/command_modules/azure-cli-lab/azure/cli/command_modules/lab/__init__.py | saurabsa/azure-cli-old |
"""Functions to interact with github API."""
import json
import re
from io import StringIO
import requests
GITHUB_API_BASE = 'https://api.github.com'
def build_github_url(
repo,
branch=None,
path='requirements.txt',
token=None
):
"""Builds a URL to a file inside a Github repository."""
repo ... | [
{
"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 | piprot/providers/github.py | ziima/piprot |
"""permissions for FRCR review
Revision ID: eaef1147f25c
Revises: b72d4946fb3c
Create Date: 2021-01-09 08:11:26.337104
"""
import sqlalchemy as sa
from alembic import op
from sqlalchemy.sql import column, table
# revision identifiers, used by Alembic.
revision = 'eaef1147f25c'
down_revision = 'b72d4946fb3c'
branch_l... | [
{
"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 | auth-api/migrations/versions/eaef1147f25c_permissions_for_frcr_review.py | argush3/sbc-auth |
# encoding=utf8
# pylint: disable=anomalous-backslash-in-string, old-style-class
import math
__all__ = ['ChungReynolds']
class ChungReynolds:
r"""Implementation of Chung Reynolds functions.
Date: 2018
Authors: Lucija Brezočnik
License: MIT
Function: **Chung Reynolds function**
:math:... | [
{
"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 | NiaPy/benchmarks/chungReynolds.py | tuahk/NiaPy |
import random
from ansible.module_utils.basic import AnsibleModule
ANSIBLE_METADATA = {
'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'
}
DOCUMENTATION = '''
---
module: real_facts
short_description: A module that dishes out the true facts.
version_added: "2.8"
description... | [
{
"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 | actions/plugins/modules/real_facts.py | ccamacho/pystol-galaxy |
"""
Code for managing the TESS eclipsing binary metadata.
"""
import pandas as pd
from pathlib import Path
from peewee import IntegerField, SchemaManager
from ramjet.data_interface.metadatabase import MetadatabaseModel, metadatabase
brian_powell_eclipsing_binary_csv_path = Path('data/tess_eclipsing_binaries/TESS_EB_... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{
... | 3 | ramjet/data_interface/tess_eclipsing_binary_metadata_manager.py | golmschenk/ramjet |
from django.test import TestCase
from django.contrib.auth import get_user_model
class ModelTests(TestCase):
def test_create_user_with_email_successful(self):
""" Test creating a new user with an email is successful"""
email = 'test@example.com'
password = 'testpass123'
user = get_... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"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 | app/core/tests/test_models.py | slauzinho/recipe-app-api |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.