source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
from .. import fixtures
from ..assertions import eq_
from ..schema import Column
from ..schema import Table
from ... import Integer
from ... import String
class SimpleUpdateDeleteTest(fixtures.TablesTest):
run_deletes = "each"
__backend__ = True
@classmethod
def define_tables(cls, metadata):
... | [
{
"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 | lib/sqlalchemy/testing/suite/test_update_delete.py | Dreamsorcerer/sqlalchemy |
# Copyright (c) 2020-2022 The PyUnity Team
# This file is licensed under the MIT License.
# See https://docs.pyunity.x10.bz/en/latest/license.html
from pyunity import Behaviour, GameObject, SceneManager, Material, RGB, Mesh, Vector3, MeshRenderer, WaitForSeconds
class Switch(Behaviour):
async def Start(sel... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answ... | 3 | pyunity/examples/example6/__init__.py | rayzchen/PyUnity |
#!/bin/env dls-python
from sys import version_info
if version_info.major == 2:
import __builtin__ as builtins # Allows for Python 2/3 compatibility, 'builtins' is namespace for inbuilt functions
else:
import builtins
import unittest
from mock import patch, MagicMock
p = patch('dls_ade.Server')
server_mock ... | [
{
"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 | dls_ade/dls_list_modules_test.py | hir12111/dls_ade |
def V(i,j):
return 'V%d_%d' % (i,j)
def domains(Vs):
return [ q + ' in 1..9' for q in Vs ]
def all_different(Qs):
return 'all_distinct([' + ', '.join(Qs) + '])'
def get_column(j):
return [V(i,j) for i in range(9)]
def get_raw(i):
return [V(i,j) for j in range(9)]
def ho... | [
{
"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 | L3/Z4/main.py | JacekLeja/AI-Projects |
from typing import List
import unittest
from model import tasks
class TestRepository(unittest.TestCase):
def test_list(self):
rep = tasks.Repository()
l = rep.list()
self.assertEqual(len(l), 2)
self.assertEqual(l[0].id, 1)
self.assertEqual(l[0].text, "task1")
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 | server/tests/test_repository.py | 74th/vscode-book-python |
#
# MIT License
#
# Copyright (c) 2018 WillQ
#
# 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, publ... | [
{
"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 | tests/util/test_i18n.py | zsluedem/MonkTrader |
from flask import Flask, render_template
app = Flask(__name__)
@app.route('/')
def index_route():
return render_template('/index.html')
@app.route('/<target>')
@app.route('/<target>.html')
def nav_target_route(target):
return render_template(target+'.html')
if __name__ == '__main__':
app.run() | [
{
"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": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?... | 3 | templates/server.py | CAL-Origami/website |
"""The SRP Energy integration."""
import logging
from srpenergy.client import SrpEnergyClient
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_ID, CONF_PASSWORD, CONF_USERNAME
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import ConfigEntryNotReady... | [
{
"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 | homeassistant/components/srp_energy/__init__.py | tbarbette/core |
from model import common
import torch.nn as nn
import torch.nn.init as init
url = {
'r20f64': ''
}
def make_model(args, parent=False):
return VDSR(args)
class VDSR(nn.Module):
def __init__(self, args, conv=common.default_conv):
super(VDSR, self).__init__()
n_resblocks = args.n_resblocks... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false... | 3 | src/model/vdsr.py | delldu/EDSR |
"""Generates the offset dictionary for the SVO pipeline."""
from time import time as marktime
from typing import List
from itertools import groupby
from collections import defaultdict
def generate_svo_offsets(svo_list: List, time: List, minimum_offsets):
"""Creates offset dictionary and int-to-string lookup for 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": "every_function_has_docstring",
"question": "Does every function in this file have a docst... | 3 | nate/svonet/svo_offsets.py | UWNETLAB/nelanna |
from typing import Dict, List, Any
from checkov.common.models.enums import CheckCategories, CheckResult
from checkov.terraform.checks.resource.base_resource_value_check import BaseResourceCheck
class S3BucketObjectLock(BaseResourceCheck):
def __init__(self) -> None:
name = "Ensure that S3 bucket has lock... | [
{
"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 | checkov/terraform/checks/resource/aws/S3BucketObjectLock.py | jamesholland-uk/checkov |
# -*- coding:utf-8 -*-
# Copyright (C) 2020. Huawei Technologies Co., Ltd. All rights reserved.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the MIT License.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the ... | [
{
"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 | built-in/TensorFlow/Official/cv/image_classification/ResnetVariant_for_TensorFlow/automl/vega/search_space/fine_grained_space/sample/random_search.py | Huawei-Ascend/modelzoo |
def queens(n):
a = list(range(n))
up = [True]*(2*n - 1)
down = [True]*(2*n - 1)
def sub(i):
if i == n:
yield tuple(a)
else:
for k in range(i, n):
j = a[k]
p = i + j
q = i - j + n - 1
if up[p] and down... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"... | 3 | lang/Python/n-queens-problem-6.py | ethansaxenian/RosettaDecode |
#!/usr/bin/env python
# encoding: utf-8
# Below is the interface for Iterator, which is already defined for you.
#
# class Iterator:
# def __init__(self, nums):
# """
# Initializes an iterator object to the beginning of a list.
# :type nums: List[int]
# """
#
# def hasNext(self)... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
}... | 3 | Sec24_Design/q0284.py | OctoberChang/LeetCode-Solutions |
import sys
import struct
from math import sqrt
def cross(a, b):
return [
a[1] * b[2] - a[2] * b[1],
a[2] * b[0] - a[0] * b[2],
a[0] * b[1] - a[1] * b[0]
]
def dot(a, b):
return a[0] * b[0] + a[1] * b[1] + a[2] * b[2]
def normalized(a):
s = 1 / sqrt(dot(a, a))
return [ a[0]... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer"... | 3 | share/scripts/augen_octahedron2camera.py | eliemichel/GrainViewer |
import os
import torch
from weaver.utils.logger import _logger
from weaver.utils.import_tools import import_module
ParticleTransformer = import_module(
os.path.join(os.path.dirname(__file__), 'ParticleTransformer.py'), 'ParT').ParticleTransformer
class ParticleTransformerWrapper(torch.nn.Module):
def __init_... | [
{
"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 | networks/example_ParticleTransformer.py | jet-universe/particle_transformer |
import pytest
from django.urls import resolve, reverse
from car_rental.users.models import User
pytestmark = pytest.mark.django_db
def test_user_detail(user: User):
assert (
reverse("api:user-detail", kwargs={"username": user.username})
== f"/api/users/{user.username}/"
)
assert resolve(... | [
{
"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 | car_rental/car_rental/users/tests/test_drf_urls.py | TheHaRyPL/Car-rental |
# -*- coding: utf-8 -*-
import cherrypy
__all__ = ['Jinja2Tool']
class Jinja2Tool(cherrypy.Tool):
def __init__(self):
cherrypy.Tool.__init__(self, 'before_finalize',
self._render,
priority=10)
def _render(self, template=None, debug... | [
{
"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 | jinja2tool.py | sborgeson/building-data-analysis |
# Add common test utils, which can be used by all test scripts..
from netaddr import IPNetwork
def assertEqual(a, b, error_msg):
'''Assert with error msg'''
assert (a == b), error_msg
def get_ip_list_from_prefix(prefix):
return map(str, IPNetwork(prefix).iter_hosts())
def get_min_max_ip_from_prefix(pref... | [
{
"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 | tcutils/test_lib/test_utils.py | lmadhusudhanan/contrail-test |
import pytest
from homework import tasks
from homework.models import AnswerCrossCheck
pytestmark = [pytest.mark.django_db]
def test_crosschecks_are_created(question_dispatcher):
question_dispatcher()
assert AnswerCrossCheck.objects.count() == 2
def test_question_method_does_the_same(question):
questi... | [
{
"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 | src/homework/tests/cross_check/tests_question_crosscheck_dispatcher.py | denkasyanov/education-backend |
#!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you ma... | [
{
"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 | desktop/libs/hadoop/src/hadoop/ssl_client_site.py | sandeepreddy3647/hue-1 |
from talon import Module, screen, ui, actions
from talon.engine import engine
import os
import platform
active_platform = platform.platform(terse=True)
mod = Module()
@mod.action_class
class Actions:
def screenshot():
'''takes a screenshot of the entire screen and saves it to the desktop as screenshot.png... | [
{
"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 | code/screenshot.py | frenchy64/knausj_talon |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2017 Edgewall Software
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://trac.edgewall.com/license.html.
#
# This software consists of vo... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (exc... | 3 | trac/upgrades/db45.py | NetSpida/trac |
"""
Module to create a file with the file sizes
From : http://mayankjohri.wordpress.com/2008/07/02/create-list-of-files-in-a-dir-tree/
"""
import os
import sys
from argparse import ArgumentParser
LIST_FILE = "file_sizes.txt"
def get_filesize(path):
""" Module to list file sizes"""
file_list ... | [
{
"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 | dist/server/list_filesize.py | teru01/AStream |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from flask import make_response, render_template
from app import app, ENV
@app.errorhandler(404)
def not_found(error):
error = "404 Not found"
return make_response(
render_template("error.html", title = ENV["sitename"], error = error),
404
)
... | [
{
"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 | app/errorHandlers.py | L-Nafaryus/elnafo |
import cpboard
import periphery
import pytest
import smbus
import sys
def pytest_addoption(parser):
group = parser.getgroup('i2cslave')
group.addoption("--bus", dest='i2cbus', type=int, help='I2C bus number')
group.addoption("--serial-wait", default=20, dest='serial_wait', type=int, help='Number of millise... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
... | 3 | tests/i2cslave/conftest.py | notro/cp-smbusslave |
import osgtest.library.core as core
import osgtest.library.files as files
import osgtest.library.mysql as mysql
import osgtest.library.osgunittest as osgunittest
import osgtest.library.service as service
class TestStopSlurm(osgunittest.OSGTestCase):
def slurm_reqs(self):
core.skip_ok_unless_installed(*cor... | [
{
"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 | osgtest/tests/test_740_slurm.py | djw8605/osg-test |
#!/usr/bin/env python3
# coding: utf-8
import numpy as np
from .ddfa import _parse_param
from .params import u_filter, w_filter, w_exp_filter, std_size, param_mean, param_std
def reconstruct_paf_anchor(param, whitening=True):
if whitening:
param = param * param_std + param_mean
p, offset, alpha_shp, ... | [
{
"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 | utils/paf.py | lexical-kenobi/Face-Vision-3D_Pose |
import unittest
import tkinter
from test.support import requires, swap_attr
from tkinter.test.support import AbstractDefaultRootTest
from tkinter.simpledialog import Dialog, askinteger
requires('gui')
class DefaultRootTest(AbstractDefaultRootTest, unittest.TestCase):
def test_askinteger(self):
... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
... | 3 | resources/WPy32/python-3.10.2/Lib/tkinter/test/test_tkinter/test_simpledialog.py | eladkarako/yt-dlp_kit |
import torch
from torch import nn
# LapSRN, 拉普拉斯金字塔结构, 2017
class LapSRN(nn.Module):
def __init__(self, fea_chan=64, scale=2, conv_num=3):
super(LapSRN, self).__init__()
self.level_num = int(scale/2)
self.share_ski_upsample = nn.ConvTranspose2d(
1, 1, 4, stride=scale, padding=... | [
{
"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 | Networks/LapSRN/LapSRN.py | ZFhuang/DiveIntoDLSketches |
class Backend:
async def on_start(self, app):
pass
async def on_shutdown(self, app):
pass
def prepare_context(self, ctx):
pass
async def perform_updates_request(self, submit_update):
raise NotImplementedError
async def perform_send(self, target_id, message, attach... | [
{
"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 | kutana/backend.py | sakost/kutana |
from typing import Callable, Any
opts = {}
class Registry(object):
def __init__(self, key: str):
self.key = key
def __call__(self, func: Callable[[], Any]) -> Callable[[], Any]:
def wrapper(*args, **kwargs) -> Any:
key = args[0].__class__.__name__
x = func(*args, **... | [
{
"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 | lm/utils/registry.py | akashmehra/nlp |
from . import FixtureTest
class AirportIataCodes(FixtureTest):
def test_sfo(self):
# San Francisco International
self.load_fixtures(['https://www.openstreetmap.org/way/23718192'])
self.assert_has_feature(
13, 1311, 3170, 'pois',
{'kind': 'aerodrome', 'iata': 'SFO'}... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 lines?",
"answer": false
},
... | 3 | integration-test/398-airport-iata-codes.py | nextzen/vector-datasource |
"""Tests for module plot for visualization """
# Author: Remi Flamary <remi.flamary@unice.fr>
#
# License: MIT License
import numpy as np
import matplotlib
matplotlib.use('Agg')
def test_plot1D_mat():
import ot
n_bins = 100 # nb bins
# bin positions
x = np.arange(n_bins, dtype=np.float64)
#... | [
{
"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 | test/test_plot.py | dohmatob/POT |
import typing
import strawberry
def test_fetch_entities():
global Product
@strawberry.federation.type(keys=["upc"])
class Product:
upc: str
@classmethod
def resolve_reference(cls, upc):
return Product(upc)
@strawberry.federation.type(extend=True)
class Query... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"... | 3 | tests/federation/test_entities.py | patrick91/strawberry |
from sklearn.svm import SVC
class Estimator:
@staticmethod
def fit(train_x, train_y):
return SVC(probability=True).fit(train_x, train_y)
@staticmethod
def predict(trained, test_x):
return trained.predict(test_x) | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than clas... | 3 | utils/trainer.py | Vitalii36/full-cycle_ML_Solution |
from perfuserBench import microbench
def test_params_product():
d = { "a": [1,2,3], "b": [4,5,6] }
p = microbench.dict_product(d)
x = [i for i in p]
assert(len(x) == 9)
def test_params_product_empty():
p = microbench.dict_product({})
x = [i for i in p]
assert(len(x) == 1) | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": fals... | 3 | nosetests/test_params.py | giraldeau/perfuser-bench |
import logging
from openstack_internal.nova.hypervisor_details import OSHypervisor
from topology.link import Link
from topology.node import Node
LOG = logging.getLogger(__name__)
class Server(Node):
def __init__(self, int_id: int, hypervisor: OSHypervisor):
super().__init__(int_id=int_id, _id=hyperviso... | [
{
"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 | app/topology/server.py | kukkalli/orchestrator |
#!/usr/bin/env python3
# Copyright (c) 2018 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test the blocksdir option.
"""
import os
import shutil
from test_framework.test_framework import bitcoinRT... | [
{
"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 | test/functional/feature_blocksdir.py | fancywarlock/bitcoinr |
import pytest
from core.models import UL_ORG_ADMIN
from sushi.models import CounterReportType, SushiCredentials
from organizations.tests.conftest import organizations # noqa
from publications.tests.conftest import platforms # noqa
from logs.tests.conftest import report_type_nd # noqa
@pytest.fixture()
def counter... | [
{
"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 | apps/sushi/tests/conftest.py | techlib/czechelib-stats |
# -*- test-case-name: cowrie.test.utils -*-
# Copyright (c) 2017 Michel Oosterhof <michel@oosterhof.net>
# See the COPYRIGHT file for more information
from os import environ
from twisted.logger import textFileLogObserver
from twisted.python import logfile
from cowrie.core.config import CowrieConfig
class CowrieDa... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true... | 3 | src/cowrie/python/logfile.py | GreyNoise-Intelligence/cowrie |
"""QuizSubmissionFiles API Tests for Version 1.0.
This is a testing template for the generated QuizSubmissionFilesAPI Class.
"""
import unittest
import requests
import secrets
from py3canvas.apis.quiz_submission_files import QuizSubmissionFilesAPI
class TestQuizSubmissionFilesAPI(unittest.TestCase):
"""Tests for... | [
{
"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 | py3canvas/tests/quiz_submission_files.py | tylerclair/py3canvas |
import subprocess
import humanize
import random
from datetime import datetime
from discord.ext import commands
class Others(commands.Cog, name='Others'):
"""
Others module
Other random commands that don't fit neatly into one of the other modules
"""
def __init__(self, bot):
self.bot = b... | [
{
"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/others.py | timwoj/tlmbot |
#!/usr/bin/env python3
# coding: utf-8
r"""
范围类型。
::
+-> Container: obj.__contains__(self, item) # item in obj
|
+-> Sized: obj.__len__(self) # len(obj)
|
+-> Iterable: obj.__iter__(self) # iter(obj)
|
+-> Collection
|
... | [
{
"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_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer... | 3 | rrpython/tests/types/test_range.py | afoolsbag/rrPython |
"""Set of functions to smooth model handling for templates that create
Python code
"""
import yacg.model.model as model
import yacg.util.stringUtils as stringUtils
def getDefaultPythonValue(propertyObj):
if propertyObj.isArray:
return '[]'
else:
if propertyObj.default is not None:
... | [
{
"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 | yacg/generators/helper/pythonFuncs.py | kylape/yacg |
import pytest
from pock.behaviour import Behaviour, ValueResult
from pock.mock import Mock
from pock.verification import VerificationBuilder, VerificationError
@pytest.fixture
def mock():
return Mock()
@pytest.fixture
def verification_builder(mock):
return VerificationBuilder(mock, lambda result: len(resul... | [
{
"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/integration/verification_integration_test.py | atbentley/pock |
import pandas as pd
import sanalytics.estimators.pu_estimators as pu
from gensim.models.doc2vec import Doc2Vec
import sanalytics.evaluation.evaluation_metric as see
from progressbar import progressbar
import sanalytics.algorithms.utils as sau
from time import time
import numpy as np
## Read threshold
arg = sys.argv[1]... | [
{
"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 | Code/analysis/psf_baseline/predict.py | lhmtriet/PUMiner_MSR |
# Counting Sundays
# Problem 19
# You are given the following information, but you may prefer to do some research for yourself.
#
# 1 Jan 1900 was a Monday.
# Thirty days has September,
# April, June and November.
# All the rest have thirty-one,
# Saving February alone,
# Which has twenty-eight, rain or shine.
# And on... | [
{
"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 | src/scripts/Problem19.py | YangLuGitHub/Euler |
"""
Some useful utility functions.
"""
import contextlib
import importlib
import sys
from typing import List, Optional, Tuple
@contextlib.contextmanager
def saved_sys_path():
"""
Contextmanager that will restore the value
of :data:`sys.path` when leaving the ``with``
block.
"""
orig_path = lis... | [
{
"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 | modulegraph2/_utilities.py | xoviat/modulegraph2 |
#!/usr/bin/env python3
import torch
import torch.cuda.profiler as profiler
from apex import pyprof
class Foo(torch.jit.ScriptModule):
def __init__(self, size):
super(Foo, self).__init__()
self.n = torch.nn.Parameter(torch.ones(size))
self.m = torch.nn.Parameter(torch.ones(size))
@torc... | [
{
"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 | apex/pyprof/examples/jit/jit_script_method.py | oyj0594/apex |
#!usr/bin/env python
# -*- coding: utf-8 -*-
DEFAULT = 'default_settings.json'
import os
import json
class Settings(dict):
def __init__(self, config_path=None):
super(Settings, self).__init__()
try:
with open(config_path, 'r') as f:
params = json.load(f)
exce... | [
{
"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 | pandora/parameters.py | mikekestemont/openbox |
# -*- coding: utf-8 -*-
__author__ = 'ffuentes'
import argparse
import os
import sys
import csv
import logging
from apps.noclook.models import ServiceType, ServiceClass
from django.core.management.base import BaseCommand, CommandError
logger = logging.getLogger('noclook_service_types_import')
def insert_service_ty... | [
{
"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 | src/niweb/apps/noclook/management/commands/import_service_types.py | SUNET/ni |
from pydub import AudioSegment
from pydub.playback import play
import os
import utils
class audiofile:
def __init__(self, file):
""" Init audio stream """
self.file = file
def play(self):
""" Play entire file """
utils.displayInfoMessage('Playing Audio')
pathpa... | [
{
"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 | AudioFile.py | CoryXie/SpeechShadowing |
import torch.nn as nn
from models.network import swish, CondResBlock
class MNISTModel(nn.Module):
def __init__(self, args):
super(MNISTModel, self).__init__()
self.act = swish
# self.relu = torch.nn.ReLU(inplace=True)
self.args = args
self.filter_dim = args.filter_dim
... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than clas... | 3 | models/mnist_model.py | karimul/ebm-sampling |
import time
from multiprocessing import Process
from proxypool.api import app
from proxypool.getter import Getter
from proxypool.tester import Tester
from proxypool.db import RedisClient
from proxypool.setting import *
class Scheduler():
def schedule_tester(self, cycle=TESTER_CYCLE):
"""
定时测试代理
... | [
{
"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 | proxypool/scheduler.py | pthchen/proxypool |
import pygame
class ControlManager(object):
@classmethod
def up(cls):
raise NotImplementedError('Error: Abstract class')
@classmethod
def down(cls):
raise NotImplementedError('Error: Abstract class')
@classmethod
def left(cls):
raise NotImplementedError('E... | [
{
"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 | src/ControlManager.py | NEKERAFA/Soul-Tower |
# Copyright (C) 2018 Kevin Ross
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the... | [
{
"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 | modules/signatures/windows/antidbg_debuggercheck.py | Yuanmessi/Bold-Falcon |
import os
import unittest
from stex_client.private import Private
class PrivateTestCase(unittest.TestCase):
def setUp(self):
self.option = {
'tokenObject': {
'access_token': os.environ.get('ENV_TOKEN'),
},
'accessTokenUrl': 'https://api3.stex.com/oauth/t... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answe... | 3 | test/private.py | StocksDevelopment/python_client |
import unittest
import unittest.mock
from programy.clients.render.passthrough import PassThroughRenderer
class MockConsoleBotClient(object):
def __init__(self):
self._response = None
def process_response(self, client_context, response):
self._response = response
class PassThroughRendererT... | [
{
"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 | test/programytest/clients/render/test_passthrough.py | motazsaad/fit-bot-fb-clt |
"""
Functions needed for dealing with age stratification
"""
def add_zero_to_age_breakpoints(breakpoints):
"""
append a zero on to a list if there isn't one already present, for the purposes of age stratification
:param breakpoints: list
integers for the age breakpoints requested
:return: lis... | [
{
"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 | summer/model/utils/age_stratification.py | malanchak/AuTuMN |
import numpy as np
import tensorflow as tf
from model import Model
from common.shared_functions import glorot_variance, make_tf_variable, make_tf_bias
class HighwayLayer(Model):
vertex_embedding_function = {'train': None, 'test': None}
def __init__(self, shape, next_component=None, next_component_2=None):
... | [
{
"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 | code/extras/highway_layer.py | vamships/RelationPrediction |
from StringIO import StringIO
from django import http
from django.core.serializers.json import Serializer
from django.db.models.query import QuerySet
from django.views.generic import TemplateView
class TemplateContextView(TemplateView):
""" Allow define context in as_view method.
"""
context = dict()
... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"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 | starter/templates/python-django/main/utils/views.py | klen/starter-python-django |
import gpipsfs
def test_coron():
gpi = gpipsfs.GPI()
gpi.obsmode='H_coron'
psf = gpi.calc_psf(monochromatic=1.6e-6)
assert psf[0].data.sum() < 5e-4
def test_direct():
gpi = gpipsfs.GPI()
gpi.obsmode='H_direct'
psf = gpi.calc_psf(monochromatic=1.6e-6)
assert psf[0].data.sum() > 0.99
... | [
{
"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 | gpipsfs/tests/test_main.py | brynickson/gpipsfs |
"""
Segment_tree creates a segment tree with a given array and function,
allowing queries to be done later in log(N) time
function takes 2 values and returns a same type value
"""
class SegmentTree:
def __init__(self, arr, function):
self.segment = [0 for x in range(3 * len(arr) + 3)]
self.arr = a... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding se... | 3 | WEEKS/CD_Sata-Structures/_MISC/algorithms/tree/segment_tree/segment_tree.py | webdevhub42/Lambda |
from fastapi import Depends, Body, APIRouter
from sqlalchemy.orm import Session
from database import get_db
from models.forex_model import Forex2_m5,Forex2_m30,Forex2_m240
from datetime import datetime as dt
from crud.forex_crud import get_last_time, add_forex
from schemas import forex_schema as schema
import pdb
# モジ... | [
{
"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": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excl... | 3 | app/routers/forex_router.py | chanmoto/eurusd_pix2pix |
from serpapi.serp_api_client import *
from serpapi.serp_api_client_exception import SerpApiClientException
class YoutubeSearch(SerpApiClient):
"""YoutubeSearch enables to search google scholar and parse the result.
```python
from serpapi import YoutubeSearch
query = YoutubeSearch({"search_query": "chai... | [
{
"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 | serpapi/youtube_search.py | serpapi/google_search_results_python |
# Copyright 2018 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": "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 | docuploader/credentials.py | renovate-bot/docuploader |
import collections
from typing import Iterator
import itertools
from stream_lib.stream_api import Stream, T
class ItertoolsStream(Stream[T]):
@staticmethod
def stream(*iterables: Iterator[T]):
if len(iterables) == 1:
return ItertoolsStream(*iterables)
else:
return Ite... | [
{
"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 | stream-lib/stream_lib/itertools_stream.py | flegac/deep-experiments |
# Copyright 2013-2020 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)
from spack import *
class Stc(AutotoolsPackage):
"""STC: The Swift-Turbine Compiler"""
homepage = 'http://swif... | [
{
"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 | var/spack/repos/builtin/packages/stc/package.py | xiki-tempula/spack |
from torch import nn, Tensor
from typing import Union
from torch.nn import CrossEntropyLoss
class LabelSmoothCrossEntropy(nn.Module):
def __init__(self, smoothing=0.1):
super().__init__()
assert smoothing < 1.0
self.smoothing = smoothing
self.confidence = 1. - smoothing
sel... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true... | 3 | utils/losses.py | jimilee/image-classification |
# FIXME: fix all "happy paths coding" issues
import liblo
from threading import Thread
class Mext(object):
device = None
def __init__(self, device_port=5000):
self.device_receiver = liblo.ServerThread(device_port)
self.device_receiver.add_method("/monome/grid/key", "iii", self.on_grid_key)
... | [
{
"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 | ui/mext.py | szymonkaliski/nott |
import json
import numpy as np
import gensim
class EmbeddingModel(object):
def __init__(
self, vocab_file, embedding_file, normalize_embeddings=True):
with open(embedding_file, 'rb') as f:
self.embedding_mat = np.load(f)
if normalize_embeddings:
self.embedding_mat = self.embedding_mat / np... | [
{
"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 | nsm/word_embeddings.py | MartinoMensio/neural-symbolic-machines |
"""
@author: Anuj Kumar
@email: cdac.anuj@gmail.com
@date: 16-Apr-18
"""
import logging
from utility.services import Services
logging.basicConfig(format='%(asctime)s - %(levelname)s: %(message)s', datefmt='%m/%d/%Y %I:%M:%S %p',
level=logging.INFO)
from selenium.webdriver.support.select import Sel... | [
{
"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": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer... | 3 | attic/2019/contributions-2019/open/mudaliar-yptu/PWAF/pages/dropdown_page.py | Agriad/devops-course |
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | [
{
"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 | python/paddle/fluid/tests/unittests/test_dygraph_sharding_stage2.py | zmxdream/Paddle |
import integ_test_base
import requests
class TestDeployModelSSLOnAuthOff(integ_test_base.IntegTestBase):
def _get_transfer_protocol(self) -> str:
return "https"
def _get_certificate_file_name(self) -> str:
return "./tests/integration/resources/2019_04_24_to_3018_08_25.crt"
def _get_key_f... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
... | 3 | tests/integration/test_deploy_model_ssl_on_auth_off.py | phantomcosmonaut/TabPy |
class Solution:
r"""
函数注解
>>> def add(x: int, y: int) -> int:
... return a + b
>>> add.__annotations__
{'x': <class 'int'>, 'y': <class 'int'>, 'return': <class 'int'>}
"""
def __init__(self):
pass
def solve(self):
pass
if __name__ == '__main__':
import do... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answ... | 3 | 7/7_3.py | kopsh/python_cookbook |
""" Formula for building parallel """
from pakit import Archive, Recipe
class Parallel(Recipe):
"""
GNU parallel executes shell jobs in parallel
"""
def __init__(self):
super(Parallel, self).__init__()
self.homepage = 'http://www.gnu.org/software/parallel'
self.repos = {
... | [
{
"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 | parallel.py | pakit/recipes |
import json
from pyquery import PyQuery
from scylla.database import ProxyIP
from .base_provider import BaseProvider
class ProxyScraperProvider(BaseProvider):
def urls(self) -> [str]:
return ['https://raw.githubusercontent.com/sunny9577/proxy-scraper/master/proxies.json']
def parse(self, document: ... | [
{
"point_num": 1,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
... | 3 | scylla/providers/proxy_scraper_provider.py | cities/scylla |
from django.contrib.auth.models import User, Group
from .models import Typhoon, Point, GraphPoint
from rest_framework import serializers
class TyphoonListSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Typhoon
fields = ('num', 'name', 'englishname', 'startat', 'endat', 'yea... | [
{
"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 | TyphoonApi/typhoon/serializers.py | ZhangDubhe/Tropical-Cyclone-Information-System |
from reliapy.distributions.continuous import _Continuous
from scipy.stats import exponnorm as prob
class ExponNorm(_Continuous):
def __init__(self, K=None, loc=None, scale=None, random_state=None):
self.K = K
self.loc = loc
self.scale = scale
self.stats = prob.stats(K=self.K, loc=... | [
{
"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/reliapy/distributions/continuous/_exponnorm.py | reliapy/reliapy |
from .KdfParams import KdfParams
from .CipherParams import CipherParams
class CryptoStruct:
def __init__(
self,
cipher: int,
ciphertext: str,
cipherparams: CipherParams,
kdf: str,
kdfparams: KdfParams,
mac: str,
):
self._cipher = cipher
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": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excludi... | 3 | xchainpy/xchainpy_crypto/xchainpy_crypto/models/CryptoStruct.py | tirinox/xchainpy-lib |
from app01.models import Comment
# 方案二
"""
思想:根据根评论递归查找它下面所有子评论
把它放到根评论的空间中
"""
def find_root_sub_comment(root_comment, sub_comment_list):
for sub_comment in root_comment.comment_set.all():
# 找根评论的子评论
sub_comment_list.append(sub_comment)
find_root_sub_comment(sub_comment, sub_comment_list... | [
{
"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 | app01/utils/sub_comment.py | Stylllzy/Blog-1.0 |
# coding: utf-8
import os
import pandas as pd
import numpy as np
import czsc
cur_path = os.path.split(os.path.realpath(__file__))[0]
file_kline = os.path.join(cur_path, "data/000001.SH_D.csv")
kline = pd.read_csv(file_kline, encoding="utf-8")
kline.loc[:, "dt"] = pd.to_datetime(kline.dt)
bars = kline.to_dict("records"... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer"... | 3 | test/test_ta.py | mylovage/czsc |
from django import forms
from django.contrib import admin
from django.contrib.contenttypes import generic
from bible import Verse, RangeError # python-bible
from models import Scripture
class ScriptureForm(forms.ModelForm):
class Meta:
model = Scripture
def clean(self):
# Checking to see if... | [
{
"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 | bibletext/admin.py | richardbolt/django-bibletext |
"""
Allow null group.creator
Revision ID: 21b1ce37e327
Revises: 9389d52b037d
Create Date: 2017-04-13 16:49:16.218511
"""
from alembic import op
revision = "21b1ce37e327"
down_revision = "9389d52b037d"
def upgrade():
op.alter_column("group", "creator_id", nullable=True)
def downgrade():
op.alter_column("g... | [
{
"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 | h/migrations/versions/21b1ce37e327_allow_null_group_creator.py | tgiardina/rpp-h |
# coding=UTF-8
import h5py
import numpy as np
import json
from DataClass.BassClass.ReaderBase import *
'''
MDFReader.py: Access measurement data from a MDF file.
'''
class ComplexEnconding(json.JSONEncoder):
def default(self, o):
if isinstance(o, complex):
return "{real}+{image}i".format(real... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": fals... | 3 | src/DataClass/Reader/MDFReader.py | XiaoYaoNet/MPIRF |
# pylint:disable=unused-variable
# pylint:disable=unused-argument
# pylint:disable=redefined-outer-name
import os
from copy import deepcopy
from typing import Dict
import aiohttp
import pytest
import tenacity
from minio import Minio
from servicelib.minio_utils import MinioRetryPolicyUponInitialization
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": tru... | 3 | packages/pytest-simcore/src/pytest_simcore/simcore_storage_service.py | colinRawlings/osparc-simcore |
import re
import yaml
def replace_e_float(d):
p = re.compile(r"^-?\d+(\.\d+)?e-?\d+$")
for name, val in d.items():
if type(val) == dict:
replace_e_float(val)
elif type(val) == str and p.match(val):
d[name] = float(val)
def load_cfg(name, prefix="."):
with open(f"{... | [
{
"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 | pol/common/load_cfg.py | neevparikh/lwm |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | [
{
"point_num": 1,
"id": "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 | src/azure-cli/azure/cli/command_modules/acs/tests/latest/mocks.py | staer/azure-cli |
import operator
from aiogram_dialog import ChatEvent, DialogManager
from aiogram_dialog.widgets.kbd import Select
from aiogram_dialog.widgets.text import Format
# let's assume this is our window data getter
async def get_data(**kwargs):
fruits = [
("Apple", '1'),
("Pear", '2'),
("Orange",... | [
{
"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 | docs/examples/widgets/select.py | prostmich/aiogram_dialog |
# -*- coding: utf-8 -*-
from qcloudsdkcore.request import Request
class QueryBmTaskResultRequest(Request):
def __init__(self):
super(QueryBmTaskResultRequest, self).__init__(
'bmvpc', 'qcloudcliV1', 'QueryBmTaskResult', 'bmvpc.api.qcloud.com')
def get_taskId(self):
return self.ge... | [
{
"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": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
... | 3 | qcloudsdkbmvpc/QueryBmTaskResultRequest.py | f3n9/qcloudcli |
#!/usr/bin/env python3
# PYTHON_ARGCOMPLETE_OK
from keyword2cmdline import command, command_config
TRANSLATIONS = {
("Hello world", "hi.IN"): "नमस्ते दुनिया"}
@command_config
def exclamation(number=2,
sign="!",
use=True):
return (sign * number if use else "")
@command
def m... | [
{
"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 | examples/hello_world_recursive.py | wecacuee/keyword2cmdline |
#######################################################################
import leiap
import pandas as pd
#######################################################################
def test_clean_datetimes_return_df():
pts = leiap.get_points_simple()
df = leiap.clean_datetimes(pts)
assert isinstance(df, pd.D... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
... | 3 | tests/test_time.py | deppen8/leiap |
#!/usr/bin/env python
# Copyright 2016 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.
"""
Prints "1" if Chrome targets should be built with hermetic Xcode.
Prints "2" if Chrome targets should be built with hermetic Xcode,... | [
{
"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 | build/mac/should_use_hermetic_xcode.py | o-lim/generate-ninja |
class MLConfig:
class ConstError(PermissionError):
pass
class ConstCaseError(ConstError):
pass
def __setattr__(self, name, value):
if name in self.__dict__:
raise self.ConstError("can't change const %s" % name)
if not name.isupper():
raise self.Const... | [
{
"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 | ModelFit/config.py | xidian-uav/uavga |
"""This module provides AdaHandler, an implementation of ETLHandler for ADA."""
import logging
import requests
from fractalis.data.etlhandler import ETLHandler
logger = logging.getLogger(__name__)
class AdaHandler(ETLHandler):
"""This ETLHandler provides integration with ADA.
'Ada provides key infrastru... | [
{
"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_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer... | 3 | fractalis/data/etls/ada/handler_ada.py | LCSB-BioCore/Fractalis |
import json
import logging
import storage
from defs import DeviceRequest
from device.models import Device, DeviceAddress
from hint.models import HintAuthentication
from hint.procedures.request_library import create_device
LOGGER = logging.getLogger(__name__)
"""
This module specifies the handling of device message... | [
{
"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 | hume/device/request_handler.py | megacorpincorporated/hume |
###############################################################################
# Copyright (c) 2017-2020 Koren Lev (Cisco Systems), #
# Yaron Yogev (Cisco Systems), Ilia Abashin (Cisco Systems) and others #
# #
... | [
{
"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 | monitoring/setup/monitoring_vnic.py | korenlev/calipso-cvim |
import pickle
import numpy as np
xgboost = pickle.load(open('./xgboost.pkl', 'rb'))
scaler = pickle.load(open('./scaler.pkl', 'rb'))
def transform_input(input):
return scaler.transform([input])
def make_hard_prediction(input):
return xgboost.predict(transform_input(input))
def make_soft_prediction(input):
... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside... | 3 | api.py | BabakShah/DS-SafetyPrediction |
from django.db import models
# Create your models here.
from django.contrib.auth.models import AbstractUser
class User(AbstractUser):
# 补充字段
mobile = models.CharField(
unique=True,
verbose_name='手机号',
null=True,
max_length=11
)
class Meta:
db_table = 'tb_users'... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{... | 3 | meiduo_mall/meiduo_mall/apps/users/models.py | lyq919233278/meiduo_mall |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.