source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
# LIBTBX_SET_DISPATCHER_NAME iotbx.pdb.sort_atoms
from __future__ import absolute_import, division, print_function
from libtbx.utils import Usage
import sys
import iotbx.pdb
import mmtbx.model
master_phil_str = """
file_name = None
.type = path
.multiple = False
.optional = False
.style = hidden
"""
def show... | [
{
"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 | iotbx/command_line/sort_atoms.py | hbrunie/cctbx_project |
import nose
import binary_heap
BinaryHeap = binary_heap.BinaryHeap
def test_binary_heap_101():
b = BinaryHeap()
nose.tools.assert_is_instance(b, BinaryHeap)
def test_binary_heap_num_entries():
b = BinaryHeap()
nose.tools.assert_equal(b.num_entries(), 0)
def test_binary_heap_insert():
b = Bina... | [
{
"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 | test/test_binary_heap.py | paolodelia99/Python-C-Algorithms |
import logging
import sys
import gym
logger = logging.getLogger(__name__)
root_logger = logging.getLogger()
requests_logger = logging.getLogger('requests')
# Set up the default handler
formatter = logging.Formatter('[%(asctime)s] %(message)s')
handler = logging.StreamHandler(sys.stderr)
handler.setFormatter(formatt... | [
{
"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 | gym/configuration.py | JialinMao/gym-ww |
from .plugin.core.main import startup, shutdown
# TODO: narrow down imports
from .plugin.core.panels import *
from .plugin.core.registry import LspRestartClientCommand
from .plugin.core.documents import *
from .plugin.panels import *
from .plugin.edit import *
from .plugin.completion import *
from .plugin.diagnostics ... | [
{
"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_return_types_annotated",
"question": "Does every function in this file have a return type annotation?... | 3 | boot.py | dndrsn/LSP |
from django.core.management.base import BaseCommand
from django.utils import timezone
from url_migration import models
class Command(BaseCommand):
def handle(self, **options):
for rule in models.UrlRegexpMapping.objects.filter(last_usage__isnull=False):
self._remove_if_unused(rule)
fo... | [
{
"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 | url_migration/management/commands/remove_expired_redirects.py | riklaunim/django-url-migration |
from app.service import token_service
from app.service import umm_client
from app.service import nexus_client
from app.domain.solution import Solution
from app.domain.document import Document
def upload_document(**args):
http_request = args.get('http_request')
token = token_service.get_token(http_request)
... | [
{
"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 | umu-python/app/service/document_service.py | corner4world/cubeai |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from s3dump.utils._text import to_native
class S3DumpError(Exception):
def __init__(self, message="", obj=None, show_content=True, suppress_extended_error=False, orig_exc=None):
super(S3DumpError, self).__init__(messa... | [
{
"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 | lib/s3dump/errors/__init__.py | Placidina/s3dump |
import sys, os, json
version = (3,7)
assert sys.version_info >= version, "This script requires at least Python {0}.{1}".format(version[0],version[1])
# Game loop functions
def render(game,current):
''' Displays the current room '''
print('You are in the ' + game['rooms'][current]['name'])
print(game['... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
... | 3 | main.py | BraffordHunter/03-Text-Adventure-2 |
def getBestBloker(si, gat):
global relations
for g in gat:
if g in relations[si]:
return [si, g]
for g in gat:
if len(relations[g]) > 0:
return [g, relations[g][0]]
return [0, 0]
def unsetter(c1, c2):
global relations
relations[c1].remove(c2)
relatio... | [
{
"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 | Medium/Skynet_Revolution_Episode_1.py | Thomaw/CodeinGame |
# -*- coding: utf-8 -*-
#
# osc2rtmidi/device.py
#
"""MIDI device abstraction classes."""
import logging
import time
from rtmidi.midiutil import open_midioutput
__all__ = ("RtMidiDevice",)
log = logging.getLogger(__name__)
class RtMidiDevice(object):
"""Provides a common API for different MIDI driver implemen... | [
{
"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 | osc2rtmidi/device.py | SpotlightKid/osc2rtmidi |
from mythic_payloadtype_container.MythicCommandBase import *
from mythic_payloadtype_container.MythicRPC import *
import json
class ShellArguments(TaskArguments):
def __init__(self, command_line):
super().__init__(command_line)
self.args = {
"command": CommandParameter(
... | [
{
"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 | Payload_Type/venus/mythic/agent_functions/shell.py | MythicAgents/venus |
import tensorflow as tf
# ===============================================
# Previously was snippets.py of: 3_2_RNNs
# ===============================================
# i = input_gate, j = new_input, f = forget_gate, o = output_gate
# Get 4 copies of feeding [inputs, m_prev] through the "Sigma" diagram.
# Note that ea... | [
{
"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 | section3/snippets.py | joyjeni/-Learn-Artificial-Intelligence-with-TensorFlow |
class Test:
def __init__(self):
self.foo = 11
self._bar = 23
self.__baz = 42
def get_gg(self):
return __gg
class ExtendedTest(Test):
def __init__(self):
super().__init__()
self.foo = 'overridden foo'
self._bar = 'overridden _bar'
self.__baz ... | [
{
"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 | python/underscore.py | mythnc/lab |
from abc import ABC
class AbcFacade(ABC):
"""Any interface will expect to be able to invoke the following methods."""
def count_rows(self):
pass
def get_rows(self):
pass
def get_last_workday(self):
pass
def delete_history(self):
pass
def disconnect(self):
... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
... | 3 | time_management/facade_abc.py | artorias111/time-management |
import json
from config import db
from models import UserModel
def table_record_to_json(record):
modelClass = type(record)
columns = [record for record in filter(lambda item: not item.startswith('_'),modelClass.__dict__)]
json_value = {column_name: str(getattr(record, column_name))for column_name in colu... | [
{
"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 | util.py | codefordc/us-congress-pizza-flag-tracker |
def possible_moves(current_word, words_list):
answer_set = set()
for word in words_list:
if word.startswith(current_word):
answer_set.add(word[len(current_word)])
return answer_set
def rec(words_list, current_word=''):
if current_word in words_list:
return {current_word,}
... | [
{
"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 | 04-A.Kraevskiy/2021-10-09-stone-game/words.py | Stankist04/2021-11-1 |
# -*- coding:utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals
import os
import random
import string
import pytest
from selenium import webdriver
from selenium.common.exceptions import WebDriverException
browsers = {
# 'firefox': webdriver.Firefox,
# 'chrome': webdriver.Chrom... | [
{
"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 | tests/conftest.py | vanadium23/django-tinymce-lite |
#
# Copyright (c) 2020 - Neptunium Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
from jinja2 import Environment, FileSystemLoader, StrictUndefined
from social_fabric.config_repo import ConfigRepo
class NetworkTemplateProcessor:
def __init__(self):
self.file_loader = FileSystemLoader(ConfigRepo.TEMPLAT... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answe... | 3 | social_fabric/network_template_processor.py | social-fabric/social-fabric |
from django import forms
from .models import SalesDiagnostic, Product, Headers
from django.contrib.auth.models import User
class ReportForm(forms.Form):
choices = Product.objects.values("vendor")
VENDOR_OPTIONS = ()
for i in choices:
choice = (i['vendor'], i['vendor'])
if choice not in VEN... | [
{
"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 | reporting/forms.py | dgmarko/django_jdsreporting |
#!/usr/bin/env python3
import hashlib
def md5(s: str) -> str:
h = hashlib.md5()
h.update(s.encode("utf-8"))
return h.hexdigest()
def mine_coin(key: str) -> int:
count = 1
while not md5(key + str(count)).startswith("000000"):
count += 1
return count
| [
{
"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 | 2015/day04.py | 0x4448/advent-of-code |
import os
import json
import tempfile
import shutil
from lxml import etree
from rest_framework import status
from hs_core.hydroshare import resource
from .base import HSRESTTestCase
class TestResourceMetadata(HSRESTTestCase):
def setUp(self):
super(TestResourceMetadata, self).setUp()
self.rty... | [
{
"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 | hs_core/tests/api/rest/test_resource_meta.py | hydroshare/hydroshare |
import os
import math
import csv
import tqdm
import argparse
"""
超新星跑分程序:用于对比submit.csv与list.csv的结果,计算得分
由于训练和测试都在使用这个集合,需要注意实际测试如果与训练集分布不一致,那么分数可能稍低
用于计算部分的得分
"""
parser = argparse.ArgumentParser(description="compare with --csv")
parser.add_argument('--csv',type=str,default="test_valid.csv")
args = parser.parse_args... | [
{
"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 | score.py | pprp/faster-rcnn.Supernova |
from django.shortcuts import render, redirect
import crawler
from calendarapp.models import Event
from crawler import Subject
import datetime
# Create your views here.
def connect_everytime(request):
return render(request, 'connect-everytime.html')
def post(request):
if request.method == "POST":
user... | [
{
"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_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"a... | 3 | everytime/views.py | SmartWebService/SmartStudyCalendar |
from rest_framework import serializers
from django.core.validators import URLValidator
from django.core.exceptions import ValidationError
from .models import User
from .models import ShortenedUrl
class RegisterSerializer(serializers.ModelSerializer):
class Meta:
model = User
fields = ("id", "emai... | [
{
"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_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
... | 3 | url_shorten_api/core/serializers.py | dorukuzucu/url_shorten |
# Dummy test
import numpy as np
from gsea import *
from numpy.testing import assert_almost_equal
def test_rank_genes():
D = np.array([[-1,1],[1,-1]])
C = [0,1]
L,r = rank_genes(D,C)
assert_almost_equal(L, [0,1])
assert_almost_equal(r, [1,-1])
def test_enrichment_score():
L = [1,0]
r = [-1,... | [
{
"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/test_gsea.py | jacobkimmel/GSEA.py |
"""
This example uses a finite number of workers, rather than slamming the system with endless subprocesses.
This is more effective than endless context switching for an overloaded CPU.
"""
import asyncio
from pathlib import Path
import shutil
import sys
from typing import Iterable
import os
FFPLAY = shutil.which("ff... | [
{
"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 | src/asyncioffmpeg/ffplay.py | scivision/asyncio-subprocess-ffmpeg |
# -*- coding: utf-8 -*-
#
# Copyright 2010 British Broadcasting Corporation and Kamaelia Contributors(1)
#
# (1) Kamaelia Contributors are listed in the AUTHORS file and at
# http://www.kamaelia.org/AUTHORS - please extend this file,
# not this notice.
#
# Licensed under the Apache License, Version 2.0 (the "Li... | [
{
"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_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": fa... | 3 | Sketches/MPS/Old/queue.py | sparkslabs/kamaelia_orig |
import repo
from collectors import basic
def extract_content(url, soup):
return soup.title.string # extract page's title
def store_content(url, content):
# store in a hash with the URL as the key and the title as the content
repo.set_content(url, content)
def allow_url_filter(url):
return True #... | [
{
"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 | parsers/defaults.py | ZenRows/scaling-to-distributed-crawling |
import aiohttp, asyncio
from bs4 import BeautifulSoup
import json
import time
VC_SEARCH = "https://vc.ru/search/v2/content/new"
async def parse_urls(key_word):
async with aiohttp.ClientSession() as session:
async with session.get(VC_SEARCH, params={
"query": key_word,
"target_type... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding ... | 3 | Parsers/vcru.py | OverFitted/hacksai2021spb |
class UnoInfo:
def __init__(self):
self.dataPins = 13
self.analogInPins = 5
self.GND = 3
self.pow = [3.3, 5]
self.TX = 1
self.RX = 0
def getMainInfo(self):
return {"0": self.dataPins, "1": self.GND, "2": self.pow}
def getDigitalPins(s... | [
{
"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_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer":... | 3 | Pyduino/Boards/Uno.py | ItzTheDodo/Pyduino |
# Aim: Mostly for phenix users and those don't like using Miniconda
# 1. wget url_to_tar_file.tar
# 2. tar -xf url_to_tar_file.tar
# 3. source amber17/ambersh
# 4. Just it
""" Usage example: python pack_non_conda.py ambertools-17.0.1-py27_1.tar.bz2
Note: You can use file pattern
This script will unpack that bz2 file... | [
{
"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 | conda_tools/pack_non_conda.py | Amber-MD/ambertools-binary-build |
from tabulate import tabulate
import re
from cesium.features.graphs import (feature_categories, dask_feature_graph,
extra_feature_docs)
def feature_graph_to_rst_table(graph, category_name):
"""Convert feature graph to Sphinx-compatible ReST table."""
header = [category_name... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": fals... | 3 | doc/tools/feature_table.py | acrellin/cesium |
#!/usr/bin/env python3
def countdown(n):
if n <= 0:
print()
return
print(n, end=' ')
countdown(n-1)
countdown(5)
print(list(range(5, 0, -1)))
print(list(x for x in range(5, 0, -1)))
def countdown2(n):
if n <= 0:
yield 'stop'
else:
yield n
for i in countdo... | [
{
"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 | PartIVExercises/11/countdown.py | eroicaleo/LearningPython |
import csv
import os
from histdata.api import download_hist_data
def mkdir_p(path):
import errno
try:
os.makedirs(path)
except OSError as exc:
if exc.errno == errno.EEXIST and os.path.isdir(path):
pass
else:
raise
def download_all():
with open('pairs.... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
... | 3 | download_all_fx_data.py | feilongbk/FX-1-Minute-Data |
#!/usr/bin/env python
# file name: google_search.py
# created by: Ventura Del Monte
# purpose: Google Search Implementation
# last edited by: Ventura Del Monte 04-10-2014
from internal_browser import *
from bs4 import BeautifulSoup
import urlparse
import re
class GoogleSearch(InternalBrowser):
# base_url = "https:/... | [
{
"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 | analyzer/google_search.py | Gr1ph00n/staticwebanalyzer |
"""Create an animation asset."""
import bpy
from avalon import api
from avalon.blender import lib, ops
from avalon.blender.pipeline import AVALON_INSTANCES
from openpype.hosts.blender.api import plugin
class CreateAnimation(plugin.Creator):
"""Animation output for character rigs"""
name = "animationMain"
... | [
{
"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 | openpype/hosts/blender/plugins/create/create_animation.py | philipluk/OpenPype |
import asyncio
import importlib.resources
import aioconsole
from playsound import playsound
import niescraper.resources
async def play_alarm():
with importlib.resources.path(niescraper.resources, 'alarm.mp3') as alarm_file:
while asyncio.get_running_loop().is_running():
playsound(alarm_file,... | [
{
"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 | niescraper/alarm.py | elKei24/niescraper |
import os
import tempfile
import pytest
import mlagents.trainers.tensorflow_to_barracuda as tf2bc
from mlagents.trainers.tests.test_nn_policy import create_policy_mock
from mlagents.trainers.settings import TrainerSettings
from mlagents.tf_utils import tf
from mlagents.model_serialization import SerializationSettings,... | [
{
"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 | ml-agents/mlagents/trainers/tests/test_barracuda_converter.py | bobcy2015/ml-agents |
from rest_framework import serializers
from profiles_api import models
class HelloSerializer(serializers.Serializer):
"""Serializes a name field for testing our APIView"""
name = serializers.CharField(max_length=10)
class UserProfileSerializer(serializers.ModelSerializer):
"""Serializes a user profile obj... | [
{
"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 | profiles_api/serializers.py | mcabrejos24/profiles-rest-api |
_TF_INCLUDE_PATH = "TF_INCLUDE_PATH"
_TF_LIB_PATH = "TF_LIB_PATH"
def _get_env_var_with_default(repository_ctx, env_var):
"""Returns evironment variable value."""
if env_var in repository_ctx.os.environ:
value = repository_ctx.os.environ[env_var]
return value
else:
fail("Environment variable '%s' was... | [
{
"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 | third_party/tensorflow/tensorflow_configure.bzl | waveflow-team/waveflow |
"""App drf url tests.
"""
from unittest import mock
import pytest
from django.urls import resolve, reverse
from .factories import ProjectFactory
pytestmark = pytest.mark.django_db
@pytest.mark.fast
@mock.patch(
"vision_on_edge.azure_projects.models.Project.validate",
mock.MagicMock(return_value=True),
)
d... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answ... | 3 | factory-ai-vision/EdgeSolution/modules/WebModule/backend/vision_on_edge/azure_projects/tests/test_drf_urls.py | kaka-lin/azure-intelligent-edge-patterns |
import unittest
from python_oop.testing.exercise.vehicle.project.vehicle import Vehicle
# from project.vehicle import Vehicle
class VehicleTest(unittest.TestCase):
def setUp(self):
self.vehicle = Vehicle(50.0, 300.0)
def test_vehicle__init_method(self):
self.assertEqual(50.0, self.vehicle.fu... | [
{
"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 | testing/exercise/vehicle/test/test_vehicle.py | PetkoAndreev/Python-OOP |
#! /usr/bin/env python
# Bruce Schneier algorithm
def mpow(a, b, m):
if a < 0:
a += m
c = 1
while b >= 1:
if b % 2 == 1:
c = (a * c) % m
a = pow(a, 2) % m
b = b // 2
return c
# extended Euclidean algorithm
def minv(a, m):
b = m
u = 1
v = 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_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer":... | 3 | eclib/modutils.py | KaoruTeranishi/EncryptedControl |
import os
import numpy as np
from keras import backend as K
from keras.losses import mean_absolute_error
import utils
from model import wdsr_b
def psnr(hr, sr, max_val=2):
mse = K.mean(K.square(hr - sr))
return 10.0 / np.log(10) * K.log(max_val ** 2 / mse)
def data_generator(path, batch_size=8, input_shap... | [
{
"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 | src/train.py | zhaipro/keras-wdsr |
# Example module for Online Python Tutor
# Philip Guo
# 2013-08-03
# To get the Online Python Tutor backend to import this custom module,
# add its filename ('htmlexample_module') to the CUSTOM_MODULE_IMPORTS
# tuple in pg_logger.py
# To see an example of this module at work, write the following code in
# http://pyth... | [
{
"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 | v3/htmlexample_module.py | ambadhan/OnlinePythonTutor |
import unittest, sys
sys.path.extend(['.','..','py'])
import h2o, h2o_cmd, h2o_hosts, h2o_import as h2i
# test some random csv data, and some lineend combinations
class Basic(unittest.TestCase):
def tearDown(self):
h2o.check_sandbox_for_errors()
@classmethod
def setUpClass(cls):
global loc... | [
{
"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 | py/testdir_single_jvm/notest_parse3.py | vkuznet/h2o |
import motor.motor_asyncio
from fastapi import FastAPI
from fastapi_users import FastAPIUsers, models
from fastapi_users.authentication import JWTAuthentication
from fastapi_users.db import MongoDBUserDatabase
DATABASE_URL = "mongodb://localhost:27017"
SECRET = "SECRET"
class User(models.BaseUser):
pass
class ... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answ... | 3 | docs/src/full_mongodb.py | rnd42/fastapi-users |
# -*- coding: utf-8 -*-
from os.path import dirname, abspath
import sys
sys.path.insert(0, dirname(dirname(abspath(__file__))))
import utils.config_loader as config
import utils.config_loader as config
import utils.tools as tools
import torch
import shutil
versions = ['sl', 'alpha']
para_org = True
for vv in versio... | [
{
"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/summ/rank_sent.py | yumoxu/querysum |
# https://app.codesignal.com/company-challenges/mz/zCYv3tuxRE4JajQNY
def questEfficiencyItem(hours, points, time_for_quests):
# Time is short, you want to complete as many quests as possible
# but it's difficult to do so. So we want to maximize the points
# we can obtain with quests in a given limited time.... | [
{
"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 | CodeSignal/Challenges/MZ/06_Quest_Efficiency_Item.py | Zubieta/CPP |
from django.test import TestCase, Client
from django.contrib.auth import get_user_model
from django.urls import reverse
class AdminSiteTests(TestCase):
def setUp(self):
self.client = Client()
self.admin_user = get_user_model().objects.create_superuser(
email="admin@londonappdev.com", 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": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false... | 3 | app/core/tests/test_admin.py | EvandroLippert/recipe-app-api |
import json
from allensdk.core.brain_observatory_cache import BrainObservatoryCache
def compress_roi(roi):
mask = []
for i, row in enumerate(roi):
for j, flag in enumerate(row):
if flag:
mask.append((i, j))
return mask
def sample(signal, n):
size = int(len(signa... | [
{
"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 | data/getdata.py | arclamp/roi-thumbnail |
# push: O(1)
# pop: O(1)
# top: O(1)
# getMin: O(1)
class MinStack:
def __init__(self):
"""
initialize your data structure here.
"""
self.stack = []
self.min = float('inf')
def push(self, x: int) -> None:
if x<self.min:
self.min = x
self.st... | [
{
"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 | 30DayChallenge_April/april_10_minstack.py | cmattey/leetcode_problems |
# -*- coding: utf-8 -*-
from pytest import raises
from mock import Mock
from pyee import EventEmitter, PatternException
def test_is_pattern():
ee = EventEmitter()
assert ee._isPattern('a/#')
assert ee._isPattern('a/+/+')
assert not ee._isPattern('a/#/+')
assert not ee._isPattern('a/c+/c')
ass... | [
{
"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 | tests/test_matching.py | joliveros/pyee-topics |
import time
from M4i6622 import *
from Functions.functions import *
#4 functions to be used
def f0(x):
return sin(x)#sin_for_time(60000000, 40000000, 20000,10000, x)
def f1(x):
return sin(x)
def f2(x):
return sin(x,f=1000)
def f3(x):
return x
t0 = time.perf_counter()
... | [
{
"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 | testing.py | vuthalab/spectrum-awg |
from PIL import Image
import os
import pathlib
from .constants import *
def calcDP(px):
index = -1
if px in SIZES_PX:
index = SIZES_PX.index(px)
else:
for item in SIZES_PX:
if item > px:
index = SIZES_PX.index(item)
break
if index == -1:
... | [
{
"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 | drimg/functions.py | hojjat-faryabi/drawable_image |
import argparse
from train import start_training
import cv2
from skimage import feature
import numpy as np
import dlib
import tensorflow as tf
import keras
def get_cmd_args():
""" Parse user command line arguments"""
parser = argparse.ArgumentParser()
parser.add_argument("-d","--dataset_dir",default="dat... | [
{
"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 | train/__main__.py | mitiku1/Emopy-Multi-Input- |
#!/usr/bin/env python
# coding=utf-8
import socket
import requests
requests.packages.urllib3.disable_warnings()
from lib.common import save_user_script_result
def do_check(self, url):
if url != '/':
return
ip = self.host.split(':')[0]
ports_open = is_port_open(ip)
headers = {
"User-Ag... | [
{
"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 | scripts/http_proxy.py | aStrowxyu/bbscan |
from django.shortcuts import get_object_or_404
from rest_framework import serializers
from .models import Category, Comment, Genre, Review, Title
class CategorySerializer(serializers.ModelSerializer):
class Meta:
model = Category
fields = (
"name",
"slug",
)
clas... | [
{
"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 | api/serializers.py | Vadim3x4/yamdb_final |
import textwrap
def test_day01():
"""Tests that the simple test case for 2020 day 01 works"""
from advent_of_code.y2020.day01 import report_repair
data = textwrap.dedent("""
1721
979
366
299
675
1456
""")
data = data.strip().split("\n")
result = ... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer":... | 3 | python/tests/test_2020.py | stonecharioteer/advent-of-code |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding unique constraint on 'Keyword', fields ['kw_text']
db.create_uni... | [
{
"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 | okhelptexts/migrations/0003_auto__add_unique_keyword_kw_text.py | MeirKriheli/Open-Knesset |
from flask import Flask, render_template
from Blueprints.Browser.route import BrowserBP
app = Flask(__name__)
app.secret_key = b'YOUR_SUPER_SECRET_KEY'
app.register_blueprint(BrowserBP)
@app.route('/')
def index():
return render_template('Homepage.html')
@app.route('/contact')
def contactme():
return rend... | [
{
"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 | app.py | mass1ve-err0r/HeadsInTheCloud |
import os
try:
import cPickle as pickle
except ImportError:
import pickle
from Histogrammer import HistReader, HistCollector
from drawing.dist_multicomp_v2 import dist_multicomp_v2
class GStarCorrectionReader(HistReader):
def begin(self, event):
self.histograms.begin(event, [event.config.dataset.... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class 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": false
}... | 3 | sequence/Collectors/GStarCorrection.py | albertdow/zinv-analysis |
"""Utilities for running custom scripts
"""
from argparse import Namespace
from core.constructs.workspace import Workspace
from core.constructs.output_manager import OutputManager
def execute_run_cli(args) -> None:
ws = Workspace.instance()
output_manager = OutputManager()
run_command(ws, output_mana... | [
{
"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 | src/core/commands/run.py | cdev-framework/cdev-sdk |
# This file is autogenerated. Do not edit it manually.
# If you want change the content of this file, edit
#
# spec/fixtures/responses/whois.domreg.lt/status_available
#
# and regenerate the tests with the following script
#
# $ scripts/generate_tests.py
#
from nose.tools import *
from dateutil.parser import pars... | [
{
"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 | test/record/parser/test_response_whois_domreg_lt_status_available.py | huyphan/pyyawhois |
import os
def encode_path(path):
if not path:
return path
if os.name == "nt":
if os.path.isabs(path):
drive, rest = os.path.splitdrive(path)
return "/" + drive[:-1].upper() + rest.replace("\\", "/")
else:
return path.replace("\\", "/")
else:
return path
def decode_path(path):
... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding ... | 3 | paths.py | backchatio/sublime-ensime |
# Copyright (c) 2020 Julian Bernhard, Klemens Esterle, Patrick Hart and
# Tobias Kessler
#
# This work is licensed under the terms of the MIT license.
# For a copy, see <https://opensource.org/licenses/MIT>.
from bark.world.opendrive import *
from bark.world import *
from bark.geometry import *
from bark.runtime impor... | [
{
"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 | modules/runtime/runtime.py | Lizhu-Chen/bark |
import sys
import json
import requests
from flask import Flask
from flask import request
from tracing import init_tracer, flask_to_scope
import opentracing
from opentracing.ext import tags
from opentracing_instrumentation.client_hooks import install_all_patches
from flask_opentracing import FlaskTracer
from flask_cors ... | [
{
"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 | newsletter/src/newsletter.py | emilybache/BeeFriendly |
import datetime
import unittest
from time import sleep
from unittest import TestCase
from pbx_gs_python_utils.utils.Dev import Dev
from gw_bot.elastic.Save_To_ELK import Save_To_ELK
from gw_bot.helpers.Test_Helper import Test_Helper
class Test_Save_To_ELK(Test_Helper):
def setUp(self):
super().setUp()
... | [
{
"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_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer":... | 3 | tests/unit/elastic/test_Save_To_ELK.py | atykhonov/GW-Bot |
from test.parser.pattern.nodes.base import PatternTestBaseClass
from programy.parser.exceptions import ParserException
from programy.parser.pattern.nodes.that import PatternThatNode
from programy.parser.pattern.nodes.root import PatternRootNode
class PatternThatNodeTests(PatternTestBaseClass):
def test_init(sel... | [
{
"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/test/parser/pattern/nodes/test_that.py | hiitsme123/python |
from django.core.files.storage import Storage
from django.conf import settings
class FastDFSStorage(Storage):
"""自定义文件存储系统,修改存储的方案"""
def __init__(self, fdfs_base_url=None):
"""
构造方法,可以不带参数,也可以携带参数
:param base_url: 存储服务器的位置
"""
self.fdfs_base_url = fdfs_base_url or set... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/c... | 3 | meiduo_mall/meiduo_mall/utils/fastdfs/fdfs_storage.py | Noah-Smith-wgp/meiduo_project |
from flask import render_template,redirect,url_for, flash,request
from . import auth
from flask import render_template,redirect,url_for
from ..models import User
from .forms import RegistrationForm,LoginForm
from .. import db
from flask_login import login_user,logout_user,login_required
@auth.route('/login',methods=[... | [
{
"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 | Dnmrk4/watchlist |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
This is rumdom run node.
subscribe No topcs.
Publish 'cmd_vel' topic.
mainly use for simple sample program
by Takuya Yamaguhi.
'''
import rospy
import random
from geometry_msgs.msg import Twist
class RandomBot():
def __init__(self, bot_name="NoName"):
... | [
{
"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 | burger_war_dev/scripts/randomRun.py | Satori063/burger_war_dev |
"""
localhost
---------
"""
import socket, os
def get_localhostname():
if os.environ.get("DOC", False) == True:
return socket.gethostname()
else:
return "sphinx-doc"
def get_ip_adress():
if os.environ.get("DOC", False) == True:
try:
s = socket.socket(socket.AF_INET, s... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"... | 3 | liesl/streams/__init__.py | jasmainak/pyliesl |
from flask import jsonify
class CustomResponse :
def __init__(self, statuscode, data):
self.statuscode = {"status":statuscode, "response_body" : data}
self.response = {"status":statuscode, "data" : data}
self.data_out = data
def getres(self):
return jsonify(self.statuscode)... | [
{
"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 | anuvaad-etl/anuvaad-nmt-models-fetch/src/models/response.py | ManavTriesStuff/anuvaad |
from django.test import TestCase
from django.contrib.auth import get_user_model
class ModelTest(TestCase):
def test_create_user_with_email_successfully(self):
email = 'test@test.com'
password = '12345'
user = get_user_model().objects.create_user(
email=email,
passw... | [
{
"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/core/tests/test_model.py | burakkirlaroglu/recipe-app-api |
from decrypt_file import decrypt
from get_commands import fetch_commands
import netmiko
import os
import concurrent.futures
hosts = decrypt(f'{os.getcwd()}/device_json.gpg')
def send_commands(connection, host, commands):
connection.send_config_set(commands)
return
def run(ip_address):
for device in hosts... | [
{
"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 | main.py | flatman123/device_auto_config_v0.0.1 |
from django.db import models
from .utils import unique_id, get_object_or_none
class BaseModel(models.Model):
"""Base model"""
id = models.CharField(max_length=22, editable=False, primary_key=True)
def __make_id(self):
uid = unique_id()[::2] # Limited to 11 characters
obj = get_object_o... | [
{
"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 | common/models.py | ssa17021992/djrest |
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
}... | 3 | py/src/ai/h2o/sparkling/ml/params/HasInitialBiases.py | krmartin/sparkling-water |
# uncompyle6 version 3.2.0
# Python bytecode 2.4 (62061)
# Decompiled from: Python 2.7.14 (v2.7.14:84471935ed, Sep 16 2017, 20:19:30) [MSC v.1500 32 bit (Intel)]
# Embedded file name: pirates.minigame.Distributed7StudTable
from pirates.minigame import PlayingCardGlobals
from pirates.minigame import DistributedPokerTabl... | [
{
"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 | pirates/minigame/Distributed7StudTable.py | itsyaboyrocket/pirates |
class Country:
def __init__(self):
self.code = ""
self.name = ""
self.population = ""
self.continent = ""
self.surfaceArea = ""
def __str__(self):
return f"Country [code= {self.code}, name= {self.name}, continent= {self.continent}, population= {self.population}]"... | [
{
"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 | module05-xml.processing.using.python/world/domain.py | deepcloudlabs/dcl162-2020-sep-02 |
# -*- coding: utf-8 -*-
# The MIT License (MIT)
#
# Copyright (c) 2015 Björn Larsson
#
# 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 limitation the r... | [
{
"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 | robot/control/controller.py | avasanthc/Autonomous-Robot-Code |
import unittest
from os import path
import json
import ndex.beta.layouts as layouts
from ndex.networkn import NdexGraph
HERE = path.abspath(path.dirname(__file__))
class NetworkNConstructorTests(unittest.TestCase):
def test1(self):
with open(path.join(HERE, 'tiny_corpus.cx'),'r') as cx_file:
... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answe... | 3 | ndex/test/test_NetworkNConstructor.py | idekerlab/heat-diffusion |
#!/usr/bin/env python3
# Copyright (c) 2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test the RPC call related to the uptime command.
Test corresponds to code in rpc/server.cpp.
"""
import ti... | [
{
"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 | test/functional/rpc_uptime.py | HUSKI3/Neblio-Node |
import os, sys, subprocess
def writetofile(args):
with open(args[0], 'w') as f:
f.write(' '.join(args[1:]))
def writeenvtofile(args):
with open(args[0], 'w') as f:
f.write(os.environ[args[1]])
def writesubprocessenvtofile(args):
with open(args[0], 'w') as f:
p = subprocess.Popen([sys.executable, "-... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (ex... | 3 | tests/pycmd.py | JeremyMarshall/pymake |
# Copyright 2014 NEC Corporation. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required ... | [
{
"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 | tempest/api/compute/images/test_list_image_filters_negative.py | cityofships/tempest |
import logging
from ambianic.configuration import get_root_config
from dynaconf.vendor.box.exceptions import BoxKeyError
from fastapi import HTTPException, status
from pydantic import BaseModel
log = logging.getLogger(__name__)
# Base class for pipeline input sources such as cameras and microphones
class SensorSour... | [
{
"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 | src/ambianic/webapp/server/config_sources.py | ivelin/ambianic-edge |
#
# Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... | [
{
"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 | tools/Polygraphy/polygraphy/tools/debug/debug.py | hwkyai/TensorRT |
import os
from pathlib import Path
from torchaudio.datasets import utils as dataset_utils
from torchaudio.datasets.commonvoice import COMMONVOICE
from torchaudio_unittest.common_utils import (
TempDirMixin,
TorchaudioTestCase,
get_asset_path,
)
class TestWalkFiles(TempDirMixin, TorchaudioTestCase):
... | [
{
"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/torchaudio_unittest/datasets/utils_test.py | adefossez/audio |
# -*- coding: utf-8 -*-
from multiplierless.csd import to_csd, to_csdfixed, to_decimal
def test_csd1():
"""[summary]"""
csdstr = "+00-00+"
csdnumber = to_decimal(csdstr)
csdnew = to_csd(csdnumber)
assert csdnew == csdstr
def test_csd2():
"""[summary]"""
csdstr = "+00-.000+"... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answ... | 3 | tests/test_csd.py | luk036/multiplierless-py |
import os
from bson.json_util import dumps
from flask_restful import Resource
from flask import Response
from utils.cache import cache
from utils.deepzoom import get_slide
class DeepZoom(Resource):
def __init__(self, config):
"""initialize DeepZoom resource
Args:
db: mongo db connection
config: application... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},... | 3 | routes/v1/DeepZoom.py | scimk/path_deepzoom |
# Monotonic array optimised solution
# Time complexity = O(n) | Space Complexity : O(1)
# method to check if the direction breaks
def directionChanged(direction, previous, current) :
difference = current - previous
if direction > 0 :
return difference < 0
return difference > 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": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fe... | 3 | Arrays/Task.py | ayushkr459/Data-Structures-And-Algorithms |
import sys
import os.path
currentDir = os.path.dirname(os.path.abspath(__file__))
sys.path.append(os.path.dirname(currentDir))
import aiohttp
import asyncio
import pypillary.request as request
import pypillary.model as model
class TestImageRequests:
def __init__(self):
with open(currentDir + "/client... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
}... | 3 | tests/ImageRequestsTest.py | ShkalikovOleh/PyPillary |
from sanic.views import HTTPMethodView
from sanic.response import json, text, html
from jinja2 import Environment, PackageLoader, select_autoescape, FileSystemLoader
import os
class BaseController(HTTPMethodView):
def __init__(self):
self.json = json
self.text = text
self.html = html
... | [
{
"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 | webgame/controller/BaseController.py | xiaojieluo/webgame |
#add parent dir to find package. Only needed for source code build, pip install doesn't need it.
import os, inspect
currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
parentdir = os.path.dirname(os.path.dirname(currentdir))
os.sys.path.insert(0,parentdir)
import gym
from pybullet_en... | [
{
"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 | examples/pybullet/gym/pybullet_envs/baselines/train_pybullet_cartpole.py | frk2/bullet3 |
from unittest import TestCase
from mock import patch
from .. import constants
class mock_service_exeTestCase(TestCase):
def setUp(self):
super(mock_service_exeTestCase, self).setUp()
self.addCleanup(patch.stopall)
self.mock_os = patch.object(constants, 'os', autospec=True).start()
d... | [
{
"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 | pact/test/test_constants.py | dwang7/pact-python |
import pytest
from eth_utils import (
decode_hex,
)
from eth_keys import keys
from trinity.utils.chains import (
get_local_data_dir,
get_database_dir,
get_nodekey_path,
ChainConfig,
)
from trinity.utils.filesystem import (
is_same_path,
)
def test_chain_config_computed_properties():
dat... | [
{
"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 | tests/trinity/core/chains-utils/test_chain_config_object.py | theresume/py-evm |
#
from binho.errors import DriverCapabilityError
class binhoAccessory:
""" Base class for objects representing accessory boards. """
# Optional: subclasses can set this variable to override their accessory name.
# If not provided, their name will automatically be taken from their class names.
# This ... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},... | 3 | binho/accessory.py | binhollc/binho-python-package |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
class AlipayFundJointaccountOperationApproveResponse(AlipayResponse):
def __init__(self):
super(AlipayFundJointaccountOperationApproveResponse, self).__init__()
def parse_res... | [
{
"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 | alipay/aop/api/response/AlipayFundJointaccountOperationApproveResponse.py | antopen/alipay-sdk-python-all |
"""
Created by Epic at 9/1/20
"""
class HTTPException(Exception):
def __init__(self, request, data):
self.request = request
self.data = data
super().__init__(data)
class Forbidden(HTTPException):
pass
class NotFound(HTTPException):
def __init__(self, request):
self.requ... | [
{
"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 | speedcord/exceptions.py | MM-coder/speedcord |
import sys
import os
import time
from kafka import KafkaProducer
# USAGE:
# python3 ./temperature-send.py host:port kafka-topic device_id
#
# Messages are sent to the kafka broker residing at host:port with topic kafka-topic
# They are being formatted as a key-value pair consisting of device_id->temperature
#
# @aut... | [
{
"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 | temperature-send.py | bredlej/alivetest |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.