source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import os
import pprint
from base import BaseObject
from base import FileIO
class GenerateParents(BaseObject):
""" Generate the parent (type) for each term
this is the SINGLE SOURCE OF TRUTH for parents in the entire system
this generated file can ... | [
{
"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 | python/taskmda/mda/svc/generate_parents.py | jiportilla/ontology |
#! /usr/bin/python3
# Define the class DVD
class DVD:
def __init__(self, title, studio, director, released):
self.__title = title
self.__studio = studio
self.__director = director
self.__released = released
def get_title(self):
return self.__title
def get_studio(se... | [
{
"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 | hw/hw9/hw9.py | RachelKes/Python |
import torch
import torch.nn as nn
import torch.nn.functional as F
from .block import Mish, SeparableConv2d, Block
class WideTipXception(nn.Module):
def __init__(self, num_class):
super(WideTipXception, self).__init__()
self.conv1 = nn.Conv2d(1, 192, 3, 2, 1, bias=True)
self.bn1 = nn.Batc... | [
{
"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 | nets/classifiernet.py | Luciano233/OCR_Japanease |
class Node:
def __init__(self, k, v):
self.key = k
self.val = v
self.prev = None
self.next = None
class LRUCache:
def __init__(self, capacity):
self.capacity = capacity
self.dic = dict()
self.head = Node(0, 0)
self.tail = Node(0, 0)
self.... | [
{
"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 | solutions/LRU Cache/solution.py | nilax97/leetcode-solutions |
import os
import unittest
from gen_tsne import build_grid
ASSETS_DIR = os.path.join(os.path.dirname(__file__), "assets")
class TestGrid(unittest.TestCase):
def test_build(self):
paths = [os.path.join(ASSETS_DIR, "dataset"), os.path.join(ASSETS_DIR, "model_a"),
os.path.join(ASSETS_DIR, ... | [
{
"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 | evaluation/tsne_analysis_baseline/test/test_grid.py | Leinadh/PeruvianImageGenerator |
import os
import shutil
import yaml
import pytest
import doublenegative
from random import choice
from pathlib import Path
from string import ascii_uppercase
TEST_CONFIG_PATH = Path.cwd() / 'data' / 'test_config.yaml'
NUM_GENRES = 3
NUM_MP3S = 5
def random_str(length=5):
return ''.join(choice(ascii_uppercase) 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": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer"... | 3 | test/conftest.py | radu-mutilica/doublenegative.io-api |
from rest_framework import generics, views
from rest_framework.response import Response
class SomeView(views.APIView):
"""
URL: /api/someview
"""
def get(self, request, *args, **kwargs):
"""
```
{
"success": "Hello, world!"
}
```
"""
... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"ans... | 3 | exampleapp/view1/views.py | thomasjiangcy/django-rest-mock |
import logging
import msgpack
from . import rpc_serialize
import WebRequest
class PluginInterface_RemoteExecLocalProxy():
name = 'RemoteExec'
can_send_partials = True
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.log = logging.getLogger("Main.RemoteExec.Caller")
self.wg = We... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false... | 3 | common/util/local_exec.py | fake-name/ReadableWebProxy |
"""
Test calculation of health metrics.
"""
import logging
from GitHubHealth.utils import (
get_health,
get_repo_details,
)
def test_perfect_repo_health(test_perfect_repo):
"""
test the health of known repo.
"""
repo_health = get_health(test_perfect_repo)
assert repo_health == 10.0
def... | [
{
"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 | tests/test_health.py | ckear1989/github |
from datetime import datetime
import boto3
from feast import utils
from feast.infra.online_stores.helpers import compute_entity_id
from feast.protos.feast.types.EntityKey_pb2 import EntityKey as EntityKeyProto
from feast.protos.feast.types.Value_pb2 import Value as ValueProto
def _create_n_customer_test_samples(n=1... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/... | 3 | sdk/python/tests/utils/online_store_utils.py | ibnummuhammad/feast |
"""
* The sum of the squares of the first ten natural numbers is,
* 1^2 + 2^2 + ... + 10^2 = 385
* The square of the sum of the first ten natural numbers is,
* (1 + 2 + ... + 10)^2 = 552 = 3025
* Hence the difference between the sum of the squares of the first ten natural numbers and the square of the sum is 3025 − 385... | [
{
"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 | p6.py | nymoral/euler |
from miscellaneous import Misc
from Vector import Vector
import Constants
import math
# pylint: skip-file
class CollisionHandler :
def collisionResolution(self,V_incident, N):# Vecteur incident a lobstacle et normale de lobstacle
pscal = (V_incident.dx*N.dx + V_incident.dy*N.dy)
if Misc.isBetween... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false... | 3 | CollisionHandler.py | HHqZz/Bounce |
from orator.migrations import Migration
class CreateProductCategoriesTable(Migration):
def up(self):
"""
Run the migrations.
"""
with self.schema.create('categories') as table:
table.increments('id')
# _TODO: name should be unique
table.string(... | [
{
"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 | databases/migrations/2020_08_26_192619_create_product_categories_table.py | krishotte/web_sperky |
from abc import ABCMeta, abstractproperty, abstractmethod
class UpdateStrategy(metaclass=ABCMeta):
@abstractproperty
def case_implementation_class(self):
pass
def __init__(self, case):
self.case = case
@classmethod
def case_from_case_update(cls, case_update, xformdoc):
""... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cl... | 3 | corehq/form_processor/update_strategy_base.py | dimagilg/commcare-hq |
class Page:
""" Implémentation d'une Page mémoire
id : Identifiant de la page
age : Age de la page (LRU)
lastMSB : Dernier bit le plus significatif (LRU)
refByte : bit de référence (Clock)
"""
def __init__(self, ident):
self.id = ident
self.age = 0
s... | [
{
"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 | util/Page.py | S0obi/PageManager |
# Copyright (c) 2020, Ahmed M. Alaa
# Licensed under the BSD 3-clause license (see LICENSE.txt)
# ---------------------------------------------------------
# Helper functions and utilities for deep learning models
# ---------------------------------------------------------
from __future__ import absolute_import, di... | [
{
"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 | alg/discriminative-jackknife/utils/parameters.py | loramf/mlforhealthlabpub |
import requests
import MySQLdb
from lxml import etree
def get_address(url):
headers={
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.75 Safari/537.36'
}
response=requests.get(url,headers=headers)
if response.status_code==2... | [
{
"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 | AddressPool/spider/spiderAddress.py | m380ghoul/AddressPool |
class Node(object):
def __init__(self, data):
self.data = data
self.next = None
def length(node):
if not node:
return 0
length=1
while node.next:
node=node.next
length+=1
return length
def count(node, data):
if not node:
return 0
count=... | [
{
"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 | 6 kyu/Linked Lists Length Count.py | mwk0408/codewars_solutions |
# Lint as: python3
# Copyright 2019 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0... | [
{
"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 | tensorflow_examples/lite/model_maker/third_party/recommendation/ml/model/keras_losses_test.py | wladimir-crypto/TensowFlow-Food |
import unittest
from alertaclient.api import Client
class AlertTestCase(unittest.TestCase):
def setUp(self):
self.client = Client(endpoint='http://api:8080', key='demo-key')
def test_notes(self):
# add tests here when /notes endpoints are created
pass
| [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
... | 3 | tests/integration/test_notes.py | mhk001/python-alerta-client |
from datetime import datetime
from sqlite3 import PARSE_DECLTYPES, Connection, register_adapter
def create_connection() -> Connection:
register_adapter(datetime, datetime.isoformat)
c = Connection("battle.db", detect_types=PARSE_DECLTYPES)
with c:
c.execute(
"""
create tabl... | [
{
"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 | battle/persistence.py | atcase/robots |
from __future__ import print_function
__author__ = 'ragomez'
def prepend_this_is(f):
def _(args):
args = 'This is {}'.format(args)
return f(args)
return _
def append_exclamation(f):
def _(args):
args = '{}!'.format(args)
return f(args)
return _
@prepend_this_is
@app... | [
{
"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 | exercise4-8.py | raygomez/python-exercise-4 |
#!/usr/bin/env python
from os.path import join, dirname, abspath
from setuptools import setup
def read(rel_path):
here = abspath(dirname(__file__))
with open(join(here, rel_path)) as fp:
return fp.read()
def get_version(rel_path):
for line in read(rel_path).splitlines():
if line.startsw... | [
{
"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 | setup.py | JockeJarre/robotframework-CSVLibrary |
#!/usr/bin/python
import argparse
import os
import subprocess
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument(
'archive_path', type=str, default=None, nargs='?')
parser.add_argument(
'--dry', action='store_true', default=False)
args = parser.parse_args()
... | [
{
"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 | scripts/archive_gs.py | wsjeon/softlearning |
def binarySearch(array, target):
return binary_search_helper(array, target, 0, len(array) - 1)
def binary_search_helper(array, target, start, end):
while start <= end:
mid = (start + end) // 2
if array[mid] == target:
return mid
elif array[mid] > target:
end = mi... | [
{
"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 | algoexpert/easy/BinarySearch.py | dawar-s/algo-ds-sol-python |
import unittest
import numpy as np
import torch
from torch import nn
from gym.spaces import Box
from all.environments import State
from all.policies import GaussianPolicy
STATE_DIM = 2
ACTION_DIM = 3
class TestGaussian(unittest.TestCase):
def setUp(self):
torch.manual_seed(2)
self.space = Box(np.... | [
{
"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 | all/policies/gaussian_test.py | gordon-frost-hwu/autonomous-learning-library |
"""New enum value gasloline carType
Revision ID: f38c424891c2
Revises: 91dac376210b
Create Date: 2021-12-08 12:31:41.706156
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'f38c424891c2'
down_revision = '91dac376210b'
branch_labels = None
depends_on = None
de... | [
{
"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 | vwsfriend/vwsfriend/model/vwsfriend-schema/versions/f38c424891c2_new_enum_value_gasloline_cartype.py | danutsoare/VWsFriend |
from typing import List
from fastapi import APIRouter, Depends
from odp.api.dependencies.auth import Authorizer, AuthData
from odp.api.dependencies.ckan import get_ckan_client
from odp.api.models.auth import Role, Scope
from odp.api.models.project import Project
from odp.config import config
from odp.lib.ckan import ... | [
{
"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 | odp/api/routers/project.py | SAEONData/Open-Data-Platform |
from model.group import Group
from timeit import timeit
def test_group_list(app, db):
ui_list = app.group.get_group_list()
def clean(group):
return Group(id=group.id, groupname=group.groupname.strip())
db_list = map(clean, db.get_group_list())
assert sorted(ui_list, key=Group.id_or_max) == sor... | [
{
"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 | test/test_db_matches_ui.py | creepoff1/python_train |
import datetime
import logging
import tornado.escape
import tornado.web
from icubam.backoffice.handlers import base, home, icus, users
from icubam.db import store
from icubam.messaging import client
class ListMessagesHandler(base.AdminHandler):
ROUTE = "list_messages"
def initialize(self):
super().initiali... | [
{
"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 | icubam/backoffice/handlers/messages.py | maximedenes/icubam |
from django.db import models
from project.store.models.abstracts import TimeStampedModel
from project.store.models import User, Book
class Cart(TimeStampedModel):
"""database table for cart"""
user = models.OneToOneField(User, on_delete=models.CASCADE)
items = models.ManyToManyField('CartItem')
def ... | [
{
"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_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": true
... | 3 | project/store/models/cart.py | aliharby12/Book-Store |
import time
from tools import shell
import os
from threading import Thread
class BitbakeThread(Thread):
def __init__(self, path, target, command):
super().__init__()
self.path = path
self.target = target
self.command = command
pass
def run(self):
self.bitbake = ... | [
{
"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 | src/tools/bbcommand.py | dianshao-embedded/dianshao |
import pytest
from seq_features import *
def test_n_neg_for_single_E_or_D():
"""Perform unit tests on n_neg."""
assert n_neg('E') == 1
assert n_neg('D') == 1
def test_n_neg_for_empty_sequence():
assert n_neg('') == 0
def test_n_neg_for_longer_sequences():
assert n_neg('ACKLWTTAE') == 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": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answ... | 3 | test_seq_features.py | daviortega/protfeature |
from importlib import import_module
from byemail.conf import settings
class DoesntExists(Exception):
pass
class MultipleResults(Exception):
pass
class Storage():
def __init__(self, loop=None):
self.loop = loop
self._storage = None
def load_storage(self, loop=None):
global st... | [
{
"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": false... | 3 | byemail/storage/__init__.py | jrmi/byemail |
import unittest
from test import support
# xxx - forces a skip in the case we haven't built ctypes_test module in ant (which is not yet a task as of now)
try:
import _rawffi
_rawffi.CDLL("ctypes_test")
except:
raise ImportError
class RawFFITestCase(unittest.TestCase):
def setUp(self):
self.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": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false... | 3 | Lib/test/test__rawffi.py | jimmyyu2004/jython |
import torch.nn as nn
class VGG11(nn.Module):
def __init__(self):
super().__init__()
conv_layers = nn.Sequential(
nn.Conv2d(3, 64, kernel_size=3, padding=1),
nn.ReLU(True),
nn.MaxPool2d((2, 2), 2),
nn.Conv2d(64, 128, kernel_size=3, padding=1),
... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 lines?",
"answer": true
},
... | 3 | libs/model.py | remorsecs/Kaggle-plant-seedlings-classification |
#!/usr/bin/python3.5
import numpy as np
import matplotlib.pyplot as plt
import scipy.interpolate as si
# parameter
N = 3 # B Spline order
def bspline_planning(points, sn):
x = []
y = []
for point in points:
x.append(point[0])
y.append(point[1])
fit_points = []
#print(points)
... | [
{
"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 | line_fitting_helpers/bspline_path.py | llove-y/self_driving_scenario_designer |
# SPDX-License-Identifier: MIT
# Copyright (c) 2019 Akumatic
#
# https://adventofcode.com/2019/day/5
import sys, os
sys.path.insert(1, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import intcode, intcode_test
def readFile() -> list:
with open(f"{__file__.rstrip('code.py')}input.txt", "r") as f:
... | [
{
"point_num": 1,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
... | 3 | 2019/05/code.py | Akumatic/Advent-of-Code |
import asyncio
import logging
import time
from typing import Callable
from silicoin.protocols.protocol_message_types import ProtocolMessageTypes
log = logging.getLogger(__name__)
async def time_out_assert_custom_interval(timeout: int, interval, function, value=True, *args, **kwargs):
start = time.time()
las... | [
{
"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 | tests/time_out_assert.py | zcomputerwiz/silicoin-light-wallet |
from .coco_entity import CoCoEntity
from .const import KEY_BASICSTATE, VALUE_TRIGGERED, VALUE_ON, KEY_STATUS
from .helpers import extract_property_value_from_device
class CoCoGeneric(CoCoEntity):
@property
def is_on(self):
return self._is_on
def __init__(self, dev, callback_container, client, pr... | [
{
"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 | nhc2_coco/coco_generic.py | nielsvissers/nhc2-coco |
# included from snippets/main.py
def debug(*x, msg=""):
import sys
print(msg, *x, file=sys.stderr)
def solve(SOLVE_PARAMS):
pass
def main():
N = int(input())
d = 999
ret = 0
while N > d:
ret += N - d
d = d * 1000 + 999
print(ret)
# tests
T1 = """
1010
"""
TEST_T1 = ... | [
{
"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 | abc195/c.py | nishio/atcoder |
from rest_framework import generics, viewsets, permissions, filters
from rest_framework.mixins import CreateModelMixin
from main_app.models import *
from main_app.serializers import *
# GENRE:
class GenreListApiView(generics.ListCreateAPIView):
serializer_class = GenreSerializer
permission_classes = [permis... | [
{
"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 | main_app/api_views.py | wszoltysek/spotify |
#!/usr/bin/env python3
"""
Restores marked tags: <tag>-X -> <tag>
"""
_VERSION = "1.0"
#from transforms.model.gedcom_line import GedcomLine
def add_args(parser):
pass
def initialize(run_args):
pass
def phase3(run_args, gedline, f):
if gedline.tag.endswith("-X"):
gedline.tag = gedline.tag[:-2]
# ... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding se... | 3 | gedder/transforms/unmark.py | Taapeli/stk-gedcom |
from pyrfuniverse.actions import BaseAction
from pyrfuniverse.envs import ToborRobotiq85ManipulationEnv
import numpy as np
class SingleTransport(BaseAction):
"""
To transfer or convey an object from one place to another.
"""
def __init__(
self,
env: ToborRobotiq85ManipulationEn... | [
{
"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 | pyrfuniverse/actions/single_transport.py | happyCoderJDFJJ/pyrfuniverse |
"""
Copyright 2020 The OneFlow Authors. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable l... | [
{
"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 | oneflow/compatible_single_client_python/nn/modules/negative.py | xcnick/oneflow |
import shopify
from test.test_helper import TestCase
class RefundTest(TestCase):
def setUp(self):
super(RefundTest, self).setUp()
self.fake("orders/450789469/refunds/509562969", method='GET', body=self.load_fixture('refund'))
def test_should_find_a_specific_refund(self):
refund = shopi... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
}... | 3 | test/refund_test.py | Perkville/shopify_python_api |
import RPi.GPIO as gpio
import time
class Tank:
def __init__(self, name):
self.name = name
def init(self):
gpio.setmode(gpio.BCM)
gpio.setup(17, gpio.OUT)
gpio.setup(22, gpio.OUT)
gpio.setup(23, gpio.OUT)
gpio.setup(24, gpio.OUT)
def forward(self):
... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answ... | 3 | tank_standalone.py | JasonGreenwell/Tank-Platform |
import RPi.GPIO as GPIO
import time
# Default pin allocations
TRIG = 2
ECHO = 3
#Function block to measure Distance
def get_distance(trigger_pin = TRIG, echo_pin = ECHO):
GPIO.setwarnings(False)
# Use BCM Mode for pin numbering
GPIO.setmode(GPIO.BCM)
#Set Trigger pin as output and echo pin as input... | [
{
"point_num": 1,
"id": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 lines?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
... | 3 | devices/distancesensors/hcsr04.py | gopal-amlekar/RaspberryPi-StepByStep |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for `locate_trace` module."""
import unittest
import numpy as np
from hotsoss import locate_trace as lt
def test_simulate_frame():
"""Test the simulate_frame function"""
# CLEAR and plot test
assert lt.simulate_frame(plot=True).shape == (256, 2048... | [
{
"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_locate_trace.py | hover2pi/hotsoss |
# GENERATED BY KOMAND SDK - DO NOT EDIT
import insightconnect_plugin_runtime
import json
class Component:
DESCRIPTION = "Request a takedown for a given alert in IntSights"
class Input:
ALERT_ID = "alert_id"
TARGET = "target"
class Output:
STATUS = "status"
class TakedownRequestInput(insi... | [
{
"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 | plugins/rapid7_intsights/icon_rapid7_intsights/actions/takedown_request/schema.py | lukaszlaszuk/insightconnect-plugins |
#!/usr/bin/python
"""
==============================================================================
Author: Tao Li (taoli@ucsd.edu)
Date: Jun 23, 2015
Question: 106-Construct-Binary-Tree-from-Inorder-and-Postorder-Traversal
Link: https://leetcode.com/problems/construct-binary-tree-from-inorder-and-postorder-... | [
{
"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 | 106-Construct-Binary-Tree-from-Inorder-and-Postorder-Traversal/solution02.py | Eroica-cpp/LeetCode |
import math, string, itertools, fractions, heapq, collections, re, array, bisect, copy, functools, random
import sys
from collections import deque, defaultdict, Counter; from heapq import heappush, heappop
from itertools import permutations, combinations, product, accumulate, groupby
from bisect import bisect_left, bis... | [
{
"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 | AtC_Reg_Con_041-050/ARC045/B.py | yosho-18/AtCoder |
from typing import Dict, List, Any
import json
from e2e.Classes.Transactions.Data import Data
from e2e.Meros.RPC import RPC
from e2e.Meros.Liver import Liver
from e2e.Tests.Errors import TestError
def LowerHashTieBreakTest(
rpc: RPC
) -> None:
vectors: Dict[str, Any]
with open("e2e/Vectors/Consensus/Families/... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"... | 3 | e2e/Tests/Consensus/Families/LowerHashTieBreakTest.py | kayabaNerve/Currency |
import os
import re
import subprocess
class FfmpegWrapper:
length_frames_regex = r"frame *\= *(?P<frames>[\d\.]+).*"
def __init__(self, ffmpeg_path):
self.ffmpeg_path = ffmpeg_path
@staticmethod
def _read_lines(process):
while True:
process.stderr.flush()
line... | [
{
"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 | video_parallel_processing/ffmpeg_wrapper.py | dadus33/opencv-video-parallel |
# provide crypto functions
from cryptography import x509
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives.asymmetric import padding
from cryptography.hazmat.primitives import hashes
# constants
cert_file = 'certificate.crt'
ca_file = 'certchain.crt'
# functions
def get_publ... | [
{
"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 | crypto.py | jdoubleu/eup-election2019 |
from django.contrib.auth import get_user_model
from django.db import models
from django.utils.translation import gettext_lazy as _
from .abstract.mixins import FullTimeStampMixin
from .car import Car
class Rating(FullTimeStampMixin):
"""
Rating Model that is extension of FullTimeStamp Mixing. Rating stores i... | [
{
"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 | apps/cars/models/rating.py | agorsk1/car-rating-app |
import hashlib
from fastecdsa import keys, curve, ecdsa
from hashlib import sha256
from uuid import uuid4
class Transaction:
def __init__(self, from_address, to_address, amount):
self.from_address = from_address
self.to_address = to_address
self.amount = amount
self.id = str(uuid4... | [
{
"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 | blockchain/Transaction.py | kaifkhan1040/voting |
from qtpy.QtCore import QSize
from qtpy.QtGui import QIcon
from qtpy.QtWidgets import QListWidget, QListWidgetItem
from pathlib import Path
ICON_ROOT = Path(__file__).parent / "icons"
STYLES = r"""
QListWidget{
min-width: 294;
background: none;
font-size: 8pt;
color: #eee;
}
... | [
{
"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 | napari_assistant/_gui/_button_grid.py | Cryaaa/napari-assistant |
import pygame, sys, math
class Ball():
def __init__(self, image, speed=[0,0], pos=[0,0], size=None):
self.image = pygame.image.load("rsc/ball/"+image)
if size:
self.image = pygame.transform.scale(self.image, [size,size])
self.rect = self.image.get_rect(center = pos)
sel... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cl... | 3 | spicymeatball.py | KRHS-GameProgramming-2016/Spoonghetti-Man |
import requests
import lxml.html
class Ticker:
def yahooFormat(self, tickers: list):
if not isinstance(tickers, list):
tickers = [tickers]
self.dticker = tickers[:]
# check if theres a currency inside the list
for i, tick in enumerate(self.dticker):
if "/" ... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
}... | 3 | DegiroAPI/ticker.py | Papyrvs/stock-bot |
#!/usr/bin/env python3
import os
import socket
from collections import namedtuple
from enum import Enum, unique
HeadTerm = namedtuple('HeadTerm', ['index', 'value'])
@unique
class Header(Enum):
FILE_NAME = HeadTerm(index=0, value=0x80)
FILE_SIZE = HeadTerm(index=0, value=0x40)
FILE_CONTEXT = HeadTerm(in... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true... | 3 | Client-Python/client.py | iao113/transfer |
"""
HelloWorldO0.py
Copyright (c) 2020 by Robert Russell Millward. All rights reserved.
"""
from tkinter import *
class GenResearch(Frame):
def sayHi(self):
print("hi Bob");
def createWidgits(self):
self.QUIT = Button(self);
self.QUIT["text"] = "Quit";
self.QUIT["fg"] = "red"... | [
{
"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 | HellowWorldO0.py | RobertMillward/pythonlearn |
import uuid
import json
import health_inspector
g_client = None
CATEGORY_WORKER = 4
HEALTH_INSPECTOR_MODULE_ID = uuid.UUID('4e5f74d0-4705-11ec-abd0-e12370ec4fc6')
def init(client, **kwargs):
"""
:param client:
:param kwargs:
:return:
"""
global g_client
g_client = client
return True
... | [
{
"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 | health_inspector/macos/src/py/scythe/health_inspector/health_inspector.py | scythe-io/community-modules |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | [
{
"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 | src/spring-cloud/azext_spring_cloud/tests/latest/app_managed_identity/test_create_app_with_system_identity_scenario.py | haroonf/azure-cli-extensions |
from flask import render_template,request,redirect,url_for
from . import main
from ..requests import get_sources,get_articles
from ..models import Sources
#views
@main.route('/')
def index():
'''
view root page function that returns the index the page and its data
'''
sources = get_sources('business')
sports_sour... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true... | 3 | app/main/views.py | stephane-evrard/IP4_News |
#
# Copyright (c) 2013-2016 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# coding=utf-8
#
from sysinv.db import api as db_api
from sysinv.objects import base
from sysinv.objects import utils
def _get_interface_name_list(field, db_object):
ifnames... | [
{
"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 | sysinv/sysinv/sysinv/sysinv/objects/interface_base.py | etaivan/stx-config |
# This is free and unencumbered software released into the public domain.
class Message:
"""A message."""
def __init__(self, id=None):
self.id = id
def __repr__(self):
"""Returns a human-readable string representation of this object."""
return "message{{id={}}}".format(self.id)
... | [
{
"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/conreality/sdk/message.py | conreality/conreality.py |
from influxdb import InfluxDBClient
class InfluxConnection:
points = []
def __init__(self):
self.points = []
self.host = "host"
self.port = "port"
self.username = "user"
self.password = "pass"
self.database = "base"
self.client = InfluxDBClient(self.hos... | [
{
"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 | Configuration/influx.py | marcosmarcon/Oracle-and-Grafana-integration |
from schemdraw import Drawing
from schemdraw import elements as elm
from src.utils import numerize
from .input import Input
def draw_void():
drawing = Drawing()
drawing += (transistor := elm.transistors.JFetP().right().reverse())
drawing += elm.SourceV().at(transistor.drain).up().label('Vdd').reverse()... | [
{
"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 | src/models/amplifier/simplified_fet/common_drain_polarization/drawing.py | luanws/amplifier-circuits |
import os
import biothings, config
biothings.config_for_app(config)
import biothings.hub.dataload.uploader
from .parser import load_druglabels
class DrugLabelsUploader(biothings.hub.dataload.uploader.BaseSourceUploader):
main_source = "pharmgkb"
name = "druglabels"
__metadata__ = {"src_meta": {}}
... | [
{
"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 | upload_druglabels.py | fbelleau/bt_pharmgkb |
class CountN:
def __init__(self, count):
self.count = count
self.current = 1
return None
def __iter__(self):
self.current = 0
return self
def __next__(self):
self.current += 1
if self.current > self.count:
raise StopIteration
else:
return self.current
if __name__ ==... | [
{
"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 | createiter.py | ajayhk/Python |
import requests
import autoscaler.conf.engine_config as eng
import os
def remove_old_create_new(f_name, header):
if os.access(f_name, os.R_OK):
os.remove(f_name)
write_to_file(header, f_name)
def write_to_file(stats, f_name):
csv = open(f_name, "a")
csv.write(stats)
def get_dpid(ip):
... | [
{
"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 | autoscaler/network/network_util.py | RajsimmanRavi/Elascale_secure |
import unittest
import tempfile
import json
import numpy as np
import pandas as pd
import os
from numpy.testing import assert_almost_equal
from sklearn import datasets
from supervised.algorithms.decision_tree import (
DecisionTreeAlgorithm,
DecisionTreeRegressorAlgorithm,
)
from supervised.utils.metric import ... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer":... | 3 | tests/tests_algorithms/test_decision_tree.py | SuryaThiru/mljar-supervised |
# Written by S. Mevawala, modified by D. Gitzel
# ECE303 Communication Networks
# Project 2: Selective Repeat simulator
# Jon Lu & David Yang 05/02/2021
import logging
import channelsimulator
import utils
import sys
import socket
import array
import hashlib
class Receiver(object):
def __init__(self, inbound_por... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false... | 3 | Project 2/receiver.py | jontlu/ECE303-Comm-Nets |
from pathlib import Path
import zipfile
import pytest
here = Path(__file__).resolve().parent
@pytest.fixture(scope='session')
def safe_zip():
path = (
here / 'data' /
'S1A_IW_GRDH_1SDV_20190301T052343_20190301T052408_026140_02EABC_E6CF.zip'
)
assert path.is_file()
return path
@pyte... | [
{
"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 | tests/s1/conftest.py | DHI-GRAS/sentinel_meta |
# SPDX-License-Identifier: Apache-2.0
#
# The OpenSearch Contributors require contributions made to
# this file be licensed under the Apache-2.0 license or a
# compatible open source license.
# Modifications Copyright OpenSearch Contributors. See
# GitHub history for details.
# Licensed to Elasticsearch B.V. under one ... | [
{
"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 | it/download_test.py | AGSaidi/opensearch-benchmark |
from django.shortcuts import render, redirect
from django.contrib.auth.models import User
from .models import UserProfile
from .forms import ProfileForm
def profile(request, pk):
profile = UserProfile.objects.get(id=pk)
context = {
'profile': profile
}
return render(request, '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": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"ans... | 3 | account/views.py | AhteshamSid/College_school_management_system |
import pytest
from cool_search import BaseClass, base_function
given = pytest.mark.parametrize
@given("fn", [BaseClass(), base_function])
def test_parameterized(fn):
assert "hello from" in fn()
def test_base_function():
assert base_function() == "hello from base function"
def test_base_class():
asse... | [
{
"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 | tests/test_base.py | khulaifi95/cool-search |
from django.shortcuts import render,redirect
from django.http import HttpResponse,Http404
from .models import Pics,categories
# Create your views here.
def welcome(request):
return render(request, 'welcome.html')
def pictogram(request):
images = Pics.objects.all()
return render(request, 'pictogram.html', ... | [
{
"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 | pics/views.py | NinahMo/Pictogram |
from rest_framework import status
from rest_framework.views import APIView
from rest_framework.response import Response
from rest_framework.generics import get_object_or_404
from jobs.models import JobBoard
from jobs.serializers import JobBoardSerializer
# Create your views here.
class JobListCreateApiView(APIView):
... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{... | 3 | jobBoard/jobs/views.py | pratikroy/DRF_API_DEMOS |
#!/programas/python3.5/bin/python3
'''
Created on 08/10/2017
@author: ernesto
'''
import sys
import logging
from bisect import bisect_left
from functools import reduce
from operator import mul,truediv,mod
from math import gcd,pow
nivel_log = logging.ERROR
#nivel_log = logging.DEBUG
logger_cagada = None
def calc_b(a,... | [
{
"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 | src/pc/e9.py | weskerhluffy/proyect_caca_euler |
import os
import numpy as np
import matplotlib.pyplot as plt
import seaborn
import sys
keras_dir = '../../example/vgg16/keras/output/'
cqt_dir = '../../example/vgg16/c_fix/output/'
qp_file = '../../examplevgg16/c_fix/weight/'
fix16mode = True
def layer_dump(i, q, fnum = 3):
"""
引数で指定されたレイヤーの、Keras出力と、コキュートス出... | [
{
"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 | tools/cqt_diff/cqt_diff_vgg16.py | natsutan/cocytus |
import os
from flask import Flask, g
from flask_sijax import sijax
path = os.path.join('.', os.path.dirname(__file__), 'static/js/sijax/')
app = Flask(__name__)
app.config['SIJAX_STATIC_PATH'] = path
app.config['SIJAX_JSON_URI'] = '/static/js/sijax/json2.js'
flask_sijax.Sijax(app)
@app.route('/')
def index():
r... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"... | 3 | Trabalho 03 - Tutorial Flask/r. Flask Sijax (with Examples)/server.py | andressagomes26/tecWeb_UFC |
def add_two_numbers(a, b):
return a + b
def add_three_numbers(a, b, c):
return a + b + c
print(add_two_numbers(1, 2))
print(add_three_numbers(1, 2, 3))
# type of args and kwargs
def zap(*args, **kwargs):
print(type(args))
print(type(kwargs))
zap()
# using *args
def add(*args):
total = 0
... | [
{
"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 | Python-3/basic_examples/args_kwargs_example.py | ghiloufibelgacem/jornaldev |
from tree import TreeNode
def min_depth(self, root):
"""
:type root: TreeNode
:rtype: int
"""
if root is None:
return 0
if root.left is not None or root.right is not None:
return max(self.minDepth(root.left), self.minDepth(root.right))+1
return min(self.minDepth(root.left),... | [
{
"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 | algorithms/tree/min_height.py | hbqdev/algorithms |
import glob
from r0vert_panel.menu import Menu, MenuItem
class BatteryMenuItem(MenuItem):
def value_string(self):
return "%.2fV" % self.value
class Status(Menu):
def __init__(self):
super(Status, self).__init__("status", True)
self.battery1 = BatteryMenuItem("Bat1", 0.0)
sel... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true... | 3 | r0vert_panel/src/r0vert_panel/status.py | splietker/r0vert_ros |
import io
from collections import Counter
from typing import Iterable
def read_input():
with io.open("input/day03") as f:
return f.read()
def most_common(bits: Iterable[str]):
c = Counter(bits)
return "0" if c["0"] > c["1"] else "1"
def least_common(bits: Iterable[str]):
c = Counter(bits)
... | [
{
"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 | aoc_2021/day03.py | guido-weber/AoC_2021 |
# project/api/common/utils/push_notifications.py
from project import app
from project.extensions import db
from project.models.event import Event
from project.models.user import User
from project.models.device import Device
from project.tasks.push_notification_tasks import send_async_push_notifications
def send_noti... | [
{
"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 | project/api/common/utils/push_notification.py | hernan0216/flask-base-api |
class CommandLineInterface:
def __init__(self):
self.commands = dict()
def loop(self):
while True:
command = ""
if command in self.commands.keys():
pass
def add_command(self):
pass
| [
{
"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 | osccontroller/command_line_interface.py | gogo2/osc-controller |
import platform, sys, os, subprocess
import psutil
from app.api.models.LXDModule import LXDModule
import logging
def readInstanceDetails():
instanceDetails = ("Python Version: {}".format(platform.python_version()))
instanceDetails +=("\nPython Path: {}".format(' '.join(path for path in sys.path)))
instanc... | [
{
"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_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer"... | 3 | app/api/utils/readInstanceDetails.py | nurely/lxdui |
from rest_framework import serializers
from .models import Rating
class RatingSerializer(serializers.ModelSerializer):
rater = serializers.SerializerMethodField(read_only=True)
agent = serializers.SerializerMethodField(read_only=True)
class Meta:
model = Rating
exclude = ["updated_at", "... | [
{
"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 | apps/ratings/serializers.py | FancyKat/django-portfolio |
#!/usr/bin/python
# -*- coding:utf-8 -*-
import time
from display import Display
import apis.psutil_metrics
import apis.darksky_weather
import RPi.GPIO as GPIO
KEYPRESS_DELAY = 5000
def handle_button_press(channel):
print("Pressed button on channel {0}".format(channel))
channel_page_mapping[channel]()
def... | [
{
"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 | main.py | JKolios/EPaperDashboard |
import numpy as np
from mushroom_rl.algorithms.value.td import TD
from mushroom_rl.utils.eligibility_trace import EligibilityTrace
from mushroom_rl.utils.table import Table
class QLambda(TD):
"""
Q(Lambda) algorithm.
"Learning from Delayed Rewards". Watkins C.J.C.H.. 1989.
"""
def __init__(self,... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": fals... | 3 | mushroom_rl/algorithms/value/td/q_lambda.py | k4ntz/mushroom-rl |
import os
from telethon import TelegramClient, events, sync
from dotenv import load_dotenv
sleeping_txt = "I'm sleeping right now, get back to you when I wake up"
turned_on = False
already_messaged_users = set()
if __name__ == "__main__":
load_dotenv(override=True, verbose=True)
api_id = int(os.getenv("API_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": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fe... | 3 | main.py | gmelodie/brb |
###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013-2019, John McNamara, jmcnamara@cpan.org
#
from ..excel_comparsion_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompareXLSXFiles(ExcelComparisonTest):
"""... | [
{
"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 | xlsxwriter/test/comparison/test_chart_str02.py | Aeon1/XlsxWriter |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 OpenStack LLC
#
# 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 requ... | [
{
"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": tru... | 3 | keystone/common/sql/migrate_repo/versions/013_drop_legacy_endpoints.py | ioram7/keystone |
import numpy as np
########################################
### Polyphony --- discarded
########################################
def polyphony_level_diff(roll_output,roll_target):
poly_output = np.sum(roll_output,axis=0)
poly_target = np.sum(roll_target,axis=0)
poly_diff = np.abs(poly_output-poly_target... | [
{
"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 | peamt/features/polyphony.py | adrienycart/PEAMT |
# Copyright 2020 The StackStorm Authors.
# 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 ... | [
{
"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 | st2client/st2client/models/keyvalue.py | kkkanil/st2 |
import argparse
def install(*args):
from .installer import Installer # noqa: autoimport
Installer.install(*args)
def clone(*args):
from .installer import Installer # noqa: autoimport
Installer.clone(*args)
def refresh(do_pull=False):
from .repomanager import RepoManager # noqa: autoimport... | [
{
"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 | autogit/main.py | quintenroets/gitmanager |
import subprocess
import re
class Ping:
def __init__(self, ip):
self.ip = ip
pass
def test_ping(self):
ftp_ret = subprocess.Popen(
'ping %s -n 2' % self.ip, stdin=subprocess.PIPE, stdout=subprocess.PIPE, shell=True)
ret = ftp_ret.stdout.read()
str_ret = r... | [
{
"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 | core/Ping.py | tanyiqu/batch-ping-core |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.