source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
from Node import Node
class Stack:
def __init__(self):
self.top = None
def empty(self):
return self.top is None
def peek(self):
return self.top.data if self.top else -1
def push(self, data):
node = Node(data)
if self.top:
node.next = self.top
... | [
{
"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 | data_structures/stack/Stack.py | agxp/algorithms |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class AlipayEcoSmsSendModel(object):
def __init__(self):
self._content = None
self._phone = None
@property
def content(self):
return self._content
@content.setter
... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (ex... | 3 | alipay/aop/api/domain/AlipayEcoSmsSendModel.py | antopen/alipay-sdk-python-all |
from pypy.module.micronumpy.test.test_base import BaseNumpyAppTest
class AppTestFlagsObj(BaseNumpyAppTest):
def test_init(self):
import numpy as np
a = np.array([1,2,3])
assert a.flags['C'] is True
b = type(a.flags)()
assert b is not a.flags
assert b['C'] is True
... | [
{
"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 | pypy/module/micronumpy/test/test_flagsobj.py | Qointum/pypy |
from pathlib import Path
import pytest
import aiopytesseract
from aiopytesseract.models import Data
from aiopytesseract.exceptions import TesseractRuntimeError
@pytest.mark.asyncio
@pytest.mark.parametrize("image", ["tests/samples/file-sample_150kB.png"])
async def test_image_to_data_with_str_image(image):
data... | [
{
"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_image_to_data.py | amenezes/aiopytesseract |
import time
import datetime
import numpy as np
__start_time = time.time()
__end_time = time.time()
def calc_accuracy(predicted_labels, real_labels):
correct_qty = 0
for i in range(len(predicted_labels)):
if predicted_labels[i] == real_labels[i]:
correct_qty += 1
return correct_qty * 1... | [
{
"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 | app/utils/prediction_utils.py | Ukasz09/Clothing-recognition |
import torch
try: # Import the keops library, www.kernel-operations.io
from pykeops.torch import LazyTensor
keops_available = True
except:
keops_available = False
def scal(α, f, batch=False):
# f can become inf which would produce NaNs later on. Here we basically
# enforce 0.0 * inf = 0.0.
... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answ... | 3 | geomloss/utils.py | cqql/geomloss |
#!/usr/bin/env python
import auracle_test
class TestInfo(auracle_test.TestCase):
def testStringFormat(self):
p = self.Auracle(['info', '-F', '{name} {version}', 'auracle-git'])
self.assertEqual(p.returncode, 0)
self.assertEqual(p.stdout.decode(), 'auracle-git r74.82e863f-1\n')
def ... | [
{
"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 | tests/custom_format.py | mrkline/auracle |
'''
References:
- An Outline of Set Theory, Henle
'''
from . import fol
class ElementSymbol(fol.ImproperSymbol):
def __init__(self):
fol.PrimitiveSymbol.__init__('∈')
def symbol_type(self) -> str:
return 'element of'
@staticmethod
def new() -> "ElementSymbol":
return Elemen... | [
{
"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 | ddq_1/lang/set.py | jadnohra/connect |
# Copyright 2012-2014 Brian May
#
# This file is part of python-tldap.
#
# python-tldap 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) any later version.... | [
{
"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 | tldap/methods/shibboleth.py | Karaage-Cluster/python-tldap-debian |
#!/usr/bin/env python
# coding=utf-8
from flask import render_template, request
from flask import redirect, url_for, flash
from flask_login import login_user
from flask_login import login_required
from flask_login import logout_user
from . import auth
from ..models import User
from .. import logger
@auth.route('/log... | [
{
"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 | app/auth/views.py | 0xff-dev/SutAcmDRA |
#!/usr/bin/env python3
# Copyright (c) 2017-2018 The dogxcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test the -uacomment option."""
import re
from test_framework.test_framework import dogxcoinTestFrame... | [
{
"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/functional/feature_uacomment.py | dogxteam/dogxwallet-master |
"""
Project: Visual Odometry
Name : Heru-05 | M09158023
Date : 10/06/2021
"""
import math
from enum import Enum
import numpy as np
import cv2
from parameters import Parameters
class ShiTomasiDetector(object):
def __init__(self, num_features=Parameters.kNumFeatures, quality_level = 0.01, min_coner_distance ... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding sel... | 3 | src/feature_shitomasi.py | Herusyahputra/Visual-Odometry |
from typing import List
def merge_sort(input: List):
length = len(input)
for step in range(1, length):
key = input[step]
j = step - 1
while j >= 0 and key < input[j]:
input[j+1] = input[j]
j = j - 1
input[j+1] = key ... | [
{
"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 | code/pgms/merge-sort.py | souradeepta/PythonPractice |
import requests, csv
from bs4 import BeautifulSoup
import pandas as pd
import matplotlib as plt
def get_html_text(url):
'''
获取html文本
'''
r = requests.get(url, timeout=30)
# print('验证码:'r.status_code)
return r.text
def process_cvs_w_file(filepath, file_list):
'''
把数据写成csv文件
... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written ... | 3 | qiushaoyi/programs/qsy_program_codes/aqi_study.py | qsyPython/Python_play_now |
class Sort_dic:
def __init__(self):
pass
@staticmethod
def sort_values(dic,rev=False,sort_by= 'values'):
if sort_by == 'values':
sv = sorted(dic.values(),reverse=rev)
new_dic = {}
for num in sv :
for k,v in d... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"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 | king_libs/sort_val.py | jacktamin/king-tools |
class IRCMsg(object):
"""simple wrapper for breaking apart an IRC PRIVMSG
"""
def __init__(self, name, chan, msg):
self.name = name
self.channel = chan
self.message = msg
def splitPrivMsg(m):
name = m[1: m.index("!")]
chan = m.split(" ")[2]
msg = m.split(":")[2]
retu... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than... | 3 | ircutil.py | phy1um/Twitch-Chat-Listener |
from playhouse import shortcuts
class CoreNormalizer(object):
fields = None
def _model_to_dict(self, model_object):
raise NotImplemented
def normalize(self, queryset):
return [self.normalize_object(i) for i in queryset]
def normalize_object(self, model_object):
if self.field... | [
{
"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 | aiommy/normalizers.py | candyboober/aiommy |
#!/usr/bin/env python
import new
def attach(*args):
"""Class decorator that adds test_* methods to decorated class
Params:
*args: source classes with test_* methods to add to decorated class
"""
def wrapper(target_class):
suffix = getattr(target_class, 'SUFFIX', '')
suffix = '... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"... | 3 | attach.py | ykvch/QABox |
import datetime
from app import db, ma
user_contact = db.Table(
"user_contact",
db.Column("user_id", db.Integer, db.ForeignKey("users.id"), primary_key=True),
db.Column("contact_id", db.Integer, db.ForeignKey("users.id"), primary_key=True),
db.Column("created_at", db.DateTime, default=datetime.datetime... | [
{
"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 | app/models/user.py | MarioFronza/hound-server |
from django.db import models
from django.urls import reverse
# Create your models here.
class Zoo(models.Model):
name = models.CharField(max_length=200, help_text="Enter Zoo Name")
logoFileName = models.CharField(max_length=200, help_text="Enter logo file name", null=True)
def __str__ (self):
return self.name
... | [
{
"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": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": fals... | 3 | Django/Spring2018Pythonzoo-master/pythonzoo/zoo/models.py | bill-neely/ITSE1311-1302-Spring2018 |
###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013-2015, John McNamara, jmcnamara@cpan.org
#
from ..excel_comparsion_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompareXLSXFiles(ExcelComparisonTest):
"""... | [
{
"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 | xlsxwriter/test/comparison/test_chart_legend02.py | shareablee/XlsxWriter |
from __future__ import absolute_import, unicode_literals
# from time import sleep
import binascii
import os
from celery import shared_task
from django.conf import settings
# Django
from django.core.cache import cache
from django.core.mail import send_mail
from django.template.loader import render_to_string
# local... | [
{
"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 | apps/mail/tasks.py | magocod/djheavy |
"""
Compatibility layer for Python 3/Python 2 single codebase
"""
import sys
import hashlib
from distutils.version import LooseVersion
import nibabel
if sys.version_info[0] == 3:
import pickle
import io
import urllib
from base64 import encodebytes
_encodebytes = encodebytes
_basestring = st... | [
{
"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_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true... | 3 | nilearn/_utils/compat.py | darya-chyzhyk/nilearn |
import click
from ocrd.decorators import ocrd_cli_options, ocrd_cli_wrap_processor
from ocrd_anybaseocr.cli.ocrd_anybaseocr_cropping import OcrdAnybaseocrCropper
from ocrd_anybaseocr.cli.ocrd_anybaseocr_deskew import OcrdAnybaseocrDeskewer
from ocrd_anybaseocr.cli.ocrd_anybaseocr_binarize import OcrdAnybaseocrBinarize... | [
{
"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 | ocrd_anybaseocr/cli/cli.py | syedsaqibbukhari/docanalysis |
from braces.views import UserFormKwargsMixin
from .models import Proposal
from .forms import ProposalForm
from django.urls import reverse
from django.utils.translation import ugettext_lazy as _
class ProposalMixin(UserFormKwargsMixin):
model = Proposal
form_class = ProposalForm
success_message = _('Studi... | [
{
"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 | proposals/mixins.py | mindruion/test |
# Copyright 2019 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import sys
import config_util # pylint: disable=import-error
# This class doesn't need an __init__ method, so we disable the warning
# pylint: disable=no... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written ... | 3 | fetch_configs/devtools-frontend.py | tomrittervg/depot_tools |
import io
import nbformat as nbf
import os
from typer import run
from shutil import copyfile
class JupyterOps:
def extract_code(self, ipynb_name):
ipynb_path = os.path.join(os.getcwd(), ipynb_name)
save_file_path = 'extras'
if os.path.exists(save_file_path):
os.remove(save_file_path)
with io... | [
{
"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 | jupyterops.py | bipinKrishnan/jupyterops |
from django import template
from home.models import Recipe, MixingAgent, Base, Ingredient, FacePack, CustomFacePack
import pdb
register = template.Library()
@register.inclusion_tag('facepack.html')
def facepack_display(item_id):
if not item_id:
return
mandatory = []
type = "primary"
for cfp in... | [
{
"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 | farms2face/home/templatetags/common_tags.py | dev1farms2face/f2f |
from unittest.mock import MagicMock, patch
from static_markdown.server import main
def test_main_regular_call():
with patch("argparse.ArgumentParser.parse_args") as argument_mock:
argument_mock.return_value = MagicMock(version=False, root=".", port=9999)
with patch("http.server.HTTPServer.serve_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 | tests/test_cli.py | brunobord/static-markdown |
import json
import requests
tvmaze_api_url = 'http://api.tvmaze.com'
show_single_search_path = '/singlesearch/shows?q='
show_episode_list_path = '/shows/{series_id}/episodes'
def show_single_search(name):
resp = requests.get(tvmaze_api_url + show_single_search_path + name)
json_response = json.loads(json.du... | [
{
"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 | common/tv_maze.py | makstermaki/Telebloop |
# ============================================================================
# FILE: tag.py
# AUTHOR: Shougo Matsushita <Shougo.Matsu at gmail.com>
# License: MIT license
# ============================================================================
from .base import Base
from denite.util import parse_tagline
from o... | [
{
"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 | bundle/denite.nvim/rplugin/python3/denite/source/tag.py | wonwooddo/vim_setup |
#!/usr/bin/env python
import unittest
import numpy
import ctf
import os
import sys
def allclose(a, b):
return abs(ctf.to_nparray(a) - ctf.to_nparray(b)).sum() < 1e-14
class KnowValues(unittest.TestCase):
def test_partition(self):
AA = ctf.tensor((4,4),sym=[ctf.SYM.SY,ctf.SYM.NS])
AA.fill_ran... | [
{
"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 | test/python/test_partition.py | airmler/ctf |
from aspen import Response
from aspen.testing import assert_raises
from aspen.testing.fsfix import attach_teardown
def test_response_is_a_wsgi_callable():
response = Response(body="Greetings, program!")
def start_response(status, headers):
pass
expected = ["Greetings, program!"]
actual = respo... | [
{
"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 | tests/test_response.py | marcusrbrown/aspen |
"""
The roseguarden project
Copyright (C) 2018-2020 Marcus Drobisch,
This program 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) any later
version.
This pr... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a ty... | 3 | backend/workspaces/Access/accessTypes.py | makakken/roseguarden |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models
from django.contrib.auth.models import AbstractUser
from django.contrib.auth.base_user import BaseUserManager
import uuid
class UserManager(BaseUserManager):
use_in_migrations = True
def _create_user(self, username, emai... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true... | 3 | apps/auth/models.py | ad-free/lab-friends |
import numpy as np
# from https://github.com/songrotek/DDPG/blob/master/ou_noise.py
class OUNoise:
def __init__(self, action_dimension, scale=0.1, mu=0, theta=0.15, sigma=1):#sigma=0.2
self.action_dimension = action_dimension
self.scale = scale
self.mu = mu
self.theta = theta
... | [
{
"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 | others/maddpg/utils/noise.py | manish-pra/trcopo |
"""books table
Revision ID: 941035b5155d
Revises: 55d9cf8d35d2
Create Date: 2020-05-26 20:38:40.592532
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '941035b5155d'
down_revision = '55d9cf8d35d2'
branch_labels = None
depends_on = None
def upgrade():
# ##... | [
{
"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 | migrations/versions/941035b5155d_0_0_2_books_table.py | szymcio32/flask-book-library-api |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 5/15/20 4:49 PM
# @File : grover.py
# qubit number=4
# total number=8
import cirq
import cirq.google as cg
from typing import Optional
import sys
from math import log2
import numpy as np
#thatsNoCode
def make_circuit(n: int, input_qubit):
c = cirq.Cir... | [
{
"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 | data/cirq_new/cirq_program/startCirq_Class18.py | UCLA-SEAL/QDiff |
from fastapi import APIRouter, HTTPException
from app.api import crud
from app.models.pydantic import SummaryPayloadSchema, SummaryResponseSchema
from app.models.tortoise import SummarySchema
from typing import List
router = APIRouter()
@router.post('/', response_model=SummaryResponseSchema, status_code=201)
async... | [
{
"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_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"an... | 3 | project/app/api/summaries.py | sububer/fastapi-tdd-docker |
# data associated with an edge can contain a weight
WEIGHT = 'weight'
class AdjacencyViewer:
"""
Provide object to iterate over adjacent nodes.
"""
def __init__(self, mat, i, neighbors):
self.mat = mat
self.i = i
self.neighbors = neighbors
def __getitem__(self, target):
... | [
{
"point_num": 1,
"id": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 lines?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/... | 3 | algs19_networkx_replacement/adjacency_viewer.py | zhubaiyuan/learning-algorithms |
import json
class ConfigParser:
@staticmethod
def read(config_file):
return json.load(open(config_file))
@staticmethod
def parse_configs(*files):
res = []
for file_ in files:
res.append(ConfigParser.read(file_))
return res
| [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
... | 3 | utils/config_parser.py | ajkdrag/PyTorch-SDAE |
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QWidget
class JogWidget(QWidget):
def __init__(self, parent, callback):
super(JogWidget, self).__init__(parent)
self.parent = parent
self.callback = callback
self.wx_current = 0
self.wy_current = 0
... | [
{
"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_multiple_inheritance",
"question": "Does any class in this file use multiple inherita... | 3 | classes/jogwidget.py | comgram/gerbil_gui |
#!/usr/bin/env python3
import logging
import convertors.html_convertor.query
import utils.text_query
import utils.value_query
import utils.logging
logger = logging.getLogger(utils.logging.getLoggerName(__name__))
def _process_query(query_def, input):
query_type = query_def.get("type")
if query_type in conv... | [
{
"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 | data/get.py | samadhicsec/threatware |
# coding: utf-8
import pandas as pd
def named_series(*args, **kwargs):
def wrapper(*args, **kwargs):
return pd.Series(*args, **kwargs)
return wrapper
| [
{
"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 | dgp/lib/transform/etc.py | DynamicGravitySystems/DGP |
#!/usr/bin/env python3
class Account:
def __init__(self, account_number, balance, type):
self.account_number = account_number
self.balance = balance
self.type = type
def deposit(self, amount):
self.balance += amount
def withdraw(self, amount):
self.balance -= amount
def check_balance(self):
return 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": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
... | 3 | bank/account.py | matthewmuccio/bank_project |
#!/usr/bin/env python
import rospy
from std_msgs.msg import String
from umnitsa_msgs import console_controller
def callback(data):
rospy.loginfo(rospy.get_caller_id() + 'I heard %s', data.data)
def updateCommand(data):
rospy.loginfo(data)
def listener():
# In ROS, nodes are uniquely named. If two nodes... | [
{
"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 | componentTesting/listener.py | betaBison/umnitsa_rpi |
from ...utils.dicttools import flatten, aggregate, propagate
def prepare_log(details, level=5, delim='/'):
prepared = aggregate(flatten(details, delim='.'), level=level, delim='.')
return {k.replace('.', delim): v for k, v in prepared.items()}
def weighted_sum(terms, **coef):
# 1. compute the final loss... | [
{
"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 | markovdwp/runtime/utils/common.py | ivannz/MarkovDWP |
import unittest
from katas.kyu_6.regexp_basics_is_it_ipv4_address import ipv4_address
class IPV4AddressTestCase(unittest.TestCase):
def test_true(self):
self.assertTrue(ipv4_address('127.0.0.1'))
def test_true_2(self):
self.assertTrue(ipv4_address('0.0.0.0'))
def test_true_3(self):
... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
... | 3 | tests/kyu_6_tests/test_regexp_basics_is_it_ipv4_address.py | the-zebulan/CodeWars |
# =======================================================================================
# \ | | __ __| _ \ | / __| \ \ / __|
# _ \ | | | ( | . < _| \ / \__ \
# @autor: Luis Monteiro _/ _\ \__/ _| \___/ _|\_\ ___| _| ____/
# ============... | [
{
"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 | autokeys/credentials.py | lcmonteiro/service-autokeys |
"""empty message
Revision ID: 5e2282d6f7ef
Revises: 81549fd19dfa
Create Date: 2020-05-20 15:14:12.085144
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '5e2282d6f7ef'
down_revision = '81549fd19dfa'
branch_labels = None
depends_on = None
def upgrade():
# ... | [
{
"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_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answe... | 3 | migrations/versions/5e2282d6f7ef_.py | Johnsoneer/The-Quote-Book |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from marionette_driver import Wait
from gaiatest.apps.lockscreen.app import LockScreen
from gaiatest.gaia_graphics_test... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
... | 3 | tests/python/gaia-ui-tests/gaiatest/tests/graphics/test_unlock_to_homescreen.py | TheoChevalier/gaia |
import pandas as pd
from .dataframe_bytes_storage import df_from_bytes, df_to_bytes
from .numpy_bytes_storage import np_from_bytes, np_to_bytes
try:
import rpy2.robjects as robjects
from rpy2.robjects import pandas2ri
from rpy2.robjects.conversion import localconverter
def r_to_py(object_):
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_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answ... | 3 | pyabc/storage/bytes_storage.py | Gabriel-p/pyABC |
from rtamt.operation.abstract_operation import AbstractOperation
import rtamt.operation.stl.dense_time.offline.intersection as intersect
class ImpliesOperation(AbstractOperation):
def __init__(self):
self.left = []
self.right = []
self.last = []
def update(self, *args, **kargs):
... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
... | 3 | rtamt/operation/stl/dense_time/offline/implies_operation.py | xiaoyaooo/rtamt |
import sys
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
import threading
import time
class MyWindow(QMainWindow):
def __init__(self):
super().__init__()
timer = QTimer(self)
timer.start(1000)
timer.timeout.connect(self.timeout)
def timeout(self):
name = t... | [
{
"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 | python-pyqt/Section02/unit04-singleshot-timer/03.py | sharebook-kr/learningspoons-bootcamp-finance |
"""
proxy patterns: 代理模式
为其它对象提供一种代理以控制对这个对象的操作
要素:
一个开放的方法集(interface)
实现相应方法集的proxy 对象
实现了相应方法集的类
应用:
远程代理, 为一个对象在不同地址空间提供局部代表, 这样就可以隐藏一个对象存在于不同地址空间的事实
哪么两个进程间, 是否可以通过这样的方式实现数据共享
虚拟代理, 根据需要创建开销很大的对象, 通过它存放实例化需要很长时间的真实对象
安全代理, 用来控制真实对象访问时... | [
{
"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_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true... | 3 | 07patterns/proxy_patterns.py | edgells/python-commons |
from unittest import TestCase, skip
import os
from docxtpl import DocxTemplate
class TestDocxTemplate(TestCase):
def setUp(self):
self.APP_DIR = os.path.abspath(os.path.dirname(__file__)) # This directory
self.FIXTURE_DIR = os.path.join(os.path.dirname(self.APP_DIR), 'fixtures')
self.FO... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
... | 3 | mergeforms/from cms10/test_wordTemplate.py | mbronstein/ssa412 |
import click
import pandas as pd
# Due textacy problems
try:
from textacy.preprocess import preprocess_text
except Exception:
from textacy.preprocess import preprocess_text
def preprocess_f(text, fix_unicode=True, lowercase=True,
no_urls=True, no_emails=True,
no_phone_numbers... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"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 | pre-process.py | nicoperetti/metadata-sadosky-santander |
import argparse
import boto3
from gbs3.backup import backup
from gbs3.restore import restore
import gbs3.settings
from gbs3.settings import *
from gbs3.util import eprint
def verify_conf(conf_name):
if not getattr(gbs3.settings, conf_name):
eprint('missing config option {}'.format(conf_name))
ex... | [
{
"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 | gbs3/main.py | SoftwareMansion/grafana-backup-s3 |
from django.db.models import Count
from django.utils.translation import gettext_lazy as _
from app.models import DefaultQuerySet, TimestampedModel, models
from app.tasks import send_mail
from users.models import User
class EmailLeadCampaignQuerySet(DefaultQuerySet):
def with_lead_count(self):
return self... | [
{
"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 | src/magnets/models.py | vaibhavantil2/education-backend |
#!/usr/bin/env python3
# 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.
from mcrouter.test.MCProcess import Memcached
from mcrouter.test.McrouterTestCase import McrouterTestCase
class TestS... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
... | 3 | mcrouter/test/test_service_info.py | kiaplayer/mcrouter |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#TF enemy position from ralative_pos topic
#Add time losed enemy to color_flag
import rospy
import tf2_ros
import tf_conversions
import tf
import math
from geometry_msgs.msg import PoseStamped
from geometry_msgs.msg import TransformStamped
from geometry_msgs.msg import ... | [
{
"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": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"ans... | 3 | burger_war_dev/scripts/transform_enemy_pose.py | Gantetsu-robocon/burger_war_dev |
#!/usr/bin/env python
from __future__ import unicode_literals
from prompt_toolkit.application import Application
from prompt_toolkit.layout import Layout
from prompt_toolkit.layout.dimension import D
from prompt_toolkit.widgets import Dialog
from ptterm import Terminal
def main():
def done():
application.... | [
{
"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 | examples/terminal-in-dialog.py | riag/ptterm |
##
##
#
# SOFTWARE HISTORY
#
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# 09/10/14 #3623 randerso Manually created, do not regenerate
#
##
class DeactivateSiteRequest(object):
def __init__(s... | [
{
"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 | dynamicserialize/dstypes/com/raytheon/uf/common/site/requests/DeactivateSiteRequest.py | mjames-upc/python-awips |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
__all__ = ['AlgoMeta']
from typing import Dict, NamedTuple, Optional
class AlgoMeta(NamedTuple):
name: str
class_name: Optional[str]
accept_class_args: bool
class_args: Optional[dict]
validator_class_name: Optional[str]
... | [
{
"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_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"an... | 3 | nni/tools/package_utils/common.py | dutxubo/nni |
from unittest import TestCase
from models.product import Product
from models.sell_order import SellOrder
from models.user import User
class TestSellOrder(TestCase):
def test___set_profitability_great(self):
client = User('Lucas')
product = Product('Product 1', 100.0, 0)
sell_order = SellO... | [
{
"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 | tests/models/test_sellOrder.py | Lucasgms/sell-orders-app |
from flask import Blueprint, redirect, request
from sqlalchemy.sql.expression import func
from ..decorators import templated
from .models import User
members = Blueprint("members", __name__)
@members.route("/members")
@templated()
def index():
return {"members": User.active_members().order_by(func.random())}
... | [
{
"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 | jazzband/members/views.py | jstockwin/website-1 |
import numpy as np
from joblib import Parallel, delayed
import multiprocessing
num_cores = multiprocessing.cpu_count()
def pearson_corr_distance_matrix(timelines, lag=0):
if lag == 0:
return np.corrcoef(timelines)
def corr(timelines, timeline, lag):
corr_mat = np.zeros((1, len(timelines)))
... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a ty... | 3 | backend/helper/pearson.py | marinaevers/regional-correlations |
import os
import pathlib
import shutil
from os.path import expanduser
extpath = os.path.join(expanduser("~"),
".local/share/flatpak/extension/org.freedesktop.Platform.GL.host/arm/1.4")
def has_extension():
return os.path.exists(extpath)
def remove_extension():
if os.path.exists(extpath... | [
{
"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 | fpk/extension.py | dashinfantry/flatpak-runner |
import hp
from pathlib import Path
import numpy as np
from tqdm import tqdm
import librosa
import torch
import librosa.filters
import numpy as np
import scipy
from random import randint
from os import makedirs
def load_wav(path, sample_rate):
return librosa.core.load(path, sr=sample_rate)[0]
def save_wav(wav, p... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written... | 3 | dataset/cut_chime.py | dzungcamlang/noise_adversarial_tacotron |
import sys
import re
import click
import tempfile
from getoc.mirror import Mirror
CONTEXT_SETTINGS = dict(help_option_names=["-h", "--help"])
@click.group(context_settings=CONTEXT_SETTINGS)
@click.pass_context
def cli(ctx):
pass
@cli.command()
@click.argument("version")
def dl(version):
"""Download an Ope... | [
{
"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 | getoc/client.py | bostrt/getoc |
from json import loads
from ..models.response import ErrorMessage
class WebsiteContactsApiError(Exception):
def __init__(self, message):
self.message = message
@property
def message(self):
return self._message
@message.setter
def message(self, message):
self._message = me... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
... | 3 | src/websitecontacts/exceptions/error.py | whois-api-llc/website-contacts-py |
import subprocess
import sys
import json
def print_time(t):
output = {
'items': [
{
'uid': 'result',
'type': 'file',
'title': t,
'subtitle': sys.argv[1],
'arg': sys.argv[1],
'icon': {
... | [
{
"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 | alfred_wrapper.py | fur6y/timely-alfred-workflow |
#!/usr/bin/env python
PARTS = ['negative', 'positive', 'full'] # up and left is negative, down and right is positive
MODES = ['interceptor', 'injector', 'adder']
class Interceptor:
def __init__(self):
self.enabled = False
self.interceptor = None
self.watchdog = 2 * 1e9 # In 2 sec disable interceptor 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": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (exclu... | 3 | interceptor/__init__.py | briskspirit/Interceptor |
# coding: utf-8
import chainer
import chainer.links as L
# Network definition
class A(chainer.Chain):
def __init__(self):
super(A, self).__init__()
with self.init_scope():
self.l0 = L.Linear(7)
self.l1 = L.Linear(5)
def g(self, y):
return self.l1(y)
def... | [
{
"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 | ch2o/tests/syntax/MultiFunction.py | disktnk/chainer-compiler |
# -----------------------------------------------------------
# Copyright (c) 2021. Danil Smirnov
# Zoom challenged Flash and offered him a fair fight in the
# form of a race. If Zoom is faster than Flash, you need
# to output "NO", if Flash is faster than Zoom, you need
# to output "YES", if their sp... | [
{
"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 | week4/task18.py | sdanil-ops/stepik-beegeek-python |
def bezout(a, b):
"""returns u, v such as au+bv = pgcd(a,b)"""
if b == 0:
return (1, 0)
else:
(u, v) = bezout(b, a % b)
return (v, u - (a // b) * v)
def chinese_theorem_inv(modulo_list):
"""
Returns (x, n1*...*nk) such as
x mod mk = ak for all k, with
modulo_list =... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"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 | 2019/Round1A/exo2.py | victor-paltz/code-jam |
from random import randint
from functools import partial
def roll3d6():
return sum(randint(1, 6) for i in range(3))
def roll4d6dl1():
dice = sorted(randint(1, 6) for i in range(4))
return sum(dice[1:])
def genchar(roll_method=roll4d6dl1):
return [roll_method() for i in range(6)]
| [
{
"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 | roll.py | intuited/legendlore |
#!/usr/bin/env python
"""
Copyright (c) 2006-2015 sqlmap developers (http://sqlmap.org/)
See the file 'doc/COPYING' for copying permission
"""
import re
from lib.core.enums import PRIORITY
__priority__ = PRIORITY.HIGHEST
def dependencies():
pass
def tamper(payload, **kwargs):
"""
Replaces greater than... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": fal... | 3 | server/sqlmap/tamper/between.py | kurpav/volcano |
from django.db import models
from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
from . import RecordStatusEnum
class LinkNote(models.Model):
id = models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')
... | [
{
"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 | mainsite/models/link_note.py | xjlin0/attendee |
from sql_alchemy import banco
class HotelModel(banco.Model):
__tablename__ = 'hoteis'
hotel_id = banco.Column(banco.String, primary_key=True)
nome = banco.Column(banco.String(80))
estrelas = banco.Column(banco.Float(precision=1))
diaria = banco.Column(banco.Float(precision=2))
cidade = banco.C... | [
{
"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 | models/hotel.py | marceloprni/FLASK_REST_API |
from django.utils.translation import gettext_lazy as _
from hcap.forms import HealthcareUnitCapacityForm
from hcap_accounts.models import HealthcareUnitNotifier, RegionManager
from hcap_notifications.models import HealthcareUnitCapacity
from hcap_utils.contrib.material.viewsets import ModelViewSet
class HealthcareUn... | [
{
"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 | hcap/views/healthcare_unit_capacities_view_set.py | fabiommendes/capacidade_hospitalar |
import bpy
from bpy.props import *
from .. id_keys import getAllIDKeys
from .. utils.unicode import toValidString, fromValidString
class IDKeySearch(bpy.types.Operator):
bl_idname = "an.choose_id_key"
bl_label = "ID Key Search"
bl_options = {"REGISTER"}
bl_property = "item"
def getSearchItems(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": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding ... | 3 | scripts/addons/animation_nodes/operators/choose_id_key.py | Tilapiatsu/blender-custom_conf |
def concat(s1, s2):
if not s1:
return s2
return s1[0:1] + concat(s1[1:], s2)
def reverse(s1):
if not s1:
return s1
return concat(reverse(s1[1:]), s1[0])
def prefix(s1, s2):
if s1 == '' and s2 != '':
return True
if s1[:1] == s2[:1]:
return prefix(s1[1:], s2... | [
{
"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 | Lista4/Lista4ex7.py | hugo-paiva/IntroducaoCienciasDaComputacao |
import numpy
class SumTree(object):
def __init__(self, capacity):
self.write = 0
self.capacity = capacity
self.tree = numpy.zeros(2*capacity - 1)
self.data = numpy.zeros(capacity, dtype=object)
def _propagate(self, idx, change):
parent = (idx - 1) // 2
self.t... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
}... | 3 | sum_tree.py | biplavc/dqn-multi-agent-rl |
__author__ = 'alvertisjo'
from django.core.serializers import json
import requests
from requests.packages.urllib3 import Timeout
from requests.packages.urllib3.exceptions import ConnectionError
class OpenProductData(object):
def getData(self):
# rowStep=100
# currentPage=0
# #####document... | [
{
"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": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"ans... | 3 | openiPrototype/appUI/importProductData.py | OPENi-ict/ntua_demo |
#!/usr/bin/env python
# Author: Zion Orent <zorent@ics.com>
# Copyright (c) 2015 Intel Corporation.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without ... | [
{
"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": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",... | 3 | examples/python/o2.py | moredu/upm |
'''
Created on 03-Nov-2017
@author: karthikeyan
'''
from com.mycompany.dbutil.reports_dbutil import DBUtil
from sqlalchemy.orm import sessionmaker
from com.mycompany.entities.report_data import ReportData
class ReportService(object):
dbutil = DBUtil()
engine = dbutil.create_engine()
Session = sessionmak... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": ... | 3 | src/main/python/com/mycompany/service/report_service.py | Karthikeyan298/system-analyzer |
import re
import os
class GitConfigParser:
def __init__(self, repoDirectory):
self._repoDirectory = repoDirectory
def originURL(self):
with open(os.path.join(self._repoDirectory, ".git", "config")) as f:
contents = f.read()
return self._parseOriginURL(contents)
def _p... | [
{
"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 | upseto/gitconfigparser.py | shlomimatichin/upseto |
"""
Miscellaneous non-bitcoin-related tools used throughout this package.
"""
################################################################################
# source: http://stackoverflow.com/a/22729414
class classproperty(object):
""" @classmethod+@property """
def __init__(self, f):
self.f = 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 | bitcoinscript/misc.py | fungibit/bitcoinscript |
from django.db import models
from django.contrib.auth.models import AbstractBaseUser, BaseUserManager, PermissionsMixin
from django.conf import settings
class UserProfileManager(BaseUserManager):
"""Manager for user profiles"""
def create_user(self, email, name, password=None):
"""Create a new user p... | [
{
"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 | core/models.py | aalmobin/profiles-rest-api |
import zeeguu.core
from zeeguu.core.sql.learner.words import words_not_studied, learned_words
from ._common_api_parameters import _get_student_cohort_and_period_from_POST_params
from .. import api, json_result, with_session
db = zeeguu.core.db
@api.route("/student_words_not_studied", methods=["POST"])
@with_session
... | [
{
"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 | zeeguu/api/api/teacher_dashboard/student_words.py | mircealungu/Zeeguu-API-2 |
def F(n):
if n > 2:
return F(n - 1) + G(n - 2)
else:
return n + 1
def G(n):
if n > 2:
return G(n - 1) + F(n - 2)
else:
return n
print(F(7)) | [
{
"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 | 18.py | makkksimka/16zadanie |
"""Docsting to fulfil linting."""
from functools import lru_cache
from numpy import sqrt
from simple_functions.functions1 import factorial
__all__ = ['pi']
def pi(terms=1):
""" Calculating pi """
return 1./(2.*sqrt(2.)/9801.*rsum(terms))
@lru_cache(maxsize=None) # Note: -> @cache in python >= 3.9
def rs... | [
{
"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 | simple_functions/constants.py | acse-jat20/ci_acse1 |
# qubit number=4
# total number=42
import pyquil
from pyquil.api import local_forest_runtime, QVMConnection
from pyquil import Program, get_qc
from pyquil.gates import *
import numpy as np
conn = QVMConnection()
def make_circuit()-> Program:
prog = Program() # circuit begin
prog += H(3) # number=31
prog... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"a... | 3 | benchmark/startPyquil3243.py | UCLA-SEAL/QDiff |
# Copyright 2013-2020 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 RoctracerDev(CMakePackage):
"""ROC-tracer library: Runtimes Generic Callback/Activity API... | [
{
"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 | var/spack/repos/builtin/packages/roctracer-dev/package.py | rvinaybharadwaj/spack |
import datetime
import re
class PublicationUtils:
@staticmethod
def get_month(bibtex_entry):
month = bibtex_entry.get("month")
m = None
try:
m = int(month)
except Exception:
pass
try:
m = datetime.datetime.strptime(month, "%b").month
... | [
{
"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 | projects/pub_utils.py | ChameleonCloud/portal |
import testing
from testing import divert_nexus,restore_nexus,clear_all_sims
from testing import failed,FailedTest
from testing import value_eq,object_eq,text_eq
def test_import():
from rmg import Rmg,generate_rmg
#end def test_import
def test_minimal_init():
from machines import job
from rmg import ... | [
{
"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 | nexus/tests/unit/test_rmg_simulation.py | eugeneswalker/qmcpack |
import numpy as np
import matplotlib.pyplot as plt
import argparse
def extract_name(word: str):
return word.split('=')[-1]
def extract_info(filename: str):
filename_splitted = filename.split('_')
assert len(filename_splitted) == 7
p = float(extract_name(filename_splitted[1]))
iterations = int(ex... | [
{
"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 | homophily_structural_balance/plotting/plot_positive_edge_density.py | robertjankowski/reproducing-dl-papers |
"""SentencePiece based word tokenizer module"""
from pathlib import Path
from typing import List
import sentencepiece as spm
from urduhack.stop_words import STOP_WORDS
def _is_token(pieces: list, special_symbol: str = "▁") -> List[str]:
"""
Check for stopwords and actual words in word pieces
Args:
... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"a... | 3 | urduhack/tokenization/wtk.py | cinfotech94/urduhackk |
from typing import Any
from argparse import ArgumentParser
from confirmation.models import Confirmation, create_confirmation_link
from zerver.lib.management import ZulipBaseCommand
from zerver.lib.actions import create_stream_if_needed
from zerver.models import MultiuseInvite
class Command(ZulipBaseCommand):
hel... | [
{
"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 | zerver/management/commands/generate_multiuse_invite_link.py | Rishabh570/zulip |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.