source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
# encoding: utf-8
import unittest
from cool.core import constants
class IntConstants(constants.Constants):
TEST0 = (0, 'test0')
TEST1 = (1, 'test1')
class IntStringCodeConstants(constants.Constants):
TEST = ('test', 'test0')
TEST1 = (1, 'test1')
class ConstantsTests(unittest.TestCase):
def te... | [
{
"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 | tests/core/test_constants.py | SmallCream/django-cool |
#
# Copyright 2019 The FATE Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than clas... | 3 | python/fate_client/pipeline/interface/model.py | rubenlozanoaht3m/DataDogm |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# thumbor imaging service
# https://github.com/thumbor/thumbor/wiki
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license
# Copyright (c) 2011 globo.com thumbor@googlegroups.com
from preggy import expect
import thumbor.metrics
from tests.base im... | [
{
"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 | tests/metrics/test_statsd_metrics.py | bear8421/thumbor |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
This is the land object of the game.
@Author: yanyongyu
"""
__author__ = "yanyongyu"
__all__ = ["Land"]
import pygame
from utils import getHitmask
class Land(pygame.sprite.Sprite):
def __init__(self, bg_size):
pygame.sprite.Sprite.__init__(self)
... | [
{
"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 | src/land.py | yanyongyu/FlappyBird |
import enum
class Priority(enum.Int):
Low = 1
High = 2
Critical = 3
class PriorityExtended(Priority, export=False):
SubLow = 0
def can_priority_displace(priority_new, priority_existing, allow_clobbering=False):
if priority_new is None:
return False
if allow_clobbering:
return ... | [
{
"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_class_has_docstring",
"question": "Does every class in this file have a docstring?... | 3 | S4/S4 Library/simulation/interactions/priority.py | NeonOcean/Environment |
import os
import subprocess
from bsm.util import which
from bsm.cmd import CmdResult
from bsm.cmd import CmdError
from bsm.cmd.pkg_base import PkgBase
from bsm.logger import get_logger
_logger = get_logger()
DEFAULT_EDITOR = ['vim', 'vi']
def _detect_editor(editors):
for editor in editors:
if which(edi... | [
{
"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 | bsm/cmd/pkg_edit.py | bsmsoft/bsm |
class CeilingType(HostObjAttributes,IDisposable):
""" Represents a ceiling type in Autodesk Revit. """
def Dispose(self):
""" Dispose(self: Element,A_0: bool) """
pass
def getBoundingBox(self,*args):
""" getBoundingBox(self: Element,view: View) -> BoundingBoxXYZ """
pass
def ReleaseUnmanagedResource... | [
{
"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 | stubs.min/Autodesk/Revit/DB/__init___parts/CeilingType.py | ricardyn/ironpython-stubs |
notas = []
def menu():
print("\nSISTEMA DE NOTAS\n")
print("1. Ingresar nota")
print("2. Cambiar nota")
print("3. Ver notas")
print("4. Estado final")
print("5. Salir")
while True:
try:
opcion = int(input("\nOPCION > "))
except:
opcion = -1
i... | [
{
"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 | Ejemplos/NotasFunciones/app/__init__.py | ampotty/uip-pc3 |
import pytest
from aws_sfn_builder import ResourceManager, State
@pytest.fixture
def jsp_resource_resolver():
resources = ResourceManager()
return resources.resolve
@pytest.mark.parametrize("input,expected", [
[
{"status": "FAILED"},
("Job Failed", {"status": "FAILED"}),
],
[
... | [
{
"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_state_execution.py | jbasko/aws-sfn-builder |
import unittest
from platform import python_version
from algoliasearch.user_agent import UserAgent
from algoliasearch.version import VERSION
class TestUserAgent(unittest.TestCase):
default = 'Algolia for Python ({}); Python ({})'.format(
VERSION, str(python_version()))
def tearDown(self):
Us... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
}... | 3 | tests/unit/http/test_user_agent.py | Anto59290/algoliasearch-client-python |
"""ERRORS"""
class Error(Exception):
"""Main Error Class"""
def __init__(self, message):
self.message = message
@property
def serialize(self):
return {
'message': self.message
}
class CompositeError(Error):
pass
class GeostoreNotFound(Error):
pass | [
{
"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 | composite/errors.py | Skydipper/Composite |
import sys
sys.path.append('/home/kailu/EDSR-PyTorch/code/')
sys.path.append('/home/wukailu/EDSR-PyTorch/code/')
from utils.tools import submit_jobs, random_params
def params_for_single_train():
params = {
'project_name': 'layerwise_model_train',
'gpus': 1,
'num_epochs': 300,
'we... | [
{
"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 | code/frameworks/classification/jobs_for_single.py | wukailu/EDSR-PyTorch |
import numpy as np
import matplotlib.pyplot as plt
from skimage.exposure import equalize_adapthist
from util import hsv2rgb, rgb2hsv, histogram_equalization, CLAHE, correlate, \
black_tophat
def threshold_strategy(I, r_b=85, r_t=145, g_b=0, g_t=0, b_b=75, b_t=130):
img = black_tophat(I, 11)
img = rgb2hs... | [
{
"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 | strategies.py | Chocomunk/caltech-ee148-spring2020-hw01 |
#!/usr/bin/env python
"""
Copyright (c) 2006-2018 sqlmap developers (http://sqlmap.org/)
See the file 'LICENSE' for copying permission
"""
from lib.core.data import logger
from lib.core.exception import SqlmapUnsupportedFeatureException
from plugins.generic.enumeration import Enumeration as GenericEnumeration
class ... | [
{
"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 | .modules/.sqlmap/plugins/dbms/sqlite/enumeration.py | termux-one/EasY_HaCk |
from sharpy.plans.acts import ActBase
from sc2 import AbilityId
class NoDoubleOrders(ActBase):
"""Don't use this for terrans, seriously!"""
def __init__(self):
super().__init__()
self.last_cancel = -1
async def execute(self) -> bool:
for unit in self.ai.structures:
if... | [
{
"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 | sharpy-sc2/sharpy/plans/debug/no_double_orders.py | etzhang416/sharpy-bot-eco |
# -*- coding: utf-8 -*-
import os
import yaml
import logging
from logging import config
class Logger:
def __init__(self, level=logging.DEBUG):
with open('{}/config.yaml'.format(os.path.dirname(__file__)), 'r') as f:
dic = yaml.safe_load(f.read())
config.dictConfig(dic)
sel... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},... | 3 | awsclimfa/log/logger.py | no-brand/aws-cli-mfa |
import tkinter
key= ""
def key_down(e):
global key
key = e.keysym
def key_up(e):
global key
key = ""
mx, my = (1, 1)
def main_proc():
global mx, my
if key == "Up" and maze[my-1][mx] == 0:
my -= 1
if key == "Down" and maze[my+1][mx] == 0:
my += 1
if key == "Left" and ... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": tru... | 3 | python/game/gui/maze.py | rrbb014/rrbb-playground |
# nlantau, 2022-01-29
from typing import *
"""
A subarray is a contiguous part of an array
Kadane's Algo
"""
class Solution:
def maxSubArray(self, nums: List[int]) -> int:
"""
Notes: 664 ms, 97.63% faster, 28.7 MB, 59.51% better
"""
max_res = nums[0]
curr_sum = 0
... | [
{
"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 | LeetCode_Python/leetcode_patterns/7_maximum_subarray.py | nlantau/Codewars_2020_2021 |
import torch
import numpy as np
class ScheduledOptim:
""" A simple wrapper class for learning rate scheduling """
def __init__(self, model, train_config, model_config, current_step):
self._optimizer = torch.optim.Adam(
model.parameters(),
betas=train_config["optimi... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/... | 3 | model/optimizer.py | richarai9/FastSpeech2 |
from crownstone_core.packets.serviceDataParsers.containers.elements.AdvTypes import AdvType
class AdvHubState:
def __init__(self):
self.type = AdvType.HUB_STATE
self.crownstoneId = None
self.hubFlags = None
self.hubData = None
self.timestamp = 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": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": fals... | 3 | crownstone_core/packets/serviceDataParsers/containers/AdvHubState.py | crownstone/crownstone-lib-python-core |
# pylint: disable=redefined-outer-name,invalid-name,no-name-in-module,unused-argument,too-few-public-methods,too-many-arguments,too-many-locals
# type: ignore
from enum import Enum
from brownie import (
Resolver,
Registry,
E721,
E1155,
DAI,
USDC,
TUSD,
accounts,
chain,
)
class NFT... | [
{
"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 | scripts/deploy_test.py | taronsung/registry |
from django.contrib.auth import authenticate, login, logout, get_user_model
from django.shortcuts import render, redirect
# Create your views here.
from .forms import LoginForm, RegisterForm
User = get_user_model()
def register_view(request):
form = RegisterForm(request.POST or None)
if form.is_valid():
... | [
{
"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 | accounts/views.py | aklauritzen/django_bootcamp |
from copy import deepcopy
import pytest
from traw.models import CaseType
ID = 1234
NAME = 'mock case type name'
@pytest.fixture()
def case_type(client):
content = {"id": ID,
"is_default": True,
"name": NAME}
return CaseType(client, deepcopy(content))
def test_id(case_type):
... | [
{
"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 | tests/models/test_case_type.py | levi-rs/testrail-api-wrapper |
"""
To understand why this file is here, please read:
http://cookiecutter-django.readthedocs.io/en/latest/faq.html#why-is-there-a-django-contrib-sites-directory-in-cookiecutter-django
"""
from django.conf import settings
from django.db import migrations
def update_site_forward(apps, schema_editor):
"""Set site d... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than clas... | 3 | sndg/contrib/sites/migrations/0003_set_site_domain_and_name.py | ezequieljsosa/sndg-web |
def get_codes():
results = []
with open('./emojis.txt') as f: lines = f.read().split('\n')
for l in lines:
temp = l.split(';')[0].strip().split('..')
if len(temp) > 1:
results.append( [int(temp[0], 16), int(temp[1], 16)] )
else:
results.append( [int(temp[0], 1... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (exclu... | 3 | emojis.py | stephwag/emojis |
from drf_yasg import openapi
from drf_yasg.utils import swagger_auto_schema
from rest_framework import mixins
from rest_framework.viewsets import GenericViewSet
from genui.accounts.serializers import FilterToUserMixIn
from genui.projects.serializers import FilterToProjectMixIn
from genui.models.genuimodels.bases impor... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": true
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
... | 3 | src/genui/generators/views.py | Tontolda/genui |
#####
#
# This class is part of the Programming the Internet of Things project.
#
# It is provided as a simple shell to guide the student and assist with
# implementation for the Programming the Internet of Things exercises,
# and designed to be modified by the student as needed.
#
import logging
from time import s... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or few... | 3 | src/main/python/programmingtheiot/cda/emulated/HumidifierEmulatorTask.py | NULishengZhang/piot-python-components |
import pygame
from pygame.sprite import Sprite
class Ship(Sprite):
def __init__(self, ai_settings, screen):
"""Initialize the ship, and set its starting position."""
super(Ship, self).__init__()
self.screen = screen
self.ai_settings = ai_settings
# Load the ship image, and... | [
{
"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 | Game/ship.py | Brunokrk/Learning-Python |
def printBigHeadline(text):
print("")
print("#######################################################################")
print(text)
print("#######################################################################")
print("")
def printSmallHeadline(text):
print("")
print("--------------------... | [
{
"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/daisyHat/Tools.py | recursinging/daisyHat |
# -*- coding: utf-8 -*-
# Copyright 2021 ProjectQ-Framework (www.projectq.ch)
#
# 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
#
# ... | [
{
"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 | projectq/setups/ionq_test.py | kevin-teddy/ProjectQ |
from pathlib import Path
from random import shuffle
from discord import VoiceChannel
from music.abstract_music_player import AbstractMusicPlayer
from music.entry import Entry
class FilePlayer(AbstractMusicPlayer):
"""
Audio player for playing local files.
"""
__slots__ = ('default_path',)
def _... | [
{
"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 | music/file_player.py | MaT1g3R/YasenBaka |
from kivy.properties import NumericProperty
from kivy.uix.image import Image
class Hero(Image):
velocity = NumericProperty(0)
def on_touch_down(self, touch):
self.source = "assets/hero_jump.png"
self.velocity = 150
super(Hero, self).on_touch_down(touch)
def on_touch_up(self, touc... | [
{
"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 | src/hero/hero.py | Ochmar/kivy_floppy_bird |
from torch.nn import Module
class AbstractSearch(Module):
"""
AbstractSearch is search algorithm on original neural model to perform special inference.
"""
def __init__(self):
super().__init__()
self._mode = 'infer'
def build(self, *args, **kwargs):
"""
Build sear... | [
{
"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 | paragen/modules/search/abstract_search.py | godweiyang/ParaGen |
import numpy as np
import pytest
import pandas._testing as tm
from pandas.core.construction import sanitize_array
@pytest.mark.parametrize(
"values, dtype, expected",
[
([1, 2, 3], None, np.array([1, 2, 3], dtype=np.int64)),
(np.array([1, 2, 3]), None, np.array([1, 2, 3])),
... | [
{
"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 | venv/Lib/site-packages/pandas/tests/dtypes/cast/test_construct_ndarray.py | arnoyu-hub/COMP0016miemie |
from azureml.core.authentication import ServicePrincipalAuthentication, AzureCliAuthentication, InteractiveLoginAuthentication, AuthenticationException
import os
from dotenv import set_key, get_key
import logging
import urllib
from zipfile import ZipFile
def get_auth(env_path):
logger = logging.getLogger(__name_... | [
{
"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 | utilities.py | dciborow/HyperdriveDeepLearning |
import torch
import torch.nn as nn
import util
class Model(nn.Module):
def __init__(self, vocab_size, embedding_dim=10):
super(Model, self).__init__()
self.embedding_dim = embedding_dim
self.embeddings = nn.Embedding(vocab_size, embedding_dim)
self.embeddings.weight.data.uniform_(-... | [
{
"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 | model.py | InzamamRahaman/PoincareDiskEmbedding |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @Time : 2019/2/19 11:06
# @User : zhunishengrikuaile
# @File : TrainTicket.py
# @Email : binary@shujian.org
# @MyBlog : WWW.SHUJIAN.ORG
# @NetName : 書劍
# @Software: 百度识图Api封装
# 火车票识别
import os
import base64
import requests
from bin.AccessToken.AccessToken imp... | [
{
"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 | utils/BaiduTextApi/bin/TrainTicket/TrainTicket.py | haodaohong/zimt8 |
"""The RAAML Modeling Language module is the entrypoint for RAAML related
assets."""
import gaphor.SysML.propertypages # noqa
from gaphor.abc import ModelingLanguage
from gaphor.core import gettext
from gaphor.diagram.diagramtoolbox import ToolboxDefinition
from gaphor.RAAML import diagramitems, raaml
from gaphor.RAA... | [
{
"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 | gaphor/RAAML/modelinglanguage.py | mrmonkington/gaphor |
from django import template
from django.utils.safestring import mark_safe
import markdown
from markdownx.utils import markdownify
from markdownx.settings import (
MARKDOWNX_MARKDOWN_EXTENSIONS,
MARKDOWNX_MARKDOWN_EXTENSION_CONFIGS
)
from markdown.extensions import Extension
register = template.Library()
@reg... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than clas... | 3 | blog/templatetags/markdown_html.py | whitecat-22/blog_site |
# Date: 09/28/2017
# Author: Ethical-H4CK3R
# Description: A Simple C&C Server
from core.prompt import Prompt
from core.server import Server
from template.design import Designer
from core.console import MainController
from core.communicate import Communicate
__version__ = 0.1
class Flex(Prompt, Server, Designer, 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": true
}... | 3 | flex.py | johndemlon/c-and-c-server |
class お布団(object):
def __init__(self):
print("眠いよ")
def __enter__(self):
print("入眠")
return self
def __exit__(self, type_, value, traceback):
print(type_, value, traceback)
print("起床")
return True
def 状態確認(self):
print("オフトニアなうZzz")
def main(... | [
{
"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": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excl... | 3 | contextManager/ofutonia.py | terasakisatoshi/pythonCodes |
#!/usr/bin/env python
#
# File Name : bleu.py
#
# Description : Wrapper for BLEU scorer.
#
# Creation Date : 06-01-2015
# Last Modified : Thu 19 Mar 2015 09:13:28 PM PDT
# Authors : Hao Fang <hfang@uw.edu> and Tsung-Yi Lin <tl483@cornell.edu>
from bleu.bleu_scorer import BleuScorer
class Bleu:
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": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answ... | 3 | evaluation/Traditional/eval_metrics/bleu/bleu.py | Guaguago/CommonGen |
#!/usr/bin/env python
"""Tests for `erd` package."""
import unittest
from click.testing import CliRunner
from erd import erd
from erd import cli
class TestErd(unittest.TestCase):
"""Tests for `erd` package."""
def setUp(self):
"""Set up test fixtures, if any."""
def tearDown(self):
"... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},... | 3 | tests/test_erd.py | Datateer/erd-python |
#!/usr/bin/env python
# Detección de polígonos negros
# Puedes probarlo con
# ./polygon0.py --dev=../../images/rot4.mjpg
# ./polygon0.py --dev=dir:../../images/marker.png
# o con la cámara, imprimiendo el marcador ../../images/ref.png
# o poniéndolo en la pantalla del ordenador o del móvil.
# paquetes habituales
f... | [
{
"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 | code/polygon/polygon0.py | ctm1098/umucv |
import functools
import warnings
def deprecated_alias(**aliases):
def deco(f):
@functools.wraps(f)
def wrapper(*args, **kwargs):
rename_kwargs(f.__name__, kwargs, aliases)
return f(*args, **kwargs)
return wrapper
return deco
def rename_kwargs(func_name, kwar... | [
{
"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 | biotransformers/utils/deprecated.py | ahmed-dj/bio-transformers |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union
from .. import _utilities, _tables
__al... | [
{
"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 | sdk/python/pulumi_azure_native/machinelearningexperimentation/outputs.py | pulumi-bot/pulumi-azure-native |
"""
MX Platform API
The MX Platform API is a powerful, fully-featured API designed to make aggregating and enhancing financial data easy and reliable. It can seamlessly connect your app or website to tens of thousands of financial institutions. # noqa: E501
The version of the OpenAPI document: 0.1.0
... | [
{
"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/test_statement_response.py | mxenabled/mx-platform-python |
"""
Module: 'onewire' on esp32 1.10.0
"""
# MCU: (sysname='esp32', nodename='esp32', release='1.10.0', version='v1.10 on 2019-01-25', machine='ESP32 module with ESP32')
# Stubber: 1.2.0
class OneWire:
''
MATCH_ROM = 85
SEARCH_ROM = 240
SKIP_ROM = 204
def _search_rom():
pass
def crc8():... | [
{
"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 | packages/micropython-official/v1.10/esp32/stubs/onewire.py | TheVinhLuong102/micropy-stubs |
def rchop(s, ending):
return s[: -len(ending)] if s.endswith(ending) else s
def lchop(s, beginning):
return s[len(beginning) :] if s.startswith(beginning) else s
def ordinal_en(n: int):
# https://stackoverflow.com/questions/9647202/ordinal-numbers-replacement
return f'{n}{"tsnrhtdd"[(n//10%10!=1)*(n... | [
{
"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 | departure/commons/helpers.py | Woll78/departure-python |
import ceilometerclient.client as clclient
import logging
log = logging.getLogger(__name__)
class Metering:
'''Wrapper for the OpenStack MEtering service (Ceilometer)'''
def __init__(self, conf):
creds = self._get_creds(conf)
self.ceilo = clclient.get_client(2, **creds)
def _get_creds(sel... | [
{
"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": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer... | 3 | archived/pyostack/pyostack/metering.py | DistributedSystemsGroup/sysadmin-dsp |
# Copyright 2017 trivago N.V.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer"... | 3 | tests/test_runner.py | hwmrocker/boerewors |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.apps.registry import Apps
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
@python_2_unicode_compatible
class UnicodeModel(models.Model):
title = models.CharField('ÚÑÍ¢ÓÐÉ', max_length=20, defaul... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{... | 3 | tests/migrations/models.py | PirosB3/django |
'''Autogenerated by xml_generate script, do not edit!'''
from OpenGL import platform as _p, arrays
# Code generation uses this
from OpenGL.raw.EGL import _types as _cs
# End users want this...
from OpenGL.raw.EGL._types import *
from OpenGL.raw.EGL import _errors
from OpenGL.constant import Constant as _C
import ctype... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (exclud... | 3 | env/Lib/site-packages/OpenGL/raw/EGL/EXT/device_query.py | 5gconnectedbike/Navio2 |
from decimal import Decimal
import setoptconf as soc
GOOD_NAMES = ("foo", "foo_bar", "foo123", "foo_bar_baz")
BAD_NAMES = ("_foo", "1foo", "FOO", "foo_", "foo__bar", "foo-bar")
def test_name():
for name in GOOD_NAMES:
yield check_good_name, name
for name in BAD_NAMES:
yield check_bad_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": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer":... | 3 | test/test_settings.py | carlio/setoptconf-tmp |
import numpy as np
class ridge:
""" Ridge estimator.
"""
def __init__(self, lmd=0.1):
self.lmd = lmd
self.hat = None
self.hatn = None
def fit(self, X, y):
if self.hat is None:
G = X.T.dot(X) + self.lmd * np.eye(X.shape[1])
self.hat = np.linal... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?"... | 3 | rootcp/models.py | EugeneNdiaye/rootCP |
from sympy import Rational, Symbol, latex, UnevaluatedExpr
import sympy as sp
import numpy as np
u = lambda x : UnevaluatedExpr(x)
# Helper functions
def explain_add(a, b):
assert(np.shape(a) == np.shape(b))
rows, columns = np.shape(a)
return sp.Matrix([[Symbol(f"({latex(u(a[i,j]))} + {latex(u(b[i,j]))})"... | [
{
"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 | helpers.py | rkeulemans/exercise_public |
### SciPyを使った実装 ###
import numpy as np
from scipy.integrate import solve_ivp
import matplotlib.pyplot as plt
def diff_eq(x, t, a):
"""微分方程式"""
return a * x
def do_example_2():
time_list = np.arange(0.0, 2.0, 0.01) # 時間のリスト
x_init = [1.0] # 初期値
a = 1
# 解く
sol = solve_ivp(
... | [
{
"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 | example_py/example_2.py | YoshimitsuMatsutaIe/ans_2021 |
import pytest
import copy
from pathlib import Path
import sys
sys.path.append(str(Path(__file__).absolute().parent.parent))
from swimmer_abm.model import Model
def test_init():
model = Model(nswimmers=3)
assert len(model.swimmers) == 3
def test_step():
model = Model(nswimmers=1)
swimmer = copy.dee... | [
{
"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_model.py | margrietpalm/covid_swimming_chaos |
import pygame
class Enemy(pygame.sprite.Sprite):
def __init__(self, location, *groups):
super(Enemy, self).__init__(*groups)
self.direction = 1
self.image_left = pygame.image.load('resources/characters/enemy1_izquierda.png')
self.image_right = pygame.image.load('resources/character... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cl... | 3 | src/enemy.py | mshopper/acv |
"""
Create a column to allow TokenOperation reference to UserPending entry.
Revision ID: 35e98bdc8aed
Revises: 00c617174e54
Create Date: 2021-04-27 18:58:34.606126
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = "35e98bdc8aed"
down_revision = "00c617174e54"
bran... | [
{
"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 | magpie/alembic/versions/2021-04-27_35e98bdc8aed_token_operation_ref_pending_user.py | Ouranosinc/Magpie |
# © 2019 Nokia
# Licensed under the BSD 3 Clause license
# SPDX-License-Identifier: BSD-3-Clause
from radish_ext.radish.step_config import StepConfig
from radish_rest.radish.requests_test_data import RequestTestData
from radish_rest.sdk.rest import RestConfig, RestClient, SimpleRestConfig
class RequestsStepsConfig(... | [
{
"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 | pkg_radish_rest/radish_rest/radish/requests_steps_config.py | bbielicki/radish-bdd-extensions |
'''
SDL2 text provider
==================
Based on SDL2 + SDL2_ttf
'''
__all__ = ('LabelSDL2', )
from kivy.compat import PY2
from kivy.core.text import LabelBase
try:
from kivy.core.text._text_sdl2 import (_SurfaceContainer, _get_extents,
_get_fontdescent, _get_fontasce... | [
{
"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 | kivy/core/text/text_sdl2.py | Kolandiolaka/kivy |
from django.contrib import admin
from django.db import models
from django.utils.text import slugify
from django.utils.translation import ugettext_lazy as _
class Tag(models.Model):
TYPE_CHOICES = [
('product', _('Product')),
('plan', _('Plan')),
('meal', _('Meal')),
]
name = model... | [
{
"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 | habitat/food/models/tag.py | matrach/habitatOS |
import abc
def yad(decorators):
def decorator(f):
for d in reversed(decorators):
f = d(f)
return f
return decorator
class Callable(object):
def __init__(self, f):
self.f = f
self.__name__ = f.__name__
def __call__(self, *args, **kwargs):
return s... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?"... | 3 | pykage/command/base_cmd.py | antoineB24/pykage |
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, Integer, String, Date, Float, ForeignKey
Base = declarative_base()
class CVE(Base):
__tablename__ = "cves"
cve_id = Column(String, primary_key=True)
description = Column(String)
base_score_v2 = Column(Float)
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": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": ... | 3 | src/models.py | savyasachi16/CVE-data-model |
# Importing required modules
from requests import get
endpoint = 'https://www.edbl.xyz/api/user/{}'
# Defining the IdNotGiven exception
class IdNotGiven(Exception):
pass
# The user class
class User:
def __init__(self,id:int=None):
self.id = id
def get_info(self):
if self.id == None:
raise IdNo... | [
{
"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/edblpy/users.py | Jakeisbored/edblpy |
# -*- coding: utf-8 -*-
# Copyright 2015-2021 CERN
#
# 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 a... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true... | 3 | lib/rucio/db/sqla/migrate_repo/versions/4cf0a2e127d4_adding_transient_metadata.py | rcarpa/rucio |
# coding=utf-8
import time
import random
from _datetime import datetime
from bs4 import BeautifulSoup as Bs
import re
import global_data as gb
def random_wait():
"""
Randomly wait some time
:return: None
"""
wait_time = random.uniform(0.5, 1.5)
time.sleep(wait_time)
def print_time_and_msg(... | [
{
"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 | OnlineMatch/monitor_result.py | BigtoC/GE2340-AI-Gomoku |
from .tokenhandler import TokenHandler
# 编译器
class Compiler(object):
# 编译
def compile(self, file, targetType):
self.file = file
self.targetType = targetType
self.result = ''
if self.targetType == 'zpy':
return self.pyToZpy(self.file)
elif self.targetType == ... | [
{
"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 | zpylib/compiler/compiler.py | louisyoungx/zpycli |
from chatbot import chatbot
from flask import Flask, render_template, request
import random
import re
import webbrowser
import smtplib
import os
trainer_dict = []
app = Flask(__name__)
app.static_folder = 'static'
@app.route("/")
def home():
return render_template("index.html")
@app.route("/get")
def get_bot_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": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": tru... | 3 | app.py | saurabdongre/Covid-19_Assistant |
#!/usr/bin/env python3
# Copyright (c) 2015-2018 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test node responses to invalid locators.
"""
from test_framework.messages import msg_getheaders, msg_g... | [
{
"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/functional/p2p_invalid_locator.py | diazcoin/diaz |
import torch
from homura.modules import cross_entropy_with_softlabels
from torch.distributions import Categorical
from torch.nn import functional as F
from backends.loss import _kl, _l2_normalize
from backends.utils import SSLTrainerBase, disable_bn_stats, get_task
class VATTrainer(SSLTrainerBase):
def labeled(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": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false... | 3 | vat.py | awesome-archive/ssl-suite |
# --------------------------------------------------------
# This code is modified from Jumpin2's repository.
# https://github.com/Jumpin2/HGA
# --------------------------------------------------------
import torch
import torch.nn as nn
import torch.nn.functional as F
# __all__ = ['MultipleChoiceLoss', 'CountLoss']
... | [
{
"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 | embed_loss.py | ahjeongseo/MASN---Attend-What-You-Need-Motion-Appearance-Synergistic-Networks-for-Video-Question-Answering |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# thumbor imaging service
# https://github.com/globocom/thumbor/wiki
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license
# Copyright (c) 2011 globo.com timehome@corp.globo.com
from os.path import abspath, join, dirname
from pyvows import Vows,... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": ... | 3 | vows/max_bytes_filter_vows.py | kilinger/thumbor |
from tool.runners.python import SubmissionPy
class JonSubmission(SubmissionPy):
def run(self, s):
l = [0]*9
for x in s.strip().split(","):
l[int(x)] += 1
shift = 0
for _ in range(256):
l[shift-2] += l[shift]
shift = (shift+1) % 9
return... | [
{
"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 | day-06/part-2/jon.py | lypnol/adventofcode-2021 |
import numpy as np
from ConfigSpace.configuration_space import ConfigurationSpace
from ConfigSpace.hyperparameters import UniformIntegerHyperparameter
from autosklearn.pipeline.components.base import AutoSklearnPreprocessingAlgorithm
from autosklearn.pipeline.constants import *
class TruncatedSVD(AutoSklearnPreproc... | [
{
"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 | autosklearn/pipeline/components/feature_preprocessing/truncatedSVD.py | jimgoo/auto-sklearn |
import codecs
import os
import sys
from setuptools import find_packages, setup
def read(rel_path):
here = os.path.abspath(os.path.dirname(__file__))
with codecs.open(os.path.join(here, rel_path), 'r') as fp:
return fp.read()
def get_definitions(rel_path, *words):
dwords = {word: None for word 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": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": tru... | 3 | setup.py | guionardo/calendar-maker |
# Copyright (c) Microsoft. All rights reserved.
# Licensed under the MIT license. See LICENSE.md file in the project root
# for full license information.
# ==============================================================================
# TODO: This does not work yet, need to figure out the right pattern.
import numpy... | [
{
"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 | bindings/python/examples/test/SLUHandsOn_test.py | KeDengMS/CNTK |
from conans import ConanFile, CMake
import os
class TestPackageConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
generators = "cmake"
requires = "glfw/3.3.4"
def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()
def test(self):
bin... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"ans... | 3 | test_package/conanfile.py | Croydon/conan-soil2 |
# for n in range(400,500):
# i = n // 100
# j = n // 10 % 10
# k = n % 10
# if n == i ** 3 + j ** 3 + k ** 3:
# print(n)
# 第一道题(16)
# input("请输入(第一次):")
# s1 = input("请输入(第二次):")
# l1 = s1.split(' ')
# l2 = []
# for i in l1:
# if i.isdigit():
# l2.append(int(i))
# for i in l2:
# ... | [
{
"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 | old/.history/a_20201125194051.py | pscly/bisai1 |
# -*- coding: utf-8 -*-
__author__ = 'Arseniy'
from model.contact import Contact
from model.group import Group
import random
def test_add_some_contact_to_some_group(app, orm):
if len(orm.get_group_list()) == 0:
app.group.create(Group(name="new group"))
if len(orm.get_contact_list()) == 0:
app.... | [
{
"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 | test/test_contacts_and_groups.py | arseny-tsyro/python_training |
# uncompyle6 version 2.9.10
# Python bytecode 2.7 (62211)
# Decompiled from: Python 3.6.0b2 (default, Oct 11 2016, 05:27:10)
# [GCC 6.2.0 20161005]
# Embedded file name: type_Result.py
from types import *
class Result:
def __init__(self):
self.__dict__['action'] = 0
self.__dict__['variable'] = ''... | [
{
"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 | Leak #5 - Lost In Translation/windows/Resources/Dsz/PyScripts/Lib/dsz/mca/process/cmd/environment/type_Result.py | bidhata/EquationGroupLeaks |
import os
import pdb
import sys
import tempfile
sys.path.append("/opt/tosca")
from translator.toscalib.tosca_template import ToscaTemplate
from core.models import Instance,User,Network,NetworkTemplate,Port
from xosresource import XOSResource
class XOSPort(XOSResource):
provides = ["tosca.nodes.network.Port"]
... | [
{
"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 | xos/tosca/resources/port.py | xmaruto/mcord |
import unittest
from fizzbuzz import checkio
class TestFizzBuzz(unittest.TestCase):
def test_fizz(self):
for i in [3, 6, 9, 18]:
print('testing', i)
assert checkio(i) == 'Fizz'
def test_buzz(self):
for i in [5, 10, 50]:
print('testing', i)
assert checkio(i) == 'Buzz'
def test_fizzbuzz(self):
for ... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"ans... | 3 | test_fizzbuzz.py | simplymanas/python-learning |
# testing Fiona's RFC 3339 support, to be called by nosetests
import logging
import re
import sys
import unittest
from fiona.rfc3339 import parse_date, parse_datetime, parse_time
from fiona.rfc3339 import group_accessor, pattern_date
logging.basicConfig(stream=sys.stderr, level=logging.DEBUG)
class DateParseTest(un... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answe... | 3 | tests/test_rfc3339.py | johanvdw/Fiona |
# -*- coding: utf-8 -*-
from flask import Flask
app = Flask(__name__)
@app.route("/") # decorador
def index():
return "Esto es una página Index"
@app.route("/info")
def info():
return "Info page"
# Guard
if __name__ == '__main__':
app.run(debug=True)
| [
{
"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 | flask_basics/app.py | MikelDietz/pythonweb |
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Cblas(Package):
"""The BLAS (Basic Linear Algebra Subprograms) are routines that
pr... | [
{
"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 | var/spack/repos/builtin/packages/cblas/package.py | kkauder/spack |
from django.db import models
# Create your models here.
class Category(models.Model):
name = models.CharField(max_length=30, unique=True)
def __str__(self):
return f'{self.name}'
class Post(models.Model):
title = models.CharField(max_length=100, unique=True)
body = models.TextField()
cr... | [
{
"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 | apps/rest_api/models.py | Marta99/rp-personal-website-pralab1 |
# -*- coding: utf-8 -*-
from collections import Counter
class Solution:
def domainToLevels(self, domain):
parts = domain.split('.')
if len(parts) == 3:
return ['.'.join(parts[-3:]), '.'.join(parts[-2:]), parts[-1]]
elif len(parts) == 2:
return ['.'.join(parts[-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 | leetcode/0811_subdomain_visit_count.py | jacquerie/leetcode |
from habu.lib import dnsx
def test_mx():
assert 'aspmx.l.google.com.' in dnsx.mx('google.com')
def test_ns():
assert 'ns1.google.com.' in dnsx.ns('google.com')
def test_axfr_fail():
assert not dnsx.axfr('google.com')
def test_axfr_success():
assert dnsx.axfr('zonetransfer.me')
| [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"ans... | 3 | tests/test_dnsx.py | riccigrj/habu |
# -*- coding: utf-8 -*-
#
# This software may be modified and distributed under the terms
# of the MIT license. See the LICENSE file for details.
########################################################################
class KibanaSavedSearch:
# ------------------------------------------------------------------... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self... | 3 | lstail/dto/kibana_saved_search.py | eht16/lstail |
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | [
{
"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": true
},
{
... | 3 | python/tink/prf/_prf_set_wrapper.py | saavan251/tink |
"""Notification."""
from models.metric_notification_data import MetricNotificationData
class Notification:
"""Handle notification contents and status."""
def __init__(self, report, metrics, destination_uuid, destination):
"""Initialise the Notification with the required info."""
self.report_... | [
{
"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 | components/notifier/src/models/notification.py | m-zakeri/quality-time |
import math
import random
import pylab
def Distance(p1, p2):
return math.hypot(p1[0] - p2[0], p1[1] - p2[1])
nLoc = 150
N = range(nLoc)
Square = 1000
random.seed(nLoc)
Pos = [(random.randint(0, Square), random.randint(0, Square)) for i in N]
D = [[Distance(Pos[i], Pos[j]) for j in N] for i in N]
def Cost(Path... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (exclud... | 3 | MetaHeuristics/TSA.py | roycek7/operation_research |
# coding: utf-8
"""
Cisco Intersight
Cisco Intersight is a management platform delivered as a service with embedded analytics for your Cisco and 3rd party IT infrastructure. This platform offers an intelligent level of management that enables IT organizations to analyze, simplify, and automate their environmen... | [
{
"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_vmedia_policy_list.py | sdnit-se/intersight-python |
"""
模块库
"""
import inspect
def get_curent_module_classes(module):
"""
获取制定模块的所有类
:param module: 模块
:return: 类的列表
"""
classes = []
for name, obj in inspect.getmembers(module):
if inspect.isclass(obj):
classes.append(obj)
return classes
# print(inspect.getmembers... | [
{
"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 | PYSTUDY/modulelib.py | shi-cong/review |
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the Li... | [
{
"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_return_types_annotated",
"question": "Does every function in this file have a return ... | 3 | warehouse/accounts/forms.py | Denon/warehouse |
from __future__ import absolute_import
from collections import defaultdict
import numpy as np
import torch
from torch.utils.data.sampler import Sampler
class RandomIdentitySampler(Sampler):
"""
Randomly sample N identities, then for each identity,
randomly sample K instances, therefore batch size is N*K.... | [
{
"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 | samplers.py | linkserendipity/deep-person-reid |
# coding: utf-8
# Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License.
# This product includes software developed at Datadog (https://www.datadoghq.com/).
# Copyright 2019-Present Datadog, Inc.
from __future__ import absolute_import
import sys
import unittest
im... | [
{
"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/v1/test_event_alert_type.py | MichaelTROEHLER/datadog-api-client-python |
import unittest
from code.google_search import get_people_also_ask_links
class TestGoogleSearch(unittest.TestCase):
def setUp(self) -> None:
pass
def test_get_people_also_ask_links(self):
"""Test the get_people_also_ask_links method"""
test = "principal components"
result = get... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
... | 3 | test/test_google_search.py | mtkumar123/CSC510_Project_LectureAid |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.