source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
"""
Definition of events.
"""
from abc import ABC
EVENT_LOG = 'eLog' #Log Event
EVENT_MARKETDATA = 'eMarketData' #Pushing MarketData Event
EVENT_TRADE = 'eTrade' #Trade Event
EVENT_BUY = 'eBuy' #Buy Event
EVENT_SELL = 'eSell' ... | [
{
"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_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},... | 3 | events.py | tilakchandlo/swing |
"""
Copyright (c) 2018 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writin... | [
{
"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 | pytorch_toolkit/face_recognition/model/blocks/mobilenet_v2_blocks.py | JinYAnGHe/openvino_training_extensions |
import subprocess
import sys
import pkg_resources
def get_bin_path(package_name: str, name: str) -> str:
bin_name = name
if sys.platform == "win32":
bin_name = bin_name + ".exe"
return pkg_resources.resource_filename(package_name, f"bin/{bin_name}")
import pkg_resources
def multiply_ext(lhs: ... | [
{
"point_num": 1,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"an... | 3 | py-ext-bin-test/src/py_ext_bin_test/external.py | mikelynch/py-ext-test |
from setuptools import setup
from setuptools import find_packages
def readme():
"""Reads the README.md file to use as the 'long description'"""
with open('README.md') as f:
return f.read()
def requirements():
"""
Reads the requirements.txt file in order to extract requirements
that need to... | [
{
"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 | setup.py | NickolausDS/globus-contents-manager |
alphabet = ["-", "_"]
def to_camel_case(text):
l = text.split("-")
if len(l) == 1:
l = text.split("_")
print(l)
for i in range(len(l)):
if i == 0:
continue
if l[i] in alphabet:
l[i] = ""
l[i] = l[i].capitalize()
res = "".join(l)
return re... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer":... | 3 | python/codewar/Convertstringtocamelcase.py | Talgatovich/algorithms-templates |
class dotnetPointList_t(object):
""" dotnetPointList_t(Size: int) """
def FromStruct(self, PointList):
""" FromStruct(self: dotnetPointList_t,PointList: PointList) """
pass
def ToStruct(self, PointList):
""" ToStruct(self: dotnetPointList_t,PointList: PointList) """
... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answ... | 3 | release/stubs.min/Tekla/Structures/ModelInternal_parts/dotnetPointList_t.py | YKato521/ironpython-stubs |
from __future__ import absolute_import, print_function, unicode_literals
from threading import Thread
import zmq
from wolframclient.language import wl
from wolframclient.serializers import export
from wolframclient.utils.externalevaluate import EXPORT_KWARGS, start_zmq_loop
from wolframclient.utils.tests import Test... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written ... | 3 | wolframclient/tests/externalevaluate/ev_loop.py | LaudateCorpus1/WolframClientForPython |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.test import TestCase
from django.test import Client
class BorgTestCase(TestCase):
def setUp(self):
self.robots_client = Client()
self.robots_response = self.robots_client.get("/robots.txt")
self.humans_client = Client()
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_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": tru... | 3 | tests/test_views.py | aaronbassett/django-cyborg |
# Copyright (c) 2016, Vladimir Feinberg
# Licensed under the BSD 3-clause license (see LICENSE)
import numpy as np
from .matrix import Matrix
from ..util.docs import inherit_doc
# TODO(test)
@inherit_doc
class Identity(Matrix):
def __init__(self, n):
super().__init__(n, n)
def matvec(self, x):
... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written ... | 3 | runlmc/linalg/identity.py | vlad17/run-lmc |
from __future__ import unicode_literals, division, absolute_import
from builtins import * # pylint: disable=unused-import, redefined-builtin
import logging
from flexget import plugin
from flexget.event import event
log = logging.getLogger('manual')
class ManualTask(object):
"""Only execute task when specified... | [
{
"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 | flexget/plugins/operate/manual.py | thisirs/Flexget |
from asyncio import sleep
from pytest import fixture, mark
from pytest_gather_fixtures import ConcurrentFixtureGroup
Foo = ConcurrentFixtureGroup('Foo')
@Foo.fixture
async def s1(parallel_checker):
with parallel_checker.context('1_start'):
await sleep(0.1)
return 1
@Foo.fixture
async def s2(paral... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written ... | 3 | tests/unittests/test_setup_errors_then_teardown_errors.py | bentheiii/pytest-gather-fixtures |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | [
{
"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 | aliyun-python-sdk-emr/aliyunsdkemr/request/v20160408/SuspendFlowRequest.py | bricklayer-Liu/aliyun-openapi-python-sdk |
# -*- coding: UTF-8 -*-
import unittest
from geopy.compat import u
from geopy.geocoders import GeoNames
from test.geocoders.util import GeocoderTestBase, env
@unittest.skipUnless( # pylint: disable=R0904,C0111
bool(env.get('GEONAMES_USERNAME')),
"No GEONAMES_USERNAME env variable set"
)
class GeoNamesTestCa... | [
{
"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 | test/geocoders/geonames.py | navidata/geopy |
# ===========================================================================
# dictionary.py -----------------------------------------------------------
# ===========================================================================
# function ----------------------------------------------------------------
# -----... | [
{
"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 | expmgmt/utils/structures.py | wbrandenburger/ExpMgmt |
from django.http import HttpResponse
from django.shortcuts import render
from .models import Post
def home(request): # the root folder of the templates must be the templates folder
# pass a context
return render(request, "blog/home.html", context={"posts": Post.objects.all()})
# this also populates the ... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answe... | 3 | app/blog/views.py | MauricioAntonioMartinez/django-posts-app |
# -*- coding: utf-8 -*-
# pylint: disable=C0111,C0103,R0205
import traceback
__author__ = 'guotengfei'
import logging
LOGGER = logging.getLogger(__name__)
class ConsumerFactory(object):
"""This is an example consumer that will handle unexpected interactions
with RabbitMQ such as channel and connection clos... | [
{
"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 | ddcCommon/rabbitMQ/consumer_factory.py | gtfaww/Python |
"""Test the main file."""
import logging
from src.jobs.main import jobs_main, spark_build
from src.jobs import extract, transform, load
from pyspark.sql import SparkSession
from pytest_mock import MockFixture
from src.jobs.utils.general import EnvEnum
def test_jobs_called(mocker: MockFixture) -> None:
"""Test th... | [
{
"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 | tests/unit/test_main.py | arthurcht/skeleton-pyspark |
"""
Evrything Docs
https://dashboard.evrythng.com/documentation/api/actiontypes
"""
from evrythng import assertions, utils
field_specs = {
'datatypes': {
'name': 'str',
'customFields': 'dict',
'tags': 'dict_of_str',
'scopes': 'dict',
},
'required': ('name',),
'readonly'... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written ... | 3 | src/evrythng/entities/action_types.py | jwpthng/evrythng-python-sdk |
"""
Module: 'uheapq' on micropython-v1.16-esp32
"""
# MCU: {'ver': 'v1.16', 'port': 'esp32', 'arch': 'xtensawin', 'sysname': 'esp32', 'release': '1.16.0', 'name': 'micropython', 'mpy': 10757, 'version': '1.16.0', 'machine': 'ESP32 module (spiram) with ESP32', 'build': '', 'nodename': 'esp32', 'platform': 'esp32', 'fami... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answe... | 3 | stubs/micropython-v1_16-esp32/uheapq.py | mattytrentini/micropython-stubs |
import setuptools
import os
own_dir = os.path.abspath(os.path.dirname(__file__))
def requirements():
with open(os.path.join(own_dir, 'requirements.oci.txt')) as f:
for line in f.readlines():
line = line.strip()
if not line or line.startswith('#'):
continue
... | [
{
"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 | setup.oci.py | busunkim96/cc-utils |
import time
import threading
import configparser
class SingletonType(type):
_instance_lock = threading.Lock()
def __call__(cls, *args, **kwargs):
if not hasattr(cls, "_instance"):
with SingletonType._instance_lock:
if not hasattr(cls, "_instance"):
cls._... | [
{
"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 | mqtt_worker/config.py | hengying/mqtt_at_home |
from types import MethodType
import pandas as pd
import numpy as np
from .server_side import VeneerNetworkElementActions
from .utils import _quote_string
GET_LOSS_TABLE_SCRIPTLET='''
ignoreExceptions=False
fn = target.lossFct
for row in fn:
result.append((row.Key,row.Value))
'''
class VeneerLossNodeActions(Veneer... | [
{
"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 | veneer/losses.py | flowmatters/veneer-py |
__author__ = 'jroy'
from mi.core.log import get_logger
log = get_logger()
from mi.idk.config import Config
import unittest
import os
from mi.dataset.driver.wc_wm.cspp.wc_wm_cspp_recovered_driver import parse
from mi.dataset.dataset_driver import ParticleDataHandler
class DriverTest(unittest.TestCase):
def s... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"ans... | 3 | mi/dataset/driver/wc_wm/cspp/test/test_wc_wm_cspp_recovered_driver.py | rmanoni/mi-dataset |
import numpy as np
from flask import Flask, request, jsonify, render_template
import pickle
app = Flask(__name__)
model = pickle.load(open('model.pkl', 'rb'))
@app.route('/')
def home():
return render_template('index.html')
@app.route('/predict', methods=['GET', 'POST'])
def predict():
'''
For renderin... | [
{
"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 | app.py | Azmal16/Covid_Symptoms_Predict_with_Machine_Learning |
from abc import ABC, abstractmethod
class StudentTaxes(ABC):
def __init__(self, name, semester_tax, average_grade):
self.name = name
self.semester_tax = semester_tax
self.average_grade = average_grade
@abstractmethod
def get_discount(self):
pass
class ExcellentStudent(St... | [
{
"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 | 13. SOLID - Lab/ocp_approaches.py | elenaborisova/Python-OOP |
from __future__ import absolute_import
from .context import *
from .base_verbs import *
from .model import OpenShiftPythonException
from .model import Model, Missing
from .selector import *
from .apiobject import *
from . import naming
from . import status
from . import config
from .ansible import ansible
# Single so... | [
{
"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 | packages/openshift/__init__.py | mhcurlee/openshift-client-python |
from paraview import simple
from vtk.web import camera
def update_camera(viewProxy, cameraData):
viewProxy.CameraFocalPoint = cameraData['focalPoint']
viewProxy.CameraPosition = cameraData['position']
viewProxy.CameraViewUp = cameraData['viewUp']
simple.Render(viewProxy)
def create_spherical_camera(v... | [
{
"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 | Web/Python/paraview/web/camera.py | qiangwushuang/ParaView |
from db import db
class StoreModel(db.Model):
__tablename__ = 'stores'
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(80))
items = db.relationship('ItemModel', lazy='dynamic')
def __init__(self, name):
self.name = name
def json(self):
return {'name':... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": ... | 3 | models/store.py | FeNYeSNaP/rest-api-flask-and-python |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Main file to test the whole project"""
import logging
from zsur.readfile import readfile
from matplotlib import pyplot as plt
from zsur.bayes import main as bayes
from zsur.chain_map import main as chmap
from zsur.cluster_levels import main as cluster
from zsur.kmeans i... | [
{
"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": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 lines?",
"answer": false... | 3 | zsur/__main__.py | mareklovci/kky-zsur |
import unittest
def reverse(str) -> str:
if len(str) < 2:
return str
else:
result = ''
for character in reversed(str):
result += character
return result
class TestReverse(unittest.TestCase):
def setUp(self):
pass
def test_string(self):
... | [
{
"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 | code/python_scripts/reverse.py | lukaschoebel/LUMOS |
import urllib.parse
from urllib.parse import parse_qs
from dotenv import load_dotenv, find_dotenv
import requests
import base64
import os
load_dotenv(find_dotenv())
CLIENT_ID = os.environ.get("CLIENT_ID")
CLIENT_SECRET = os.environ.get("CLIENT_SECRET")
REDIRECT_URI = os.environ.get("REDIRECT_URI")
OAUTH_AUTHORIZE_URL... | [
{
"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 | setup/authorization.py | LenoxFro/spotify-save-discover-weekly |
import adv_test
from adv import *
def module():
return Vida
class Vida(Adv):
comment = 'unsuitable resist'
conf = {
"mod_a1": ('fs', 'passive', 0.30)
}
def init(this):
this.s2charge = 0
def s2_proc(this, e):
this.s2charge = 3
def fs_proc(this, e):
if... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than clas... | 3 | adv/vida.py | hcc123915/dl |
class Agent(object):
def __init__(self,name):
self.name = name # Name of the agent
"""
* Sets the role of this agent. Typlically will be called by your extended Game class (The class which extends the Game Class).
@param role
"""
def setRole(self,role):
self.role = role;
"""
* I... | [
{
"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 | py2.7/Agent.py | kamrulhasan1203/four-in-a-row |
# -*- coding: utf-8 -*-
# Copyright 2019 Cohesity Inc.
class CloudParameters(object):
"""Implementation of the 'CloudParameters' model.
Specifies Cloud parameters that are applicable to all Protection
Sources in a Protection Job in certain scenarios.
Attributes:
failover_to_cloud (bool): Sp... | [
{
"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 | cohesity_management_sdk/models/cloud_parameters.py | chandrashekar-cohesity/management-sdk-python |
# -*- coding: utf-8 -*-
"""
Coin sums
Problem 31
In England the currency is made up of pound, £, and pence, p, and there are
eight coins in general circulation:
1p, 2p, 5p, 10p, 20p, 50p, £1 (100p) and £2 (200p).
It is possible to make £2 in the following way:
1×£1 + 1×50p + 2×20p + 1×5p + 1×2p + 3×1p
How many differ... | [
{
"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 | project_euler/problem_31/sol1.py | KirilBangachev/Python |
"""Arguments Parser."""
import argparse
class ArgumentsParser(object):
"""Arguments parser"""
def __init__(self, params=[]):
"""Constructor"""
self.params = params
self.parser = argparse.ArgumentParser()
for arg, msg, choices in self.params:
if not choi... | [
{
"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": true
}... | 3 | utilities/arguments_parser.py | Jwuthri/GtfsTools |
from pytest import fixture, raises
import easy_dict as nd
@fixture()
def n():
return nd.NestedDict({'a': {'b': {'c': 123}}, 'd': {'e': 456}, 'f': {'e': 789}})
def test_mod_rooted_chain(n):
n['a']['b']['c'] = 234
assert n == {'a': {'b': {'c': 234}}, 'd': {'e': 456}, 'f': {'e': 789}}
def test_mod_float... | [
{
"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 | easy_dict/tests/test_04_mods.py | cahoy/NestedDictionary |
# 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.
import logging
from ci_workflow.ci_check_package import CiCheckPackage
class CiCheckNpmPackageVersion(CiCheckPackage):
@... | [
{
"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": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer"... | 3 | src/ci_workflow/ci_check_npm_package_version.py | asifsmohammed/opensearch-build |
import os
import pytest
from virtool.subtractions.utils import (
check_subtraction_file_type,
get_subtraction_files,
join_subtraction_path,
rename_bowtie_files,
)
def test_join_subtraction_path(tmp_path, config):
assert join_subtraction_path(config, "bar") == tmp_path / "subtractions" / "bar"
... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding se... | 3 | tests/subtractions/test_utils.py | ReeceHoffmann/virtool |
import time
import math
class Simulator:
def __init__(self):
self.amplitude = pow(10,-3)
self.frequency = 1
def sin_wave(self):
t = time.time()
frequency = self.frequency
amp = self.amplitude
phase = 0
value = amp*math.sin(frequency*t+phase)
return t, value;
def cos_wave(self):
t = time.time()
... | [
{
"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 | sinusoid.py | SivanYeh/WaveSimulator |
# coding: utf-8
import pytest
import json
from aiohttp import web
async def test_nature_list(client):
"""Test case for nature_list
"""
params = [('limit', 56),
('offset', 56)]
headers = {
'Accept': 'text/plain',
}
response = await client.request(
me... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"... | 3 | clients/python-aiohttp/generated/tests/test_nature_controller.py | cliffano/pokeapi-clients |
"""
http://scikit-learn.org/stable/auto_examples/model_selection/plot_confusion_matrix.html#sphx-glr-auto-examples-model-selection-plot-confusion-matrix-py
"""
import itertools
import numpy as np
import matplotlib.pyplot as plt
from sklearn.metrics import confusion_matrix
def plot_confusion_matrix(cm, classes,
... | [
{
"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 | confusion_matrix.py | christophersampson/digit_recognition_demo |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
Game of life
author: Pleiades
'''
import os
import random
#import functools
width = 60
height = 15
screen = []
def Init():
global screen
screen = [['#' if random.random() > 0.8 else ' ' for i in range(width)]
for j in range(height)]
def Pri... | [
{
"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 | Demo/gameOfLife.1.py | calllivecn/GameOfLife |
class Solution:
"""
@param s: an expression includes numbers, letters and brackets
@return: a string
"""
def expressionExpand(self, s):
# write your code here
if s is None or len(s) == 0:
return ""
return self.dfs(s)
def dfs(self, s):
... | [
{
"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 | Stack/575.Decode String/Solution_DFS.py | chenxi-ge/lintcode |
import hashlib
from abc import ABCMeta, abstractmethod
from enum import Enum
from core.exceptions import BaseError
class HashingAlgorithm(Enum):
SHA256 = 'http://www.w3.org/2001/04/xmlenc#sha256'
SHA512 = 'http://www.w3.org/2001/04/xmlenc#sha512'
class HashingError(BaseError):
"""Raised in the case of... | [
{
"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 | api/lcp/hash.py | tdilauro/simplified-circulation |
'''Gradient penalty functions.
'''
import torch
from torch import autograd
def contrastive_gradient_penalty(network, input, penalty_amount=1.):
"""Contrastive gradient penalty.
This is essentially the loss introduced by Mescheder et al 2018.
Args:
network: Network to apply penalty through.
... | [
{
"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 | cortex_DIM/functions/gradient_penalty.py | Soapy-Salted-Fish-King/DIM |
import pytest
import textwrap
from ansible_builder.steps import AdditionalBuildSteps, PipSteps, BindepSteps
def test_steps_for_collection_dependencies():
assert list(PipSteps('requirements.txt')) == [
'ADD requirements.txt /build/',
'RUN pip3 install --upgrade -r /build/requirements.txt'
]
... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer"... | 3 | test/test_steps.py | jladdjr/ansible-builder |
from rest_framework import status
from rest_framework.exceptions import (APIException, PermissionDenied,
ValidationError)
class FileParseException(APIException):
status_code = status.HTTP_400_BAD_REQUEST
default_detail = 'Invalid file format, line {}: {}'
default_cod... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{... | 3 | app/api/exceptions.py | Thinginitself/doccano |
#!/home/tarasen/Studying/3kurs/kursova/Django-Agregator-Site/env/bin/python3
#
# The Python Imaging Library
# $Id$
#
# this demo script illustrates how a 1-bit BitmapImage can be used
# as a dynamically updated overlay
#
import sys
if sys.version_info[0] > 2:
import tkinter
else:
import Tkinter as tkinter
fr... | [
{
"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 | env/bin/thresholder.py | tarasen1/Django-Agregator-Site |
#!/usr/bin/env python
# core modules
import datetime
import flask_babel
# 3rd party modules
from flask import Flask, flash, render_template
from flask_babel import Babel, _
def format_datetime(value, format="medium"):
import flask_babel
if format == "full":
format = "EEEE, d. MMMM y 'at' HH:mm"
... | [
{
"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 | Python/flask/l10n/app.py | saneravi/ML_Stuff |
from app.utilities.schema import load_schema_from_name
from tests.app.app_context_test_case import AppContextTestCase
class SchemaLoaderTest(AppContextTestCase):
def test_load_schema_from_name(self):
self.assertIsNotNone(load_schema_from_name("test_checkbox"))
def test_load_schema_with_different_sche... | [
{
"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 | tests/app/schema_loader/test_schema_loader.py | petechd/eq-questionnaire-runner |
import re
from django.db.models import Q
from django.utils.translation import ugettext_lazy as _
from rest_framework.exceptions import APIException
from rest_framework.response import Response
from rest_framework.views import APIView
from leasing.models import Contact
from leasing.permissions import PerMethodPermissi... | [
{
"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 | leasing/viewsets/contact_additional_views.py | hkotkanen/mvj |
import json
import logging
import traceback
def helper(function):
"""Decorator to mark helper functions.
Will do nothing to the original function.
"""
return function
def flask_method(function):
"""Decorator to handle errors."""
def generate_errcode(*args, **kwargs):
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_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"... | 3 | dream/server/helpers.py | icyblade/dream |
# -*- coding: utf-8 -*-
"""
tests.cache
-----------
Tests cache module.
"""
import pytest
from renoir import Renoir
@pytest.fixture(scope='function')
def templater_reload():
return Renoir(reload=True)
@pytest.fixture(scope='function')
def templater_noreload():
return Renoir()
def test_norel... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"ans... | 3 | tests/test_cache.py | emmett-framework/renoir |
import pytest
import io
from unittest.mock import patch
import os
import tempfile
from microrepl import connect_miniterm
@pytest.yield_fixture
def fake_stderr():
fake_stderr = io.StringIO()
with patch('sys.stderr', fake_stderr):
yield fake_stderr
@pytest.yield_fixture
def fake_sys_exit():
with pa... | [
{
"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.py | carlosperate/microrepl |
# Libraries
from sqlalchemy import Column, Float, ForeignKey, Integer, String
# Taskobra
from taskobra.orm.components import Component
class CPU(Component):
__tablename__ = "CPU"
unique_id = Column(Integer, ForeignKey("Component.unique_id"), primary_key=True)
manufacturer = Column(String)
model = Colu... | [
{
"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": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answ... | 3 | taskobra/orm/components/cpu.py | Vipyr/taskobra |
from pprint import pprint
class Config:
lr = 0.1
resume = False
checkpoint = '/home/claude.cy/file/ssd/checkpoint/'
data_root = '/home/claude.cy/.data/all_images'
voc07_trainval = 'torchcv/datasets/voc/voc07_trainval.txt'
voc12_trainval = 'torchcv/datasets/voc/voc12_trainval.txt'
voc07_test... | [
{
"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 | torchcv/utils/config.py | chenyuntc/dsod.pytorch |
def sqrt(n):
x0 = 1
while (x0 * x0) - 1 <= n:
x0 += 1
for _ in range(10):
x0 -= ( (x0**2 - n) / (x0 * 2) )
return x0
def root(n, p=2):
x0 = 1
while (x0 * x0) - 1 <= n:
x0 += 1
for _ in range(10):
x0 -= ( (x0**p - n) / (p * (x0 ** (p-1))) )
return x0
| [
{
"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 | raw/root.py | mentix02/TheSmallProgrammingBook |
from uuid import uuid4
from django.core.management.base import BaseCommand
from django.db import connections
from django.core.files.storage import default_storage
from django.conf import settings
from django.core.mail import send_mail
class Command(BaseCommand):
help = 'Check connections to external dependencies... | [
{
"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 | modelchimp/management/commands/check_connection.py | samzer/modelchimp-server |
from jesse.strategies import Strategy
# test_is_smart_enough_to_open_positions_via_market_orders
class Test05(Strategy):
def update(self):
pass
def should_long(self):
return self.time == 1547201100000 + 60_000
def should_short(self):
return self.time == 1547203560000 + 60_000
... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
... | 3 | jesse/strategies/Test05/__init__.py | discohead/jesse |
import bpy
def showTextPopup(text, title = "", icon = "NONE"):
bpy.context.window_manager.popup_menu(getPopupDrawer(text), title = title, icon = icon)
def getPopupDrawer(text):
def drawPopup(menu, context):
layout = menu.layout
layout.label(text = text)
return drawPopup
| [
{
"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 | scripts/addons/animation_nodes/ui/info_popups.py | Tilapiatsu/blender-custom_conf |
import streamlit as st
from streamlit_agraph import agraph, Node, Edge, Config
import pandas as pd
import numpy as np
@st.cache(suppress_st_warning=True)
def get_graph(file):
nodes = []
edges = []
df = pd.read_csv(file)
for x in np.unique(df[["Source", "Target"]].values):
nodes.append(Node(id=... | [
{
"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 | agraph.py | UmbraVenus/streamlit |
import ctypes
import os
import random, urllib.request, json
global drive, folder, image
drive = "C:\\"
folder = "images"
image = "test.jpg"
f = open("url.txt")
urls = []
# "https://www.reddit.com/r/MinimalWallpaper/.json"
subreddit = "http://pastebin.com/raw/DLNYEhNw"
def setImage(image):
image_path = os.path.jo... | [
{
"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 | main.py | Westie1012/redditwallpapers |
import heapq
def solution(scoville, K):
answer = 0 # 횟수
heap = []
for i in scoville:
heapq.heappush(heap, i)
while len(heap) > 1:
if heap[0] >= K:
return answer
else:
make_it_spicy(heap)
answer += 1
if heap[0] >= K:
return answer... | [
{
"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 | lv2/spicy_1.py | mrbartrns/programmers-algorithm |
import math
import torch
from pixelflow.distributions import Distribution
from pixelflow.utils import sum_except_batch
from torch.distributions import Normal
class StandardNormal(Distribution):
"""A multivariate Normal with zero mean and unit covariance."""
def __init__(self, shape):
super(StandardNo... | [
{
"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 | pixelflow/distributions/normal.py | didriknielsen/pixelcnn_flow |
import os
from unittest import mock
from castero.downloadqueue import DownloadQueue
from castero.episode import Episode
from castero.feed import Feed
my_dir = os.path.dirname(os.path.realpath(__file__))
feed = Feed(file=my_dir + "/feeds/valid_basic.xml")
episode1 = Episode(feed=feed, title="episode1 title")
episode2... | [
{
"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_downloadqueue.py | runrin/castero |
# Payment rest api serializers
from rest_framework import serializers
from rest_framework.serializers import (
SerializerMethodField,
IntegerField
)
from ...sale.models import PaymentOption
from ...payment.models import MpesaPayment
class MpesaPaymentUpdateSeri... | [
{
"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 | saleor/api/payment/serializers.py | glosoftgroup/KahawaHardware |
# Copyright 2016-2017 Dirk Thomas
# Copyright 2017 Open Source Robotics Foundation, 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
#
#... | [
{
"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 | keymint_cli/verb/__init__.py | keymint/keymint_cli |
from kazoo.client import KazooClient
from kazoo.exceptions import NoNodeError
from kazoo.exceptions import NodeExistsError
_callback = None
_zk = None
def init_kazoo(hosts, data_path, callback, children=True):
global _zk
global _callback
_zk = KazooClient(hosts=hosts)
_zk.start()
_callback = ca... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written ... | 3 | chapter_3/my_service/scrap/zoo.py | rinjyu/the_red |
from __future__ import print_function
from random import randint
from tempfile import TemporaryFile
import numpy as np
import math
def _inPlaceQuickSort(A, start, end):
count = 0
if start < end:
pivot = randint(start, end)
temp = A[end]
A[end] = A[pivot]
A[pivot] = temp
... | [
{
"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 | notes-n-resources/Data-Structures-N-Algo/_DS-n-Algos/_Another-One/sorts/random_normaldistribution_quicksort.py | side-projects-42/INTERVIEW-PREP-COMPLETE |
from flask import Flask, render_template, redirect
import pymongo
import scrape_mars
app = Flask(__name__)
# Set up pymongo connection and link db
client = pymongo.MongoClient('mongodb://localhost:27017')
db = client.mission_to_mars_2
listings = db.listings
@app.route("/")
def index():
listings = 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_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"... | 3 | app.py | mkrenicki/web-scraping-challenge |
"""
Create the module default metadata files by plugging the appropriate component table
descriptions into a TableGroup.
"""
from collections import OrderedDict
from clldutils.jsonlib import dump, load
from cldfspec.util import REPO_DIR
MODULES = {
'Generic': [],
'Wordlist': ['forms'],
'StructureDataset... | [
{
"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 | cldfspec/commands/make_module_defaults.py | cldf/cldf |
import itertools
import typing
def solve(s: str) -> typing.NoReturn:
n = 10
cand = []
must = 0
for i in range(n):
if s[i] == 'o':
cand.append(i)
must |= 1 << i
if s[i] == '?':
cand.append(i)
cnt = 0
for prod in itertools.product(cand, repeat=4):
res = 0
... | [
{
"point_num": 1,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"an... | 3 | jp.atcoder/abc201/abc201_c/25914704.py | kagemeka/atcoder-submissions |
import os
from getpass import getpass
# Devloped By Black_angel
# This is Logo Function
def logo():
print(" ──────────────────────────────────────────────────────── ")
print(" | | ")
print(" | ######## ## ######### ## ## ### | ")... | [
{
"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 | login.py | Wish1991/Python |
import Domoticz
from devices.custom_sensor import CustomSensor
class Adapter():
def __init__(self, devices):
self.devices = []
self.devices.append(CustomSensor(devices, 'signal', 'linkquality', ' (Link Quality)'))
def convert_message(self, message):
return message
def register(se... | [
{
"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 | adapters/base_adapter.py | volmart/domoticz-zigbee2mqtt-plugin |
from PIL import Image
from torch.utils.data import Dataset
from src.data_utils.utils import load_data
class ImageDataset(Dataset):
def __init__(self, samples: list, transform, preload: bool = False, num_workers=None):
self.transform = transform
self.samples = samples
self.targets = [label... | [
{
"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/data_utils/image_dataset.py | lindsey98/dml_cross_entropy |
"""create frame and block table
Revision ID: 1fc165a90d68
Revises:
Create Date: 2021-03-12 15:41:50.150507
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = "1fc165a90d68"
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# ### comma... | [
{
"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 | pyprof/alembic/versions/2021_03_12_15_41_50.py | kooichirooooo/pyprof |
"""
Example application using Tornado and Curl
"""
import os
import sys
import tornado.httpclient
import tornado.ioloop
import tornado.web
tornado.httpclient.AsyncHTTPClient.configure(
'tornado.curl_httpclient.CurlAsyncHTTPClient')
class MainHandler(tornado.web.RequestHandler):
@tornado.web.asynchronous
... | [
{
"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 | app.py | grosskur/tornado-sample |
import numpy as np
from numpy import ndarray
def hash_args(*args):
"""Return a tuple of hashes, with numpy support."""
return tuple(hash(arg.tobytes())
if isinstance(arg, ndarray)
else hash(arg) for arg in args)
class OrientedBoundary(ndarray):
"""An array of facet ind... | [
{
"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 | skfem/generic_utils.py | gatling-nrl/scikit-fem |
"""Business Logic for Rate Limiter Status API"""
from core.common.constants import RateLimitPer as Per
from core.common.utils import data_not_found
from http import HTTPStatus
class RateLimitStatus:
"""Business Logic for Rate Limit Status API"""
def __init__(self, namespace=None, datastore=None):
se... | [
{
"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 | services/sync-app/core/apis/rate_limit_status.py | shawnhankim/distributed-rate-limiting-solution |
import json
from server import db
from sqlalchemy.ext import mutable
class JsonEncodedDict(db.TypeDecorator):
impl = db.Text
def process_bind_param(self, value, dialect):
if value is None:
return '{}'
else:
return json.dumps(value)
def process_result_value(self, val... | [
{
"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 | server/models/utils.py | Justinyu1618/Coronalert |
from django.db import IntegrityError
from django.test import TestCase
from ..models import Badge, Award
from .mixins import UserFixturesMixin
class BadgeTestCase(TestCase):
"""
Badge model test case.
"""
def test_autocreate_slug(self):
badge = Badge.objects.create(name='Super Chouette')
... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": true... | 3 | badgify/tests/test_models.py | BrendanBerkley/django-badgify |
import unittest
from mock import MagicMock, Mock, patch
import brew_view
@unittest.skip("TODO")
class AdminAPITest(unittest.TestCase):
# @classmethod
# def setUpClass(cls):
# brew_view.load_app(environment="test")
def setUp(self):
self.app = brew_view.app.test_client()
self.cl... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
... | 3 | test/integration/controllers/admin_api_test.py | beer-garden/brew-view |
#!/bin/env python2.7
## SCCwatcher 2.0 ##
## ##
## sccwatcher.py ##
## ##
## Everything starts here ##
############################
import sys
import re
from settings_ui import *
from PyQt4 import QtGui, QtCore
#This is required to override the closeEvent... | [
{
"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 | sccwatcher.pyw | TheRealBanana/SCCwatcher-GUI |
from .base import BaseController
from views import RegisterView
from models import Registration, Student
from common_queries import get_section_name, get_username_and_full_name
from peewee import IntegrityError
from routes import *
class RegisterController(BaseController):
def __init__(self, router, payload):
supe... | [
{
"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 | controllers/register.py | MatthewKosloski/student-information-system |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"ans... | 3 | aliyun-python-sdk-cms/aliyunsdkcms/request/v20190101/PutCustomEventRequest.py | LittleJober/aliyun-openapi-python-sdk |
from app.genetic.genes.gene import Gene
class AndGene(Gene):
def __init__(self, left_gene: Gene, right_gene: Gene):
super().__init__()
self.leftGene = left_gene
self.rightGene = right_gene
def condition(self, company, day):
left_cond = self.leftGene.condition(company, day)
... | [
{
"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 | app/genetic/genes/logical/and_gene.py | SDomarecki/WSEOptimizer |
"""
给定不同面额的硬币 coins 和一个总金额 amount。编写一个函数来计算可以凑成总金额所需的最少的硬币个数。如果没有任何一种硬币组合能组成总金额,返回 -1。
来源:力扣(LeetCode)
链接:https://leetcode-cn.com/problems/coin-change
著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。
"""
# 用备忘录解决了重叠子问题
# 是一种剪枝
class Solution:
def coinChange(self,coins, amount: int):
# 备忘录
memo = dict()
... | [
{
"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 | 322CoinCange/CoinChange2.py | Easonyesheng/CodePractice |
from django.shortcuts import render, redirect
from django.contrib import messages
from django.core.mail import send_mail
from .models import AboutDescription
from .models import Contact
from .models import TeamInfo
from .models import OurServices
def addAboutSection(request):
aboutDesc = AboutDescription.objects
... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": fal... | 3 | aboutus/views.py | Alwin1847207/Hackathon |
def metade(num):
return num/2
def dobro(num):
return num*2
def aumentar(num, perc):
perc /= 100
return num + num*perc
def diminuir(num, perc):
perc /= 100
return num - num*perc | [
{
"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 | CursoEmVideo/107Cev/moeda.py | yazdejesus/FirstLessons-Python |
import time
class Clock:
def __init__(self):
self.start_time = time.time()
self.current_time = time.time()
def get_time(self):
return time.time() - self.start_time
def get_dt(self):
return time.time() - self.current_time
def update(self):
self.current_time = time.time()
def delay(self, sec):
time.s... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer":... | 3 | clingine/clock.py | avancayetano/clingine |
from motor.motor_asyncio import AsyncIOMotorClient
from pymongo import MongoClient
__all__ = ['PymongoConnection', 'MotorConnection']
class PymongoConnection:
def __init__(self, host="127.0.0.1", port="27017", db="default", user=None, password=None):
"""Create database connection."""
if user and... | [
{
"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 | extviews/connections.py | BilalAlpaslan/fastapi-extviews |
import numpy as np
def random_crop_flip(x_in, y_in, i0=None, j0=None, crop_shape=(256, 256)):
# Sample frame from random location in image. Randomly flip frame.
if i0 == None:
i0 = np.random.randint(low=0, high=(x_in.shape[0]-crop_shape[0]))
if j0 == None:
j0 = np.random.randint(low=0, high... | [
{
"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 | helper_functions.py | fbickfordsmith/finding-houses |
#!/usr/bin/env python
"""
Copyright (c) 2006-2017 sqlmap developers (http://sqlmap.org/)
See the file 'LICENSE' for copying permission
"""
from plugins.generic.syntax import Syntax as GenericSyntax
class Syntax(GenericSyntax):
def __init__(self):
GenericSyntax.__init__(self)
@staticmethod
def es... | [
{
"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/dbms/maxdb/syntax.py | danielvvDev/Sqlmap-Reforced2 |
#! /usr/bin/env python
# Copyright (c) 2019 Uber Technologies, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by a... | [
{
"point_num": 1,
"id": "every_function_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 | ludwig/utils/print_utils.py | yarenty/ludwig |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
def getAverage(img, u, v, n):
"""img as a square matrix of numbers"""
s = 0
for i in range(-n, n+1):
for j in range(-n, n+1):
s += img[u+i][v+j]
return float(s)/(2*n+1)**2
def getStandardDeviation(img, u, v, n):
s = 0
avg = getA... | [
{
"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 | cross-correlation/zncc.py | cirosantilli/algorithms-fork |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2015-2018 CERN.
#
# cds-migrator-kit is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""Test example app."""
import os
import signal
import subprocess
import ti... | [
{
"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 | tests/test_examples_app.py | kprzerwa/cds-migrator-kit |
# Copyright (c) 2019-2020, NVIDIA CORPORATION.
# 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... | [
{
"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/cusignal/test/utils.py | randompast/cusignal |
import pytest
from selenium import webdriver
from methods import litecart
@pytest.fixture
def wd(request):
wd = webdriver.Chrome()
request.addfinalizer(wd.quit)
return wd
def test_links(wd):
litecart.login_to_admin(wd)
litecart.check_links_on_country_page(wd)
litecart.logout_from_admin(wd)
| [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answe... | 3 | tests/test_links.py | rgurevych/webdriver_training |
"""use sequences
Revision ID: b7a3e293c207
Revises: 0bde60e6657f
Create Date: 2017-06-15 11:43:35.574932
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'b7a3e293c207'
down_revision = '0bde60e6657f'
branch_labels = None
depends_on = None
# Create Postgresql ... | [
{
"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 | db_migrations/versions/b7a3e293c207_use_sequences.py | HBPSP8Repo/i2b2-setup |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.