source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
class ZhimaCreditPeUserContractUnsignResponse(AlipayResponse):
def __init__(self):
super(ZhimaCreditPeUserContractUnsignResponse, self).__init__()
self._operate_time = None... | [
{
"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 | alipay/aop/api/response/ZhimaCreditPeUserContractUnsignResponse.py | snowxmas/alipay-sdk-python-all |
import os
import open3d
import numpy as np
def get_pcd(pcdpath, filename):
return open3d.read_point_cloud(os.path.join(pcdpath, filename + '.ply'))
def get_keypts(keyptspath, filename):
keypts = np.load(os.path.join(keyptspath, filename + f'.npy'))
return keypts
def get_desc(descpath, filename, desc_n... | [
{
"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 | geometric_registration/utils.py | HOUYONGKUO/D3Feat |
import logging
from .DatabaseBase import DatabaseBase
logger = logging.getLogger(__name__)
logging.basicConfig(level=logging.DEBUG)
class ImageResource(DatabaseBase):
def __init__(self):
super().__init__()
def get_product_images_by_id(self, id):
search_image_query = """Select * From images w... | [
{
"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 | app/Resource/ImageResource.py | ansabkhaliq/backend |
# Copyright 2014 Cloudera Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, 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_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"ans... | 3 | ibis/expr/tests/test_pipe.py | tswast/ibis |
"""Inspiration from
https://github.com/fabric/fabric/blob/master/fabric/colors.py
"""
import re
def _wrap_with(code, bold=False):
def inner(text):
c = code
if bold:
c = "1;%s" % c
return "\033[%sm%s\033[0m" % (c, text)
return inner
red = _wrap_with('31')
green = _wrap_with... | [
{
"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 | textract/colors.py | Pandaaaa906/textract |
import json
from rest_framework import serializers
from django.core.urlresolvers import reverse
from landscapesim.models import Region
class ReportingUnitSerializer(serializers.Serializer):
type = serializers.SerializerMethodField()
properties = serializers.SerializerMethodField()
geometry = serializers... | [
{
"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 | landscapesim/serializers/regions.py | consbio/landscapesim |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import torch.utils.data
import torchvision
from .coco import build as build_coco
def get_coco_api_from_dataset(dataset):
for _ in range(10):
# if isinstance(dataset, torchvision.datasets.CocoDetection):
# break
if ... | [
{
"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 | datasets/__init__.py | HAadams/detr |
# Copyright 2019-2021 Axis Communications AB.
#
# For a full list of individual contributors, please see the commit history.
#
# 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... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": true
},
{
... | 3 | eiffellib/events/eiffel_test_execution_recipe_collection_created_event.py | eiffel-community/eiffel-pythonlib |
class BaseClient:
def send_message(self, text=None, urls=None):
pass
@staticmethod
def get_client_name():
pass
def is_threadable(self) -> bool:
pass
def run_client(self, *args):
pass
def get_run_args(self):
pass
| [
{
"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 | src/base_client.py | ryanclanigan/messaging-bridge |
from okdata.aws.logging import logging_wrapper
from starlette.middleware.base import BaseHTTPMiddleware
def _logging_middleware(request, call_next):
@logging_wrapper("event-stream-api", async_wrapper=True)
async def handler(event, context):
return await call_next(request)
return handler(request.s... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written ... | 3 | logging_middleware.py | oslokommune/okdata-event-stream-api |
import os
import queue
import traceback
from concurrent.futures import ThreadPoolExecutor
class BlockingExecutor:
def __init__(self, thread_count, cache_size):
if cache_size <= 0:
raise ValueError('cache_size must > 0')
self.finish = False
self.executor = ThreadPoolExecutor(thr... | [
{
"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 | blocking_executor.py | AoEiuV020/NotionImportKeep |
#
# 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... | [
{
"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 | liminal/runners/airflow/tasks/python.py | ZionCervello/incubator-liminal |
from __future__ import unicode_literals
import frappe, json
from frappe import _
from frappe.model.document import Document
from frappe.utils import get_url
def get_context(context):
context.show_search = True
@frappe.whitelist(allow_guest=True)
def create_student_applicant(first_name, middle_name, last_name, pro... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/... | 3 | eduone/templates/pages/student_application.py | efeone/eduone |
import marshmallow
import ujson
from snow.exceptions import PayloadValidationError
from ..core import PostRequest
class Creator:
def __init__(self, resource):
self.resource = resource
self.schema = resource.schema_cls
async def write(self, data):
try:
payload = self.sche... | [
{
"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 | snow/request/helpers/create.py | sulbig/snow |
import datetime
def main(j, args, params, tags, tasklet):
page = args.page
modifier = j.portal.tools.html.getPageModifierGridDataTables(page)
filters = dict()
for tag, val in args.tags.tags.items():
val = args.getTag(tag)
if tag == 'from' and val:
filters['from_'] = {'name'... | [
{
"point_num": 1,
"id": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 lines?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
... | 3 | apps/gridportal/base/Grid/.macros/page/ecos/1_ecos.py | Jumpscale/jumpscale_portal8 |
import pytest # type: ignore
from snyk.client import SnykClient
from snyk.errors import SnykError
from snyk.managers import Manager
from snyk.models import Organization, Project
class TestManager(object):
@pytest.fixture
def client(self):
return SnykClient("token")
def test_factory(self, client... | [
{
"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 | snyk/test_manager.py | husband-inc/pysnyk |
"""
Always handy to have a random agent.
If an RL agent performs significantly better than random, then it must be at least learning something.
"""
import gym
from microtbs_rl import envs
from microtbs_rl.algorithms.common import run_policy_loop
from microtbs_rl.algorithms.common.agent import AgentRandom
from mic... | [
{
"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 | microtbs_rl/algorithms/baselines/enjoy_baseline_random.py | alex-petrenko/simple-reinforcement-learning |
def load():
with open("inputs/7.txt") as f:
yield from map(int, f.readline().split(","))
def solve(cost):
positions = tuple(load())
min_position, max_position = min(positions), max(positions)
return min(
sum(cost(suggestion, crab) for crab in positions)
for suggestion in range(... | [
{
"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 | JB/7.py | boostjanbjorge/adventofcode |
from django.contrib import admin
class CustomModelAdmin(admin.ModelAdmin):
date_hierarchy = 'created_on'
def save_model(self, request, instance, form, change):
user = request.user
instance = form.save(commit=False)
if not change or not instance.created_by:
instance.created... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{... | 3 | irekua_database/admin/models.py | CONABIO-audio/irekua-database |
from .model import TreeNode
"""
Space : O(n)
Time : O(n)
"""
class Solution:
def preorder(self, root: TreeNode) -> List[int]:
s = []
if root:
s.append(root.val)
s += self.preorder(root.left)
s += self.preorder(root.right)
else:
return ... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or few... | 3 | python3/same_tree.py | joshiaj7/CodingChallenges |
import vlc
instance = vlc.Instance()
class VLCPlayer:
def __init__(self):
self.player = instance.media_player_new()
self.player.audio_output_set("Scaletempo")
self.length = 0
def set_position(self,position) :
self.player.set_position(position / self.get_length())
... | [
{
"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 | vlcplayer.py | danlyke/squareplay |
class Lavadora:
def __init__(self):
pass
def lavar(self, temperatura='caliente'):
self._llenar_tanque_de_agua(temperatura)
self._anadir_jabon()
self._lavar()
self._centrifugar()
def _llenar_tanque_de_agua(self, temperatura):
print(f'Llenando el tanque con ag... | [
{
"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 | 6. Abstraccion.py | elviscruz45/POOAlgoritmoPython |
from __future__ import annotations
from typing import List
from abc import ABC, abstractmethod
class RealObject(ABC):
"""
This class represents a real object in the proxy design pattern.
"""
@abstractmethod
def get_list(self) -> List:
raise NotImplementedError()
class ProxyObject(ABC):
"""
This class repr... | [
{
"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 | design_pattern/proxy/framework.py | AustinHellerRepo/DesignPatternDemo |
"""episode_source
Revision ID: d6fcd3132857
Revises: bca0b2a3b5f4
Create Date: 2021-10-17 18:51:29.927189
"""
import sqlalchemy as sa
from sqlalchemy.sql import table, column
from sqlalchemy import String
from alembic import op
# revision identifiers, used by Alembic.
revision = "d6fcd3132857"
down_revision = "bca0b... | [
{
"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 | alembic/versions/d6fcd3132857_episode_source.py | DmitryBurnaev/podcast-service |
# qubit number=4
# total number=15
import pyquil
from pyquil.api import local_forest_runtime, QVMConnection
from pyquil import Program, get_qc
from pyquil.gates import *
import numpy as np
conn = QVMConnection()
def make_circuit()-> Program:
prog = Program() # circuit begin
prog += H(0) # number=1
pr... | [
{
"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 | data/p4VQE/R4/benchmark/startPyquil685.py | UCLA-SEAL/QDiff |
import subprocess
def decrypt(message, key):
return subprocess.check_output(['./application.out', message, key, "1"]).decode('utf8').strip()
def encrypt(message, key):
return subprocess.check_output(['./application.out', message, key, "0"]).decode('utf8').strip()
if __name__ == '__main__':
original_msg =... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (ex... | 3 | wrapper.py | 0rangeFox/easy-encryption |
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
# @param head, a ListNode
# @param k, an integer
# @return a ListNode
def rotateRight(self, head, k):
if not head:
return None
... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/... | 3 | algorithms/rotateList/rotateList.py | zhyu/leetcode |
version_info = (5, 6, 0)
pre_info = ''
dev_info = ''
def create_valid_version(release_info, epoch=None, pre_input='', dev_input=''):
'''
Creates a pep440 valid version of version number given a tuple integers
and optional epoch, prerelease and developmental info.
Parameters
----------
release_... | [
{
"point_num": 1,
"id": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 lines?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
... | 3 | Lib/site-packages/nbconvert/_version.py | caiyongji/py36-tf2.0rc |
from pathlib import Path
def release(data: dict, outfile: Path) -> None:
with open(outfile, "w") as fh:
fls = [dd["flags"] for dd in data["data"]]
fh.write("|".join(fls))
def main() -> None:
from . import parser
infile = Path("sources/rout.txt")
outfile = Path("releases/latest/windo... | [
{
"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_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"an... | 3 | microkg/releaser.py | goude/microkg |
#!/usr/bin/python
################################################################################
# 21132ac6-5cc5-11e4-af55-00155d01fe08
#
# Justin Dierking
# justindierking@hardbitsolutions.com
# phnomcobra@gmail.com
#
# 10/24/2014 Original Construction
################################################################... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": ... | 3 | pcat2py/class/21132ac6-5cc5-11e4-af55-00155d01fe08.py | phnomcobra/PCAT2PY |
from wp.command import WPCommand
class DBQuery(WPCommand):
command = ['db', 'query']
# SQL.
sql = '' # Required
# Skips outputting column names.
skip_column_names = bool
def __init__(self, sql, **args):
super().__init__(**args)
self.sql = sql
self.skip_column_names... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
}... | 3 | src/wp_cli/db_query.py | wpsmith/wp-cli-python |
# coding=utf-8
# Copyright 2011 Foursquare Labs Inc. All Rights Reserved
from __future__ import (nested_scopes, generators, division, absolute_import, with_statement,
print_function, unicode_literals)
import unittest
from foursquare.source_code_analysis.scala.scala_unused_import_remover impor... | [
{
"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/python/foursquare_test/source_code_analysis/scala/test_scala_unused_import_remover.py | foursquare/source_code_analysis |
import os
import re
import sys
import torch
import hashlib
from progress.bar import Bar
from sequence import NoteSeq, EventSeq, ControlSeq
import utils
import config
def preprocess_midi(path):
note_seq = NoteSeq.from_midi_file(path)
note_seq.adjust_time(-note_seq.notes[0].start)
event_seq = EventSeq.from_... | [
{
"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 | preprocess.py | hircumg/Performance-RNN-PyTorch |
import logging
logger = logging.getLogger( __file__ )
def CustomSQLQuery( sql, args ):
from django.db import connection
cursor = connection.cursor()
# Data retrieval operation - no commit required
cursor.execute( sql, args )
rows = cursor.fetchall()
cursor.execute( "COMMIT" )
return rows
... | [
{
"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": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 lines?",
"answer": false
... | 3 | app/backend/common/functions/custom_sql.py | karstenv/nmp-arm |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import collections
##from ansible.errors import AnsibleOptionsError, AnsibleModuleError##, AnsibleError
####from ansible.module_utils._text import to_native
from ansible.module_utils.six import iteritems, string_types
from ansi... | [
{
"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 | plugins/action/gitlab_modwrap.py | sma-de/ansible-collections-gitlab |
"""
CryptoAPIs
Crypto APIs 2.0 is a complex and innovative infrastructure layer that radically simplifies the development of any Blockchain and Crypto related applications. Organized around REST, Crypto APIs 2.0 can assist both novice Bitcoin/Ethereum enthusiasts and crypto experts with the development of thei... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer":... | 3 | test/test_create_coins_transaction_request_from_address_rb_data.py | Crypto-APIs/Crypto_APIs_2.0_SDK_Python |
class TreeNode:
def __init__(self, val=0, left=None, right=None):
self.val = val
self.left = left
self.right = right
def isBalanced(root: TreeNode) -> bool:
def check(root):
if not root:
return 0
l, r = check(root.left), check(root.right)
if -1 in [... | [
{
"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": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (e... | 3 | 1-Easy/isBalanced.py | Sma-Das/Leetcode |
import operator as op
import math
import random
import sys
def ncr(n, r):
r = min(r, n - r)
if r == 0:
return 1
numer = reduce(op.mul, xrange(n, n - r, -1))
denom = reduce(op.mul, xrange(1, r + 1))
return numer // denom
def run():
length = int(input("Length(-1 to quit): "))
if lengt... | [
{
"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 | useWord.py | babebeebaboo/WordCookiesLIST |
from bluepy import btle
"""
This class enables us to scan for BLE devices.
"""
class BLEScanner:
"""
Scan for BLE devices and returns these devices as ScanEntry
:param interface the Bluetooth interface
:param timeout how long scan operation takes (in seconds)
:return A list of ScanEntry obj... | [
{
"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/protocols/BLE/ble_tools.py | QWERTSKIHACK/peniot |
# Copyright 2022 Touca, Inc. Subject to Apache-2.0 License.
from dataclasses import dataclass
from time import sleep
from typing import List
from datetime import date
from random import random
import touca
@dataclass
class Course:
name: str
grade: float
@dataclass
class Student:
username: str
fulln... | [
{
"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 | examples/python/02_python_main_api/students.py | trytouca/trytouca |
import numpy as np
from pytorch_drl.utils.schedule import LinearSchedule
class OrnsteinUhlenbeck:
def __init__(self, x_size, mu=0,
sigma_init=0.2, sigma_final=0.2,
sigma_horizon=1, theta=0.2, dt=1e-2):
self.mu = mu
self.x_size = x_size
self.dt = dt
... | [
{
"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 | pytorch_drl/utils/exploration.py | selim-karaduman/pytorch-drl-algs |
import pytest
from sopel_help import providers
MOCK_RESULT = 'https://example.com/clbin-content'
MOCK_URL = 'https://clbin.com/'
def test_publish(requests_mock):
requests_mock.post(MOCK_URL, text=MOCK_RESULT)
# this provider doesn't need any bot setup to work
provider = providers.CLBinPublisher()
p... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": fals... | 3 | tests/test_providers_clbin.py | MacFan4000/sopel-help |
import os
import torch
import os
import random
from torch.nn import(
Module,Linear,LayerNorm
)
import math
from .AutoEncoder import Encoder
class DeltaT(Module):
def __init__(self):
super().__init__()
self.reset_seed()
self.elem = math.prod(Encoder().output_size)
self.input_size... | [
{
"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 | _Sensation0/DeltaTime.py | Geson-anko/JARVIS3 |
from datetime import datetime
CERT = "Certificate"
PUBKEY = "Public Key"
PRIVKEY = "Private Key"
# TODO: Replace dict with oid search
X509_SIG_ALGORITHMS = {
"MD2WITHRSAENCRYPTION": False,
"MD2WITHRSA": False,
"MD5WITHRSAENCRYPTION": False,
"MD5WITHRSA": False,
"SHA1WITHRSAENCRYPTION": False,
... | [
{
"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 | utils.py | matedealer/pem_analyser |
import os
import subprocess
import sys
import unittest
# TODO: these command should be written at once, at only .travis.yml or at only here
paths = ['oj', 'onlinejudge', 'setup.py', 'tests']
class ContinuousIntegrationTest(unittest.TestCase):
"""A dummy test to run the commands same to CI on local environments"... | [
{
"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 | tests/continuous_integration.py | kfaRabi/online-judge-tools |
# pylint: disable=missing-docstring
import unittest
import numpy as np
import tensorflow as tf
import tf_encrypted as tfe
from tf_encrypted.layers.activation import Tanh
class TestTanh(unittest.TestCase):
def setUp(self):
tf.reset_default_graph()
def test_forward(self):
input_shape = [4]
input_tanh ... | [
{
"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_tanh.py | gavinuhma/tf-encrypted |
import numpy as np
import cv2
BUFFER_SIZE = 30
class imageGenerator:
def __init__(self, img):
self.imgBuffer = [img] * BUFFER_SIZE
self.currentIndex = 0
print(f"Image type: {type(img)}")
print(f"buffer shape: {self.imgBuffer[0].shape}")
def addNewImage(self, img):
self... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answ... | 3 | main.py | Classic-Daniel/gradient-video-delay |
# https://adventofcode.com/2019/day/6
def load_file(filename: str) -> dict:
with open(filename) as f:
raw_orbits = f.readlines()
orbits = dict()
for line in raw_orbits:
value, key = line[:-1].split(')')
orbits[key] = value
return orbits
def get_lineage(parent: str, orbits: d... | [
{
"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 | 2019/problem06.py | wandrewjam/advent-of-code |
from django.test import TestCase
from django.contrib.auth import get_user_model
class ModelTests(TestCase):
def test_create_user_with_email_successful(self):
"""Test creando nuevo usuario con email es exitoso"""
email = 'test@google.com'
password = 'Testpass123'
user = get_user_mo... | [
{
"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 | app/core/test/test_models.py | RoqueSanJuan/recipe-app-api |
from functools import lru_cache
from injector import inject
from .config_parameter_base import ConfigParameterBase
from ...data.repository import RepositoryProvider
from ...dependency import IScoped
from ...exceptions import RequiredClassException
class ConfigService(IScoped):
@inject
def __init__(self,
... | [
{
"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 | pdip/configuration/services/config_service.py | ahmetcagriakca/pdip |
#!/usr/bin/python
import httplib2
import os
import sys
from googleapiclient.discovery import build
from oauth2client.client import flow_from_clientsecrets
from oauth2client.file import Storage
from oauth2client.tools import argparser, run_flow
import sloelib
class SloeYouTubeSession(object):
YOUTUBE_API_SERVICE... | [
{
"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 | sloeplugins/sloeyoutube/sloeyoutubesession.py | sloe/chan |
"""isort:skip_file"""
# start_pipeline_marker
from dagster import pipeline, solid
@solid
def get_name(_):
return "dagster"
@solid
def hello(context, name: str):
context.log.info("Hello, {name}!".format(name=name))
@pipeline
def hello_pipeline():
hello(get_name())
# end_pipeline_marker
# start_ex... | [
{
"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 | examples/docs_snippets/docs_snippets/getting_started/hello_world.py | withshubh/dagster |
from django import template
from django.contrib.contenttypes.models import ContentType
from django.urls import reverse
from ..forms import CommentForm
from ..hooks import hookset
from ..models import Comment
register = template.Library()
@register.filter
def can_edit_comment(comment, user):
return hookset.load_... | [
{
"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 | pinax/comments/templatetags/pinax_comments_tags.py | rosscdh/pinax-comments |
from abc import ABC, abstractmethod
from anasymod.targets import CPUTarget
from anasymod.config import EmuConfig
class Simulator(ABC):
def __init__(self, target: CPUTarget, flags=None):
# set defaults
if flags is None:
flags = []
# save settings
self.cfg = ta... | [
{
"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 | anasymod/sim/sim.py | SubjeBilisim/anasymod |
import os
import numpy as np
def get_lax_sod_network():
return [12, 12, 10, 12, 10, 12, 10, 10, 12,1]
def get_lax_sod_data_inner():
data_path = os.environ.get("LAX_SOD_REPO_PATH", "../lax_sod_tube")
qmc_points = np.loadtxt(os.path.join(data_path, "parameters/parameters_sobol_X.txt"))
forces = np... | [
{
"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 | python/lax_sod_data.py | kjetil-lye/lax_sod_shock_tube_machine_learning |
import py
from pypy.rlib.rsdl import RSDL
from pypy.rlib.rarithmetic import r_uint
from pypy.rpython.lltypesystem import rffi
def test_sdl_init():
assert RSDL.Init(RSDL.INIT_VIDEO) >= 0
RSDL.Quit()
def test_surface_basic():
assert RSDL.Init(RSDL.INIT_VIDEO) >= 0
surface = RSDL.CreateRGBSurface(0, 150... | [
{
"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 | pypy/rlib/rsdl/test/test_basic.py | woodrow/pyoac |
from .migrations import migrate_exchanges, migrate_datasets
def drop_unspecified_subcategories(db):
"""Drop subcategories if they are in the following:
* ``unspecified``
* ``(unspecified)``
* ``''`` (empty string)
* ``None``
"""
UNSPECIFIED = {"unspecified", "(unspecified)... | [
{
"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 | bw2io/strategies/biosphere.py | mfastudillo/brightway2-io |
# Copyright (c) 2016 Matthew Earl
#
# 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, modify, merge, publish, distr... | [
{
"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 | common.py | gy29289957/deep-anpr |
"""Basic message."""
from datetime import datetime
from typing import Union
from marshmallow import fields
from ...agent_message import AgentMessage, AgentMessageSchema
from ...util import datetime_now, datetime_to_str
from ...valid import INDY_ISO8601_DATETIME
from ..message_types import BASIC_MESSAGE
HANDLER_CLA... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{
... | 3 | aries_cloudagent/messaging/basicmessage/messages/basicmessage.py | DibbsZA/aries-cloudagent-python |
# -*- coding: utf-8 -*-
from __future__ import print_function, division, absolute_import, unicode_literals
from parser_base import RegexParser
import model
class RegexSemantics(object):
def __init__(self):
super(RegexSemantics, self).__init__()
self._count = 0
def START(self, ast):
re... | [
{
"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 | examples/regex/regex_parser.py | alyosha1879/grako |
# This problem was asked by Google.
# Given a string of words delimited by spaces, reverse the words in string. For example,
# given "hello world here", return "here world hello"
# Follow-up: given a mutable string representation, can you perform this operation in-place?
####
def reverse_string(arr, i, j):
n = j - ... | [
{
"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 | 113.py | whoophee/DCP |
import mitmproxy
class CheckCA:
def __init__(self):
self.failed = False
def configure(self, updated):
has_ca = (
mitmproxy.ctx.master.server and
mitmproxy.ctx.master.server.config and
mitmproxy.ctx.master.server.config.certstore and
mitmproxy.ct... | [
{
"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 | mitmproxy/addons/check_ca.py | 00cool/project-X |
import os
import sys
import mock
import pytest
from program_synthesis.karel import arguments
from program_synthesis.karel.dataset import dataset
from program_synthesis.karel.dataset import edit_data_loader
from program_synthesis.karel.models import karel_edit_model
@pytest.fixture
def args():
with mock.patch('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 | program_synthesis/karel/dataset/edit_data_loader_test.py | kavigupta/program_synthesis |
#!/usr/bin/python3
"""
A rectangle is represented as a list [x1, y1, x2, y2], where (x1, y1) are the
coordinates of its bottom-left corner, and (x2, y2) are the coordinates of its
top-right corner.
Two rectangles overlap if the area of their intersection is positive. To be
clear, two rectangles that only touch at the... | [
{
"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 | 836 Rectangle Overlap.py | krishna13052001/LeetCode |
''' clip.py:
Implement's the clip ONNX node as a flexnode (for use with any accelerator)
'''
import uuid
import numpy as np
from operators.flexnode import FlexNode
from core.defines import Operator
from core.messaging import Message
class Clip(FlexNode):
def __init__(self, onnx_node, inputs, outputs):
... | [
{
"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 | operators/clip.py | ngiambla/nnflex |
import cv2
def take_picture(filePath):
# Camera 0 is the integrated web cam on my netbook
camera_port = 0
#Number of frames to throw away while the camera adjusts to light levels
ramp_frames = 30
# Now we can initialize the camera capture object with the cv2.VideoCapture class.
# ... | [
{
"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 | takepicture.py | andrewleader/cafe-wait-times |
class PluginsContext(object):
def __init__(self, app, session, plugins_data):
self.app = app
self.session = session
self.plugins_data = plugins_data
def getvar(self, var):
try:
var = self.plugins_data._get(var)
return var
except KeyError:
... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
... | 3 | pcraft/PluginsContext.py | n0Hats/pCraft |
import pytest
from django.core import mail
from app.mail.owl import TemplOwl # type: ignore
pytestmark = [pytest.mark.django_db]
@pytest.fixture(autouse=True)
def _enable_email(settings):
settings.EMAIL_ENABLED = True
@pytest.fixture
def owl():
return TemplOwl(
to='f@f213.in',
template_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": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/... | 3 | src/app/tests/owl/tests_owl_functional.py | denkasyanov/education-backend |
from datetime import datetime
from requests_html import HTMLSession
from bs4 import BeautifulSoup
from fake_useragent import UserAgent
UA = UserAgent()
BASE_URL = "https://www.infobase.md/ro/"
class Explorer:
def __init__(self, entity):
self.entity = entity
self.headers = {"User-Agent": UA.chrome,... | [
{
"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 | infobase.py | markmelnic/Infobase-Telegram-Bot |
import sys, os, pwd, signal, time
from resource_management import *
from resource_management.core.base import Fail
from resource_management.core.exceptions import ComponentIsNotRunning
from subprocess import call
from impala_base import ImpalaBase
class StateStore(ImpalaBase):
#Call setup.sh to install the service... | [
{
"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 | ambari-server/src/main/resources/stacks/HDP/2.5/services/IMPALA/package/scripts/impala-state-store.py | cas-packone/ambari-chs |
import datetime
import copy
import pprint
from .base import CommandBase
from akebono.inspector import get_scenario_summary
def _get_fixed_length_str(s, length):
if not isinstance(s, str):
raise TypeError('invalid type')
l = length - len(s)
if l < 0:
raise Exception('invalid length')
r... | [
{
"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 | akebono/commands/models/inspect.py | OTA2000/akebono |
from os.path import abspath as absolute_path
from time import time
import aiofiles
from wbb import aiohttpsession as session
from wbb.core.tasks import add_task
def ensure_status(status_code: int):
if status_code < 200 or status_code >= 300:
raise Exception(f"HttpProcessingError: {status_code}")
async... | [
{
"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 | wbb/utils/downloader.py | stylishsuryaa/JohnShelby |
# coding: utf-8
#
# Copyright 2022 :Barry-Thomas-Paul: Moss
#
# 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 applicab... | [
{
"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 | ooobuild/dyn/ucb/content_event.py | Amourspirit/ooo_uno_tmpl |
import unittest
from unittest import TestCase
from bitsnpieces import torrent
class TestTorrentFile(TestCase):
def test_torrent_load_ubuntu(self):
torfile = torrent.load("test/data/ubuntu-20.04.1-desktop-amd64.iso.torrent")
self.assertEqual(torfile.announce, "https://torrent.ubuntu.com/announce")
... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
... | 3 | test/test_torrent.py | MoazAshraf/bits-n-pieces |
from elasticsearch import Elasticsearch
from pprint import pprint as pp
es = Elasticsearch()
INDEX = "meme-index"
TYPE = "meme"
def submit(id, doc):
res = es.index(index=INDEX, doc_type=TYPE, id=id, body=doc)
if res['created']:
return True
def search(query):
es.indices.refresh(index=INDEX)
... | [
{
"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/search.py | AInursery/george |
from __future__ import print_function
from numpy import linspace, sin
from chaco.api import ArrayPlotData, Plot
from enable.api import BaseTool
from enable.component_editor import ComponentEditor
from traits.api import Enum, HasTraits, Instance
from traitsui.api import Item, View
class CustomTool(BaseTool):
def... | [
{
"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_class_has_docstring",
"question": "Does every class in this file have a docstring?"... | 3 | examples/tutorials/scipy2008/custom_tool_click.py | janvonrickenbach/Chaco_wxPhoenix_py3 |
from typing import List
import pydash
from jesse.config import config
from jesse.models import Order
class OrdersState:
def __init__(self) -> None:
# used in simulation only
self.to_execute = []
self.storage = {}
for exchange in config['app']['trading_exchanges']:
f... | [
{
"point_num": 1,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (exc... | 3 | jesse/store/state_orders.py | quantfor/jesse |
#!/usr/bin/env python3
import pytest
DOCKER_CMD = "docker run --rm -i devops-tools:latest"
# demonstrate that we can use go to get/build/run
GO_CMD = "set -e;go get github.com/go-training/helloworld;find / -type d -name helloworld -print;go install github.com/go-training/helloworld;find / -type f -name helloworld -pri... | [
{
"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_post_build.py | natemarks/docker-devops-tools |
"""
netvisor.requests.product
~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2013-2016 by Fast Monkeys Oy | 2019- by Heltti Oy
:license: MIT, see LICENSE for more details.
"""
from .base import Request
from ..exc import InvalidData
from ..responses.products import GetProductResponse, ProductListResponse
c... | [
{
"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 | netvisor_api_client/requests/product.py | ajmyyra/netvisor-api-client |
from .compat import unittest
import ucl
import json
import os.path
import glob
import re
TESTS_SCHEMA_FOLDER = '../tests/schema/*.json'
comment_re = re.compile('\/\*((?!\*\/).)*?\*\/', re.DOTALL | re.MULTILINE)
def json_remove_comments(content):
return comment_re.sub('', content)
class ValidationTest(unittest.Te... | [
{
"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 | python/tests/test_validation.py | JX7P/libucl |
import matplotlib.pyplot as plt
import networkx as nx
def print_graph(vertices, edges, print_dist: bool = False) -> None:
"""
Summary
Args:
vertices (TYPE): Description
edges (TYPE): Description
print_dist (bool, optional): Description
"""
for v in vertices:
print(... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self... | 3 | flee/postprocessing/analyze_graph.py | jataware/flee |
# Copyright 2021 The KServe Authors.
#
# 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 wr... | [
{
"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 | python/alibiexplainer/alibiexplainer/explainer_wrapper.py | ittus/kserve |
# start_repo_marker_0
from dagster import PresetDefinition, pipeline, repository, solid
@solid(tags={"metadata": "some_metadata"})
def get_tag(context):
metadata = context.solid_def.tags.get("metadata")
context.log.info("solid has tag: {}".format(metadata))
owner = context.pipeline_run.tags.get("owner")
... | [
{
"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 | examples/pipeline_tags/repo.py | withshubh/dagster |
from django.db import models
from django.utils import timezone
from cms.models import NameSlugModel
class FeedbackCategory(NameSlugModel):
class Meta:
verbose_name = 'feedback category'
verbose_name_plural = 'feedback categories'
class IssueType(NameSlugModel):
class Meta:
verbose... | [
{
"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 | feedbacks/models.py | caputomarcos/pythondotorg |
"""hug/input_formats.py
Defines the built-in Hug input_formatting handlers
Copyright (C) 2015 Timothy Edmund Crosley
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, includi... | [
{
"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 | hug/input_format.py | alisaifee/hug |
import unittest
from app.models import Comments
class CommentsModelTest(unittest.TestCase):
def setUp(self):
self.new_comment = Comments(comment='a')
def test_instance(self):
self.assertEqual(self.new_comment.comment, 'a')
def test_save_comment(self):
self.new_comment.save_comme... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},... | 3 | tests/test_comments.py | EugeneZnm/pitches |
from unittest import TestCase
from wagtail.wagtailcore.blocks.field_block import CharBlock
from wagtail.wagtailcore.blocks.stream_block import StreamValue
from pages.blocks import StreamBlock
class TestCharBlock(CharBlock):
def __init__(self, *args, **kwargs):
self.expected = kwargs.pop('expected', None... | [
{
"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 | pages/tests/test_blocks.py | nhsuk/nhsuk-content-store |
# Copyright 2018, OpenCensus Authors
#
# 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 w... | [
{
"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/unit/common/transports/test_common_base_transport.py | CESARBR/opencensus-python |
"""note
Revision ID: b66e30eb6816
Revises: 8add39cb253d
Create Date: 2019-02-26 13:09:27.596374
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = 'b66e30eb6816'
down_revision = '8add39cb253d'
branch_labels = None
depends_on = None
def upgrade():
op.create_ta... | [
{
"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 | ocdskingfisherprocess/maindatabase/migrations/versions/b66e30eb6816_note.py | matiasSanabria/kingfisher-process |
from __future__ import print_function
import sys
# USAGE
# sys.argv[1] = genes.gtf
# Example
# $ python gtf2protein_coding_genes.py genes.gtf > protein_coding_genes.lst
def get_value(mykey, lookup):
try:
myvalue = lookup[mykey]
except KeyError:
myvalue = ''
return myvalue.strip('"').strip("'")
def seperate... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/... | 3 | workflow/scripts/builder/gtf2protein_coding_genes.py | mtandon09/RNA-seek |
#!/usr/bin/env python3
import asyncio
import logging
import uuid
from bleak import BleakScanner, BleakClient
# Enable debug output
# logging.basicConfig(level=logging.DEBUG)
DEVICE_NAME = "m5-stack"
SERVICE_UUID = uuid.UUID("4fafc201-1fb5-459e-8fcc-c5c9c331914b")
CHAR_UUID = uuid.UUID("beb5483e-36e1-4688-b7f5-ea0736... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined insid... | 3 | client/main.py | naoki-sawada/m5stack-ble |
from flask_restful import Resource, request
import random
import time
import os
import requests
import json
oil_tank = {
'nome': "oleo",
'volume': random.randint(100, 200)
}
BASE_URL = os.environ['BASE_URL']
class OilTank(Resource):
def __init__(self):
self.oil_url = BASE_URL + '/oleo'
... | [
{
"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 | app/modules/OilTank/OilTank.py | JBizarri/concurrent-computing |
import googlemaps
class GeoLocate:
def __init__(self, address=None, city=None, country=None):
self.gmaps = googlemaps.Client(key="AIzaSyC1ullKaTqRdkIy8djqWq7pIkh5A1JaINQ")
self.geocode = self.geo_locate(address, city, country)
def geo_locate(self, address, city, country):
geocode = 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": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
}... | 3 | backend/foodapp/geolocate.py | RaitzeR/FinnBros |
import rootfs_boot
import os
from devices import board
class IPTablesDump(rootfs_boot.RootFSBootTest):
'''Dumps all IPTables rules with stats'''
def runTest(self):
pp = board.get_pp_dev()
with open(os.path.join(self.config.output_dir, 'iptables.log'), 'w') as ipt_log:
for tbl in [... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer":... | 3 | tests/iptables.py | premandfriends/boardfarm-1 |
from django.shortcuts import render,redirect
from django.core.paginator import EmptyPage, PageNotAnInteger, Paginator
from partenaires.models import Partenaire
# Create your views here.
def partenaires_view(request):
"""
docstring
"""
partenaire = Partenaire.objects.all().order_by('-created')
pagin... | [
{
"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 | partenaires/views.py | Kgermando/e-s |
from django.contrib.syndication import feeds
from populous.news.models import Collection
class CollectionFeed(feeds.Feed):
def title(self, obj):
return u"Latest %s Entries" % obj
def link(self, obj):
if not obj:
raise feeds.FeedDoesNotExist
return obj.get_absolute_u... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": ... | 3 | populous/news/feeds.py | caiges/populous |
# coding: utf-8
"""
Memsource REST API
Welcome to Memsource's API documentation. To view our legacy APIs please [visit our documentation](https://wiki.memsource.com/wiki/Memsource_API) and for more information about our new APIs, [visit our blog](https://www.memsource.com/blog/2017/10/24/introducing-rest-apis... | [
{
"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/test_project_workflow_step_dto_v2.py | unofficial-memsource/memsource-cli-client |
import pytest
from django.contrib.auth import get_user_model
from rest_framework.test import APIClient
@pytest.fixture
def client():
return APIClient()
@pytest.fixture
def db_user():
user_data = {
'email': 'test@example.com',
'password': 'testpass123',
'first_name': 'Jack',
'... | [
{
"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 | backend/user/tests/conftest.py | thehomebrewnerd/react-django-template |
import socket
import sys
from io import BytesIO
from opendis.DataOutputStream import DataOutputStream
from opendis.dis7 import EntityStatePdu
data_in = " ".join(sys.argv[1:])
udp_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
def send_dis(host, port):
pdu = EntityStatePdu()
# Entity ID
pdu.... | [
{
"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 | dis_pdu_sender.py | DMOC-C/DIS-PDU |
import tensorflow as tf
from tensorflow.keras.losses import SparseCategoricalCrossentropy
from backend.loss_metric_utils import nan_mask, identity
class ClassificationLoss(tf.keras.losses.Loss):
def __init__(self, config, name='classification_loss', **kwargs):
super().__init__(name=name, **kwargs)
... | [
{
"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 | losses/losses.py | Shahaf-Yamin/Vlocano_erruption_time_predication |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.