source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
import torch
import torch.nn as nn
from .subnet import DoubleConv, UpConv, RRCU
class R2UNet(nn.Module):
def __init__(self, in_ch, out_ch, base_ch=64):
super(R2UNet, self).__init__()
self.inc = DoubleConv(in_ch, base_ch)
self.down = nn.MaxPool2d(kernel_size=2, stride=2)
self.down1... | [
{
"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 | network/r2unet.py | nitsaick/pytorch-kit |
#!/usr/bin/env python
#
# File Name : bleu.py
#
# Description : Wrapper for BLEU scorer.
#
# Creation Date : 06-01-2015
# Last Modified : Thu 19 Mar 2015 09:13:28 PM PDT
# Authors : Hao Fang <hfang@uw.edu> and Tsung-Yi Lin <tl483@cornell.edu>
from bleu_scorer import BleuScorer
class Bleu:
def __init__(self, n=4... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inherita... | 3 | coco-caption/pycocoevalcap/bleu/bleu.py | wenhuchen/ethz-bootstrapped-captioner |
###############################################################################
##
## Copyright (C) 2014 Tavendo GmbH
##
## 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:/... | [
{
"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 | examples/twisted/wamp/basic/rpc/decorators/frontend.py | luhn/AutobahnPython |
from fastapi import HTTPException
from sqlalchemy import orm
from ultron8.api.db.pagination.pagination import Pagination
class PaginationQuery(orm.Query):
def get_or_404(self, ident):
rv = self.get(ident)
if rv is None:
raise HTTPException(status_code=404, detail="Item not found")
... | [
{
"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 | ultron8/api/db/pagination/query.py | bossjones/ultron8 |
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os
from spack import *
class SspaceLongread(Package):
"""SSPACE-LongRead is a stand-alone program for scaffo... | [
{
"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 | var/spack/repos/builtin/packages/sspace-longread/package.py | padamson/spack |
class fact:
def __init__(self, enter_int=0):
from numpy.ctypeslib import load_library
cal = load_library('lib_fact.so', './NodeEditor/modules/C/sources/')
self.out = cal.fact(enter_int)
def factorial(self: 'int'):
return self.out
| [
{
"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 | mri_works/NodeEditor/modules/C/Maths.py | montigno/mri_works |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | [
{
"point_num": 1,
"id": "all_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 | aliyun-python-sdk-iot/aliyunsdkiot/request/v20180120/DeleteDeviceRequest.py | liuzheng/aliyun-openapi-python-sdk |
from __future__ import absolute_import
from __future__ import print_function
import logging
class _Formatter(logging.Formatter):
def __init__(self):
datefmt = '%m%d %H:%M:%S'
super(_Formatter, self).__init__(datefmt=datefmt)
def get_color(self, level):
if logging.WARNING <= level:
... | [
{
"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_multiple_inheritance",
"question": "Does any class in this file use multiple inherit... | 3 | server/canonicalization/utils/log.py | hotpxl/canonicalization-server |
import logging
import re
from .baseoutput import baseoutput
from ..helpers import get_kwargs
from ..helpers import key_wanted
log = logging.getLogger("screen")
class screen(baseoutput):
def __str__(self):
return "[the default output module] outputs the results to standard out in a slightly formatted way... | [
{
"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 | mppsolar/outputs/screen.py | suanlian1/mpp-solar |
"""Hardening Importer - Import IronBank Hardening Manifests for builds.
This module provides tests for the models building argument strings for build
executors.
"""
import pytest
from hardening_importer.models import HardeningManifest
from .conftest import VALID_MANIFESTS
def test_build_args():
"""Test valid ... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true... | 3 | tests/test_build_args.py | fandigunawan/hardening-importer |
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from telemetry import story
from page_sets import polymer
class PaperCalculatorHitTest(polymer.PolymerPage):
def __init__(self, page_set):
super(Pap... | [
{
"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 | tools/perf/page_sets/key_hit_test_cases.py | metux/chromium-deb |
"""
Base Test Case.
"""
import os
import tempfile
import shutil
from unittest import TestCase as BaseTestCase
from cfg.main_cfg import CFG
class TestCase(BaseTestCase):
cfg = CFG()
EXAMPLES_PATH = './test/examples'
""" Test Case Methods """
@classmethod
def setUpClass(cls):
cls.cfg.OUTP... | [
{
"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_case.py | harsh-mody/DeepAPI |
# Problem 37: Truncatable primes
# https://projecteuler.net/problem=37
def is_prime(n):
if n < 2:
return False
if n == 2:
return True
if n % 2 == 0:
return False
for x in range(3, int(n ** 0.5) + 1, 2):
if n % x == 0:
return False
return ... | [
{
"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 | p037.py | yehnan/project_euler_python |
import sys
import os
def start_tojas():
os.system("cd tojas && python3 tojas.py -nb && cd ..")
def start_tojas_gui():
os.system("python3 lib/tojas_gui.py -nb")
def start_scanizen():
os.system("cd scanizen && python3 scanizen.py -nb && cd ..")
def start_doser():
os.system("cd doser && python3 doser.py -n... | [
{
"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 | core/mixon_core.py | onuratakan/MIXON |
# automatically generated by the FlatBuffers compiler, do not modify
# namespace: tflite
import flatbuffers
class EqualOptions(object):
__slots__ = ['_tab']
@classmethod
def GetRootAsEqualOptions(cls, buf, offset):
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
x = E... | [
{
"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 | tflite/EqualOptions.py | neil-tan/tflite_experiment |
import os
import pytest
import toml
from voluptuous import MultipleInvalid
from worker.conf_schemata import validate_general, validate_storage
def test_toml_loader():
config_dict = toml.load(os.getcwd() + '/src/tests/worker/config_handling/conf.toml')
validate_general(config_dict['general'])
validate_sto... | [
{
"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 | src/tests/worker/config_handling/test_toml_config_parser.py | mehsoy/jaws |
import numpy as np
from scipy.integrate import simps
from beluga.numeric.compilation import jit_lambdify, jit_compile_func
from beluga.symbolic.data_classes.components_structures import CostStruct
def compile_control(control_options, args, ham_func, lambdify_func=jit_lambdify):
num_options = len(control_options... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding... | 3 | beluga/numeric/compilation/component_compilation.py | doublefloyd/beluga |
# coding=utf-8
import os
import pickle
import requests
from .errors import CloudFuncError
class CloudFuncClient:
def __init__(self, serve_address: str = None):
if serve_address is None:
serve_address = os.environ['CLOUDFUNC_SERVE_ADDRESS']
assert serve_address is not None, 'cloudfun... | [
{
"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 | cloudfunc/client.py | jadbin/cloudfunc |
import numpy as np
import scipy.sparse as sp
np.random.seed(0)
def nx_sample_neighbor(nx_g, start_node):
neighbors = [nd for nd in nx_g.neighbors(start_node)]
return np.random.choice(neighbors, size=1)[0]
def random_walk_with_restart(g, node_idx, restart_prob, length):
trace = [node_idx]
start_nod... | [
{
"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 | utils/graph_utils.py | mingyangzhang/CCGAD |
from other_language.testing_ast.BinaryExpression import *
class Div(BinaryExpression):
def __init__(self, left: Expression, right: Expression):
super().__init__(left, right)
def eval(self):
self.left.eval() // self.right.eval()
| [
{
"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 | orb_simulator/other_language/testing_ast/Div.py | dmguezjaviersnet/IA-Sim-Comp-Project |
import pytest
import lib.cache
import lib.retriever
import lib.settings
import feedparser
import os
class TestRetriever:
@pytest.fixture(scope="class")
def chdir(self, request):
print(f"dirname: {request.fspath.dirname}")
print(f"invocation dir: {request.config.invocation_dir}")
os.chd... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answ... | 3 | tests/test_retriever.py | fxlv/sscom-tracker |
from mopidy import backend
import pykka
from mopidy_funkwhale import api, client, library, playback, playlists
class FunkwhaleBackend(pykka.ThreadingActor, backend.Backend):
def __init__(self, config, audio):
super(FunkwhaleBackend, self).__init__()
self.api = api.FunkwhaleApi(config)
se... | [
{
"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 | mopidy_funkwhale/backend.py | gjabell/mopidy-funkwhale |
"""
Item pipeline
See documentation in docs/item-pipeline.rst
"""
from scrapy.middleware import MiddlewareManager
from scrapy.utils.conf import build_component_list
from scrapy.utils.defer import deferred_f_from_coro_f
class ItemPipelineManager(MiddlewareManager):
component_name = 'item pipeline'
@classme... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inherita... | 3 | scrapy/pipelines/__init__.py | bf96163/scrapy |
from composo_py import ioc
def init(config):
ioc.Config.config.from_dict(config)
app = ioc.Plugin.plugin()
return app
def test():
app = ioc.Plugin.plugin()
app.run("test")
if __name__ == "__main__":
test()
| [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answe... | 3 | templates/py/main.plugin.py | composo/composo-python-plugin |
import json
import os
from pathlib import Path
from typing import Callable
def get_test_resource(relative_path):
dir = Path(os.path.dirname(os.path.realpath(__file__)))
return str(dir / relative_path)
def load_json_resource(relative_path, preprocess: Callable = None):
with open(get_test_resource(relativ... | [
{
"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 | tests/__init__.py | clausmichele/openeo-python-client |
from threading import Lock
class FooBar:
def __init__(self, n):
self.n = n
self.lock1 = Lock()
self.lock2 = Lock()
self.lock2.acquire()
def foo(self, printFoo: "Callable[[], None]") -> None:
for _ in range(self.n):
self.lock1.acquire()
printFoo(... | [
{
"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 | leetCode/algorithms/medium/print_foobar_alternately.py | ferhatelmas/algo |
class BinaryTree:
def __init__(self, value):
self.value = value
self.left = None
self.right = None
def branchSums(root, sum=0, sumsList=None):
if root is None:
return
if sumsList is None: #refer https://stackoverflow.com/a/60202340/6699913
sumsList = []
sum += r... | [
{
"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_multiple_inheritance",
"question": "Does any class in this file use multiple inherit... | 3 | algoexpert/branchSums.py | mahendra-rk/coding-interview-prep |
__author__ = 'Alex Gusev <alex@flancer64.com>'
import prxgt.const as const
from prxgt.domain.meta.attribute import Attribute as AttributeBase
class Attribute(AttributeBase):
"""
Attribute model contains data.
"""
def __init__(self, name=None, type_=None, value=None):
super(Attribute, self).__... | [
{
"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 | prxgt/domain/attribute.py | praxigento/teq_test_db_schema_attrs |
import re
l = []
with open("functionsthunk.txt", "r") as f:
s = f.readlines()
for k, m in zip(s[0::2], s[1::2]):
if 'non-virtual' not in k:
l.append((k, m))
def sfun(a):
m = re.search(r"(?:non-virtual thunk to )?(.+?\(.*\)(?: const)?\n.+\n\n)", a)
print(a)
return m.group(1)
with open("functions.tx... | [
{
"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 | scripts/idc/sortsymbols.py | camden314/CacaoSDK |
"""Utility functions for testing neurodsp functions."""
from functools import wraps
import numpy as np
import matplotlib.pyplot as plt
from neurodsp.utils.data import compute_nsamples
from neurodsp.tests.settings import N_SECONDS, FS
#################################################################################... | [
{
"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 | neurodsp/tests/tutils.py | voytekresearch/neurodsp |
import os
import pytest
from dagster.check import CheckError, ParameterCheckError
from dagster.utils import EventGenerationManager, ensure_dir, ensure_gen, ensure_single_item
def test_ensure_single_item():
assert ensure_single_item({"foo": "bar"}) == ("foo", "bar")
with pytest.raises(ParameterCheckError, mat... | [
{
"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 | python_modules/dagster/dagster_tests/general_tests/utils_tests/test_utils.py | dbatten5/dagster |
from django.contrib.gis.db import models
class Property(models.Model):
account = models.ForeignKey(
"accounts.Account",
null=True,
blank=True,
on_delete=models.SET_NULL,
)
cadastre = models.ForeignKey(
"cadastres.Cadastre",
null=True,
blank=True,
... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
}... | 3 | 5. WEB/app/properties/models.py | doyaguillo1997/Data2Gether |
# @Author: Antoine Pointeau <kalif>
# @Date: 2017-03-27T01:24:24+02:00
# @Email: web.pointeau@gmail.com
# @Filename: UCSModel.py
# @Last modified by: kalif
# @Last modified time: 2017-04-04T00:50:08+02:00
import os
import yaml
import copy
from ..UCException import *
from ..UCChain import *
from .Interface impor... | [
{
"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": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (exclud... | 3 | uniformConfig/UCStructure/DSModel.py | apointea/config-normalizer |
from django.conf import settings
from django.db import models
from django.utils.text import slugify
from django.db.models.signals import pre_save
from django.core.urlresolvers import reverse
# Create your models here.
User = settings.AUTH_USER_MODEL
class Restaurants(models.Model):
owner = models.ForeignKey(User... | [
{
"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 | restaurants/models.py | electricsheepindream/menu |
import discord, json, requests
from discord.ext import commands
from utils import rpc_module as rpc
class Wallet:
def __init__(self, bot):
self.bot = bot
self.rpc = rpc.Rpc()
@commands.command()
async def wallet(self):
"""Shows wallet info"""
info = self.rpc.getinfo()
... | [
{
"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 | cogs/wallet_info.py | heartofgold42/Bulwark-Bot-Discord |
import re
def parse_k(msg):
"""Parse create keypoint message and return keypoint number"""
if not re.search(r"KEYPOINT NUMBER", msg):
res = re.search(r"(KEYPOINT\s*)([0-9]+)", msg)
else:
res = re.search(r"(KEYPOINT NUMBER =\s*)([0-9]+)", msg)
if res:
result = int(res.group(2))... | [
{
"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 | pyansys/geometry_commands.py | xiaomaiAI/pyansys |
from app.api.services import (
briefs
)
def get_briefs(user_id, status=None):
return briefs.get_buyer_dashboard_briefs(user_id, status)
def get_brief_counts(user_id):
return briefs.get_brief_counts(user_id)
| [
{
"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 | app/api/business/buyer_dashboard_business.py | ArenaNetworks/dto-digitalmarketplace-api |
from pyautogui import *
import pyautogui
import time
import keyboard
import random
import win32api, win32con
px = 0
py = 0
class Tile():
def __init__(self,px,py):
self.x = px
self.y = py
def click(x,y):
win32api.SetCursorPos((x,y))
win32api.mouse_event(win32con.MOUSE... | [
{
"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 | Bot tiles.py | Santiagorich/Piano-tiles-bot |
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | [
{
"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 | jax/experimental/jax2tf/tests/tf_test_util.py | BuddenD/jax |
import sys
from .checker import PackagesDistroChecker
def main(*args: str) -> int:
return PackagesDistroChecker(*args).run()
def cmd():
sys.exit(main(*sys.argv[1:]))
if __name__ == "__main__":
cmd()
| [
{
"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 | envoy.distribution.verify/envoy/distribution/verify/cmd.py | phlax/pytooling |
from flask import Flask,jsonify,request
import os
from subprocess import PIPE,Popen
app = Flask(__name__)
@app.route("/",methods=["GET"])
def home():
return "Working"
@app.route("/sendcode",methods=["POST"])
def sendCode():
print(request.json)
owd = os.getcwd() # chdir into this once done executing.
u... | [
{
"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 | backend/server.py | ryzbaka/Niyuddha |
import unittest
from ansiblelint.rules import RulesCollection
from ansiblelint.runner import Runner
from ansiblelints.stage.IncompleteConditional import IncompleteConditional
class TestIncompleteConditional(unittest.TestCase):
collection = RulesCollection()
def setUp(self):
self.collection.register... | [
{
"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 | ansible/tests/TestIncompleteConditional.py | SODALITE-EU/defect-prediction |
#
# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
# its licensors.
#
# For complete copyright and license terms please see the LICENSE at the root of this
# distribution (the "License"). All use of this software is governed by the License,
# or, if provided, by the license below or th... | [
{
"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 | dev/Gems/CloudGemMetric/v1/AWS/lambda-code/ServiceLambda/api/dashboard.py | brianherrera/lumberyard |
def area(a,b):
return a*b
print(area(2,3))
# key word args
print(area(a=2,b=3))
def area_1(a,b=5):
return a*b
print(area_1(2))
### add n numbers of args
def mean(*args):
return args
print(mean(1,23,'hi'))
def mean(*args):
return sum(args) / len(args)
print(mean(1,23,22))
### keyword Arg... | [
{
"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 | The_Basics/More_on_Functions.py | vishu22314558/py-code |
# Lot's of stuff for making text prettier
# try to import all the needed libraries, if it doesn't work,
# make all the functions do nothing.
try:
import colorama
from termcolor import colored
colorama.init()
def bold(string):
return colored(string, attrs = ["bold"])
def underline(string):
... | [
{
"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 | text.py | nicksolomon/lib_game |
# Copyright 2019 Nokia
# 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, softwar... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self... | 3 | cmframework/src/cmframework/utils/cmpluginmanager.py | akraino-edge-stack/ta-config-manager |
import os, sys, re
import importlib
try:
from PySide.QtGui import *
from PySide.QtCore import *
except:
from PySide2.QtGui import *
from PySide2.QtCore import *
from PySide2.QtWidgets import *
from multi_script_editor import scriptEditor
importlib.reload(scriptEditor)
import MaxPlus
q3dsmax = QApp... | [
{
"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 | python/pw_multiScriptEditor/managers/_3dsmax.py | smile-jing/NukeToolSet |
"""add sessions table
Revision ID: 3ee15b8edebb
Revises: feac35539764
Create Date: 2018-08-03 23:32:03.940252
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '3ee15b8edebb'
down_revision = 'feac35539764'
branch_labels = None
depends_on = None
def upgrade():
... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": tru... | 3 | migrations/versions/3ee15b8edebb_add_sessions_table.py | romantomjak/dns-cockpit |
from oosc.absence.models import Absence
from rest_framework import serializers
from oosc.students.serializers import SimpleStudentSerializer
from datetime import datetime
class AbsenceSerializer(serializers.ModelSerializer):
class Meta:
model=Absence
fields=('id','student','_class','reasons','date... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{... | 3 | oosc/oosc/absence/serializers.py | C4DLabOrg/da_api |
"""Add primary key to worker_dependency
Revision ID: 54725ffc62f3
Revises: 730e212b938
Create Date: 2016-11-15 14:02:41.621934
"""
# revision identifiers, used by Alembic.
revision = '54725ffc62f3'
down_revision = '730e212b938'
from alembic import op
def upgrade():
# Cannot add primary key with auto-increment... | [
{
"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 | alembic/versions/2016111514_add_primary_key_to_worker__54725ffc62f3.py | millerjohnp/codalab-worksheets |
from rply import ParserGenerator
from poketype.ast import Number, Boolean, NegNumber
class DataTypes():
def __init__(self, pg: ParserGenerator) -> None:
@pg.production('expression : NUMBER')
def expression_number(p):
return Number(int(p[0].getstr()))
@pg.production('expression : BOOLEAN')
def expressio... | [
{
"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 | PokeType/compiler/data_types.py | Daggy1234/PokeType |
import importlib
from json import loads
from base64 import b64decode
import sys
import gevent.monkey
gevent.monkey.patch_all()
import gevent
import config
from os import getpid
from requests import post
def fetch(module):
global message
m = importlib.import_module('modules.'+module)
m.go(message)
def ... | [
{
"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 | fuzzer/handling_module.py | junorouse/dynamic-fuzzer |
from .plugins.tarsier_checker_base import TarsierCheckerPlugin
from .plugins.tarsier_input_base import TarsierInputPlugin
from .plugins.tarsier_output_base import TarsierOutputPlugin
class Executor:
def __init__(self, input_plugin: TarsierInputPlugin, checker_plugin: TarsierCheckerPlugin,
output_... | [
{
"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 | lib/tarsier/executor.py | motomizuki/simple-data-checker |
# -*- coding: utf-8 -*-
__author__ = 'custer'
__date__ = '2017/7/27 11:41'
from random import Random
from django.core.mail import send_mail
from users.models import EmailVerifyRecord
from MxOnline.settings import EMAIL_FROM
def random_str(randomlength=8):
str = ''
chars = 'AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqR... | [
{
"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 | apps/utils/email_send.py | custertian/DjangoLMS |
import numpy as np
import collections
def _xv_from_uni(xi,zmax,gct):
"""
Generate a z vertex displacement from a uniform random variable
both zmax and gct should be in cm
"""
if xi > 0.:
return gct*np.log(xi) + zmax
else:
return -100.*zmax
xv_from_uni = np.vectorize(_xv_fr... | [
{
"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 | dev/mathematica/get_ldmx_acceptance_to_share/detector_hit_conditions.py | jmlazaro25/vissig |
from rest_api.database import db
from rest_api.database.models import Video
from sqlalchemy.orm.exc import NoResultFound
def create_url(data):
url = data.get('url')
video = Video(url)
db.session.add(video)
db.session.commit()
def find_by_url(url):
try:
youtube = Video.query.filter(Video.... | [
{
"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 | rest_api/api/video/business.py | ushaesel/youtubeFlaskAPI |
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
def removeNthFromEnd(self, head, n):
"""
:type head: ListNode
:type n: int
:rtype: ListNode
"""
ptr = head
ln... | [
{
"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 | others/remove_nth_node_from_end.py | sumitsk/leetcode |
from six import string_types
class CashewException(Exception):
pass
class InternalCashewException(CashewException):
pass
class UserFeedback(CashewException):
pass
class InactivePlugin(UserFeedback):
def __init__(self, plugin_instance_or_alias):
if isinstance(plugin_instance_or_alias, string_... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},... | 3 | cashew/exceptions.py | dexy/cashew |
import unittest
import random
from stanford_algoritms_part1.build_blocks import partioners
class TestSequenceFunctions(unittest.TestCase):
def setUp(self):
self.seq = range(10)
def test_shuffle(self):
# make sure the shuffled sequence does not lose any elements
random.shuffle(self.se... | [
{
"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 | my-cs/intern/java_details/java_sort_selection_details/partioners_test.py | zaqwes8811/cs-courses |
import time
import pytest
from pnp.plugins.pull.simple import Repeat
from . import make_runner, start_runner
@pytest.mark.asyncio
async def test_repeat_pull():
events = []
def callback(plugin, payload):
events.append(payload)
dut = Repeat(name='pytest', repeat="Hello World", wait=0.001)
run... | [
{
"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/plugins/pull/test_simple_repeat.py | HazardDede/pnp |
import yaml
from enum import Enum
class SimulationType(Enum):
explosion = "EXPLOSION"
collision = "COLLISION"
class SatType(Enum):
rb = "RB"
sat = "SC"
soc = "SOC"
deb = "DEB"
class SimulationConfiguration:
# Takes a .yaml file with simulation configurations
def __init__(self, file... | [
{
"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 | src/nasa_sbm/configuration.py | ReeceHumphreys/NASA-breakup-model-python |
from __future__ import print_function
from ctypes import c_int
BASE = int(1e9 + 7)
class TreeMatrix:
def __init__(self, N):
self.mat = (c_int * ((N + 1) * (N + 1)))()
self.N = N
@staticmethod
def lowbit(x):
return x & (-x)
def add(self, x, y, val):
x, y = x + 1, y +... | [
{
"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 | 0000 hihoOnce/172 Matrix Sum/main.py | SLAPaper/hihoCoder |
import os
import time
import cv2
import numpy as np
from PIL import ImageGrab
class Screen(object):
WINDOW_NAME = 'data'
def __init__(self):
self.image = None
self.data = None
self.event = None
@property
def inverted_image_size(self):
return (self.image.size[1], se... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (exclu... | 3 | EZ Queue/screen.py | HSU-S21-CS232/final-th150 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
import sklearn.preprocessing as prep
import tensorflow as tf
from autoencoder_models.VariationalAutoencoder import VariationalAutoencoder
from tensorflow.examples.tutorials.mnist import input... | [
{
"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 | research/autoencoder/VariationalAutoencoderRunner.py | SimiaCryptus/models |
#!/usr/bin/env python
import copy,re,subprocess
class Parameter:
def __init__(this, typ, name):
this.typ = typ
this.name = name
def param_choices(x):
return param_choices_internal(x.items())
def param_choices_internal(list_of_ranges):
if len(list_of_ranges) == 0:
return [{}]
... | [
{
"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 | attic/knl/survey.py | nushio3/formura |
from enum import Enum
class Network(str, Enum):
Ethereum = "ethereum"
Polygon = "polygon"
Arbitrum = "arbitrum"
BinanceSmartChain = "binancesmartchain"
Avalanche = "avalanche"
Fantom = "fantom"
xDai = "xdai"
def __str__(self):
return self.value
class Currency(str, Enum):
... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": true
},... | 3 | config/enums.py | Badger-Finance/python-keepers |
import collections
import requests
from requests.adapters import HTTPAdapter
from requests.packages.urllib3.util.retry import Retry
def requests_retry_session(
retries=3,
backoff_factor=0.3,
status_forcelist=(500, 502, 504),
session=None
):
"""
Exponential back off for requests.
via https... | [
{
"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 | foreman/data_refinery_foreman/surveyor/utils.py | cgreene/refinebio |
from unittest import TestCase
from tests import get_data
from pytezos.michelson.contract import ContractStorage
class BigMapCodingTestooP8uo(TestCase):
def setUp(self):
self.maxDiff = None
def test_big_map_ooP8uo(self):
section = get_data(
path='big_map_diff/ooP8uoN2eMv1dcC8... | [
{
"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 | tests/big_map_diff/ooP8uoN2eMv1dcC8wdMgKvgHJBuQYARFXH4KMURfJdGgMZofC79/test_big_map_ooP8uo.py | juztin/pytezos-1 |
#!/usr/bin/env python
import webnsock
import web
from signal import signal, SIGINT
from os import path
class SimpleUIServer(webnsock.WebServer):
def __init__(self):
webnsock.WebServer.__init__(
self,
None,
# path.join(
# path.dirname(__file__),
... | [
{
"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 | test/simple_test.py | marc-hanheide/webnsock |
"""
examples.basic_usage
~~~~~~~~~~~~~~~~~~~~
Common usage patterns for the yaspin spinner.
"""
import signal
import time
from yaspin import Spinner, yaspin
from yaspin.signal_handlers import fancy_handler
from yaspin.spinners import Spinners
def context_manager_default():
with yaspin(text="Braille"):
... | [
{
"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 | examples/basic_usage.py | J-M0/yaspin |
import numpy
import scipy.signal
from generate import *
def generate():
def process(factor, x):
out = scipy.signal.decimate(x, factor, n=128 - 1, ftype='fir', zero_phase=False)
return [out.astype(type(x[0]))]
vectors = []
x = random_complex64(256)
vectors.append(TestVector([2], [x], ... | [
{
"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/composites/decimator_spec.py | telent/luaradio |
import pendulum
import requests
from github_poster.loader.base_loader import BaseLoader
from github_poster.loader.config import DUOLINGO_CALENDAR_API
class DuolingoLoader(BaseLoader):
unit = "XP"
def __init__(self, from_year, to_year, **kwargs):
super().__init__(from_year, to_year)
self.user... | [
{
"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 | github_poster/loader/duolingo_loader.py | phh95/GitHubPoster |
DEF_LOGGING_LEVEL = 'DEBUG'
DEF_LOGGING_FORMAT = '%(levelname)s:%(name)s -- %(message)s'
import sys
def getLogger(loggerName):
return logging.getLogger(loggerName)
def setLevel(loglevel = DEF_LOGGING_LEVEL):
try:
loglevel = eval('logging.%s' % loglevel)
except:
loglevel = eval('logging.... | [
{
"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 | src/test/pSafeLogger.py | fermi-lat/CalRecon |
### Full credit for this file goes to Richard Fan @ https://github.com/richardfan1126/nitro-enclave-python-demo
import socket
import sys
import threading
import time
def server(local_port, remote_cid, remote_port):
try:
dock_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
dock_socket.bi... | [
{
"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 | src/server/traffic-forwarder.py | hxhwing/Nitro-Enclave-Demo |
from kraken import plugins
from kraken.core.maths import Xfo, Vec3, Quat
from kraken.core.configs.config import Config
from kraken_components.biped.arm_component import ArmComponentGuide, ArmComponentRig
class CustomConfig(Config):
"""Base Configuration for Kraken builders."""
def __init__(self):
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 | tests/customConfig/arm_build_with_custom_config.py | goshow-jp/Kraken |
import torch
class ActionCrossEntropyFunction(torch.autograd.Function):
@staticmethod
def forward(self,input,target,action,force = None):
self.mb_size,self.dim = input.size()
# save the force for backward
self.force = force
# get action difference
action_input = torch... | [
{
"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_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding s... | 3 | src/LossFunctions/ActionCrossEntropy.py | Marcel-Rodekamp/MLP |
from __future__ import annotations
from prettyqt import core, gui
from prettyqt.qt import QtQuick
QtQuick.QQuickItemGrabResult.__bases__ = (core.Object,)
class QuickItemGrabResult:
def __init__(self, item: QtQuick.QQuickItemGrabResult):
self.item = item
def __getattr__(self, val):
return g... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answ... | 3 | prettyqt/quick/quickitemgrabresult.py | phil65/PrettyQt |
"""
Test handling of alerts.
"""
from bok_choy.web_app_test import WebAppTest
from .pages import AlertPage
class AlertTest(WebAppTest):
"""
Test handling of alerts.
"""
def setUp(self):
super(AlertTest, self).setUp()
self.alert = AlertPage(self.browser)
self.alert.visit()
... | [
{
"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_alert.py | Jawayria/bok-choy |
import os
import zipfile
from os.path import basename
from time import sleep
from log_settings import logger
from flask import Response, Flask, send_from_directory
__author__ = ["Thirumal"]
__email__ = "m.thirumal@hotmail.com"
app = Flask(__name__)
def read_log():
"""creates logger information"""
with open(... | [
{
"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.py | m-thirumal/stream-log |
from django.db import models
class SFWManager(models.Manager):
def get_queryset(self):
return super(SFWManager, self).get_queryset().filter(sfwness=gifsong.SFW)
class gifsong(models.Model):
SFW = 1
NSFW = 2
UNKNOWN = 3
STATUS_CHOICES = (
(SFW, 'SFW'),
(NSFW, 'NSFW'),
... | [
{
"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 | gifsong/models.py | bigjust/gifsong |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import inspect
from collections import OrderedDict
from datetime import datetime
from . import constants as const
def get_template_context(steps):
"""Return a dict containing the context to be passed to the template."""
return... | [
{
"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 | behave_catalog/context.py | teapow/behave-catalog |
###################################################
#
# Usage:
# {% load help_text_as_placeholder %}
# form.field|help_text_as_placeholder
# OR
# field|help_text_as_placeholder
###################################################
from django import template
from django.utils.safestring import... | [
{
"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 | hard-gists/18a73aa5dab4b574e2f5/snippet.py | jjhenkel/dockerizeme |
import re
class EndpointManager(object):
def __init__(self, session):
self.session = session
def __getattr__(self, name):
return SessionContext(self.session, name)
class SessionContext(object):
def __init__(self, session, name):
self.session = session
self.prefix = '/api... | [
{
"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 | api/kiveapi/endpoint_manager.py | dmacmillan/Kive |
import requests
import time
from backend.wallet.wallet import Wallet
BASE_URL = "http://localhost:5000"
def get_blockchain():
return requests.get(f"{BASE_URL}/blockchain").json()
def get_blockchain_mine():
return requests.get(f"{BASE_URL}/blockchain/mine").json()
def post_wallet_transact(recipient, amount):... | [
{
"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 | backend/scripts/test_app.py | AdityaStark7/blockchain_backend |
from django.db import models
from django.contrib.auth.models import AbstractBaseUser, BaseUserManager, PermissionsMixin
class UserManager(BaseUserManager):
def create_user(self, email, password=None, **extra_fields):
"""creates and saves a new user"""
if not email:
raise ValueError('U... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": true
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
... | 3 | app/core/models.py | yourdon/recipe-app-api |
from corehq.apps.app_manager.dbaccessors import (
get_brief_apps_in_domain,
get_latest_released_app,
get_latest_released_app_versions_by_app_id,
)
from corehq.apps.linked_domain.models import DomainLink
from corehq.apps.linked_domain.remote_accessors import (
get_brief_apps,
get_latest_released_vers... | [
{
"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 | corehq/apps/linked_domain/applications.py | rochakchauhan/commcare-hq |
# MIT 6.034 Lab 0: Getting Started
from copy import deepcopy
import time
class Point(object):
"""A Point has x and y coordinates and a secret ID."""
def __init__(self, x, y):
self._x = x # Don't modify this directly! Use .setX() etc
self._y = y
# secret ID to differentiate be... | [
{
"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 | Lab 0/point_api.py | lcchiang/Artificial-Intelligence-Course |
# coding: utf-8
from datetime import datetime
import json
from urllib.parse import urlencode
import requests
from waste_collection_schedule import Collection # type: ignore[attr-defined]
TITLE = "Lerum Vatten och Avlopp"
DESCRIPTION = "Source for Lerum Vatten och Avlopp waste collection."
URL = "https://vatjanst.ler... | [
{
"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 | custom_components/waste_collection_schedule/waste_collection_schedule/source/lerum_se.py | UBS-P/hacs_waste_collection_schedule |
from functools import lru_cache
from jinja2 import Markup
from markdown import markdown
import re
@lru_cache()
def markdown_to_html(text):
html = markdown(
text,
extensions=[
'mdx_urlize',
])
html = fix_preposition_nbsp(html)
return Markup(html)
def fix_preposition_nb... | [
{
"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 | pyworking_cz/util/markdown.py | stlk/pyworking.cz |
#!/usr/bin/env python3
import sys; assert sys.version_info[0] >= 3, "Python 3 required."
from sapling_generators import (
find_group_hash,
NOTE_POSITION_BASE,
WINDOWED_PEDERSEN_RANDOMNESS_BASE,
)
from sapling_jubjub import Fr, Point
from sapling_utils import cldiv, i2leosp
#
# Pedersen hashes
#
def I_D_... | [
{
"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 | sapling_pedersen.py | paracetamolo/zcash-test-vectors |
# 트라이를 저장할 노드 선언
class TrieNode:
def __init__(self):
self.word = False
self.children = {}
# 트라이 연산을 구현할 클래스 선언
class Trie:
def __init__(self):
self.root = TrieNode()
def insert(self, word):
node = self.root
for char in word:
i... | [
{
"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 | LectureNote/15.Heap/56.py | minssoj/Study_turtleCoding |
class EC():
def __init__(self, id=None):
self.database = 'EC'
self.id = id
self._long_name = 'EC (Enzyme Commission) number of the Nomenclature Committee of the International Union of Biochemistry and Molecular Biology (IUBMB) Database of Interacting Proteins'
self._web = 'https://... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": tru... | 3 | evidence/refs/EC.py | dprada/evidence |
import unittest
from sdk.signature_generator import SignatureGenerator
class TestSignatureGenerator(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def test_with_empty_body(self):
method = "GET"
path = "/v1/wallets"
timestamp = 1581850266351
... | [
{
"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 | developers-sdk-py/tests/test_signature_generator.py | lyingdragon/developers-sdk |
"""
.. See the NOTICE file distributed with this work for additional information
regarding copyright ownership.
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.... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written ... | 3 | tests/test_rest_file_region.py | Multiscale-Genomics/mg-rest-file |
# Plotting tools and utility functions
# Nested GridSpec : https://matplotlib.org/stable/gallery/subplots_axes_and_figures/gridspec_nested.html#sphx-glr-gallery-subplots-axes-and-figures-gridspec-nested-py
# GridSpec : https://matplotlib.org/stable/gallery/subplots_axes_and_figures/gridspec_multicolumn.html#sphx-glr-ga... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": true
... | 3 | sentIA/utils/figure/__init__.py | thomas-brth/sentinel |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models
class ResPartner(models.Model):
_inherit = 'res.partner'
barcode = fields.Char(string='Barcode', help="BarCode", oldname='ean13')
pos_order_count = fields.Integer(
... | [
{
"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 | apps/odoo/lib/odoo-10.0.post20170615-py2.7.egg/odoo/addons/point_of_sale/models/res_partner.py | gtfarng/Odoo_migrade |
# 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, software
# distrib... | [
{
"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 | openstackclient/identity/v3/unscoped_saml.py | cloudification-io/python-openstackclient |
import sqlalchemy as alchemy
from . import base
from typing import Optional
class FacebookReportTableModel(base.ReportTableModel):
@property
def date_column_name(self) -> str:
return 'date_start'
class FacebookCampaignReportTableModel(FacebookReportTableModel):
@property
def table_name(self) -> str:
... | [
{
"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 | models/model_facebook.py | xyla-io/almacen |
import os
def check(cmd, mf):
m = mf.findNode("pygame")
if m is None or m.filename is None:
return None
def addpath(f):
return os.path.join(os.path.dirname(m.filename), f)
RESOURCES = ["freesansbold.ttf", "pygame_icon.icns"]
return {"loader_files": [("pygame", map(addpath, RESOUR... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": tru... | 3 | py2app/recipes/pygame.py | MAKOMO/py2app |
#!/usr/bin/python3
# mari von steinkirch @2013
# steinkirch at gmail
def find_edit_distance(str1, str2):
''' computes the edit distance between two strings '''
m = len(str1)
n = len(str2)
diff = lambda c1, c2: 0 if c1 == c2 else 1
E = [[0] * (n + 1) for i in range(m + 1)]
for i in range(m + 1):
E[i][0] = i
f... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
... | 3 | src/examples_in_my_book/general_problems/strings/find_edit_distance.py | lucidrohit/Over-100-Exercises-Python-and-Algorithms |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.