source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
import heapq
class PriorityQueue:
"""
Defines a pq.
"""
class Node:
"""
A node for the priority queue.
"""
def __init__(self, priority, obj):
self.priority = priority
self.obj = obj
def __lt__(self, other):
return self.prio... | [
{
"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 | chess/utils.py | thkim1011/chess-ai |
from numpy import array
from retry import retry
from litai import ArticleScorer
def test_scoring():
@retry(tries=10)
def score_fun():
scorer = ArticleScorer(database='data/example.db')
scorer.score(
scores_table='mouse',
pos_keywords='mouse',
neg_keywords='... | [
{
"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/score_test.py | lakes-legendaries/litai |
#! /usr/bin/env python
# Copyright (c) 2021 Uber Technologies, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by a... | [
{
"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 | ludwig/datasets/walmart_recruiting/__init__.py | dantreiman/ludwig |
from django.test import TestCase
from django.utils import timezone
from data_refinery_common.models import (
SurveyJob,
DownloaderJob,
ProcessorJob,
)
class SanityTestJobsTestCase(TestCase):
def test_jobs_sanity(self):
"""Just makes sure creating Jobs doesn't fail"""
s_job = SurveyJob... | [
{
"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 | common/data_refinery_common/models/test_jobs.py | cgreene/refinebio |
# Create a function called get_format_name with first and last name
def get_formatted_name(first_name, last_name):
# Describe the function
"""Return a full name, neatly formatted."""
# The names are joined into full name
formatted_name = first_name + ' ' + last_name
# return the value, don't do anyt... | [
{
"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 | ch08/08_05-formatted_name.py | remotephone/pythoncrashcourse |
## ********Day 55 Start**********
## Advanced Python Decorator Functions
class User:
def __init__(self, name):
self.name = name
self.is_logged_in = False
def is_authenticated_decorator(function):
def wrapper(*args, **kwargs):
if args[0].is_logged_in == True:
function(args[... | [
{
"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 | Day_55/sandbox.py | ecanro/100DaysOfCode_Python |
import pytest
from esu.base import NotFoundEx
from esu.client import Client
from esu.project import Project
from esu.tests import load_fixtures
@load_fixtures
def test_not_found_by_id(rsps):
client_id = '10000000-1000-1000-1000-100000000000'
with pytest.raises(NotFoundEx):
Client.get_object(client_id... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fe... | 3 | esu/tests/test_client.py | pilat/rustack-esu |
from __future__ import division, absolute_import, print_function
import numpy as np
import numpy.ma as ma
from numpy.testing import *
from numpy.compat import sixu
rlevel = 1
class TestRegression(TestCase):
def test_masked_array_create(self,level=rlevel):
"""Ticket #17"""
x = np.ma.masked_array([... | [
{
"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 | numpy/ma/tests/test_regression.py | WeatherGod/numpy |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import math
def get_factorials(n):
f = lambda x: x * f(x - 1) if x else 1
return [f(i) for i in range(n)]
def sum_factorial_digits(limit):
factorial = get_factorials(10)
total = 0
digit_sum = 0
order = int(math.log10(limit))
for n in range(3, int(limit)):
digi... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"ans... | 3 | 34.py | goldsborough/euler |
import os
from conans import ConanFile, CMake, tools
class XsimdTestConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
generators = "cmake"
def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()
def test(self):
self.run(os.path.join("bi... | [
{
"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 | recipes/xsimd/all/test_package/conanfile.py | hoxnox/conan-center-index |
from abc import ABCMeta, abstractmethod
class PathFinder(object):
__metaclass__ = ABCMeta
def __init__(self, G, P):
self.G = G
self.P = P
@abstractmethod
def heuristic(self, v, src, dest):
pass
@abstractmethod
def calc(self, src, dest):
pass
| [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than cla... | 3 | path_finders/path_finder.py | dulek/alt-tester |
# Write a function called unique_english_letters that takes the string word as a parameter. The function should return the total number of unique letters in the string.
# Uppercase and lowercase letters should be counted as different letters.
# We’ve given you a list of every uppercase and lower case letter in the Eng... | [
{
"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 | exercises/play_ground/pg_041.py | EngineerToBe/python-labs |
from rest_framework import serializers
from rest_framework_gis import serializers as gis_serializers
from .models import Tree
class TreeSerializer(gis_serializers.GeoFeatureModelSerializer):
location = gis_serializers.GeometrySerializerMethodField()
class Meta:
model = Tree
fields = ('id', ... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
}... | 3 | trees_api/serializers.py | scrambldchannel/trees-api-v2 |
def main():
a, b, c = list(map(int, input().split()))
print(solve(a, b, c))
def solve(a, b, c):
if a + b == c:
return "{0}+{1}={2}".format(a, b, c)
elif a - b == c:
return "{0}-{1}={2}".format(a, b, c)
elif a / b == c:
return "{0}/{1}={2}".format(a, b, c)
elif a * b == c:
return "{0}*{1}={2... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fe... | 3 | kattis/tri.py | terror/Solutions |
from __future__ import unicode_literals
from django.conf import settings
from django.db.models.signals import post_save
from django.dispatch import receiver
from django_auth_ldap.backend import populate_user
from .models import UserProfile
try:
USER_ATTR_IMAGE_URL = settings.AUTH_LDAP_USER_ATTR_IMAGE_URL
except At... | [
{
"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": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (... | 3 | profiles/signals.py | nivbend/memoir |
# Copyright (c) 2003-2005 Maxim Sobolev. All rights reserved.
# Copyright (c) 2006-2007 Sippy Software, Inc. All rights reserved.
#
# This file is part of SIPPY, a free RFC3261 SIP stack and B2BUA.
#
# SIPPY is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License a... | [
{
"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 | pulsar/core/sippy/UaStateDisconnected.py | N0nent1ty/pulsar |
from flask_wtf import FlaskForm
from wtforms import StringField, PasswordField, SubmitField
from wtforms.validators import DataRequired, Length, ValidationError
from app.models.user import User
class SignupForm(FlaskForm):
username = StringField('Username', validators=[DataRequired(), Length(min=4, max=32)])
... | [
{
"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 | app/forms/auth.py | poiley/take-note |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import logging
from typing import List, Optional
import torch.nn as nn
import torch.nn.functional as F
logger = logging.getLogger(__name__)... | [
{
"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 | fairseq/modules/fairseq_dropout.py | zhengzx-nlp/REDER |
# Markov chain comparison class
# create multiple Markov_learning classes, and conduct comparison
import numpy as np
import Markov_learning as ml
import copy
class Markov_comp(object):
# attributes
# it may have multiple Markov_learning objects
# maximum, 10
ML=[]
# how many MLs? for comparison be... | [
{
"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 | Markov_comp.py | xxelloss/Markov-Learning |
import sys
sys.setrecursionlimit(10**6)
def fibonacci(term_num):
if(term_num == 1 or term_num == 2):
return 1
else:
return (fibonacci(term_num-1)+fibonacci(term_num-2))
def check_first_fib_term_over(limit):
third_last_term = 1
second_last_term = 1
last_term = 2
term_index = ... | [
{
"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 | project_euler/Problem25/p25.py | bernardosequeir/CTFfiles |
import io
from dagster_aws.s3 import S3FakeSession, S3FileCache, S3FileHandle
def test_s3_file_cache_file_not_present():
session_fake = S3FakeSession()
file_store = S3FileCache(
s3_bucket='some-bucket', s3_key='some-key', s3_session=session_fake, overwrite=False
)
assert not file_store.has_f... | [
{
"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_modules/libraries/dagster-aws/dagster_aws_tests/s3_tests/test_s3_file_cache.py | flowersw/dagster |
from flask import render_template,redirect,url_for, flash,request
from flask_login import login_user,logout_user,login_required
from . import auth
from ..models import User
from .forms import LoginForm,RegistrationForm
from .. import db
from ..email import mail_message
@auth.route('/login',methods=['GET','POST'])
def ... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answ... | 3 | app/auth/views.py | Kihara-tony/one-minute-pitch |
import graphene
from graphene import Node
from graphene_django.filter import DjangoFilterConnectionField
from graphene_django.rest_framework.mutation import SerializerMutation
from graphene_django.types import DjangoObjectType
from rest_framework.generics import get_object_or_404
from contact.models import Contact
fro... | [
{
"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": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (... | 3 | src/contact/schema.py | mesherinovivan/graphql-django |
import gc
import pprint
class Graph:
def __init__(self, name):
self.name = name
self.next = None
def set_next(self, next):
print('Linking nodes {}.next = {}'.format(self, next))
self.next = next
def __repr__(self):
return '{}({})'.format(
self.__class... | [
{
"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/lesson_runtime_features/gc_collect.py | jasonwee/asus-rt-n14uhp-mrtg |
import os
import unittest
import ansiblelint
from ansiblelint import RulesCollection
class TestTaskIncludes(unittest.TestCase):
def setUp(self):
rulesdir = os.path.join('lib', 'ansiblelint', 'rules')
self.rules = RulesCollection.create_from_directory(rulesdir)
def test_included_tasks(self):
... | [
{
"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 | test/TestTaskIncludes.py | eemz/ansible-lint |
from openeo_udf.api.datacube import DataCube
from openeo_udf.api.udf_data import UdfData
from typing import Dict, Callable
import xarray
import numpy
import pandas
from pandas import Series
def apply_timeseries(series: Series, context:Dict)->Series:
"""
Do something with the timeseries
:param series:
... | [
{
"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 | src/openeo_udf/api/udf_wrapper.py | Open-EO/openeo-udf |
# coding:utf-8
# TODO: We should pass a read-only view of the cgroup instead to ensure
# thread-safety.
class RestartRequestedMessage(object):
def __init__(self, cg):
self.cg = cg
class RestartCompleteMessage(object):
def __init__(self, cg):
self.cg = cg
| [
{
"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": false
... | 3 | captain_comeback/restart/messages.py | zharben/captain-comeback |
# -*- coding: ISO-8859-1 -*-
#############################################
## (C)opyright by Dirk Holtwick, 2002-2007 ##
## All rights reserved ##
#############################################
__reversion__ = "$Revision: 20 $"
__author__ = "$Author: holtwick $"
__date__ = "$Date: 2007-10-09... | [
{
"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 | sx/pisa3/pisa_pdf.py | gustavohenrique/wms |
from __future__ import absolute_import
from collections import OrderedDict
from uuid import uuid4
from django.utils.translation import ugettext_lazy as _
from vishap import render_video
from nonefield.fields import NoneField
from fobi.base import FormElementPlugin
from . import UID
from .forms import ContentVideo... | [
{
"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 | events/contrib/plugins/form_elements/content/content_video/base.py | mansonul/events |
lista = enumerate('zero um dois três quatro cinco seis sete oito nove'.split())
numero_string=dict(lista)
string_numero={valor:chave for chave,valor in numero_string.items()}
print (numero_string)
print(string_numero)
def para_numeral(n):
numeros=[]
for digito in str(n):
numeros.append(numero_... | [
{
"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 | Tarefa03/Tarefa03.py | igorlimasan/poo-python |
class Article:
'''
Class that instantiates objects of the news article objects of the news sources
'''
def __init__(self,author,description,time,url,image,title):
self.author = author
self.description = description
self.time = time
self.url = url
self.image = imag... | [
{
"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 | app/models.py | Kabu1/flashnews |
def setup():
size (600,600)
noLoop()
def drawMyScene(myColor,x):
rotate(PI/4*x)
fill(myColor)
rect(0,50,150,50)
rect(50,0,50,150)
def draw():
background(20)
smooth()
noStroke()
pushMatrix()
translate(100,0)
drawMyScene(180,1)
popMatrix()
pus... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": fal... | 3 | processing/chapter4/sketch_4_2_Z3/sketch_4_2_Z3.pyde | brickdonut/2019-fall-polytech-cs |
import sys
from sys import stdin, stdout
import time
import gtk
import __builtin__, gettext, gtk.glade
gettext.install("pychess", unicode=1)
t = gettext.translation("pychess", fallback=True)
__builtin__.__dict__["ngettext"] = t.ungettext #evilness copy-paste from pychess startup script
import pychess.Main
from pyche... | [
{
"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 | src/Application/PythonScriptModule/pymodules_old/apitest/chessview/pychessview.py | antont/tundra |
class solution:
def oneEditAwayInsert(self,input1,input2):
index1 = 0
index2 = 0
while((index2 < len(input2)) and (index1 < len(input1))):
if(input1[index1] != input2[index2]):
if(index1 != index2):
return False
index2+=1
... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer"... | 3 | String-Algorithms/String-Algorithms-master/One Edit Away/oneEditAway.py | SrijaniSom/dsa-code-store |
from logging import basicConfig, getLogger, DEBUG
logger = getLogger(__name__)
OBJECT = 'DFW section'
MODULE = 'Services'
def get_list(client):
"""
"""
request = client.__getattr__(MODULE).ListSections()
response, _ = request.result()
return response['results']
def get_id(client, data):
if... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than ... | 3 | pynsxt/nsx_dfw_section.py | yktsubo/pynsxt |
from dataclasses import dataclass
from mint.consensus.constants import ConsensusConstants
from mint.types.blockchain_format.sized_bytes import bytes100
from mint.util.streamable import Streamable, streamable
@dataclass(frozen=True)
@streamable
class ClassgroupElement(Streamable):
"""
Represents a classgroup ... | [
{
"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 | mint/types/blockchain_format/classgroup.py | sai-genesis/rc1-test |
from torch.nn.functional import one_hot
from operations.base import Operator
class OneHot(Operator):
def __init__(self, dim=-1, non_zero_values_only=False):
self.dim = dim
self.non_zero_values_only = non_zero_values_only
super().__init__()
def forward(self, indices, depth, values):
... | [
{
"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 | private/TrainingHelperServices/operations/onehot.py | microsoft/MaskedLARk |
import zlib
from io import BytesIO
import pytest
from df_raw_decoder import (
decode_data, DecodingException, encode_to_int32, encode_to_int16, encode_data,
encode_decode_index_file_line
)
def test_invalid_file():
file = BytesIO()
file.write(100 .to_bytes(4, 'little'))
file.write(b'\0')
file... | [
{
"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 | test_df_raw_decoder.py | dfint/df_raw_decoder |
'''
app.forms
~~~~~~~~~
Forms we need to use when posting datas in our website.
flask_wtf.Form is still useable, but FlaskForm is suggested.
'''
from flask_wtf import FlaskForm
from wtforms import StringField, BooleanField, TextAreaField
from wtforms.validators import DataRequired, Length
from flask_babel import get... | [
{
"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 | app/forms.py | Napchat/microblog |
from unittest import TestCase
from littlelambocoin.types.blockchain_format.program import Program, SerializedProgram, INFINITE_COST
from littlelambocoin.wallet.puzzles.load_clvm import load_clvm
SHA256TREE_MOD = load_clvm("sha256tree_module.clvm")
# TODO: test multiple args
class TestSerializedProgram(TestCase):
... | [
{
"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 | tests/clvm/test_serialized_program.py | Tony4467/littlelambocoin-blockchain |
import numpy as np
def load_csv_test_data(filename):
with open(filename, 'r') as input_file:
return [[item for item in line.strip().split(',')]
for line in input_file]
def load_csv_data(filename:str) -> np.ndarray:
if not filename.endswith('.csv'):
filename += '.csv'
with... | [
{
"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 | src/utils/file.py | dballesteros7/master-thesis-2015 |
from flask import Flask
from flask import request
from flask import make_response
import base64
import pickle
app = Flask(__name__)
@app.route('/')
def index():
cookie = {'type': 'pickles', 'user_name': 'user'}
encoded_cookie = base64.b64encode(pickle.dumps(cookie))
green_pickle = request.cookies.get('gr... | [
{
"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 | web_challenges/pickle/ctf_pickle.py | code4days/BsidesCincyCTF |
import torch
import torchvision.transforms as transforms
import model
from PIL import Image
import sys
DIR="data/models/"
MODEL="model-100-epochs-adam-0003-lr-cpu.pth"
def get_model(PATH, model):
device = torch.device('cpu')
model.load_state_dict(torch.load(PATH, map_location=device))
model.eval()
re... | [
{
"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 | app.py | arunbonagiri190/Cat-Dog-Classifier |
import pytest
from temporal import DEFAULT_VERSION
from temporal.workflow import workflow_method, WorkflowClient, Workflow
TASK_QUEUE = "test_workflow_get_version_single_tq"
NAMESPACE = "default"
version_found_in_step_1_0 = None
version_found_in_step_1_1 = None
version_found_in_step_2_0 = None
version_found_in_step_... | [
{
"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 | tests/test_workflow_get_version_single.py | Optimally-com/temporal-python-sdk |
# Tencent is pleased to support the open source community by making ncnn available.
#
# Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
#
# Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
# in compliance with the License. You may obtain a copy of the... | [
{
"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 | tools/pnnx/tests/ncnn/test_F_softmax.py | fzyzcjy/ncnn |
import numpy as np
from lmfit import Parameters, minimize, report_fit
from lmfit.models import LinearModel, GaussianModel
from lmfit.lineshapes import gaussian
def per_iteration(pars, iter, resid, *args, **kws):
"""iteration callback, will abort at iteration 23
"""
# print( iter, ', '.join(["%s=%.4f" % (p.... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding se... | 3 | tests/test_itercb.py | FaustinCarter/lmfit-py |
from machine import Pin, PWM
import pycom
import time
class Rotate:
# Servo to fixed position
def __init__(self, pwm):
# Assum 50ms timer already set up and going to reuse
self.pwm = pwm
self.is_active = False
self.at_position = 50
def run(self):
pass
def state... | [
{
"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 | controller/test5_hw_test/rotate_axis.py | drummonds/od-robot |
"""
Week 6 - Paddle Class
---------
AUTHOR: Edward Camp
"""
from cs1lib import *
class Paddle:
def __init__(self, x, y, width, height, r, g, b, paddleName, game):
self.game = game
self.x = x
self.y = y
self.width = width
self.height = height
self.r ... | [
{
"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 | Week6/Paddle.py | johnlev/coderdojo-curriculum |
"""
db.py
"""
from pymongo import MongoClient
class Db: # pylint: disable=too-few-public-methods
"""
Database.
Singleton pattern, from Bruce Eckel
"""
class __Db: # pylint: disable=invalid-name
def __init__(self, dbname):
self.val = dbname
self.client = MongoClien... | [
{
"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 | leadreader/db.py | raindrift/leadreader |
import os
import sys
sys.path.append(os.path.dirname(os.path.abspath(os.path.dirname(__file__))))
import torch.nn as nn
import torch.nn.functional as F
#from layers.graph_convolution_layer import GraphConvolutionLayer
from layers.graph_unet_layer import GraphUNetLayer
from readouts.basic_readout import readout_functi... | [
{
"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 | models/GraphUNet.py | qbxlvnf11/graph-neural-networks-for-graph-classification |
"""rising Sphinx theme.
"""
from os import path
__version__ = '0.0.25'
__version_full__ = __version__
def get_html_theme_path():
"""Return list of HTML theme paths."""
cur_dir = path.abspath(path.dirname(path.dirname(__file__)))
return cur_dir
# See http://www.sphinx-doc.org/en/stable/theming.html#dist... | [
{
"point_num": 1,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answe... | 3 | rising_sphinx_theme/__init__.py | PhoenixDL/rising_sphinx_theme |
from django.db import models
from accounts.models import Profile
from django.contrib.auth.models import User
class Shop(models.Model):
name = models.CharField(max_length=100)
desc = models.TextField()
address = models.CharField(max_length=100)
admin = models.ForeignKey(
Profile,
... | [
{
"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 | ShopkeeperUI/models.py | imsubhams/ProdCheck |
class Node:
def __init__(self, key, value):
self.key, self.value = key, value
self.prev = None
self.next = None
class LRUCache:
def __init__(self, capacity: int):
self.capacity = capacity
self.cache = {}
self.left = Node(0, 0)
self.right = Node(0, 0)
... | [
{
"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 | lru_cache.py | tejeshreddy/python-oops |
from test.vim_test_case import VimTestCase as _VimTest
from test.constant import *
# Anonymous Expansion {{{#
class _AnonBase(_VimTest):
args = ''
def _extra_vim_config(self, vim_config):
vim_config.append('inoremap <silent> %s <C-R>=UltiSnips#Anon(%s)<cr>'
% (EA, self.arg... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{... | 3 | ultisnips/test/test_AnonymousExpansion.py | adrewasa/asavim |
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
"""JSON reporter."""
import json
from typing import TYPE_CHECKING, Optional
from pylint.interface... | [
{
"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 | venv/Lib/site-packages/pylint/reporters/json_reporter.py | AnxhelaMehmetaj/is219_flask |
import abc
import typing
class BaseInputFeed(abc.ABC):
"""
"""
def __init__(self, model, batch_size):
self.model = model
self.batch_size = batch_size
@abc.abstractmethod
def get_train_batch(self):
"""Defien a batch feed dictionary the model needs for training, each sub cl... | [
{
"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 | esrt/engine/base_input_feed.py | PTYin/ESRT |
from django.core.exceptions import PermissionDenied
from rules.rulesets import RuleSet
from .rules import has_site_access
site_permissions = RuleSet()
site_permissions.add_rule("site_perm", has_site_access)
class SitePermissionBackend(object):
"""Authentication backend that checks row-level permissions grante... | [
{
"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 | djangocms_fil_permissions/permissions.py | FidelityInternational/djangocms-fil-permissions |
import datetime
from flask import Blueprint, request, abort
from app.auth.helper import token_required
from app.programs.helper import response, response_for_program, get_programs_json_list, response_for_programs_list, get_programs, get_single_program
from app.models.user import User
from app.models.program import Prog... | [
{
"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/programs/views.py | rukaury/vsrpapi |
# coding: utf-8
"""
LogicMonitor REST API
LogicMonitor is a SaaS-based performance monitoring platform that provides full visibility into complex, hybrid infrastructures, offering granular performance monitoring and actionable data and insights. logicmonitor_sdk enables you to manage your LogicMonitor account... | [
{
"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_auto_discovery_filter.py | JeremyTangCD/lm-sdk-python |
import os
def mkdirs(paths):
if isinstance(paths, list) and not isinstance(paths, str):
for path in paths:
mkdir(path)
else:
mkdir(paths)
def mkdir(path):
if not os.path.exists(path):
os.makedirs(path)
| [
{
"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 | utils/util.py | SimonTreu/sdvae |
from credoscript import adaptors, models
from tests import CredoAdaptorTestCase
class InterfaceAdaptorTestCase(CredoAdaptorTestCase):
def setUp(self):
self.adaptor = adaptors.InterfaceAdaptor()
self.expected_entity = models.Interface
def test_fetch_by_interface_id(self):
"""Fetch a sin... | [
{
"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 | tests/adaptors/interfaceadaptortestcase.py | tlb-lab/credoscript |
# -*- coding: utf-8 -*-
# Copyright 2018-2022 the orix developers
#
# This file is part of orix.
#
# orix is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) ... | [
{
"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 | orix/plot/orientation_color_keys/ipf_color_key.py | bm424/texpy |
import pytest
from app.models.user import User
from datetime import date
@pytest.fixture(scope='module')
def new_user():
user = User('test', date(day=1, month=12, year=1989))
return user
def test_new_user(new_user):
"""
GIVEN a User model
WHEN a new User is created
THEN check the username a... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": fals... | 3 | tests/unit/test_app.py | atsikham/flask-test-app |
from typing import Tuple
import numpy as np
from ...core import ContinuousParameter, InformationSourceParameter, ParameterSpace
from ...core.loop.user_function import MultiSourceFunctionWrapper
def multi_fidelity_currin_function() -> Tuple[MultiSourceFunctionWrapper, ParameterSpace]:
r"""
High fidelity fun... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
... | 3 | emukit/test_functions/multi_fidelity/currin.py | lfabris-mhpc/emukit |
# -*- coding: utf-8 -*-
# Copyright 2019 Bruno Toshio Sugano <brunotoshio@gmail.com>
import os
import pytest
from monogatari.dict_handler import DictHandler
@pytest.fixture
def handler():
test_dir = os.path.dirname(__file__)
return DictHandler(f'{test_dir}/testdic.dic')
def test_parse_categories(handler):... | [
{
"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 | tests/dict_handler_test.py | brunotoshio/monogatari |
# coding: utf-8
"""
Seldon Deploy API
API to interact and manage the lifecycle of your machine learning models deployed through Seldon Deploy. # noqa: E501
OpenAPI spec version: v1alpha1
Contact: hello@seldon.io
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future... | [
{
"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/test/test_downward_api_volume_source.py | adriangonz/seldon-deploy-sdk |
from actions.action import AbstractAction, CombinedAction, WrappedAction, SequenceAction
def COMBINE(*actions: list[AbstractAction]):
return CombinedAction(actions)
def WRAP(outer_action: AbstractAction, inner_action: AbstractAction):
return WrappedAction(outer_action, inner_action)
def SEQUENCE(*actions: l... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"ans... | 3 | keypad/driver/actions/utils.py | lnixdo2s/saiga |
import pandas as pd
import numpy as np
import csv
import pickle
Jobs_path = "TestDescriptions.csv"
Jobs = pd.read_csv(Jobs_path, delimiter=',')
def get_JobID():
IDs = np.array(Jobs.index.values.tolist())
IDs = np.unique(IDs)
IDs = IDs.tolist()
return(IDs)
def get_Info(ID):
return J... | [
{
"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 | khc_home_edited/method.py | eitrheim/Resume-Screening-and-Selection |
class BinTree:
def __init__(self):
'''Container for structuring and handling all nodes used in an option-like asset.
Creates a generic binomial option tree whose by planting an option.
Ha, what?
'''
class Binodes:
def __init__(self, u_node, d_node):
... | [
{
"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": false
... | 3 | atop/options/tree.py | MouseAndKeyboard/All_Things_Options_Notebooks |
import sys
from pymunk import Body, Circle, ShapeFilter
from configsingleton import ConfigSingleton
from common import *
from common.drawing import draw_circle
class Landmark(object):
def __init__(self, mask, radius):
self.body = Body(0, 0, Body.STATIC)
self.body.position = 0, 0
self.body.a... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": fals... | 3 | landmark.py | gavincangan/alvin |
from FSMSIM.expr.arr_expr import ArrayExpr
from FSMSIM.expr.expr import Expr
class ArrayAccessExpr(Expr):
def __init__(self, arr: "ArrayExpr", field: str) -> None:
self.arr = arr
self.field = field
def evaluate(self) -> str:
return self.arr.evaluate(self.field)
def __len__... | [
{
"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": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer... | 3 | FSMSIM/expr/arr_access_expr.py | FSMSIM/FSMSIM |
import torch
import torch.nn as nn
import math
from torch.autograd import Variable
class Embedder(nn.Module):
def __init__(self, vocab_size, d_model):
super().__init__()
self.d_model = d_model
self.embed = nn.Embedding(vocab_size, d_model)
def forward(self, x):
return self.emb... | [
{
"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 | Embed.py | zhengxiawu/Transformer |
import pypro.core
import os
class CreateConfig(pypro.core.Recipe):
def __init__(self, source, destination):
self.source = source
self.destination = destination
def run(self, runner, arguments=None):
# Read the template file
content = ''
with open(self.source, 'r') as ... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than cla... | 3 | examples/vagrant_todo/provision/recipes/project.py | avladev/pypro |
import datetime
from app import db
class BucketList(db.Model):
id = db.Column(db.Integer, primary_key=True, autoincrement=True)
name = db.Column(db.String(100), unique=True)
description = db.Column(db.Text, nullable=True)
interests = db.Column(db.String(120), nullable=True)
date_created = db.Colum... | [
{
"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": false
... | 3 | app/api/v1/models/bucketlist.py | johnseremba/bucket-list |
# Given a linked list, rotate the list to the right by k places, where k is non-negative.
# Example 1:
# Input: 1->2->3->4->5->NULL, k = 2
# Output: 4->5->1->2->3->NULL
# Explanation:
# rotate 1 steps to the right: 5->1->2->3->4->NULL
# rotate 2 steps to the right: 4->5->1->2->3->NULL
# Example 2:
# Input: 0->1->2->... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/c... | 3 | leetcode/medium/Linked Lists/RotateList.py | cheshtaaagarrwal/DS-Algos |
# Copyright 2014 Confluent Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | [
{
"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 | ducktape/cluster/localhost.py | stan-confluent/ducktape |
import pandas as pd
import itertools
from functools import partial
from fastai.callbacks import CSVLogger
def get_config_df(config):
df = pd.DataFrame(list(itertools.product(*config.values())), columns=config.keys())
df.index = [f'model_{i+1}' for i in range(len(df))]
return df
def create_experiment(nm, ... | [
{
"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 | code/fastai_ext/fastai_ext/hyperparameter.py | jandremarais/TabularLearner |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2016, the cclib development team
#
# This file is part of cclib (http://cclib.github.io) and is distributed under
# the terms of the BSD 3-Clause License.
"""Unit tests for writer xyzwriter module."""
import os
import unittest
import cclib
__filedir__ = os.path.dirname(__f... | [
{
"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/io/testxyzwriter.py | alvarovm/cclib |
class response:
codes = {"Bad request": 1, "Success": 2, "Internal error":3, "Denied":4, "Accepted":5}
def __init__(self, Response, Data=None, _bool=None):
"""Possible Responses: Bad request, Success, Internal error
"""
self.Response = Response
self.Data = Data
self.Code ... | [
{
"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 | modules/response.py | NightKey/Server-monitoring-discord-bot |
# -*- coding: utf-8 -*-
#
# Scimitar: Ye Distributed Debugger
#
# Copyright (c) 2016 Parsa Amini
# Copyright (c) 2016 Hartmut Kaiser
# Copyright (c) 2016 Thomas Heller
#
# Distributed under the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt... | [
{
"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 | util/history.py | parsa/scmitar |
#!/usr/bin/env python
from os import walk
from os.path import join, splitext
from ntpath import basename
def get_images_labels_list(images_dir_path):
"""
Recursively iterates through a directory and its subdirectories to list the info all the images found in it.
Returns a list of dictionary where each dic... | [
{
"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 | ML/Minor/code/common/generate_images_labels.py | SIgnlngX/Minor-Project |
from django.test import SimpleTestCase
from django.utils.safestring import mark_safe
from ..utils import render, setup
class DefaultTests(SimpleTestCase):
"""
Literal string arguments to the default filter are always treated as
safe strings, regardless of the auto-escaping state.
Note: we have to 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_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
... | 3 | tests/template_tests/filter_tests/test_default.py | DasAllFolks/django |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from flask import Blueprint, render_template
from flask_login import login_required, current_user
from vhoops.modules.home.forms.user_profile import General, ChangePassword
from vhoops.modules.alerts.api.controllers import get_alerts_func
from vhoops.modules.teams.api.contro... | [
{
"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 | vhoops/modules/home/ui/routes.py | yigitbasalma/vhoops |
from django.contrib.auth.models import User
def get_anonymous_user():
"""
Get the user called "anonymous" if it exist. Create the user if it doesn't
exist This is the default concordia user if someone is working on the site
without logging in first.
"""
try:
return User.objects.get(us... | [
{
"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 | concordia/utils.py | ptrourke/concordia |
# -*- coding: utf-8 -*-
"""
Created on Tue Apr 7 17:58:09 2020
@author: Leonardo Saccotelli
"""
import numpy as np
"""
FORMULA DEI TRAPEZI
Al metodo vengono passati:
- la funzione integranda
- l'estremo inferiore di integrazione
- l'estremo superiore di integrazione
"""
def Trapezoid(f_x, a, b):
... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": fal... | 3 | 5_Quadrature Formulas/Algoritmi_Quadratura.py | LeonardoSaccotelli/Numerical-Calculus-Project |
import pathlib
import os
import invoke
TOP_LEVEL = [
'shim',
'snafu',
]
CURDIR = pathlib.Path(__file__, '..')
def _run_for_each(ctx, cmd):
for p in TOP_LEVEL:
# Can't use Path.resolve() because it can return a UNC path, which
# ctx.cd() does not accept.
with ctx.cd(os.path.abs... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside... | 3 | shims/__init__.py | uranusjr/snafu |
# coding: utf-8
from __future__ import absolute_import
from datetime import date, datetime # noqa: F401
from typing import List, Dict # noqa: F401
from jobbing.models.base_model_ import Model
from jobbing import util
class WorkingArea(Model):
def __init__(self,
working_area_id:int = None,
working_area_mun... | [
{
"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 | jobbing/models_remote/working_area.py | davidall-amdocs/jobbing |
#!/usr/bin/env python3
# coding: utf-8
from slackclient import SlackClient
from .config import SLACK_TOKEN
class SlackPoster:
def __init__(self, token, channels):
self.client = SlackClient(token)
self.channels = channels
def post(self, message):
for ch in self.channels:
... | [
{
"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 | scholar_bot/post_slack.py | finsberg/scholar_bot |
#Definir exceptions
class UsernameDuplicado(Exception):
pass
class IdadeMenor(Exception):
pass
class IdadeInvalida(Exception):
pass
class EmailInvalido(Exception):
pass
class User:
def __init__(self, username, idade, email):
self.__username = username
self.__idade = idade
... | [
{
"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 | Aulas/Aula11/exercicio.py | matheusmenezs/com220 |
import os
import pickle
import torch
SPECIAL_WORDS = {'PADDING': '<PAD>'}
def load_data(path):
"""
Load Dataset from File
"""
input_file = os.path.join(path)
with open(input_file, "r") as f:
data = f.read()
return data
def preprocess_and_save_data(dataset_path, token_lookup, creat... | [
{
"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 | 3. Generate TV scripts/helper.py | mihir135/deep_learning_nanodegree |
from probs import Binomial
class TestBinomial:
@staticmethod
def test_binomial() -> None:
d = Binomial()
assert d.expectation() == 0
assert d.variance() == 0
# TODO: Python 3.7 implementation differs from 3.8+
# assert P(d == 0) == 1
# assert P(d == 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": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": ... | 3 | tests/discrete/binomial_test.py | TylerYep/probs |
"""
.. module: lemur.plugins.bases.source
:platform: Unix
:copyright: (c) 2015 by Netflix Inc., see AUTHORS for more
:license: Apache, see LICENSE for more details.
.. moduleauthor:: Kevin Glisson <kglisson@netflix.com>
"""
from lemur.plugins.base import Plugin
class SourcePlugin(Plugin):
type = 'sou... | [
{
"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 | lemur/plugins/bases/source.py | prdonahue/lemur |
import sys
import pytest
from organizer.util.arguments import is_option
@pytest.mark.parametrize("arg", ['verbose', 'silent', 'dry-run', 'ignored', 'exists'])
def test_have_arguments(arg: str):
sys.argv = ['--' + arg]
assert is_option(arg)
@pytest.mark.parametrize("arg", ['verbose', 'silent', 'dry-run', '... | [
{
"point_num": 1,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answe... | 3 | tests/utils/arguments_test.py | darkanakin41/media-organizer |
import logging
from pathlib import Path
import numpy as np
import simulacra as si
import simulacra.units as u
import matplotlib.pyplot as plt
FILE_NAME = Path(__file__).stem
OUT_DIR = Path(__file__).parent / "out" / FILE_NAME
def w(z, w_0, z_0):
return w_0 * np.sqrt(1 + ((z / z_0) ** 2))
def R(z, z_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": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/... | 3 | dev/gaussian_beam.py | JoshKarpel/simulacra |
import math
from collections import Counter
# Collect BLEU-relevant statistics for a single hypothesis/reference pair.
# Return value is a generator yielding:
# (c, r, numerator1, denominator1, ... numerator4, denominator4)
# Summing the columns across calls to this function on an entire corpus will
# produce a vector... | [
{
"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 | reranker/bleu.py | wangka11/wordAlignment |
# coding: utf-8
"""
Isilon SDK
Isilon SDK - Language bindings for the OneFS API # noqa: E501
OpenAPI spec version: 2
Contact: sdk@isilon.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import isi_sdk_7_2
from isi... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
... | 3 | isi_sdk_7_2/test/test_worm_settings_extended.py | mohitjain97/isilon_sdk_python |
# -*- coding: utf-8 -*-
"""
:author: Grey Li (李辉)
:url: http://greyli.com
:copyright: © 2018 Grey Li
:license: MIT, see LICENSE for more details.
"""
import click
from flask import Flask
app = Flask(__name__)
# the minimal Flask application
# app.route()装饰器把根地址(/)和函数index()绑定起来,当用户访问该URL(/)时就触发此函数ind... | [
{
"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 | demos/hello/app.py | yunlinzi/helloflask |
class AuthError(ValueError):
def __init__(self, message, code=None):
if code:
self.code = code
super().__init__(message)
class PermissionDenied(AuthError):
def __init__(self, message, code=None):
if code:
self.code = code
super().__init__(message)
| [
{
"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": false
... | 3 | chowkidar/utils/exceptions.py | aswinshenoy/chowkidar-ariadne |
from ncssl_api_client.config.api.api_client_production_config import ApiProductionClientConfig
from ncssl_api_client.config.crypto.crypto_config import CryptoConfig
from ncssl_api_client.config.api.api_client_sandbox_config import ApiSandboxClientConfig
from ncssl_api_client.config.api.api_command_config import ApiComm... | [
{
"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 | ncssl_api_client/config/manager.py | antonku/ncssl_api_client |
from __future__ import annotations
import abc
from alocacao.adapters import repository
from alocacao.config import DEFAULT_SESSION_FACTORY
class AbstractUOW(abc.ABC):
produtos: repository.AbstractRepository
def __enter__(self) -> AbstractUOW:
return self
def __exit__(self, *args):
self.... | [
{
"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": true
},
{
... | 3 | src/alocacao/camada_servicos/unit_of_work.py | ralphribeiro/APWP-T2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.