source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
import pandas as pd
import numpy as np
from sklearn.cluster import KMeans
class SKmeans:
def __init__(self, n_grupos = 3):
self.n_grupos = n_grupos
def fit(self, L, U, y):
sementes = self.gerarSementes(L, y)
self.kmeans = KMeans(n_clusters = self.n_grupos, init = sementes,... | [
{
"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 | SEEDEDKmeans.py | brunnovicente/SeedKmeans |
from nose.plugins.attrib import attr
@attr('demo_smoke', 'smoke', 'known_bad')
def test_dummy_known_bad_with_assertion_error():
assert False
@attr('demo_smoke', 'smoke', 'known_bad')
def test_dummy_known_bad_with_assertion_pass():
assert True
@attr('demo_smoke', 'smoke', 'known_bad')
def test_dummy_known_ba... | [
{
"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 | test/nose_integration_tests/dummy_first_level_pkg_two_tests/dummy_test_f.py | Points/teamcity-python |
# coding: utf-8
"""
Metacore IoT Object Storage API
Metacore Object Storage - IOT Core Services # noqa: E501
OpenAPI spec version: 1.1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import metacore_api_python_cli
fr... | [
{
"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 | test/test_error_error.py | metacore-io/metacore-api-client-python |
from __future__ import annotations
from typing import Iterator, Type
from ._cdata import CData
from ._ffi import ffi, lib
from .dcp_profile import DCPProfile
__all__ = ["Input"]
class Input:
def __init__(self, dcp_input: CData):
self._dcp_input = dcp_input
if self._dcp_input == ffi.NULL:
... | [
{
"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 | deciphon/input.py | EBI-Metagenomics/deciphon-py |
# ~*~ encoding: utf-8 ~*~
from functools import wraps
from flask import abort
from flask_login import current_user
def permission_required(permission):
def decorator(f):
@wraps(f)
def decorated_function(*args, **kwargs):
if current_user.permission != permission:
abort(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": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding sel... | 3 | app/decorators.py | schenkd/webdev-project |
from django.shortcuts import render, redirect
from django.utils import translation, timezone
from django.http import HttpResponseRedirect
from django.urls import reverse
from product.models import Product, Product_type
from .forms import ProductForm
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteg... | [
{
"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 | janggoCompany/mainsite/views.py | jangheeseung/janggo_system |
import typing
from collections import (
Counter,
)
def solve(
a: typing.List[int],
) -> typing.NoReturn:
c = Counter(a)
s = 0
for k, v in c.items():
s += min(v, k - 1)
print(s)
def main() -> typing.NoReturn:
t = int(input())
for _ in range(t):
n = int(input())
*a, = map(
int, in... | [
{
"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 | src/codechef/cook131/c/sol_0.py | kagemeka/competitive-programming |
from rest_framework.viewsets import ModelViewSet
from .models import Profile, Group
from .serializers import ProfileSerializers, GroupSerializers
from rest_framework.response import Response
from rest_framework.decorators import action
from itertools import chain
class ProfileViewSet(ModelViewSet):
serializer_cla... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{... | 3 | copilot/views.py | Feudo-Laranja-ave-do-paraiso-DS-2021-2/copilot-api |
from aliexpress.api.base import RestApi
class AliexpressMarketingRedefiningGetactlistRequest(RestApi):
def __init__(self, domain="gw.api.taobao.com", port=80):
RestApi.__init__(self, domain, port)
self.param_seller_coupon_activity_api_query = None
def getapiname(self):
return "aliexpr... | [
{
"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 | aliexpress/api/rest/MarketingRedefiningGetactlist.py | bayborodin/aliexpress-sdk |
print("Propriedades e Descritores")
input()
print("Propriedades - Permitem gerenciar a criação")
print("e manipulação de atributos de uma da classe")
print("Semelhante aos métodos __getattr__, __setattr")
print("e __getattribute__ porem menos genéricos")
input()
print("Exemplo")
class Pessoa(object):
def __init_... | [
{
"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 | Conteudo das Aulas/125/125.py | cerberus707/lab-python |
import math
class Solution:
def countPrimes(self, n):
"""
:type n: int
:rtype: int
厄拉多塞筛法
比如求20以内质数的个数, 首先0,1不是质数。
2是第一个质数,然后把20以内所有2的倍数划去。
2后面紧跟的数即为下一个质数3,然后把3所有的倍数划去。
3后面紧跟的数即为下一个质数5,再把5所有的倍数划去,以此类推。
"""
if n < 2:
return... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
... | 3 | python/math/0204_count_primes.py | linshaoyong/leetcode |
import pygame
import random
class Bos(pygame.sprite.Sprite):
def __init__(self, screen, lvl):
super(Bos, self).__init__()
self.lvl = lvl
self.screen = screen
if lvl == 1:
self.image = pygame.image.load("дизайн/инопланетяни, бонцсы и т.д/bos_1_.png")
if lvl == 2... | [
{
"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 | bos.py | IlyaLyamin/projekt-Ailen |
from django.db import models
from django.contrib.auth.models import AbstractBaseUser, BaseUserManager, \
PermissionsMixin
class UserManager(BaseUserManager):
def create_user(self, email, password=None, **extra_fields):
"""Create and save new user"""
if not ... | [
{
"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_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
}... | 3 | app/core/models.py | hussainanjar/recipe-app-api |
import unittest
from unittest.mock import MagicMock
import pandas as pd
from pandas.testing import assert_frame_equal
from data_export.pipeline.dataset import Dataset
class TestDataset(unittest.TestCase):
def setUp(self):
example = MagicMock()
example.to_dict.return_value = {"data": "example"}
... | [
{
"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 | backend/data_export/tests/test_dataset.py | arcada-uas/doccano |
import pytest
from app import crud
from app.schemas import EpisodeCreate
from app.schemas.episode import EpisodeSearch
from app.tests.utils import random_segment
def test_get_episode(db):
ep_in = EpisodeCreate(name="ep1", air_date="2022-03-04", segment=random_segment())
ep = crud.episode.create(db, ep_in)
... | [
{
"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 | backend/app/tests/unit/crud/test_episode.py | flsworld/comment-rick-n-morty |
# Zip file download of Filip Korzeniowski's version with annotated keys: http://www.cp.jku.at/people/korzeniowski/bb.zip
import os
import re
import glob
import logging
from typing import Iterator, Optional, Tuple
from abc import abstractmethod
from inceptionkeynet.data import Dataset, DatasetCreator, MusicPi... | [
{
"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 | inceptionkeynet/datasets/mcgill_billboard.py | stefan-baumann/inceptionkeynet |
from pyrogram import Client, filters
import asyncio
import os
from pytube import YouTube
from pyrogram.types import InlineKeyboardMarkup
from pyrogram.types import InlineKeyboardButton
from youtubesearchpython import VideosSearch
from TamilBots.TamilBots import ignore_blacklisted_users, get_arg
from TamilBots import ap... | [
{
"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 | TamilBots/modules/song.py | serxan22/drakulasongbottelegram |
from __future__ import print_function, division
import pytest
import attr
from scantree.test_utils import assert_dir_entry_equal
from scantree import DirEntryReplacement
class MockStat(object):
def __init__(self, st_ino=None):
self.st_ino = st_ino
class TestAssertDirEntryEqual(object):
def get_... | [
{
"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 | tests/test_test_utils.py | tomasaschan/scantree |
"""Test code for relu activation"""
import os
import numpy as np
import tvm
import topi
from topi.util import get_const_tuple
def verify_relu(m, n):
A = tvm.placeholder((m, n), name='A')
B = topi.nn.relu(A)
a_np = np.random.uniform(size=get_const_tuple(A.shape)).astype(A.dtype)
b_np = a_np * (a_np > 0... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (e... | 3 | nnvm/tvm/topi/tests/python/test_topi_relu.py | rah9eu/p3 |
import logging
import os
import unittest
import pypesto
import pypesto.logging
class LoggingTest(unittest.TestCase):
def test_optimize(self):
# logging
pypesto.logging.log_to_console(logging.WARN)
filename = ".test_logging.tmp"
pypesto.logging.log_to_file(logging.DEBUG, filename)
... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"... | 3 | test/test_logging.py | LukasSp/pyPESTO |
"""
Role tests
"""
import os
from testinfra.utils.ansible_runner import AnsibleRunner
testinfra_hosts = AnsibleRunner(
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
def test_package(host):
"""
Ensure package installed
"""
if host.system_info.distribution in ('debian', 'ubuntu'):
... | [
{
"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 | molecule/default/tests/test_installation.py | infOpen/ansible-role-xvfb |
#!/usr/bin/env python3
# https://leetcode.com/problems/remove-linked-list-elements/
import unittest
from typing import Optional
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
class Solution:
def removeElements(self, head: Optional[ListNode], val: int) -> Optional[List... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excl... | 3 | algorithms/code/leetcode/lc203_remove_linked_list_elements/lc203_remove_linked_list_elements.py | altermarkive/training |
from credentials import credentials
import unittest
import pyperclip
class TestUser(unittest.TestCase):
'''
Test that defines test cases for the User class
Args:
unitest.Testcase: Testcase that helps in creating test cases for class User.
'''
def setUp(self):
'''
Set up me... | [
{
"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 | credentials_test.py | paulmunyao/Password-Locker |
from __future__ import print_function
from setuptools import setup
from setuptools.command.test import test as TestCommand
import io
import sys
import bitcoingraph
def read(*filenames, **kwargs):
encoding = kwargs.get('encoding', 'utf-8')
sep = kwargs.get('sep', '\n')
buf = []
for filename in filenam... | [
{
"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 | setup.py | blatherdrift/bitcoingraph |
import wikipedia as wiki
from ..parsing import get_wiki_page_id, get_wiki_lines, get_wiki_sections
def get_wiki_references(url, outfile=None):
"""get_wiki_references.
Extracts references from predefined sections of wiki page
Uses `urlscan`, `refextract`, `doi`, `wikipedia`, and `re` (for ArXiv URLs)
:... | [
{
"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 | scraper/apis/wikipedia.py | antimike/citation-scraper |
# This file is generated by C:\projects\numpy-wheels\numpy\setup.py
# It contains system_info results at the time of building this package.
__all__ = ["get_info","show"]
blas_opt_info={'library_dirs': ['C:\\projects\\numpy-wheels\\windows-wheel-builder\\atlas-builds\\atlas-3.11.38-sse2-64\\lib'], 'language': 'c', ... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"... | 3 | python-3.4.4.amd64/Lib/site-packages/numpy/distutils/__config__.py | CSnap/photogate |
from django.conf import settings
def get_django_setting_or_default(setting_name, default):
"""
Wrapper for checking if something exists in the settings or not. Return the default otherwise
@param setting_name: the key of the config value
@param default: the default value to get otherwise
@return: ... | [
{
"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 | iitb_oauth/helpers.py | nautatva/iitb_oauth |
from abc import abstractmethod
from crawling.crawler_data_structures.crawl_data import CrawlData
class Crawler:
"""
An abstract class for other Crawlers to inherit from.
A Crawler should open a given file and attempt to find an associated file pattern at every byte in the given file.
"""
@abstrac... | [
{
"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 | crawling/crawler.py | LukasTinnes/sPyRat |
# pip install freegames
# Click on screen to control ball
# import modules
from random import *
import turtle as t
from freegames import vector
# Set window title, color and icon
t.title("Flappy Ball")
root = t.Screen()._root
root.iconbitmap("logo-ico.ico")
t.bgcolor('#80ffd4')
bird = vector(0, 0)
balls = []
... | [
{
"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 | games/Flappy.py | jayamithun/py-box |
from unittest import TestCase
from runtime_typing import typed, RuntimeTypingError
@typed(include=("return",))
def check_return_only(x: int) -> str:
return str(x)
@typed(include=("return",))
def fail_to_check_return_only(x: int) -> str:
return x
@typed(exclude=("x",))
def do_not_check_x(x: int) -> str:
... | [
{
"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 | tests/test_exclude_include.py | jonathan-scholbach/runtime_typing |
"""
Copyright (c) 2018 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in wri... | [
{
"point_num": 1,
"id": "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 | model-optimizer/mo/ops/lrn.py | apexxs/dldt |
import pytest
from receptor.router import MeshRouter
test_networks = [
(
[
("a", "b", 1),
("a", "d", 1),
("a", "f", 1),
("b", "d", 1),
("b", "c", 1),
("c", "e", 1),
("c", "h", 1),
("c", "j", 1),
("e"... | [
{
"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 | test/unit/test_router.py | RedHatOfficial/receptor |
"""LCM type definitions
This file automatically generated by lcm.
DO NOT MODIFY BY HAND!!!!
"""
try:
import cStringIO.StringIO as BytesIO
except ImportError:
from io import BytesIO
import struct
class L05Ebola(object):
__slots__ = ["cured"]
def __init__(self):
self.cured = False
def enco... | [
{
"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 | lcmtype/lilylcm/L05Ebola.py | WeirdCoder/LilyPadOS |
from scrapy.utils.project import get_project_settings
from sqlalchemy import Column
from sqlalchemy import Integer
from sqlalchemy import String
from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
def db_connect():
"""
Performs database conne... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
... | 3 | src/parliamentbg/parliamentbg/models.py | Georgitanev/python38_proj_adata |
from kivy.lang import Builder
from kivy import properties as p
from kivymd.app import MDApp as App
from kivymd.uix.screen import MDScreen
from kivymd.uix.card import MDCard
class MDButton(MDCard):
text = p.StringProperty('')
bold = p.BooleanProperty(0)
class HomeMainScreen(MDScreen):
pass
with open('... | [
{
"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 | controllers/home.py | elydev01/kvtemplate7 |
import numpy as np
from edutorch.nn import RNNCell
from tests.gradient_check import estimate_gradients
def test_rnn_cell_forward() -> None:
N, D, H = 3, 10, 4
x = np.linspace(-0.4, 0.7, num=N * D).reshape(N, D)
model = RNNCell(
prev_h=np.linspace(-0.2, 0.5, num=N * H).reshape(N, H),
Wx=n... | [
{
"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 | tests/nn/rnn_cell_test.py | TylerYep/edutorch |
from flask import Blueprint, request, url_for, jsonify
from flask_api import status
from models.main import *
from models.appendix import *
from flask_jwt_extended import (create_access_token, create_refresh_token,
jwt_required, get_jwt_identity)
from config import Config
app_auth = Blu... | [
{
"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 | routes/authentication.py | ivanjrju/backend |
from JJE_Standings.models import YahooStanding
def get_overclaim_teams(team_list):
team_standings = YahooStanding.objects.filter(current_standings=True).filter(yahoo_team_id__in=team_list)
if len(team_standings) == 0:
return []
max_rank = max([t.rank for t in team_standings])
overclaim_teams =... | [
{
"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 | JJE_Standings/utils/jje_standings_functions.py | namur007/JJE_App |
from __future__ import unicode_literals
class CitiesLightException(Exception):
""" Base exception class for this app's exceptions. """
pass
class InvalidItems(CitiesLightException):
"""
The cities_light command will skip item if a city_items_pre_import signal
reciever raises this exception.
... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
}... | 3 | cities_light/exceptions.py | endur24/django-cities-light |
#!/usr/bin/env python
"""
python list_bundles.py prod b6dc9b93-929a-45d0-beb2-5cf8e64872fe
python list_bundles.py staging 3b41f062-621c-46ca-abad-bce09427934d
"""
import argparse
import json
import logging
import sys
from ingest.api.ingestapi import IngestApi
logging.getLogger('ingest').setLevel(logging.DEBUG)
form... | [
{
"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 | list_bundles.py | HumanCellAtlas/ingest-common |
# pylint: disable=preferred-module # FIXME: remove once migrated per GH-725
import unittest
from ansiblelint.rules import RulesCollection
from ansiblelint.rules.ShellWithoutPipefail import ShellWithoutPipefail
from ansiblelint.testing import RunFromText
FAIL_TASKS = '''
---
- hosts: localhost
become: no
tasks:
... | [
{
"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 | test/TestShellWithoutPipefail.py | chilicheech/ansible-lint |
import os
import re
import _import_wrapper as iw
class XsParser(object):
def __init__(self, path, unit):
self._path = path
retargeted = os.path.join(unit.path(), os.path.basename(path))
with open(path, 'rb') as f:
includes, induced = XsParser.parse_includes(f.readlines())
... | [
{
"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 | build/plugins/xs.py | SitdikovRustam/CatBoost |
import unittest
from django.test import TestCase
from back2back.models import Entry
from back2back.structure import GentsRecurve
class TestCreatingEntry(TestCase):
def test_simple(self):
category = GentsRecurve()
category.create_entry('Larry Godfrey')
self.assertEqual(Entry.objects.count... | [
{
"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 | back2back/tests/test_entry.py | mjtamlyn/back2back |
from random import choice
class RandomWalk:
def __init__(self, num_points=5000):
self.num_points = num_points
self.x_values = [0]
self.y_values = [0]
def fill_walk(self):
while len(self.x_values) < self.num_points:
x_direction = choice([-1, 1])
x_dista... | [
{
"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 | matplotlib/random_walk.py | colorhistory/python-code |
from bs4 import BeautifulSoup
import os
import patoolib
import requests
import shutil
judicial_history_directory = 'judicial_history'
fincial_judgement_directory = 'fincial_judgement'
def copy_fincial_judgement():
for root, _dirs, files in os.walk(judicial_history_directory):
print('check {}'.format(roo... | [
{
"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 | update_judicial_data.py | ronaldshaooo/OpenDataJudicial |
#!/usr/bin/env python
import unittest
from piprot.piprot import main
class TestRequirementsParser(unittest.TestCase):
def setUp(self):
pass
def test_requirement_exact(self):
with self.assertRaises(SystemExit):
main([open('piprot/test/files/pytz_req.txt')])
if __name__ == '__mai... | [
{
"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 | piprot/test/test_piprot.py | sedrubal/piprot |
"""Support for Lutron Powr Savr occupancy sensors."""
from pylutron import OccupancyGroup
from homeassistant.components.binary_sensor import (
DEVICE_CLASS_OCCUPANCY,
BinarySensorEntity,
)
from . import LUTRON_CONTROLLER, LUTRON_DEVICES, LutronDevice
def setup_platform(hass, config, add_entities, discovery_... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"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 | homeassistant/components/lutron/binary_sensor.py | tbarbette/core |
import importlib
from typing import List
class ModuleInterface:
@staticmethod
def register() -> None:
"""Init the command"""
def import_module(name: str) -> ModuleInterface:
return importlib.import_module(name) # type: ignore
def load_commands(commands: List[str]) -> None:
for command_nam... | [
{
"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 | musicbotv2/plugins/loader.py | dabolink/MusicBot |
#!/usr/bin/env python
from napalm_base import get_network_driver
import napalm_yang
import configuration
import json
def pretty_print(data):
print(json.dumps(data, indent=4))
def main():
ios_driver = get_network_driver("ios")
with ios_driver(**configuration.ios) as device:
r = device.yang.ge... | [
{
"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 | examples/napalm-yang/basics/parse_example_1.py | dravetech/openconfig-with-napalm |
"""
Leetcode 70.
Climbing Stairs.
DP.
类似斐波那契数列:
转移方程: f(n) = f(n-1) + f(n-2).
时间复杂度:O(n)
还是没看明白这跟DP有啥关系,就是递归而已。
"""
class Solution:
def climbStairs(self, n: int) -> int:
res = [-1] * (n)
def dfs(n):
if n == 1:
return 1
if n == 2:
return 2
... | [
{
"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 | dp/climbing_stairs.py | vandesa003/leetcode_algo |
"""
@package mi.dataset.driver.nutnr_j.cspp
@file mi-dataset/mi/dataset/driver/nutnr_j/cspp/nutnr_j_cspp_recovered_driver.py
@author Joe Padula
@brief Recovered driver for the nutnr_j_cspp instrument
Release notes:
Initial Release
"""
__author__ = 'jpadula'
from mi.dataset.dataset_driver import SimpleDatasetDriver
... | [
{
"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 | mi/dataset/driver/nutnr_j/cspp/nutnr_j_cspp_recovered_driver.py | ronkyo/mi-dataset |
import argparse
import sys
from typing import List, Sequence
from exabel_data_sdk import ExabelClient
from exabel_data_sdk.scripts.base_script import BaseScript
class ListTimeSeries(BaseScript):
"""
Lists all time series.
"""
def __init__(self, argv: Sequence[str], description: str):
super()... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 2... | 3 | exabel_data_sdk/scripts/list_time_series.py | burk/python-sdk |
#!/usr/bin/env python3
import functools
import time
class Chrono():
def __init__(self, msg=None):
if msg:
print(msg)
self.t0 = time.time()
self.t = self.t0
def lap(self, name=None):
now = time.time()
if name:
print(name, end=': ')
msg = '... | [
{
"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 | papy/misc.py | ArcturusB/papy |
class SpaceAge(object):
ORBITAL_PERIOD = 31557600 # seconds
def __init__(self, seconds):
self.seconds = seconds
def on_mercury(self) -> float:
return round(self.seconds / float(self.ORBITAL_PERIOD) / 0.2408467, 2)
def on_venus(self) -> float:
return round(self.seconds / float... | [
{
"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 | python/space-age/space_age.py | PlugaruT/exercism-playground |
import onnx
import unittest
import torchvision
import numpy as np
from onnxruntime_customops.utils import trace_for_onnx, op_from_model
from onnxruntime_customops import eager_op, hook_model_op, PyOp, mytorch as torch
class TestTorchE2E(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.mobilen... | [
{
"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_mytorch.py | Zuwei-Zhao/ort-customops |
'''
Universidade Tecnológica Federal do Paraná
Aluno: Clodoaldo A. Basaglia da Fonseca
RA: 968692
Engenharia de Software 2
'''
import math, sys
'''
IN: String com o caminho até o arquivo com valores
Recebe o caminho do arquivo, faz um split na quebra de linha e devolve um vetor
de valores
OUT: Vetor de valores
'''... | [
{
"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 | PSP01/programa2.py | clodoaldoBasaglia/personalSoftwareProcess |
from kairosdbclient.exceptions import RequestException
from kairosdbclient.rest.apirequests.base import Request
from kairosdbclient.rest.resources import MetricTags
class QueryMetricTagsRequest(Request):
uri = 'datapoints/query/tags'
resource = MetricTags
success_status_code = 200
request_method = 'PO... | [
{
"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 | kairosdbclient/rest/apirequests/query_metric_tags.py | FrEaKmAn/kairosdb-python-client |
""" Router WAN information """
class Wan(object):
""" WAN information"""
def __init__(self, downspeed, maxdownloadspeed, history, devname, upload,
upspeed, maxuploadspeed, download):
self._downspeed = downspeed
self._maxdownloadspeed = maxdownloadspeed
self._history =... | [
{
"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 | xiaomirouter/status/wan.py | RiRomain/python-xiaomi-router |
"""
Elo Rating Calculator
"""
from whist.core.scoring.score_card import ScoreCard
from whist.core.scoring.team import Team
from whist.core.user.player import Player
# pylint: disable=too-few-public-methods
class EloRater:
"""
Static class that calculates the Elo-Rating for players after several hands played.
... | [
{
"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 | whist/core/scoring/elo.py | Whist-Team/Whist-Core |
import os
import unittest
from jsonasobj import as_json
from biolinkml.generators.pythongen import PythonGenerator
from tests.test_issues.environment import env
from tests.utils.python_comparator import compare_python, compile_python
from tests.utils.test_environment import TestEnvironmentTestCase
class Issue113Tes... | [
{
"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 | tests/test_issues/test_issue_113.py | deepakunni3/biolinkml |
from Load_And_Visualize_Time_Data import Load_and_Visualize_Time_Data
import sys
import pandas as pd
import numpy as np
from sktime.forecasting.model_selection import temporal_train_test_split
from sktime.forecasting.exp_smoothing import ExponentialSmoothing
from sktime.utils.plotting import plot_series
from sktime.per... | [
{
"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/ml/Univariate_Time_Series/Exponenial_Univariate_Forecasting.py | Hakan-er/utma |
from flask import Blueprint, render_template, redirect, url_for, flash
from ..forms import ForumPostForm
from ..models.forum_posts import ForumPost
forum_bp = Blueprint('forum', __name__, url_prefix='/forum')
@forum_bp.route('/')
def forum_index():
"""Generates the index page of the forum."""
# TODO: Fix thi... | [
{
"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 | {{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/views/forum.py | CodeSelfStudy/cookie-flask |
#
# (c) Copyright 2015-2016 Hewlett Packard Enterprise Development LP
# (c) Copyright 2017 SUSE LLC
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-... | [
{
"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 | lint_rules/ardana_hyphen_on_same_line_rule.py | jjolly/ardana-dev-tools |
import unittest
from trends import News
Movie = movie.Movie
class NewsTest(unittest.TestCase):
'''
Test Class to test the behaviour of the News class
'''
def setUp(self):
'''
Set up method that will run before every Test
'''
self.new_news = news(1234,'Python Must Be Cra... | [
{
"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 | app/news_test.py | Patrick322/News-Highlight |
#!/usr/bin/env python2
# coding: utf-8
from collections import OrderedDict
from pykit.p3json.test import PyTest
from pykit import ututil
dd = ututil.dd
class TestS2Cases(object):
def test_loads_dumps(self):
cases = [
('""', ''),
('"it168/\xb6\xd4.exe"', 'it168/\xb6\xd4... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": ... | 3 | p3json/test/test_unicode2.py | wenbobuaa/pykit |
import logging
from threading import Thread, Event
from .exceptions import ConnectionError, TimeoutError
class HeartbeatThread(Thread):
daemon = True
def __init__(
self, send_heartbeat,
relax_interval_in_seconds,
hurry_interval_in_seconds):
super(HeartbeatThread,... | [
{
"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 | socketIO_client/heartbeats.py | Layer3DLab/socketIO-client |
import unittest
import trw
import torch
import numpy as np
class TestTransformsResizeModuloPadCrop(unittest.TestCase):
def test_crop_mode_torch(self):
batch = {
'images': torch.rand([2, 3, 64, 64], dtype=torch.float32)
}
tfm = trw.transforms.TransformResizeModuloCropPad(60)
... | [
{
"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 | tests/test_transforms_resize_modulo_pad_crop.py | civodlu/trw |
from enum import Enum
class IndexMethod(str, Enum):
"""
Used to specify the index method for a
:class:`Column <piccolo.columns.base.Column>`.
"""
btree = "btree"
hash = "hash"
gist = "gist"
gin = "gin"
def __str__(self):
return f"{self.__class__.__name__}.{self.name}"
... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answe... | 3 | piccolo/columns/indexes.py | smythp/piccolo |
import asyncio
import decimal
import unittest
def tearDownModule():
asyncio.set_event_loop_policy(None)
class DecimalContextTest(unittest.TestCase):
def test_asyncio_task_decimal_context(self):
async def fractions(t, precision, x, y):
with decimal.localcontext() as ctx:
... | [
{
"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/Lib/test/test_asyncio/test_context.py | jasam/ciclo_vida_datos_scraping |
"""419. Battleships in a Board
https://leetcode.com/problems/battleships-in-a-board/
"""
from typing import List
class Solution:
def countBattleships(self, board: List[List[str]]) -> int:
def helper(r: int, c: int):
found = False
board[r][c] = '.'
for dr, dc in ([0, 1],... | [
{
"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": "has_nested_function_def",
"question": "Does this file contain any function defined inside ... | 3 | python-algorithm/leetcode/problem_419.py | isudox/leetcode-solution |
import json
import requests
from utils.classes.Const import config
file_path = '../../data'
def download_gamestrings(dir):
gs_file = 'gamestrings'
languages = ['dede', 'enus', 'ruru']
for lang in languages:
gs_url = f'https://raw.githubusercontent.com/HeroesToolChest/heroes-data/master/heroesdata/... | [
{
"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 | utils/scripts/download_gamestrings.py | fennr/Samuro-HotsBot |
"""
Validator for a regular language.
"""
from typing import Dict
from prompt_toolkit.document import Document
from prompt_toolkit.validation import ValidationError, Validator
from .compiler import _CompiledGrammar
__all__ = [
"GrammarValidator",
]
class GrammarValidator(Validator):
"""
Validator which... | [
{
"point_num": 1,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (exclu... | 3 | .venv/lib/python3.7/site-packages/prompt_toolkit/contrib/regular_languages/validation.py | ITCRStevenLPZ/Proyecto2-Analisis-de-Algoritmos |
import py.test
from descent.parser import parse_grammar
from descent.ast import *
def single_rule_grammar(name, body):
return grammar([rule(name=reference(name), expr=body)])
parse_cases = [
("A <- 'a'", single_rule_grammar("A", string("a"))),
("A <- \"a\"", single_rule_grammar("A", string("a"))),
... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (ex... | 3 | tests/test_grammar_parser.py | ethframe/descent |
# uncompyle6 version 3.7.4
# Python bytecode 3.7 (3394)
# Decompiled from: Python 3.7.9 (tags/v3.7.9:13c94747c7, Aug 17 2020, 18:58:18) [MSC v.1900 64 bit (AMD64)]
# Embedded file name: T:\InGame\Gameplay\Scripts\Server\clubs\club_ops.py
# Compiled at: 2015-10-22 00:30:07
# Size of source mod 2**32: 1503 bytes
from clu... | [
{
"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 | Scripts/simulation/clubs/club_ops.py | velocist/TS4CheatsInfo |
from .TfChain import TfChainClient, TfChainExplorer, TfChainBridged, TfChainDaemon
from Jumpscale import j
JSBASE = j.baseclasses.object_config_collection
class TfChainFactory(JSBASE):
__jslocation__ = "j.sal_zos.tfchain"
def daemon(
self,
name,
container,
data_dir="/mnt/data... | [
{
"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 | sandbox/lib/jumpscale/JumpscaleLibsExtra/sal_zos/tfchain/TfChainFactory.py | threefoldtech/threebot_prebuilt |
class Solution:
def findCircleNum(self, isConnected: List[List[int]]) -> int:
visited = set()
count = 0
def dfs(root):
if root in visited:
return
visited.add(root)
for child, connected in enumerate(isConnected[root]):
if con... | [
{
"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 | src/547.py | zhaoyi3264/leetcode-solutions |
import os
import numpy as np
from paddlehub.common.logger import logger
from lda_webpage.util import rand, rand_k
class VoseAlias(object):
"""Vose's Alias Method.
"""
def __init__(self):
self.__alias = None
self.__prob = None # np.array
def initialize(self, distribution):
... | [
{
"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 | modules/text/language_model/lda_webpage/vose_alias.py | chunzhang-hub/PaddleHub |
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 email """
email = "test@aqurds.com"
password = "aqurds123"
user = get_user_model().objects... | [
{
"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 | app/core/tests/test_models.py | Aqurds/django-rest-api |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright 2017 The Procyon Authors
#
# 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
#
# Un... | [
{
"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 | src/python/test/pn2json_test.py | orbea/procyon |
from django.shortcuts import *
from django.conf import settings
from django.utils.decorators import method_decorator
from django.contrib.auth.decorators import login_required
from django.views.generic import TemplateView
from rest_framework.views import APIView
from rest_framework.permissions import IsAuthenticated
fro... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": ... | 3 | uchicagohvz/chat/views.py | 100starnight/uchicago-hvz |
import unittest
from power_dict.errors import NoneParameterError
from power_dict.utils import DictUtils
class GetListDictPropertyTests(unittest.TestCase):
properties = {
"property_1": [1, 2, 3],
"property_1_none": None
}
def test_get_property(self):
target = DictUtils.get_list_di... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},... | 3 | tests/get_list_dict_property_tests.py | agorinenko/power_dict |
from typing import TypeVar
from datetime import datetime
from gphotos import Utils
from gphotos.DbRow import DbRow
from gphotos.DatabaseMedia import DatabaseMedia
from gphotos.GoogleAlbumMedia import GoogleAlbumMedia
import logging
log = logging.getLogger(__name__)
# this allows self reference to this class in its fa... | [
{
"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 | gphotos/GoogleAlbumsRow.py | rothgar/gphotos-sync |
"""
Small general mathematical functions.
This file was necessary to make CartPole module self-contained.
"""
from math import fmod
import numpy as np
# Wraps the angle into range [-π, π]
def wrap_angle_rad(angle: float) -> float:
Modulo = fmod(angle, 2 * np.pi) # positive modulo
if Modulo < -np.pi:
... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined insid... | 3 | CartPole/_CartPole_mathematical_helpers.py | jhuebotter/CartpoleSNNdemo |
# Run this script from the dir Reverse-Conway/src.
import sys
sys.path.append('.')
import pandas as pd
import numpy as np
import time
from components.binary_conway_forward_prop_fn import BinaryConwayForwardPropFn
def timing(msg):
global prev_t
t = time.time()
t_sec = round(t - prev_t)
(t_min, t_sec) =... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
... | 3 | src/data/tests/verify_kaggle_training.py | morgannewellsun/Reverse-Conway |
import threading
from sqlalchemy import Column, String
from . import BASE, SESSION
class LynxChats(BASE):
__tablename__ = "lynx_chats"
chat_id = Column(String(14), primary_key=True)
def __init__(self, chat_id):
self.chat_id = chat_id
LynxChats.__table__.create(checkfirst=True)
INSERTION_LOCK =... | [
{
"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 | lsf/database/auto_chatbot_sql.py | unknownkz/LynxSuperFederation |
from django.test import TestCase
from django.urls import reverse
from rest_framework.test import RequestsClient
class TestApiRoot(TestCase):
url = reverse('index')
def test_allows_unauthenticated(self):
response = self.client.get(self.url)
self.assertTrue(response.status_code < 400)
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_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
}... | 3 | boomerang/tests/test_apiroot.py | vsemionov/boomerang |
import sqlite3
from util.constants import DATABASE
class DBManager:
def __init__(self):
self.connection = None
self.cursor = None
def connect(self):
self.connection = sqlite3.connect(DATABASE["path"])
self.cursor = self.connection.cursor()
return self
def create_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": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
... | 3 | server_side/interfaces/database.py | yagorezende/TCC00314-Streaming |
from django.test import TestCase, override_settings
from wagtail_storages.factories import (
CollectionFactory,
CollectionViewRestrictionFactory,
)
from wagtail_storages.utils import (
get_acl_for_collection,
get_frontend_cache_configuration,
is_s3_boto3_storage_used,
)
class TestIsS3Boto3Storage... | [
{
"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_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},... | 3 | wagtail_storages/tests/test_utils.py | ski-family/wagtail-storages |
from app.clients import (Client, ClientException)
class SmsClientResponseException(ClientException):
'''
Base Exception for SmsClientsResponses
'''
def __init__(self, message):
self.message = message
def __str__(self):
return "Message {}".format(self.message)
class SmsClient(Cl... | [
{
"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 | app/clients/sms/__init__.py | department-of-veterans-affairs/notification-api |
"""
:author: Maikel Punie <maikel.punie@gmail.com>
"""
import json
import velbus
COMMAND_CODE = 0xbe
class CounterStatusMessage(velbus.Message):
"""
send by: VMB7IN
received by:
"""
def __init__(self, address=None):
velbus.Message.__init__(self)
self.channel = 0
self.puls... | [
{
"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 | velbus/messages/counter_status.py | ddanssaert/python-velbus |
from logging import getLogger, DEBUG, StreamHandler, Formatter, FileHandler
from functools import partial
from os.path import realpath, abspath, dirname
from os import getcwd
from typing import Union, Callable, Type
def get_logger(obj: Union[str, type, Callable,] = None):
if isinstance(obj, str) or obj is None:
... | [
{
"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 | larning/logging_i.py | tasigabi97/larning |
###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013-2021, John McNamara, jmcnamara@cpan.org
#
import unittest
from ...compatibility import StringIO
from ...vml import Vml
class TestWriteDiv(unittest.TestCase):
"""
Test the Vml _wri... | [
{
"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 | xlsxwriter/test/vml/test_write_div.py | eddiechapman/XlsxWriter |
def adicionar_tarefa(lista_tarefas, tarefas):
lista_tarefas.append(tarefas)
def deletar_tarefa(lista_tarefas, tarefas_deletadas):
"""
Esta função serve para deletar a ultima tarefa da lista e guarda esta tarefa em outra lista.
"""
if not lista_tarefas:
print("Nada a deletar")
r... | [
{
"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 | meus_projetos/projetos_python/lista_de_tarefas/minhas_funcoes.py | SabinoEduardo/Python |
import sys
from typing import IO
STDOUT = sys.stdout
class BufferedStream:
def __init__(self, stream: IO):
self.stream = stream
self.data = []
def write(self, data):
self.data.append(data)
def writelines(self, datas):
self.data += datas
def read(self) -> str:
... | [
{
"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 | src/custom_io.py | RostanTabet/Refery |
# author: Justus Schock (justus.schock@rwth-aachen.de)
import torch
class CustomGroupNorm(torch.nn.Module):
"""
Custom Group Norm which adds n_groups=2 as default parameter
"""
def __init__(self, n_features, n_groups=2):
"""
Parameters
----------
n_features : int
... | [
{
"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 | shapenet/networks/utils.py | ss18/shapenet |
from modules.botutil import BotUtil
class MongoHelper:
def __init__(self, client):
self.__client = client
self.__games = client.interbellum.games
def create_game(self, chat_id, game_admin):
commit = {
'id': chat_id,
'admin': game_admin,
'players': ... | [
{
"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 | modules/mongohelper.py | Chika-Fujiwara/interbellum |
class Solution:
def smallestRepunitDivByK(self, K: int) -> int:
if K % 2 == 0:
return -1
nums = set()
r = 0
for i in range(1, K + 1):
r = (r * 10 + 1) % K
if r == 0:
return i
if r not in nums:
nums.add(r)... | [
{
"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 | solution/lc1015.py | sth4nothing/pyleetcode |
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
class PID():
def __init__(self, P,I,D, bias):
self.P = P
self.I = I
self.D = D
self.bias = bias
def adjust(self,data:np.array):
output = self.P*self.prop(data) + self.I*self.inte(data) + self.D*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": true
... | 3 | ChemE/ml/PID.py | ConciseVerbosity18/ChemE_CV |
from functools import lru_cache
class Solution:
def longestPalindromeSubseq(self, s: str) -> int:
@lru_cache(None)
def helper(b,e):
print(b,e)
if b > e : return 0
if b == e : return 1
if s[b] == s[e] :
return helper(b+1,e-1) + 2
... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding se... | 3 | dp/longestPalindromicSubsequence/Solution.py | shahbagdadi/py-algo-n-ds |
import os
import discord
import json
from discord.ext import commands
import traceback
from dotenv import load_dotenv
load_dotenv()
if os.name == 'nt':
data_directory = 'json\\'
else:
data_directory = 'json/'
class Mochi(commands.Bot):
def __init__(self, command_prefix, **options):
... | [
{
"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 | main.py | mov-huyu/Mochi |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.