source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, val=0, next=None):
# self.val = val
# self.next = next
class Solution:
def swapPairs(self, head: Optional[ListNode]) -> Optional[ListNode]:
return self.recursive(head)
def recursive(self, head):
... | [
{
"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 | python/24_swap_nodes_in_pairs.py | dchapp/blind75 |
import urllib.parse
import webbrowser
def traverser_graphe(graphe, oriente):
if oriente:
type_graphe = "digraph"
lien = "->"
else:
type_graphe = "strict graph"
lien = "--"
donnees_graphe = type_graphe + " G { \n"
if len(graphe.sommets()) != 0:
num_som... | [
{
"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 | TP/TP16/afficheur_graphe.py | Aaz0og/NSI |
"""
Tests for the pywind.roc module.
"""
import os
import unittest
from pywind.roc.eroc import *
class ROCTest(unittest.TestCase):
"""
ROC Tests
"""
def test_local(self):
"""
Local file test.
"""
erp = EROCPrices()
here = os.path.dirname(__file__)
self.... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answe... | 3 | tests/roc_test.py | jnicho02/pywind |
'''
Utils to simplify testing
'''
# These imports needed for the `eval` blocks
from classad import classad # noqa
import datetime # noqa
import pandas as pd # noqa
def input_from_file(fname):
with open(fname) as fd:
return eval(fd.read())
def raw_input_from_file(fname):
wi... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a ty... | 3 | src/decisionengine_modules/util/testutils.py | hyunwoo18/decisionengine_modules |
"""Tests for the pyworld.my_module module.
"""
import pytest
from pyworld.my_module import hello
def test_hello():
assert hello('nlesc') == 'Hello nlesc!'
def test_hello_with_error():
with pytest.raises(ValueError) as excinfo:
hello('nobody')
assert 'Can not say hello to nobody' in str(excinfo.... | [
{
"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_my_module.py | sunxb05/pyworld |
# coding: utf-8
"""
OpenAPI Petstore
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ # noqa: E501
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
"""
... | [
{
"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 | samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_child.py | JigarJoshi/openapi-generator |
# -*- coding: utf-8 -*-
"""
Profile: http://hl7.org/fhir/StructureDefinition/Range
Release: R4
Version: 4.0.1
Build ID: 9346c8cc45
Last updated: 2019-11-01T09:29:23.356+11:00
"""
import sys
from . import element
class Range(element.Element):
""" Set of values bounded by low and high.
A set of ordered Quan... | [
{
"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 | fhir/resources/range.py | mmabey/fhir.resources |
import os
from distutils.extension import Extension
def _get_bool(key: str, default: bool = False) -> bool:
value = os.getenv(key)
if value is not None:
return value.lower() in ["true", "1", "t"]
return default
def _get_extensions():
return [
Extension(
"audiomatch.popcou... | [
{
"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 | build.py | unmade/audiomatch |
from flask import request, jsonify
from flask_restful import Resource, reqparse, abort
from flask_jwt import current_app
from app.auth.models import User
def generate_token(user):
""" Currently this is workaround
since the latest version that already has this function
is not published on PyPI yet and we do... | [
{
"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 | Chapter04/app/auth/resources.py | Abhishek1373/Building-Serverless-Python-Web-Services-with-Zappa |
from unittest import TestCase
from tests import get_data
from pytezos.michelson.converter import build_schema, decode_micheline, encode_micheline, micheline_to_michelson
class StorageTestKT1HYegMXP5pqPe83SbeYdHuJZub4tuG2ZvN(TestCase):
@classmethod
def setUpClass(cls):
cls.maxDiff = None
cls.... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
... | 3 | tests/storage/cases/test_KT1HYegMXP5pqPe83SbeYdHuJZub4tuG2ZvN.py | juztin/pytezos-1 |
import json
logger = None
name = 'Vendor'
uuid = 'vendor-123'
level = 'device'
vendor_file = 'plugins/vendor/mac_vendor'
with open(vendor_file, 'r', encoding="utf-8") as fp:
vendor_data = fp.readlines()
vendors = {}
for vnd in vendor_data:
vnd_parts = vnd.split('\t')
vendors[vnd_parts[0].strip()] = vnd_pa... | [
{
"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 | center/app/thirdparty/plugins/vendor/__init__.py | netSensTeam/netSens |
# app/models.py
from app import db
class Bucketlist(db.Model):
"""This class represents the bucketlist table."""
__tablename__ = 'bucketlists'
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(255))
date_created = db.Column(db.DateTime, default=db.func.current_timestamp())
... | [
{
"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 | app/models.py | imireallan/Bucketlist |
from __future__ import division
import pytest
import numpy as np
from random import randint
from fairml.orthogonal_projection import audit_model
from fairml.orthogonal_projection import get_orthogonal_vector
from fairml.utils import mse
from fairml.utils import accuracy
from fairml.utils import detect_feature_sign
... | [
{
"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 | fairml/tests/test_orthogonal_projection.py | ravish0007/fairml |
# coding=utf-8
r"""
This code was generated by
\ / _ _ _| _ _
| (_)\/(_)(_|\/| |(/_ v1.0.0
/ /
"""
from twilio.base.domain import Domain
from twilio.rest.messaging.v1 import V1
class Messaging(Domain):
def __init__(self, twilio):
"""
Initialize the Messaging Domain
... | [
{
"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 | venv/lib/python3.7/site-packages/twilio/rest/messaging/__init__.py | uosorio/heroku_face |
# coding: utf-8
"""
Isilon SDK
Isilon SDK - Language bindings for the OneFS API # noqa: E501
OpenAPI spec version: 7
Contact: sdk@isilon.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import isi_sdk_8_2_0
from i... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
}... | 3 | isi_sdk_8_2_0/test/test_report_about.py | mohitjain97/isilon_sdk_python |
from typing import TYPE_CHECKING
from modules.base import ModuleProcessor
from opta.core.gcp import GCP
from opta.exceptions import UserErrors
if TYPE_CHECKING:
from opta.layer import Layer
from opta.module import Module
class GcpGkeProcessor(ModuleProcessor):
def __init__(self, module: "Module", layer:... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"ans... | 3 | modules/gcp_gke/gcp_gke.py | run-x/opta |
import GPUtil
from threading import Thread
import time
class GPUMonitor(Thread):
def __init__(self, delay):
super().__init__()
self.stopped = False
self.delay = delay
self.data = {
g.id: dict(
load=[],
memory=[],
temperatu... | [
{
"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 | milarun/lib/monitor.py | laceyg/milabench |
import abc
from backend.model.SentenceTokenise import SentenceTokenise
from backend.service.ExtractSentences import extract_sentences
from backend.service.ReadCorpus import read_corpus
class Corpus:
def __init__(self):
self.receive_text = ""
self.input_file = "t1_biology_0_0.txt"
self.bas... | [
{
"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 | backend/model/Corpus.py | CiprianBodnar/DeftEval |
import discord
from discord.ext import commands
from discord.ext.commands import cog
import discord_slash
from discord_slash import cog_ext
class Slashes(commands.Cog):
def __init__(self, client) -> None:
self.client: commands.Bot = client
@commands.Cog.listener()
async def on_ready(self):
... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": fals... | 3 | cogs/slashes.py | mallusrgreatv2/PyHDISCORD |
from flask import request
from flask_apispec import MethodResource
from flask_apispec import doc
from flask_jwt_extended import jwt_required
from flask_restful import Resource
from sqlalchemy import func, or_
from db.db import DB
from decorator.catch_exception import catch_exception
from decorator.log_request import l... | [
{
"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 | oxe-api/resource/datacontrol/get_data_controls.py | CybersecurityLuxembourg/openxeco |
def mxdiflg(a1, a2):
allmax = []
counter = 0
if len(a1) and len(a2) != 0:
if len(a1) > len(a2):
while counter <= len(a1):
for x in a1:
for y in a2:
allmax.append(abs(len(x) - len(y)))
counter += 1
... | [
{
"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 | codewars/7kyu/amrlotfy77/Maximum Length Difference/main.py | ictcubeMENA/Training_one |
import logging
import pytest
import os
from functional_tests.t_utils import remove_tmp_dir, create_tmp_dir, __data_testing_dir__
from ivadomed.scripts import convert_to_onnx
from ivadomed.utils import ArgParseException
logger = logging.getLogger(__name__)
__model_path__ = os.path.join(__data_testing_dir__, 'spinegener... | [
{
"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 | testing/functional_tests/test_convert_to_onnx.py | cakester/ivadomed |
import json, socket
class Provider:
def __init__(self, name: str):
self.name = name
self._is_connected = False
self._initializing = False
def connect(self):
pass
def client_connect(
self, remote_address: str, remote_port: int, client_socket: socket.socket
) ->... | [
{
"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 | aproxy/providers/provider_config.py | FrodeHus/aproxy |
"""AuthTokenDriver Module."""
from ...contracts import AuthContract
from ...drivers import BaseDriver
from ...app import App
class AuthTokenDriver(BaseDriver, AuthContract):
def __init__(self, app: App):
"""AuthTokenDriver initializer.
Arguments:
request {masonite.request.Request} --... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excludi... | 3 | src/masonite/drivers/authentication/AuthTokenDriver.py | erhuabushuo/masonite1 |
###############################################################################
# Lambda kinder class
###############################################################################
# lambda is actionable dot ru
###############################################################################
# TODO:
####################... | [
{
"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 | kinder/lambda_funcs.py | 42B/krampus |
import os
import dropbox
from dropbox.files import WriteMode
class TransferData:
def __init__(self, access_token):
self.access_token = access_token
def upload(self, file_from, file_to):
dbx = dropbox.Dropbox(self.access_token)
for root, dirs, files in os.walk(file_from):
... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/c... | 3 | uploadFiles.py | AbhigyanRanjan0505/P328958dsgjok |
def eth_address_to_cfx(address: str):
assert type(address) == str
return '0x1' + (address.lower()[3:] if address.startswith("0x") else address.lower()[1:])
def hex_address_bytes(hex_address: str):
assert type(hex_address) == str
return bytes.fromhex(hex_address.lower().replace('0x', ""))
| [
{
"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 | electrum_gui/common/provider/chains/cfx/sdk/cfx_address/utils.py | BixinKey/electrum |
"""Test that not-in-loop is detected properly."""
# pylint: disable=missing-docstring, invalid-name, too-few-public-methods
# pylint: disable=useless-else-on-loop, using-constant-test, useless-object-inheritance
# pylint: disable=no-else-continue
while True:
def ala():
continue # [not-in-loop]
while True:... | [
{
"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 | vimfiles/bundle/vim-python/submodules/pylint/tests/functional/n/not_in_loop.py | ciskoinch8/vimrc |
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
# Create Instance Flask App
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'postgresql://mohammdelzanaty@localhost:5432/postgres'
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
db = SQLAlchemy(app)
# Create Person Model
class Perso... | [
{
"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 | Udacity/nd001-mena-nfp3/Ch-02/S-04/hello-flask/app.py | mohammedelzanaty/myRoad2BeFullStack |
__all__ = [
'Features',
'Motif',
'__Empty__'
]
class Features:
""" Features: features of the motif -
pattern - sequence
rank - rank/priority/id (must be unique)
valid - valid motif or not (only for universal frequency)
"""
__slots__ = ('pattern', 'rank', 'valid')
p... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
... | 3 | discountpy/motif.py | Umesh-JNU/DiscountPy |
"""
This is an implementation of `sha256_treehash`, used to calculate
puzzle hashes in clvm.
This implementation goes to great pains to be non-recursive so we don't
have to worry about blowing out the python stack.
"""
from typing import Optional, Set
from clvm import CLVMObject
from silicoin.types.blockchain_forma... | [
{
"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": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 lines?",
"answer":... | 3 | silicoin/types/blockchain_format/tree_hash.py | zcomputerwiz/silicoin-light-wallet |
from airflow.hooks.postgres_hook import PostgresHook
from airflow.models import BaseOperator
from airflow.utils.decorators import apply_defaults
from airflow.contrib.hooks.aws_hook import AwsHook
class StageToRedshiftOperator(BaseOperator):
sql_unformated = """
COPY {} FROM '{}'
ACCESS_KEY_ID '{}'
... | [
{
"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 | airflow/plugins/operators/stage_redshift.py | ofbennett/nhs-prescribing-etl-pipeline |
# -*- coding: utf-8 -*-
"""layers.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1fCQ_zLCcWNzgE99LK9B2cWrql8J3HgBO
"""
# Author : Vedant Shah
# E-mail : vedantshah2012@gmail.com
import torch
import torch.nn as nn
from torch.nn.parameter import P... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a ty... | 3 | gcn/layers.py | veds12/aiheaven |
class CallbackDict:
def __init__(self):
self.callbacks = {}
def set_callback(self, key, callback):
self.callbacks[key] = callback
def do_callback(self, key, *args, **kwargs):
self.callbacks[key](*args, **kwargs)
def append_callback(self, key, callback):
... | [
{
"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": "more_functions_than_classes",
"question": "Does this file define more functions than cla... | 3 | airypi/callback_dict.py | airypi/airypi |
class SpiderDevice(object):
def __init__(self, data, api):
self.api = api
self.data = data
@property
def id(self):
return self.data.get('id')
@property
def name(self):
return self.data.get('name')
@property
def model(self):
return self.data.get('mod... | [
{
"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 | spiderpy/devices/base.py | peternijssen/spiderpy |
from rest_framework.views import APIView
from rest_framework.response import Response
from rest_framework import status
from . import models, serializers
from django.db.models import Q
class ListAllChatRooms(APIView):
def get(self, request, format=None):
user = request.query_params.get('username', None) ... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{... | 3 | tradgram/chatrooms/views.py | didils/tradgram |
import logging
import wx
class LogPanel(wx.Panel):
"""
Simple wxPanel containing a text control which will display the root
logger's stream.
"""
class CustomConsoleHandler(logging.StreamHandler):
def __init__(self, text_ctrl, *args, **kwargs):
super().__init__(*args, *... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true... | 3 | src/wxExtra/logpanel.py | Derfies/panda3d-editor |
import django
if django.VERSION >= (1, 10, 1):
def user_is_authenticated(user):
# Explicit comparision due to the following bug
# https://code.djangoproject.com/ticket/26988
return user.is_authenticated == True # noqa E712
else:
def user_is_authenticated(user):
return user.is_... | [
{
"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 | ddtrace/contrib/django/compat.py | tophatmonocle/dd-trace-py |
# -*- coding: utf-8 -*-
# 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 writing, softw... | [
{
"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 | vaultlocker/tests/unit/test_systemd.py | placeholder-tech/vaultlocker |
class FSM:
def __init__(self,states,alphabet,transitionmatrix,currstate):
self.S=states
self.A=alphabet
self.TM=transitionmatrix
self.currstate=currstate
def accept(self,sym):
if sym not in self.A:
return
symi=self.A.index(sym)
if self.TM[... | [
{
"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 | sketches/automata_00/components.py | heerdyes/raspi-art |
# -*- coding: utf-8 -*-
import os
from babel import support
from flask.ext.babel import Babel, gettext, ngettext, lazy_gettext, _
from flask.ext.babel import get_locale
from flask import g, request, current_app
from flask import _request_ctx_stack
from flask.ext.login import current_user
from david.translations impor... | [
{
"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 | david/ext/babel/__init__.py | ktmud/david |
from valclient import Client
def join_party(username,password,region,party_id):
client = Client(region=region,auth={'username':username,'password':password})
client.activate()
return client.party_join(party_id)
def request_party(username,password,region,party_id):
client = Client(region=region,aut... | [
{
"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 | client.py | colinhartigan/valorant-web-auth-server |
# -*- coding: utf-8 -*-
"""
Defines the unit tests for the :mod:`colour_datasets.loaders.jakob2019` module.
"""
import unittest
from colour_datasets.loaders import DatasetLoader_Jakob2019, build_Jakob2019
__author__ = 'Colour Developers'
__copyright__ = 'Copyright (C) 2019-2021 - Colour Developers'
__license__ = 'Ne... | [
{
"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 | colour_datasets/loaders/tests/test_jakob2019.py | colour-science/colour-datasets |
import os
from django.shortcuts import render
from rest_framework import viewsets
from rest_framework.decorators import action
from rest_framework.response import Response
from rest_framework import status
from pose_analyser.models import Pose, PoseAnalysis
from pose_analyser.serializers import PoseSerializer, Analys... | [
{
"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 | Backend/pose_analyser/views.py | saksham1991999/Yoga-Pose-Analyser |
#
# This file is part of m.css.
#
# Copyright © 2017, 2018, 2019 Vladimír Vondruš <mosra@centrum.cz>
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including... | [
{
"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 | pelican-plugins/m/test/test_alias.py | Serkan-devel/m.css |
import sqlite3
import click
from flask import current_app, g
from flask.cli import with_appcontext
def get_db():
if 'db' not in g:
g.db = sqlite3.connect(
current_app.config['DATABASE'],
detect_types=sqlite3.PARSE_DECLTYPES
)
g.db.row_factory = sqlite3.Row
retu... | [
{
"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 | flaskr/db.py | jeckt/flask_official_tutorial |
import peewee
class Trade(peewee.Model):
id = peewee.UUIDField(primary_key=True)
# timestamp in milliseconds
timestamp = peewee.BigIntegerField()
price = peewee.FloatField()
buy_qty = peewee.FloatField()
sell_qty = peewee.FloatField()
buy_count = peewee.IntegerField()
sell_count = p... | [
{
"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 | jesse/models/Trade.py | slipperlobster/flipper |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# Copyright (c) 2014-2021 Megvii Inc. All rights reserved.
import torch.nn as nn
from .yolo_head import YOLOXHead,YOLOXHead4
from .yolo_pafpn import YOLOPAFPN,YOLOPAFPN4
class YOLOX(nn.Module):
"""
YOLOX model module. The module list is defined by create_yolov... | [
{
"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": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (... | 3 | yolox/models/yolox.py | qq1243196045/YONO |
import os
import numpy as np
import pandas as pd
from CHECLabPy.plotting.setup import Plotter
from CHECLabPy.spectrum_fitters.gentile import pedestal_signal, K
from CHECLabPy.waveform_reducers.cross_correlation import CrossCorrelation
from target_calib import CameraConfiguration
class SPEHist(Plotter):
def plot(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": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 lines?",
"answer": f... | 3 | sstcam_sandbox/old/mc_config/fadc_noise.py | watsonjj/CHECLabPySB |
import time
import datetime
import json
import redis
from .control import Control
import RPi.GPIO as GPIO
r = redis.Redis(host='127.0.0.1', port=6379)
class ButtonControl(Control):
def __init__(self, pin, name=None, key=None, resistor=None, edge_detection=None, debounce=None, topic=None, redis_conn=None):
super()... | [
{
"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": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheri... | 3 | controls/pi/button_control.py | robert2469/mudpi-core |
import argparse
import logging
from pprint import pprint
from .gcal import GCal
logger = logging.getLogger(__name__)
def parse_args() -> argparse.Namespace:
parser = argparse.ArgumentParser(
description="TODO"
)
parser.add_argument(
'-v', '--verbose', action='count', default=0,
)
... | [
{
"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 | src/gcal_sync/cli.py | liskin/gcal-sync |
# encoding: utf-8
from sys import path
from os.path import dirname as dir
path.append(dir(path[0]))
from connectors import users
from telegram.ext import CommandHandler
def main(dispatcher):
about_handler = CommandHandler('about', __about)
dispatcher.add_handler(about_handler)
def __about(bot, update):
... | [
{
"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 | bot/about.py | alesanmed/YourEnglishTeacher_Bot |
from django.db import models
class Category(models.Model):
name = models.CharField(max_length=100)
created_at = models.DateTimeField(auto_now_add=True)
def __str__(self):
return self.name
class Meta:
verbose_name_plural = 'Categorias'
class Transactions(models.Model):
date = models.DateField()
... | [
{
"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 | src/contas/models.py | br-monteiro/learning-django |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
from conans import ConanFile, CMake, tools
import os
class AZMQConan(ConanFile):
name = 'azmq'
version = 'a8f54cc8c9672da7d6301fe1d2719b1436ab4816'
url = 'https://github.com/bincrafters/conan-azmq'
hom... | [
{
"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 | conanfile.py | demin-dmitriy/conan-azmq |
# flake8: noqa
import csv
def model_name(table_name):
if table_name in ["vtm", "vpi", "vmp", "vmpp", "amp", "ampp", "gtin"]:
return table_name.upper()
else:
return "".join(tok.title() for tok in table_name.split("_"))
def quote(s):
assert '"' not in s
return '"' + s + '"'
with open... | [
{
"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 | openprescribing/dmd/gen_models/gen_models.py | annapowellsmith/openpresc |
from unittest import TestCase
from rapidtest import Result, Test, Case, TreeNode
class TestTest(TestCase):
def test_check_result(self):
t = Test(list, operation=True)
t.add_case(Case('append', [1],
'pop', Result(1),
'append', [2],
... | [
{
"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 | tests/test_test.py | yehzhang/RapidTest |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Generate random usernames in
"""
import random
from .names import names as default_names
class NameGenerator(object):
def __init__(self, names=None):
self.names = names or default_names
def __call__(self):
return self.names.pop(rando... | [
{
"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 | django_quicky/namegen/namegen.py | sametmax/django-quicky |
"""Example file with multiple flows."""
from metaflow import FlowSpec, step
class LinearFlow1(FlowSpec):
@step
def start(self):
self.a = 111
self.next(self.end)
@step
def end(self):
self.b = 222
assert self.a == 111
class LinearFlow2(FlowSpec):
@step
def star... | [
{
"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 | metaflow/tests/flows/linear_flows.py | celsiustx/metaflow |
"""
Item class for Jaseci
Each item has an id, name, timestamp.
"""
from jaseci.element.element import element
class item(element):
"""Item class for Jaseci"""
def __init__(self, value=None, *args, **kwargs):
self.item_value = value
super().__init__(*args, **kwargs)
@property
def va... | [
{
"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 | jaseci_core/jaseci/attr/item.py | Gorgeous-Patrick/jaseci |
# coding=utf-8
import logging
from scrapy import FormRequest
from scrapy import Request
from zspider.basespider import BaseSpider
__author__ = "zephor"
logger = logging.getLogger(__name__)
class NewsSpider(BaseSpider):
name = "news"
def __init__(self, *args, **kwargs):
super(NewsSpider, self).__... | [
{
"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 | zspider/spiders/news.py | Zephor5/zspider |
import pytest
from pyrpio.mdio import MDIO
class TestMDIO:
def test_open(self):
assert True
def test_transfer(self):
assert True
| [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"ans... | 3 | tests/test_mdio.py | Samtec-ASH/pyrpio |
import requests
from termcolor import cprint
class trace:
def __init__(self,url):
self.url = url
def checktrace(self):
headers = {
"User-Agent": "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_8; en-us) AppleWebKit/534.50 (KHTML, like Gecko) Version/5.1 Safari/534.50"
}
... | [
{
"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 | info/trace.py | bingpo/dedecmscan |
from fastapi import FastAPI
import uvicorn
app = FastAPI()
@app.get("/")
async def root():
return {"message": "Hello Duke"}
@app.get("/add/{num1}/{num2}")
async def add(num1: int, num2: int):
"""Add two numbers together"""
total = num1 + num2
return {"total": total}
if __name__ == '__main__':
u... | [
{
"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 | main.py | Hearsch-Jariwala/fastapi |
from __future__ import unicode_literals
import erpnext.education.utils as utils
import frappe
no_cache = 1
def get_context(context):
try:
course = frappe.form_dict['course']
program = frappe.form_dict['program']
topic = frappe.form_dict['topic']
except KeyError:
frappe.local.flags.redirect_location = '/lms'... | [
{
"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 | mindhome_alpha/erpnext/www/lms/topic.py | Mindhome/field_service |
import json
from flask import request, render_template
from app.utils.docx.docx import set_sand_docxtpl
from config import Config
from app.main import main
@main.route('/test_report/', methods=['GET', 'POST'])
def test_report():
if request.method == 'POST':
file_location = Config.SAVE_DOCUMENT_PATH
... | [
{
"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 | app/main/tools/test_report.py | BorrowHome/flasky-sandbox |
from collections import Counter
class MajorityBaselineClassifier:
@staticmethod
def train(_, labels):
c = Counter(labels)
return c.most_common()[0][0]
@staticmethod
def predict(_, majority_label):
return majority_label
| [
{
"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 | HW2/majority_baseline_classifier.py | dompuiu/PROEA-821-005-Spring-2018 |
import logging
from logging import Logger
from typing import Any, List, Optional
from obsei.analyzer.base_analyzer import AnalyzerResponse
from obsei.sink.base_sink import BaseSink, BaseSinkConfig, Convertor
class LoggerSinkConfig(BaseSinkConfig):
TYPE: str = "Logging"
logger: Optional[Logger] = None
lev... | [
{
"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 | obsei/sink/logger_sink.py | fossabot/obsei |
import os
from kivy.app import App
from kivy.factory import Factory
from kivy.properties import ObjectProperty
from kivy.lang import Builder
from electrum_smart.util import base_units
from ...i18n import _
from .label_dialog import LabelDialog
Builder.load_string('''
#:import os os
<WalletDialog@Popup>:
title: ... | [
{
"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 | gui/kivy/uix/dialogs/wallets.py | glemercier/electrum-smart |
class INestedContainer(IContainer,IDisposable):
""" Provides functionality for nested containers,which logically contain zero or more other components and are owned by a parent component. """
def __enter__(self,*args):
"""
__enter__(self: IDisposable) -> object
Provides the implementation of __ent... | [
{
"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 | release/stubs.min/System/ComponentModel/__init___parts/INestedContainer.py | htlcnn/ironpython-stubs |
from django.shortcuts import render, redirect
from .forms import UserForm, PerfilForm
from django.contrib.auth import login as auth_login, authenticate, logout
from django.contrib.auth.models import auth
from django.contrib import messages
from django.contrib.auth.decorators import login_required
def cadastro(request... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excludi... | 3 | accounts/views.py | LuizFelipeGondim/AUline |
import time
import types
import pytest
import teek
from teek.extras import tooltips
def run_event_loop(for_how_long):
# this is dumb
start = time.time()
while time.time() < start + for_how_long:
teek.update()
@pytest.mark.slow
def test_set_tooltip():
window = teek.Window()
assert not ha... | [
{
"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 | tests/extras/test_tooltips.py | Akuli/tkinder |
def test_mario():
"""
======= ====== ====== ===== =====================
Name Mario Luigi Toad Princess Toadstool
======= ====== ====== ===== =====================
Speed 4 3 5 2
Jump 4 5 2 3
Power 4 3 5 2
======= ====== ====== ===== ======... | [
{
"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 | labs/super_test.py | turing4ever/illustrated-python-3-course |
import json
class FileMgmt:
@classmethod
def save_json(cls, fp: str, data):
with open(fp, mode='w', encoding='utf-8') as file:
json.dump(data, file)
@classmethod
def load_json(cls, fp: str):
with open(fp, mode='r', encoding='utf-8') as file:
return json.load(fi... | [
{
"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 | models/utils/FileMgmt.py | GabrielAmare/Models |
# Copyright (C) 2019-2020, Therapixel SA.
# All rights reserved.
# This file is subject to the terms and conditions described in the
# LICENSE file distributed in this package.
"""The commands module exposes the different command lines methods
that can be used with pacsanini.
"""
from click import echo, group, option
... | [
{
"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": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (... | 3 | src/pacsanini/cli/commands.py | Therapixel/pacsanini |
# --------------------------------------------------------------------------------------------
# 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": "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 | src/command_modules/azure-cli-interactive/azure/cli/command_modules/interactive/tests/latest/test_shell_progress.py | cmcclister/azure-cli |
# This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
# for complete details.
from cryptography import utils
from cryptography.exceptions import (
AlreadyFinalized,
UnsupportedAlgorithm,
_Reasons,
)
cla... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answ... | 3 | venv/Lib/site-packages/cryptography/hazmat/primitives/poly1305.py | gilbertekalea/booking.com_crawler |
# IMPORTATION STANDARD
# IMPORTATION THIRDPARTY
import pytest
# IMPORTATION INTERNAL
from openbb_terminal.stocks.discovery import ark_model
@pytest.fixture(scope="module")
def vcr_config():
return {
"filter_headers": [("User-Agent", None)],
"filter_query_parameters": [
("period1", "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 | tests/openbb_terminal/stocks/discovery/test_ark_model.py | tehcoderer/GamestonkTerminal |
#!/usr/bin/env python3
import re
import sys
import logging
import argparse
from unicon.mock.mock_device import MockDevice, MockDeviceTcpWrapper
logger = logging.getLogger(__name__)
class MockDeviceSpitfire(MockDevice):
def __init__(self, *args, **kwargs):
super().__init__(*args, device_os='iosxr', **kw... | [
{
"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_class_has_docstring",
"question": "Does every class in this file have a docstring?... | 3 | src/unicon/plugins/tests/mock/mock_device_iosxr_spitfire.py | nielsvanhooy/unicon.plugins |
# Definition for a binary tree node.
# class Node(object):
# def __init__(self, val=" ", left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
def checkEquivalence(self, root1: 'Node', root2: 'Node') -> bool:
def post_order(node):
... | [
{
"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 | Python3/1612-Check-If-Two-Expression-Trees-are-Equivalent/soln.py | zhangyaqi1989/LeetCode-Solutions |
import socket
class NakamaSocket:
def __init__(self, socket_ip: str, socket_port: int):
self._socket_ip = socket_ip
self._socket_port = socket_port
@property
def socket_ip(self) -> str:
return self._socket_ip
@property
def socket_port(self) -> int:
return self._so... | [
{
"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 | nakamapy/services/socket.py | JeromeK13/nakamapy |
# Copyright 2019-2021 ETH Zurich and the DaCe authors. All rights reserved.
import math
import numpy as np
import dace
import polybench
N = dace.symbol('N')
#datatypes = [dace.float64, dace.int32, dace.float32]
datatype = dace.float64
# Dataset sizes
sizes = [{N: 40}, {N: 120}, {N: 400}, {N: 2000}, {N: 4000}]
args ... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
... | 3 | samples/polybench/lu.py | Walon1998/dace |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 5/15/20 4:49 PM
# @File : grover.py
# qubit number=4
# total number=16
import cirq
import cirq.google as cg
from typing import Optional
import sys
from math import log2
import numpy as np
#thatsNoCode
def make_circuit(n: int, input_qubit):
c = cirq.Ci... | [
{
"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 | data/cirq_new/cirq_program/startCirq_Class485.py | UCLA-SEAL/QDiff |
from click import argument
from flask.cli import AppGroup
from sqlalchemy.orm.exc import NoResultFound
manager = AppGroup(help="Queries management commands.")
@manager.command()
@argument("query_id")
@argument("tag")
def add_tag(query_id, tag):
from redash import models
query_id = int(query_id)
try:
... | [
{
"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 | redash/cli/queries.py | zero1number/redash |
# =============================================================================
# IMPORTS
# =============================================================================
import torch
from espaloma.nn.readout.base_readout import BaseReadout
# ===========================================================================... | [
{
"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 | espaloma/nn/readout/node_typing.py | cschlick/espaloma |
from torch.utils.data import Dataset
from .mol_tree import MolTree
import numpy as np
class MoleculeDataset(Dataset):
def __init__(self, data_file):
with open(data_file) as f:
self.data = [line.strip("\r\n ").split()[0] for line in f]
def __len__(self):
return len(self.data)
... | [
{
"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 | jtnn/datautils.py | brianhie/icml18-jtnn |
import pytest
import numpy as np
all_dtypes = pytest.mark.parametrize('dtype', ['f4', 'f8', 'c8', 'c16'])
class Base(object):
def rand(self, dtype, shape=()):
a = np.random.normal(size=shape).astype(dtype)
if np.issubdtype(dtype, np.complexfloating):
a += np.random.normal(size=a.sha... | [
{
"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 | pyblis/tests/utils.py | jcrist/pyblis |
import pytest
from helpers.cluster import ClickHouseCluster
cluster = ClickHouseCluster(__file__)
node1 = cluster.add_instance('node1', with_zookeeper=True)
node2 = cluster.add_instance('node2', with_zookeeper=True)
# no adaptive granularity by default
node3 = cluster.add_instance('node3', image='yandex/clickhouse-s... | [
{
"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 | tests/integration/test_adaptive_granularity_different_settings/test.py | HuaWorld/ClickHouse |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
# Export this package's modules as members:
from .get_entity import *
from .get_hierarchy_setting import *
from .get_management_group import *
from .ge... | [
{
"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 | sdk/python/pulumi_azure_native/management/v20200501/__init__.py | pulumi-bot/pulumi-azure-native |
"""Future-proof self-describing hashes.
Examples:
decode(data).digest
"""
from typing import NamedTuple
import uvarint
class MultiHash(NamedTuple):
"""The digest, its length and the hashing algorithm that produced it."""
function: int
length: int
digest: bytes
class LengthMismatchError(Except... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class 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/cls)?",... | 3 | multihash/__init__.py | matheusmoreira/multihash.py |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models
from morango.models import UUIDField
from kolibri.core.auth.models import AbstractFacilityDataModel
from kolibri.core.auth.models import Facility
from kolibri.core.auth.models import FacilityUser
from kolibri.core.auth.permis... | [
{
"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 | kolibri/core/bookmarks/models.py | Carlcollins35/kolibri |
from django import forms
from django.forms import ModelForm
from .models import Review
class ReviewForm(ModelForm):
required_css_class = 'required'
def __init__(self, *args, **kwargs):
"""
user object is passed to the form in kwargs in the view
the user objected is removed from kwarg... | [
{
"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 | reviews/forms.py | mohammadasim/online-bookstore |
# The MIT License (MIT)
#
# Copyright (c) 2021 NVIDIA CORPORATION
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation the rights to
# use, copy... | [
{
"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 | docs/examples/multi_input/multi_input_pipeline.py | laochonlam/dali_backend |
#-
# Copyright (c) 2011 Robert N. M. Watson
# Copyright (c) 2014 Robert M. Norton
# All rights reserved.
#
# This software was developed by SRI International and the University of
# Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237
# ("CTSRD"), as part of the DARPA CRASH research programme.
#
# @... | [
{
"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 | cheritest/trunk/tests/cp2/test_cp2_tlb_instruction_miss.py | tupipa/beri |
# -*- coding: utf-8 -*-
from datetime import date, datetime
from django.core.management.base import BaseCommand
from django.conf import settings
from schedulemaster.models import ProgramSchedule
from config.models import get_configurations
from utils.datedeux import DateDeux
import sendgrid
from .notify... | [
{
"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 | aasaan/config/management/commands/notify_program_cancellation.py | deepakkt/aasaan |
# uncompyle6 version 2.9.10
# Python bytecode 2.7 (62211)
# Decompiled from: Python 3.6.0b2 (default, Oct 11 2016, 05:27:10)
# [GCC 6.2.0 20161005]
# Embedded file name: Mcl_Cmd_GeZu_KernelMemory_Tasking.py
def TaskingMain(namespace):
import mcl.tasking
procedure = mcl.tasking.GetProcedureNumber()
if pro... | [
{
"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 | Leak #5 - Lost In Translation/windows/Resources/GeZu/PyScripts/Tasking/Mcl_Cmd_GeZu_KernelMemory_Tasking.py | bidhata/EquationGroupLeaks |
from typing import List
from .EconDataRecord import *
import json
class EconDataListRequest(object):
def __init__(self, data: List[EconData]) -> None:
self.data = data
@classmethod
def from_json(cls, data):
x = list(map(EconData.from_json, data['data']))
return cls(x)
... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
... | 3 | contracts/EconDataList.py | dbeis/algotrading-api |
#!/usr/bin/env python
from strip import Strip
import random
import time
import signal
import logging
logger = logging.getLogger(__name__)
def init_logging(log_level):
logging.basicConfig(level=log_level)
# catch signals for tidy exit
_exiting = False
def signal_handler(signal, frame):
global _exiting
_... | [
{
"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 | test_leds.py | DavidAntliff/apa102 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Hive Netius System
# Copyright (c) 2008-2020 Hive Solutions Lda.
#
# This file is part of Hive Netius System.
#
# Hive Netius System is free software: you can redistribute it and/or modify
# it under the terms of the Apache License as published by the Apache
# Foun... | [
{
"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 | examples/basic/future.py | timgates42/netius |
# Author: OMKAR PATHAK
# Contributors: Mohamed Kiouaz
# Created On: 31st July 2017
# Best O(n); Average O(n*(n-1)/4); Worst O(n^2)
# Bubble Sorting algorithm
def sort(List):
for i in range(len(List)):
for j in range(len(List) - 1, i, -1):
if List[j] < List[j - 1]:
List[j], List... | [
{
"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 | pygorithm/sorting/bubble_sort.py | aklakahamed/Mod1 |
from __future__ import annotations
from datetime import date, datetime
from unittest import TestCase
from tests.classes.super_datetime import SuperDateTime
class TestToboday(TestCase):
def test_toboday_transforms_datetime_into_the_time_of_beginning_of_day(self):
d = SuperDateTime(dtbd=datetime(2021, 10,... | [
{
"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 | tests/test_toboday.py | Jesse-Yung/jsonclasses |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.