source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
from django.contrib import admin
from django.contrib.admin import ModelAdmin
from common.admin import BaseRegionalAdminMixin
from containers.models import Container
@admin.register(Container)
class ContainerAdmin(BaseRegionalAdminMixin, ModelAdmin):
ordering = ("size_class",)
list_display = (
"id",
... | [
{
"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 | containers/admin.py | stanwood/traidoo-api |
# IMPORTATION STANDARD
# IMPORTATION THIRDPARTY
import pytest
# IMPORTATION INTERNAL
from openbb_terminal.stocks.government import quiverquant_model
@pytest.fixture(scope="module")
def vcr_config():
return {
"filter_headers": [("Authorization", "MOCK_TOKEN")],
}
@pytest.mark.vcr
@pytest.mark.param... | [
{
"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/openbb_terminal/stocks/government/test_quiverquant_model.py | tehcoderer/GamestonkTerminal |
class Solution:
# Delete row func using indexes, O(n*m) time, O(1) space
def minDeletionSize(self, strs: List[str]) -> int:
n, m = len(strs), len(strs[0])
def delete(j):
for i in range(n-1):
if strs[i][j] > strs[i+1][j]:
return True
re... | [
{
"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 | sols/944.py | Paul11100/LeetCode |
import os
import io
from stanza_wrapper import parse
__here__ = os.path.dirname(os.path.realpath(__file__))
txt = b'''Dit is een tekst. Er zijn twee zinnen.'''
def assert_equal(val1, val2):
assert val1 == val2
def test_tokenize():
my_obj = parse(io.BytesIO(txt))
token_list = list(my_obj.get_tokens())
... | [
{
"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_tokenizer.py | Filter-Bubble/stanza_wrapper |
#!/usr/bin/env python
import logging
import os
from pprint import pformat
from .cleaner import delete_tweets, print_tweet_urls, print_user_info
from .util import parse_options, write_credentials_template
def main():
args = parse_options()
_set_log_config(args=args)
logging.debug('args:' + os.linesep + 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": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": fals... | 3 | deltw/cli.py | dceoy/extract-twitter-id |
import cv2
class SimplePreprocessor:
def __init__(self, width, height, inter=cv2.INTER_AREA):
# store the target image width, height, and interpolation
# method used when resizing
self.width = width
self.height = height
self.inter = inter
def preprocess(self, image):
... | [
{
"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 | 22. Neural Networks from Scratch/preprocessing/simplepreprocessor.py | Arjitg450/Machine-Learning-Case-Studies |
# -*- coding: utf-8 -*-
"""
Created on Wed Nov 28 01:15:31 2018
@author: Andres
"""
import pandas as pd
url = 'http://catalogo.datosabiertos.gob.ec/api/action/datastore_search?resource_id=8513f446-1c94-426e-8592-d4cbdd295f33&limit=1000'
datos = pd.read_json(url, typ='frame')
datos =pd.DataFrame.from_dict(datos["res... | [
{
"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 | 03_spyder/proyecto_spyder.py | 2018-B-GR1-Python/Velasco-Yepez-Andres-David |
# coding: utf-8
"""
UltraCart Rest API V2
UltraCart REST API Version 2
OpenAPI spec version: 2.0.0
Contact: support@ultracart.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
import unittest
import ultracart
f... | [
{
"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 | test/test_item_option.py | gstingy/uc_python_api |
#
# Copyright Soramitsu Co., Ltd. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
#
import irohalib
import commons
import primitive_pb2
admin = commons.new_user('admin@first')
alice = commons.new_user('alice@second')
iroha = irohalib.Iroha(admin['id'])
@commons.hex
def genesis_tx():
test_permissions ... | [
{
"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 | example/python/permissions/can_get_all_acc_txs.py | artyom-yurin/iroha-archive |
import os
from unittest import mock
def delete_file(filename):
while os.path.exists(filename):
os.unlink(filename)
@mock.patch('os.path.exists', side_effect=(True, False, False))
@mock.patch('os.unlink')
def test_delete_file(mock_exists, mock_unlink):
# first try:
delete_file('some non-existing ... | [
{
"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 | books/masteringPython/cp10/source_test/mock_delete.py | Bingwen-Hu/hackaway |
from typing import Any, Callable, Dict, Iterable, List
import spotipy
from spotipy.oauth2 import SpotifyOAuth
from . import constants
from .types import Track
def get_saved_tracks() -> List[Track]:
"""Gets list of saved tracks using Spotify API.
Returns
-------
List[Track]
list of users sav... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 2... | 3 | spotify_2_apple_music/spotify.py | ryansingman/spotify-2-apple-music |
"""change SystemParameter key to name
Revision ID: cae154d4dcb4
Revises: 17e220f9fafb
Create Date: 2021-09-24 13:42:12.722846
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'cae154d4dcb4'
down_revision = '17e220f9fafb'
branch_labels = None
depends_on = None
... | [
{
"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 | apis/alembic/versions/cae154d4dcb4_change_systemparameter_key_to_name.py | iii-org/devops-system |
from .._py2 import *
class CacheError(Exception):
'''Base class for exceptions related to the cache'''
pass
class PageNotCachedError(CacheError):
'''Exception raised when a non-existent page is requested'''
def __init__(self):
super().__init__('This page has not been cached yet.')
class Page... | [
{
"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": true
},
{
... | 3 | mixnmatchttp/cache/exc.py | aayla-secura/simple_CORS_https_server |
from bs4 import BeautifulSoup
from ..occurrences.occurrences import Occurrences
from ..occurrences.occurrence_interface import OccurrenceInterface
class Recommendation36:
"""
Recomendação 36: Nome da recomendação
- Fornecer controle para áudio
"""
def __init__(self, sourcecode):
self.rec... | [
{
"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 | crawling/recommendations/recommendation36.py | carlosbognar/TCC-WCGA-1 |
'''
LeetCode LinkedList Q.876 Middle of the Linked List
Recusion and Slow/Fast Pointer Solution
'''
def middleNode(self, head: ListNode) -> ListNode:
def rec(slow, fast):
if not fast:
return slow
elif not fast.next:
return slow
return rec(slow.next, fast.next.nex... | [
{
"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 | Q876_Middle_Linked_List.py | amitjoshi9627/LeetCode-Solutions |
from plenum.common.messages.node_messages import Nomination, Primary
from plenum.server.replica import Replica
from plenum.test.test_node import TestNode
def checkNomination(node: TestNode, nomineeName: str):
matches = [replica.name for instId, replica in enumerate(node.elector.replicas) if
node.el... | [
{
"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 | plenum/test/primary_election/helpers.py | spivachuk/plenum |
import pygame
import random
import math
import enemies.enemy
class ZigZagEnemy(enemies.enemy.Enemy):
def __init__(self, game):
super().__init__(game)
self.timer = self.game.getRepeateTimer()
self.timer.duration = 3000
self.timer.action = self.changeAngle
def changeAngle(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": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding se... | 3 | PyShooter/enemies/zigzagenemy.py | ildave/PyShooter |
load("//:deps.bzl",
"bazel_gazelle",
"bazel_skylib",
"org_pubref_rules_node",
"build_bazel_rules_nodejs",
"build_bazel_rules_typescript",
"com_google_protobuf",
"io_bazel_rules_closure",
"io_bazel_rules_go",
"io_bazel_rules_webtesting",
"ts_protoc_gen",
)
def ts_proto_compile(*... | [
{
"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 | github.com/improbable-eng/ts-protoc-gen/deps.bzl | mirandacong/rules_proto |
from ignition.dsl.flame.tensors.tensor_names import (convert_name,
add_lower_ind, add_upper_ind, set_lower_ind, set_upper_ind, to_latex)
def test_convert_name():
assert(convert_name("A", 2) == "A")
assert(convert_name("A", 1) == "a")
assert(convert_name("A", 0) == "alpha")
assert(convert_name("a", ... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer"... | 3 | ignition/dsl/flame/tensors/tests/test_tensor_names.py | IgnitionProject/ignition |
# -*- encoding: utf-8 -*-
from django.core.management import BaseCommand
from django.db.models import CharField, TextField, Q
from django.apps import apps
from bpp.models import Sumy, Typ_KBN, Charakter_Formalny
from bpp.util import usun_nieuzywany_typ_charakter
class Command(BaseCommand):
help = "Usuwa nieuzywa... | [
{
"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 | src/bpp/management/commands/usun_nieuzywane_charaktery_kbny.py | iplweb/django-bpp |
import json
import logging
import time
from six.moves.urllib.request import urlopen
SPACEL_URL = 'https://ami.pbl.io/spacel/%s.json'
logger = logging.getLogger('spacel.aws.ami')
class AmiFinder(object):
def __init__(self, channel=None, cache_bust=None):
self._channel = channel or 'stable'
self.... | [
{
"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_has_docstring",
"question": "Does every function in this file have a docs... | 3 | src/spacel/aws/ami.py | mycloudandme/spacel-provision |
# -*- coding: utf-8 -*-
# Copyright 2010 Dirk Holtwick, holtwick.it
#
# 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 ... | [
{
"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 | xhtml2pdf/turbogears.py | trib3/xhtml2pdf |
# coding=utf-8
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.modules import conv
from torch.nn.modules.utils import _single
from ..functions.max_sv import max_singular_value
class SNConv1d(conv._ConvNd):
def __init__(self, in_channels, out_channels, kernel_size, stride=1, paddin... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding se... | 3 | src/snlayers/snconv1d.py | Zihang97/PAGAN |
from . import get_connector, get_engine
import pandas as pd
def get_dataframe(table_name, limit=None):
# limit query
limit_query=""
if limit:
limit_query="limit {}".format(limit)
# create query
query = "SELECT * FROM {} {}".format(table_name, limit_query)
# get dataframe from sql qu... | [
{
"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 | db/pandas.py | NovaSBE-DSKC/retention-evaluation |
import os
from swaglyrics.cli import lyrics
from swaglyrics import SameSongPlaying
from flask import Flask, render_template
from SwSpotify import spotify, SpotifyNotRunning
app = Flask(__name__, template_folder=os.path.join(os.path.dirname(os.path.abspath(__file__)), 'templates'))
# use relative path of the template f... | [
{
"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 | swaglyrics/tab.py | Tantan4321/SwagLyrics-For-Spotify |
import logging
from .Container import Container
class SyslogUdpClientContainer(Container):
def __init__(self, name, vols, network, image_store, command=None):
super().__init__(name, 'syslog-udp-client', vols, network, image_store, command)
def get_startup_finished_log_entry(self):
return "Sys... | [
{
"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 | docker/test/integration/minifi/core/SyslogUdpClientContainer.py | nandorsoma/nifi-minifi-cpp |
#!/usr/bin/ctx python
# -*- coding: UTF-8 -*-
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import pytest
import time
import redis
from pprint import pprint as pp
from sensor.constants import (TEST_CAHNNEL_ID, CONFIG)
class PublishMock(object):
de... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},... | 3 | tests/test_monitor.py | autostack/pytest-sensor |
from suds.client import Client
from suds import WebFault
from model.project import Project
class SoapHelper:
def __init__(self, app):
self.app = app
def can_login(self, username, password):
client = Client("http://localhost:8080/mantisbt-1.2.20/api/soap/mantisconnect.php?wsdl")
try:
... | [
{
"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 | fixture/soap.py | nicholas-y/python_mantis |
__version__ = "0.4.4"
from typing import Dict
_OPT_DEFAULTS: Dict[str, bool] = dict(
specialized_code=True,
optimize_einsums=True,
jit_script_fx=True,
)
def set_optimization_defaults(**kwargs) -> None:
r"""Globally set the default optimization settings.
Parameters
----------
**kwargs
... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true... | 3 | e3nn/__init__.py | claycurry34/e3nn |
# -*- coding: utf-8 -*-
# Copyright 2021 Red Hat
# GNU General Public License v3.0+
# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
"""
Unit test file for netaddr test plugin: mac
"""
from __future__ import absolute_import, division, print_function
__metaclass__ = type
import unittest
from ansible_colle... | [
{
"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 | venv/lib/python3.6/site-packages/ansible_collections/ansible/utils/tests/unit/plugins/test/test_mac.py | usegalaxy-no/usegalaxy |
"""Checks for obsolete messages in PO files.
Returns an error code if a PO file has an obsolete message.
"""
import argparse
import sys
def check_obsolete_messages(filenames, quiet=False):
"""Warns about all obsolete messages found in a set of PO files.
Parameters
----------
filenames : list
... | [
{
"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 | hooks/obsolete_messages.py | mondeja/pre-commit-po-hooks |
import tflite_runtime.interpreter as tflite
from PIL import Image
from io import BytesIO
from urllib import request
import numpy as np
#import model
interpreter = tflite.Interpreter(model_path='cats-dogs-v2.tflite')
interpreter.allocate_tensors()
# get input and output index
input_index = interpreter.g... | [
{
"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 | 9_Serverless/lambda_function.py | snikhil17/mlzoomcamp |
#!/usr/bin/env python3
import os
import logging
import json
import argparse
from gen import engine_pb2
from gen import issue_pb2
logger = logging.getLogger(__name__)
parser = argparse.ArgumentParser()
__source_dir = "/dracon/source"
def parse_flags(args: object) -> object:
"""
Parses the input flags for ... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding... | 3 | producers/producer.py | ValntinDragan/dracon-1 |
__all__ = ("group_attempts", "fails_filter", "reduce_to_failures",)
def group_attempts(sequence, filter_func=None):
if filter_func is None:
filter_func = lambda x:True
last, l = None, []
for x in sequence:
if isinstance(x, tuple) and x[0] == 'inspecting':
if l:
... | [
{
"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 | src/pkgcore/resolver/util.py | thesamesam/pkgcore |
from django import forms
from sme_uniforme_apps.proponentes.models import Anexo
class AnexoForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
super(AnexoForm, self).__init__(*args, **kwargs)
self.fields['tipo_documento'].required = True
class Meta:
model = Anexo
fi... | [
{
"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 | sme_uniforme_apps/proponentes/models/forms.py | prefeiturasp/SME-PortalUniforme-BackEnd |
import os
from unittest import TestCase
class TestCLI(TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def test_get_command(self):
pass
def test_index_of(self):
pass
def test_contains(self):
pass
def test_get_or_die(self):
pass
... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
... | 3 | tests/test_cli.py | simonski/pycommon |
from .BasicTypeAttr import BasicTypeAttr
class StringAttr(BasicTypeAttr):
def __init__(self, attr):
BasicTypeAttr.__init__(self, attr)
if self.get('Max') is not None:
self['Max'] = int(self['Max'])
if self.get('Min') is not None:
self['Min'] = int(self['Min'])
... | [
{
"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 | webware/MiddleKit/Core/StringAttr.py | PeaceWorksTechnologySolutions/w4py3-middlekit |
import unittest
import tests.io.generate_pazy_udpout as gp
import os
import shutil
class TestPazyCoupledStatic(unittest.TestCase):
"""
Test Pazy wing static coupled case and compare against a benchmark result.
As of the time of writing, benchmark result has not been verified but it
serves as a backward... | [
{
"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/io/test_pazy_udpout.py | ACea15/sharpy |
A = 'A'
B = 'B'
Environment = {
A: 'Dirty',
B: 'Dirty',
'Current': A
}
def REFLEX_VACUUM_AGENT(loc_st): # Determine action
if loc_st[1] == 'Dirty':
return 'Suck'
if loc_st[0] == A:
return 'Right'
if loc_st[0] == B:
return 'Left'
def Sensors(): # Sense Environment
... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding se... | 3 | Lecture_3_Agents/Exercise1/Exercises/reflex_vacuum_agent.py | aleksander-GD/AI-F20 |
import unittest
import os
from datetime import datetime
from util import Singleton
from .. import GithubService, GithubRemote, GithubRealRemote
@Singleton
class GithubMockRemote(GithubRemote):
def get_notifications(self):
return [{"type": "Issue", "title": "This is an issue"}]
def connect(self, key)... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
... | 3 | services/github/test/test_service.py | Ovakefali13/buerro |
# -*- coding: utf-8 -*-
# Copyright (c) 2020, omar jaber and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
from frappe import _
class OKRPerformanceProfile(Document):
def validate(self):
self.validate_... | [
{
"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 | one_fm/one_fm/doctype/okr_performance_profile/okr_performance_profile.py | askmetoo/One-FM |
from DAL.DAL_XRayPatient import DAL_XRayPatient
class BUS_XRayPatient():
def __init__(self):
self.dalXRayPatient = DAL_XRayPatient()
def firstLoadLinkXRay(self, IDPatient):
return self.dalXRayPatient.selectLinkXRayViaIDPatient(IDPatient=IDPatient)
def loadLinkXRay(self, IDPatient, XRayTyp... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
... | 3 | eHealth_Version1.0_01_13_2022_12_47_pm_Release/BUS/BUS_XRayPatient.py | kyvipro113/Graduation_Thesis |
from django.contrib.sitemaps import Sitemap
from Blog.models import Post
class BlogSitemap(Sitemap):
changefreq = "weekly"
priority = 0.5
def items(self):
return Post.objects.filter(status=True)
def lastmod(self, obj):
return obj.published_date
| [
{
"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 | Blog/sitemaps.py | myselfajp/MyFirstPage |
from django.contrib.auth.models import User
from rest_framework.test import APITestCase
class FVHAPITestCase(APITestCase):
def assert_dict_contains(self, superset, subset, path=''):
for key, expected in subset.items():
full_path = path + key
received = superset.get(key, None)
... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a ty... | 3 | django_server/feedback_map/rest/tests/base.py | ForumViriumHelsinki/FVHFeedbackMap |
# Go through a directory, gather all files with
# specific postfix and attempt converting them into
# .wav files with 16-bit, 16khz sampling rate.
import argparse
import os
import subprocess
from tqdm import tqdm
parser = argparse.ArgumentParser("Gather audio files from directory and turn them into .wav files")
parse... | [
{
"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_has_docstring",
"question": "Does every function in this file have a docs... | 3 | utils/audio_files_to_wav16.py | entn-at/asv-cm-reinforce |
"""
42. Storing files according to a custom storage system
``FileField`` and its variations can take a ``storage`` argument to specify how
and where files should be stored.
"""
import random
import tempfile
from django.db import models
from django.core.files.base import ContentFile
from django.core.files.storage imp... | [
{
"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 | src/django-nonrel/tests/modeltests/files/models.py | adamjmcgrath/glancydesign |
#!/usr/bin/env python
# Copyright (C) 2015 Dmitry Rodionov
# This software may be modified and distributed under the terms
# of the MIT license. See the LICENSE file for details.
from os import path
from time import sleep
def sanitize_path(raw_path):
""" Replace spaces with backslashes+spaces """
return raw_p... | [
{
"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 | analyzer/darwin/lib/dtrace/common.py | Yuanmessi/Bold-Falcon |
# coding: utf-8
"""
metal-api
API to manage and control plane resources like machines, switches, operating system images, machine sizes, networks, IP addresses and more # noqa: E501
OpenAPI spec version: v0.15.7
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __futur... | [
{
"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 | test/test_v1_filesystem_layout_constraints.py | metal-stack/metal-python |
"""Helper methods for components within Home Assistant."""
from __future__ import annotations
from collections.abc import Iterable, Sequence
import re
from typing import TYPE_CHECKING
from homeassistant.const import CONF_PLATFORM
if TYPE_CHECKING:
from .typing import ConfigType
def config_per_platform(
con... | [
{
"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 | homeassistant/helpers/__init__.py | PiotrMachowski/core |
from typing import List, Tuple
from ....source_shared.base import Base
from ....utilities.byte_io_mdl import ByteIO
class StudioTrivert(Base):
def __init__(self):
self.vertex_index = 0
self.normal_index = 0
self.uv = []
def read(self, reader: ByteIO):
self.vertex_index = read... | [
{
"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 | goldsrc/mdl_v6/structs/mesh.py | tltneon/SourceIO |
import pytest
@pytest.mark.webtest
def test_send_http():
print('========== Hello *********************************')
assert True
def test_something_quick():
pass
def test_another():
pass
class TestClass(object):
def test_method(self):
pass
# Run marked tests
# pytest -v -m webtest
... | [
{
"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 | 14_Lesson14/test_marking/test_example1.py | turovod/Otus |
# coding=utf-8
from __future__ import unicode_literals
from django import forms
from models import Result
# Create your forms here.
class QueryForm(forms.ModelForm):
class Meta:
model = Result
fields = ('doc_id', 'authorList',)
def clean(self):
form_doc_id = self.cleaned_data.get('d... | [
{
"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 | deep_stylo/forms.py | Ninad998/FinalYearProject |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Preprocessor for stemming
Created on Thu Oct 7 14:00:58 2021
@author: zqirui
"""
from code.preprocessing.preprocessor import Preprocessor
from code.util import string_to_words_list
import nltk
class Stemmer(Preprocessor):
def __init__(self, input_column,... | [
{
"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 | code/preprocessing/stemmer.py | zqirui/MLinPractice |
import json
import requests
from time import sleep
from urllib3.exceptions import HTTPError
from .exceptions import ErroApiBNMP
REGISTROS = 50
DADOS = {
'criterio': {
'orgaoJulgador': {
'uf': 'RJ',
'municipio': '',
'descricao': '',
},
'orgaoJTR': {},
... | [
{
"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 | robobnmp/cliente.py | MinisterioPublicoRJ/robobnmp |
import re
import sys
cookie_re = re.compile(br"coding[:=]\s*([-\w.]+)")
if sys.version_info[0] == 2:
default_encoding = "ascii"
else:
default_encoding = "utf-8"
def guess_encoding(fp):
for _i in range(2):
ln = fp.readline()
m = cookie_re.search(ln)
if m is not None:
r... | [
{
"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 | venv/lib/python3.9/site-packages/py2app/bootstrap/boot_aliasplugin.py | dequeb/asmbattle |
from flask_restful import Resource, reqparse
from models.user import UserModel
from resources.email import Email
class ResetPassword(Resource):
parser = reqparse.RequestParser()
parser.add_argument("email", required=True)
def post(self):
data = ResetPassword.parser.parse_args()
user = Use... | [
{
"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 | resources/reset_password.py | donovan-PNW/dwellinglybackend |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Used for testing the stop of an instance
"""
import os
from types import SimpleNamespace
# Set env to make debugging in interactive shell more comfortable
os.environ['AWS_SPAWNER_TEST'] = '1'
import spawner
from models import Server
from tornado import gen
#%% Config... | [
{
"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 | test_stop.py | tomcatling/jupyterhub_aws_spawner |
"""
Tests for the spm info utility
"""
import shutil
import pytest
from tests.support.case import SPMCase
@pytest.mark.windows_whitelisted
@pytest.mark.destructive_test
class SPMInfoTest(SPMCase):
"""
Validate the spm info command
"""
def setUp(self):
self.config = self._spm_config()
... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
... | 3 | tests/integration/spm/test_info.py | babs/salt |
#!/usr/bin/env python3
from datetime import datetime, timezone
from reporting.category import Category
from reporting.activity import Activity
#{
# "_class": "org.jenkinsci.plugins.workflow.job.WorkflowRun",
# "id": "1",
# "url": "http://jk.domain/job/ancestor/job/grandfather/job/father/1/",
# "result": ... | [
{
"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 | statsSend/jenkins/jenkinsBuild.py | luigiberrettini/build-deploy-stats |
class Rectangle:
def __init__(self, length, width):
self.length = length
self.width = width
def area(self):
return self.length * self.width
def perimeter(self):
return 2 * self.length + 2 * self.width
class Square(Rectangle):
def __init__(self, length):
super(S... | [
{
"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 | test/test_files/test_inheritance/super_test_3.py | SoftwareUnderstanding/inspect4py |
from typing import TYPE_CHECKING, Optional
from ..core.notification.utils import get_site_context
from ..core.notify_events import NotifyEventType
from ..graphql.core.utils import to_global_id_or_none
if TYPE_CHECKING:
from ..account.models import User
from ..app.models import App
from ..plugins.manager i... | [
{
"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 | saleor/invoice/notifications.py | nestfiy/saleor |
import numpy as np
class LowLevelController:
"""Low level controller of a point mass robot with dynamics:
x_{k+1} = x_k + v_k * Ts * cos(psi_k)
y_{k+1} = y_k + v_k * Ts * sin(psi_k)
v_{k+1} = v_k + Ts * a_k
psi_{k+1} = psi_k + Ts * omega_k
omega_{k+1} = omega_k + Ts * epsilon_k
Where a_k... | [
{
"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 | gradplanner/controller/low_level_controller.py | ferenctorok/potential_field_planner |
# 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/.
try:
from marionette.marionette import Actions
except:
from marionette_driver.marionette import Actions
from ga... | [
{
"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": fals... | 3 | tests/python/gaia-ui-tests/gaiatest/tests/functional/browser/test_browser_save_image.py | marshall/gaia |
#!/usr/bin/python
# Add security groups to CloudFormation template files.
# This will modify the CloudFormation template files,
import sys, json, glob
from ansible.module_utils.basic import *
from cfyaml import yaml
def read_template(file_name):
with open(file_name, 'r') as f:
template = yaml.load(f)
... | [
{
"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 | ansible/library/cf_security_groups.py | pzurzolo/aem-aws-stack-builder |
#!/usr/bin/env python3
import re
from ranking.management.modules.common import REQ, BaseModule, parsed_table
from ranking.management.modules.excepts import ExceptionParseStandings
class Statistic(BaseModule):
def get_standings(self, users=None, statistics=None):
season = self.get_season()
def ... | [
{
"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 | ranking/management/modules/techgig.py | aropan/clist |
"""Routines to make lines
"""
from Numeric import *
from math import cos, sin, pi, atan2
def R(theta):
array = zeros([3,3], Float)
array[0,0] = array[1,1] = cos(theta)
array[0,1] = sin(theta)
array[1,0] = -sin(theta)
array[2,2] = 1
return array
def T(tx, ty):
array = zeros([3,3], Float)
... | [
{
"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 | Depict/LineGenerator.py | UnixJunkie/frowns |
"""Module for testing Amino Acid DelIns Classifier."""
import unittest
from variation.classifiers import AminoAcidDelInsClassifier
from .classifier_base import ClassifierBase
class TestAminoAcidDelInsClassifier(ClassifierBase, unittest.TestCase):
"""A class to test the Amino Acid DelIns Classifier."""
def cl... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},... | 3 | tests/classifiers/test_amino_acid_delins.py | cancervariants/variant-normalization |
# Copyright 2019 Extreme Networks, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/... | 3 | st2common/st2common/services/queries.py | saucetray/st2 |
from django import forms
from .models import Comment, Answer
class CommentForm(forms.ModelForm):
class Meta:
model = Comment
fields = ('text',)
widgets = {
#'author':forms.TextInput(attrs={'class':'textinputclass'}),
'text':forms.Textarea(attrs={'class':'editable m... | [
{
"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 | djangofiles/BlogProject/blog/forms.py | manvith263/tricalidee |
# coding: utf-8
"""
Strava API v3
The [Swagger Playground](https://developers.strava.com/playground) is the easiest way to familiarize yourself with the Strava API by submitting HTTP requests and observing the responses before you write any client code. It will show what a response will look like with differe... | [
{
"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 | xapp-image-base/swagger/test/test_temperature_stream.py | martinsallandm/hw-xapp-python-lenovo |
# Copyright (c) 2019, NVIDIA CORPORATION.
import urllib.parse
from utils import assert_eq
import nvstrings
urls1 = ["http://www.hellow.com", "/home/nvidia/nfs", "123.45 ~ABCDEF"]
urls2 = [
"http://www.hellow.com?k1=acc%C3%A9nted&k2=a%2F/b.c",
"%2Fhome%2fnfs",
"987%20ZYX",
]
def test_encode_url():
... | [
{
"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 | python/nvstrings/tests/test_url.py | williamBlazing/cudf |
# Import all dependencies
import re, os, sys
from shutil import copyfile
def GetNewName(oldName, parameters):
"""if (not '.dll' in oldName
and not '.so' in oldName
and not '.eon' in oldName
):
raise ValueError()"""
pattern = r'([a-zA_Z_\.]+)([0-9]+)(.*)'
beginning = re.sub(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_params_annotated",
"question": "Does every function parameter in this file have a ty... | 3 | renameFiles.py | fkorsa/PythonScripts |
import pymysql.cursors
import ldap
def get_domain_name():
"""
Returns the domain name of the current configuration from a config file
Returns
-------
string
the domain name
"""
with open("/var/www/logic_webapp/webapp_config") as file:
line = file.readline()
dom... | [
{
"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 | webapp/external_access.py | Quoding/petricore |
from copy import deepcopy
with open("day-04/input.txt", "r") as file:
numbers = [int(i) for i in file.readline().split(",")]
boards = [
[[int(i) for i in row.split()] for row in board.strip().split("\n")]
for board in file.read().strip().split("\n\n")
]
def find_first(numbers, boards, mar... | [
{
"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 | day-04/main.py | andrewyazura/aoc-2021 |
from starling_sim.basemodel.agent.agent import Agent
class SpatialAgent(Agent):
"""
Class describing a spatial agent, with a position and origin in the simulation environment.
"""
SCHEMA = {
"properties": {
"origin": {
"type": ["number", "string"],
... | [
{
"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 | starling_sim/basemodel/agent/spatial_agent.py | tellae/starling |
#!/usr/bin/env python
##########################################################
# File Name: classfier.py
# Author: gaoyu
# mail: gaoyu14@pku.edu.cn
# Created Time: 2018-04-30 20:21:33
##########################################################
from base_loss import *
from pycaffe import L
class ClassfierLoss(BaseLos... | [
{
"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 | net/gan/loss/classfier.py | bacTlink/caffe_tmpname |
import torch
import torch.nn as nn
import torch.nn.functional as F
class QNetwork(nn.Module):
"""Actor (Policy) Model."""
def __init__(self, state_size, action_size, seed, fc1_units=64, fc2_units=64):
"""Initialize parameters and build model.
Params
======
state_size (int):... | [
{
"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 | p1_navigation/model.py | cshreyastech/deep-reinforcement-learning |
from addons.base.apps import BaseAddonAppConfig
from addons.dropbox.views import dropbox_root_folder
from addons.dropbox import routes
class DropboxAddonAppConfig(BaseAddonAppConfig):
name = 'addons.dropbox'
label = 'addons_dropbox'
full_name = 'Dropbox'
short_name = 'dropbox'
configs = ['accoun... | [
{
"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 | addons/dropbox/apps.py | alexschiller/osf.io |
from typing import List
from entities import Entity
class Enemy(Entity):
def __init__(self, pos_x: int, pos_y: int, tile: str, friendly_tile: str, enemy_tile: str):
super().__init__("enemy", pos_x, pos_y, tile)
self.friendly_tile = friendly_tile
self.enemy_tile = enemy_tile
class Battle... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self... | 3 | battles.py | legend-plus/LegendBot |
class Buffer:
def __init__(self):
self._buffer = bytearray()
def write(self, data: bytes):
self._buffer.extend(data)
def read(self, size: int):
data = self._buffer[:size]
self._buffer[:size] = b""
return data
def peek(self, size: int):
return self._buf... | [
{
"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 | utils.py | HarukaMa/bitshares-p2p |
# U S Σ R Δ T O R / Ümüd
""" U S Σ R Δ T O R """
from userbot import LOGS
from telethon.tl.types import DocumentAttributeFilename
def __list_all_modules():
from os.path import dirname, basename, isfile
import glob
mod_paths = glob.glob(dirname(__file__) + "/*.py")
all_modules = [
basename(f)... | [
{
"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 | userbot/modules/__init__.py | caerus19/Userator |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Oct 7 14:53:52 2021
@author: ml
"""
import ast
import nltk
from src.feature_extraction.feature_extractor import FeatureExtractor
class BigramFeature(FeatureExtractor):
def __init__(self, input_column):
super().__init__([input_co... | [
{
"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 | src/feature_extraction/bigrams.py | chbroecker/MLinPractice |
"""
Python program to search for an element in the linked list using recursion
"""
class Node:
def __init__(self, data):
self.data = data
self.next = None
class Linked_list:
def __init__(self):
self.head = None
self.last_node = None
def append(self, data):
if s... | [
{
"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 | Advance_Python/Linked_List/Search_Ele_In_SLL.py | siddharth-143/Python |
"""
Add a keyword and a description field which are helpful for SEO optimization.
"""
from __future__ import absolute_import, unicode_literals
from django.db import models
from django.utils.translation import ugettext_lazy as _
from feincms import extensions
class Extension(extensions.Extension):
def handle_mo... | [
{
"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 | feincms/module/extensions/seo.py | barseghyanartur/feincms |
from ldap3 import Server, Connection, ALL
from utils.config import get_config
_client = None
_base_dn = None
def init(serverUrl):
global _client
if _client is None:
server = Server(serverUrl, get_info=ALL)
_client = Connection(server, None, None, auto_bind=True)
return _client
def ini... | [
{
"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 | utils/ldap_client.py | bsquizz/qontract-reconcile |
from tkinter import *
from PIL import Image,ImageTk
from resizeimage import resizeimage
#import os
class CountryIMG:
def __init__(self):
self.size = 400
self.TXT =open('CountryImages\Europ\Panstwa.txt',"r",encoding="utf-8")
self.CountryName=[]
self.CountryImage = []
for li... | [
{
"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 | CountryIMG.py | AGH-Narzedzia-Informatyczne/Project-Maze |
#!/usr/bin/env python3
# Copyright (c) 2017-2018 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test the RPC call related to the uptime command.
Test corresponds to code in rpc/server.cpp.
"""
impo... | [
{
"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 | test/functional/rpc_uptime.py | jardelfrank42/paymecoin |
import os
import pytest
import numpy as np
from deepforest import _io as io
open_buffer = io.Buffer(use_buffer=True,
buffer_dir="./",
store_est=True,
store_pred=True,
store_data=True)
close_buffer = io.Buffer(use_buffer... | [
{
"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_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",... | 3 | tests/test_buffer.py | pjgao/Deep-Forest |
#!/usr/bin/env python
"""
Simple implementation for mixup. The loss and onehot functions origin from: https://github.com/moskomule/mixup.pytorch
Hongyi Zhang, Moustapha Cisse, Yann N. Dauphin, David Lopez-Paz: mixup: Beyond Empirical Risk Minimization
https://arxiv.org/abs/1710.09412
"""
__all__ = [ 'mixup_cross_ent... | [
{
"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 | kws/utils/mixup.py | bozliu/E2E-Keyword-Spotting |
#!/usr/bin/env python3
import argparse
import tarfile
import tempfile
from pathlib import Path
def work(path_in: Path, path_out: Path):
path_out.parent.mkdir(exist_ok=True, parents=True)
outs = []
sids = []
fileinfos = []
with path_in.open() as inf:
for line in inf:
if line.st... | [
{
"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 | scripts/dist2katool.py | shirayu/ita-corpus-chuwa |
# -*- coding: utf-8 -*-
# Created by restran on 2016/10/10
from __future__ import unicode_literals, absolute_import
import logging
import os
import sys
import psycopg2
# 把项目的目录加入的环境变量中,这样才可以导入 common.base
sys.path.insert(1, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from common.base import TaskExecu... | [
{
"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 | password/postgresql.py | restran/hacker-scripts |
"""
Test base objects with context
"""
from pii_manager import PiiEnum, PiiEntity
from pii_manager.api import PiiManager
def _pii(pos):
return PiiEntity(PiiEnum.GOV_ID, pos, "3451-K", country="vo", name="vogonian ID")
TEST = [
("my Vogon ID is 3451-K", [_pii(15)]),
("the number 3451-K is my Vogonian ID... | [
{
"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 | pii-manager/test/unit/api/test_manager_ctx.py | ruinunca/data_tooling |
import ckan.model as model
from sqlalchemy import Column, types
from sqlalchemy.ext.declarative import declarative_base
log = __import__('logging').getLogger(__name__)
Base = declarative_base()
class MunicipalityBoundingBox(Base):
'''
Contains bbox data for every Finnish municipality
'''
__tablename... | [
{
"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 | modules/ckanext-ytp_main/ckanext/ytp/model.py | vrk-kpa/opendata-ckan |
# -*- coding: utf-8 -*-
from pyramid_oereb.standard.xtf_import.util import parse_string, parse_multilingual_text, parse_ref
class PublicLawRestriction(object):
TAG_INFORMATION = 'Aussage'
TAG_SUB_THEME = 'SubThema'
TAG_OTHER_THEME = 'WeiteresThema'
TAG_TYPE_CODE = 'ArtCode'
TAG_TYPE_CODE_LIST = '... | [
{
"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 | pyramid_oereb/standard/xtf_import/public_law_restriction.py | pvalsecc/pyramid_oereb |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import numpy as np # type: ignore
import onnx
from ..base import Base
from . import expect
from ..utils import all_numeric_dtypes
class Max(Base):
@staticmethod
... | [
{
"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 | onnx/backend/test/case/node/max.py | cnheider/onnx |
import pytest
from gi.repository import Gtk
from gaphas.canvas import Canvas
from gaphas.item import Element, Line
from gaphas.view import GtkView
class Box(Element):
def draw(self, context):
cr = context.cairo
top_left = self.handles()[0].pos
cr.rectangle(top_left.x, top_left.y, self.wid... | [
{
"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_params_annotated",
"question": "Does every function parameter in this file have a type annotation (exc... | 3 | tests/conftest.py | gaphor/gaphas |
from tool.runners.python import SubmissionPy
class RemiSubmission(SubmissionPy):
def get_param(self, p, opcode, index, param):
modes = opcode // 100
for _ in range(index):
modes //= 10
mode = modes % 10
if mode == 0:
return p[param]
elif mode == 1:
... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (exclu... | 3 | day-05/part-1/remi.py | TPXP/adventofcode-2019 |
from bin.Settings.SettingsEntity import SettingsEntity
from bin.Settings.SettingsSerialEntity import SettingsSerialEntity
from bin.Utility.SerialDiscoverer import get_port_name
class DeviceFactoryAbstract:
def __init__(self, settings_entity=SettingsEntity("")):
self.settings_entity = settings_entity
... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
... | 3 | src/bin/Devices/DeviceFactory.py | rCorvidae/OrionPI |
import torch.nn as nn
import torch.nn.functional as F
from utils.noisy_liner import NoisyLinear
from torch.nn import LayerNorm
class NoisyRNNAgent(nn.Module):
def __init__(self, input_shape, args):
super(NoisyRNNAgent, self).__init__()
self.args = args
self.fc1 = nn.Linear(input_shape, arg... | [
{
"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 | src/modules/agents/noisy_agents.py | mariuslindegaard/6.867_MARL_project |
"""
Makes python 2 behave more like python 3.
Ideally we import this globally so all our python 2 interpreters will assist in spotting errors early.
"""
# future imports are harmless if they implement behaviour that already exists in the current interpreter version
from __future__ import absolute_import, division, prin... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
... | 3 | errorCheckTool/py23.py | peerke88/error-check-tool |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.