source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
# Copyright 2020 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.
"""Chromium presubmit script for src/components/autofill.
See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
for more details on th... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docs... | 3 | components/autofill/PRESUBMIT.py | sarang-apps/darshan_browser |
#!/usr/bin/python
#
# Copyright 2019 Polyaxon, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | [
{
"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 | sdks/python/http_client/v1/test/test_v1_list_queues_response.py | hackerwins/polyaxon |
# © Copyright 2021 HP Development Company, L.P.
import json
import pprint
from re import subn
from utils import SubCrawlColors
from .default_storage import DefaultStorage
class ExampleStorage(DefaultStorage):
cfg = None
logger = None
def __init__(self, config, logger):
self.cfg = config
... | [
{
"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 | crawler/storage/example_storage.py | hpthreatresearch/subcrawl |
import unicodedb_shim as unicodedb
from data import Position
class CStream(object):
def __init__(self, source, index=0, col=0, lno=1):
self.col = col
self.index = index
self.lno = lno
self.source = source
def advance(self):
c = self.current
self.index += 1
... | [
{
"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 | compiler/lever_parser/reader/stream.py | cheery/lever |
"""
Utility functions
"""
import numpy as np
def set_all_args(obj, argdict):
for k in argdict.keys():
if hasattr(obj, k):
setattr(obj, k, argdict[k])
else:
print("Warning: parameter name {} not found!".format(k))
def div0(a,b):
with np.errstate(divide='ignore', inval... | [
{
"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 | utility.py | cyber-meow/Robotic_state_repr_learning |
try:
xrange
except:
xrange = range
def totalvalue(comb):
' Totalise a particular combination of items'
totwt = totval = 0
for item, wt, val in comb:
totwt += wt
totval += val
return (totval, -totwt) if totwt <= 400 else (0, 0)
items = (
("map", 9, 150), ("compass", 13, 35)... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docs... | 3 | lang/Python/knapsack-problem-0-1-2.py | ethansaxenian/RosettaDecode |
from pydocmd.preprocessors.rst import Preprocessor as RSTPreprocessor
from pydocmd.preprocessors.google import Preprocessor as GooglePreprocessor
class Preprocessor(object):
"""
This class implements the preprocessor for restructured text and google.
"""
def __init__(self, config=None):
self.c... | [
{
"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 | pydocmd/preprocessors/smart.py | vemel/pydoc-markdown |
'''
You can use this as a boilerplate for your test framework.
Define your customized library methods in a master class like this.
Then have all your test classes inherit it.
BaseTestCase will inherit SeleniumBase methods from BaseCase.
'''
from seleniumbase import BaseCase
class BaseTestCase(BaseCase):
def set... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",... | 3 | examples/boilerplates/base_test_case.py | vineeshvinnu/SeleniumBase |
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from __future__ import unicode_literals
from ..registration import MultiResolutionAffineRegistration
def test_MultiResolutionAffineRegistration_inputs():
input_map = dict(
args=dict(argstr='%s', ),
environ=dict(
nohash=True,
... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
... | 3 | nipype/interfaces/slicer/legacy/tests/test_auto_MultiResolutionAffineRegistration.py | felixsc1/nipype |
# Copyright 2018, OpenCensus Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | [
{
"point_num": 1,
"id": "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 | opencensus/stats/stats_recorder.py | Flared/opencensus-python |
"""
Special Pythagorean triplet.
A Pythagorean triplet is a set of three natural numbers, a < b < c, for which,
a**2 + b**2 = c**2
For example, 3**2 + 4**2 = 9 + 16 = 25 = 5**2.
There exists exactly one Pythagorean triplet for which a + b + c = 1000.
Find the product abc.
"""
from datetime import datetime
from fun... | [
{
"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 | project_euler/ex9_special_pythagorean_triplet.py | ralphribeiro/uri-projecteuler |
"""
Module: 'json' on micropython-v1.10-pyboard
"""
# MCU: {'ver': 'v1.10', 'build': '', 'platform': 'pyboard', 'port': 'pyboard', 'machine': 'PYBv1.1 with STM32F405RG', 'release': '1.10.0', 'nodename': 'pyboard', 'name': 'micropython', 'family': 'micropython', 'sysname': 'pyboard', 'version': '1.10.0'}
# Stubber: 1.5.... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answe... | 3 | stubs/micropython-v1_10-pyboard/json.py | mattytrentini/micropython-stubs |
#!/usr/bin/env python
# coding=utf8
from copy import deepcopy
class Deque:
def __init__(self):
self.data = []
def addFront(self, item):
self.data.insert(0, item)
def addTail(self, item):
self.data.append(item)
def removeFront(self):
if self.size() == 0:
... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding se... | 3 | palindrome_check.py | igelfiend/Python.Structures.Deque |
import sha3
import ethereum
def sig_to_vrs(sig):
# sig_bytes = bytes.fromhex(sig[2:])
r = int(sig[2:66], 16)
s = int(sig[66:130], 16)
v = int(sig[130:], 16)
return v,r,s
def hash_personal_message(msg):
padded = "\x19Ethereum Signed Message:\n" + str(len(msg)) + msg
return sha3.keccak_256(b... | [
{
"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 | web3auth/utils.py | Axellatron/django-web3-auth |
import joblib
import pandas as pd
class ExtraTreesClassifier:
def __init__(self):
path_to_artifacts = "../../research/"
self.values_fill_missing = joblib.load(path_to_artifacts +
"train_mode.joblib")
self.encoders = joblib.load(path_to_artifac... | [
{
"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 | backend/server/apps/ml/income_classifier/extra_trees.py | omkarudawant/ML-Service |
import pytest
from sanic import Sanic
from sanic_jwt import exceptions, Initialize
class MyCustomDict(dict):
async def to_dict(self):
raise Exception("i am not supposed to be called")
@pytest.yield_fixture
def app_with_dict_test():
the_user = MyCustomDict(user_id=1)
async def retrieve_user(r... | [
{
"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 | tests/test_endpoints_dict_first.py | bastiendonjon/sanic-jwt |
class Point:
def __init__(self, x, y):
self.x = x
self.y = y
def getPoint(self):
return (self.x, self.y)
| [
{
"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/trafficSimulator/point.py | Naor-Yekutiely/trafficSimulator |
from typing import Tuple
import numpy as np
from games.level import Level
class Game:
"""
A game can be played (by a human/agent/etc).
It requires a level and has some rules.
"""
def __init__(self, level: Level):
self.level = level
self.current_pos = np.array([0, 0])
def... | [
{
"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 | src/games/game.py | Michael-Beukman/NEATNoveltyPCG |
import pygame
import numpy as np
import logger
cp_logger = logger.get_logger(__name__)
class Joystick:
def __init__(self, control_board_api):
self._control_board_api = control_board_api
if self._control_board_api:
self._non_normalize_function = self._control_board_api.get_joystick_dir... | [
{
"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 | Managers/joystick.py | xqgex/CrazyFlie |
# Copyright 2022 Google Inc. 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 applicable law or ... | [
{
"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 | samples/interactive-tutorials/search/search_simple_query_test.py | tetiana-karasova/python-retail |
#
# Copyright 2015 SUSE 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
... | 3 | salt/modules/philips_hue.py | markgras/salt |
"""Log Number of Parameters after session creation"""
from typing import Tuple, List
import logging
import tensorflow as tf
from deepr.utils import mlflow
LOGGER = logging.getLogger(__name__)
class NumParamsHook(tf.train.SessionRunHook):
"""Log Number of Parameters after session creation"""
def __init__... | [
{
"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 | deepr/hooks/num_params.py | Mbompr/deepr |
"""ADD autograde_enabled to assignment
Revision ID: 452a7485f568
Revises: 3d972cfa5be9
Create Date: 2021-04-27 20:45:32.938022
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = "452a7485f568"
down_revision = "3d972cfa5be9"
branch_labels = None
depends_on = None
... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": tru... | 3 | api/migrations/versions/452a7485f568_add_autograde_enabled_to_assignment.py | Racheltrq/Anubis |
"""
Test cfdi/utils/cfdi_amounts
"""
import os
import pytest
from tests.resources import scenarios
from cfdi.utils import cfdi_amounts as cfdia
@pytest.fixture(scope='session')
def dir_path():
return os.path.dirname(
os.path.realpath(__file__)
)
def test_get_directory_cfdi_amounts(dir_path):
fo... | [
{
"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/test_utils_cfdi_amounts.py | joules457/cfdi-iva-snippet |
# -*- coding:utf-8 -*-
import os
import time
from collections import OrderedDict
import cv2
import numpy as np
__all__ = ['reader', 'preprocess_v']
def preprocess_v(img, w, h):
img = cv2.resize(img, (w, h), cv2.INTER_LINEAR).astype(np.float32)
img_mean = np.array([0.5, 0.5, 0.5]).reshape((3, 1, 1))
img_... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 lines?",
"answer": true
... | 3 | modules/image/semantic_segmentation/humanseg_mobile/data_feed.py | chunzhang-hub/PaddleHub |
from django.shortcuts import render, HttpResponseRedirect, get_object_or_404
from cartapp.models import Cart
from mainapp.models import Product
from django.contrib.auth.decorators import login_required
@login_required
def view(request):
return render(request, 'cartapp/cart.html', context = {
'cart': Cart... | [
{
"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 | geekshop/cartapp/views.py | A1eksAwP/GB-Internet-Store |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class AlipayOpenMiniAmpeMiniappUnbindModel(object):
def __init__(self):
self._mini_app_id = None
self._mobile_app_id = None
self._scene_code = None
@property
def mini_a... | [
{
"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 | alipay/aop/api/domain/AlipayOpenMiniAmpeMiniappUnbindModel.py | antopen/alipay-sdk-python-all |
import torch
from torch.autograd import Function
from torch import nn
import torch.nn.functional as F
def op_copy(optimizer):
for param_group in optimizer.param_groups:
param_group['lr0'] = param_group['lr']
return optimizer
def lr_scheduler(optimizer, iter_num, max_iter, gamma=10, power=0.75):
de... | [
{
"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 | models/algorithms.py | VuongLong/DANCE_W |
import addict
from act.scio.aliasregex import normalize
from act.scio.vocabulary import Vocabulary
from act.scio.plugin import BasePlugin, Result
from typing import Text, List
import configparser
import os.path
def normalize_ta(name: Text) -> Text:
return normalize(
name,
capitalize=True,
... | [
{
"point_num": 1,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"an... | 3 | act/scio/plugins/threatactor_pattern.py | martineian/act-scio2 |
# coding: utf-8
# cf.http://d.hatena.ne.jp/white_wheels/20100327/p3
import numpy as np
import matplotlib.pylab as plt
from mpl_toolkits.mplot3d import Axes3D
def _numerical_gradient_no_batch(f, x):
h = 1e-4 # 0.0001
grad = np.zeros_like(x)
for idx in range(x.size):
tmp_val = x[idx]
x[idx]... | [
{
"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 | ch04/gradient_2d.py | Yuansurex/deep_learning |
from promise import Promise, is_thenable
import six
from graphql.error import format_error as format_graphql_error
from graphql.error import GraphQLError
from graphene.types.schema import Schema
def default_format_error(error):
if isinstance(error, GraphQLError):
return format_graphql_error(error)
r... | [
{
"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 | graphene/test/__init__.py | sebdiem/graphene |
from django.http import JsonResponse, HttpResponseRedirect
from rest_framework.decorators import api_view
from sdk.key_generation import generate_random_key
from sdk.storage import create_storage
from sdk.url import URL, ModelValidationError
storage = create_storage()
@api_view(['GET'])
def go_to(request, key, form... | [
{
"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 | backend/backend/views.py | mkorman9/python-build-system |
import multiprocessing
from gensim.models import Word2Vec
from gensim.models.word2vec import LineSentence
import time
def train():
# Model 1 - create morpheme-embeddings
start = time.time()
print(start)
inp1 = "../wiki-he-morph-FULL.txt"
out_model1 = "./wiki.he-morph.window10.word2vec.skipgram-mo... | [
{
"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 | Embeddings-preparation/word2vec/word2vec.py | danovia/Hebrew-punctuator2 |
import tkinter as tk
class GUI(tk.Frame):
def __init__(self,master=None):
super().__init__(master)
self.pack()
self.create_wigets()
def create_wigets(self):
self.hi_there = tk.Button(self)
self.hi_there["width"] = 15
self.hi_there["height"] = 10
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": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
... | 3 | gui.py | unchangedusername/SimpleMultithreadedDownloader |
import typing
import netmiko
import napalm_digineo_procurve.queries.interfaces
import napalm_digineo_procurve.queries.lldp_neighbors
import napalm_digineo_procurve.queries.device_info
import napalm_digineo_procurve.queries.system_info
import napalm_digineo_procurve.queries.uptime
def get_uptime(device: netmiko.Base... | [
{
"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 | src/napalm_digineo_procurve/device.py | digineo/napalm-digineo-procurve |
# Copyright 2018 REMME
#
# 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, softwa... | [
{
"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 | remme/ws/utils.py | REMME-ONU/remme-core-temp |
#!/usr/bin/python
#
# Copyright 2018-2022 Polyaxon, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... | [
{
"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 | cli/polyaxon/cli/utils.py | polyaxon/cli |
import run as whython
import os
def main():
welcome()
while True:
try:
text = input("whython > ")
if text.strip() == "": continue
if text.strip() == "exit": print("Goodbye!"); return
result, error = whython.run("<stdin>", text)
if error: prin... | [
{
"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 | whython/shell.py | NexInfinite/whython |
from features.arduino_features import BlackrockSerialDIORowByte, SerialDIORowByte
from riglib import experiment
class par(object):
def init(self):
pass
class F(BlackrockSerialDIORowByte, par):
pass
f = F()
f.init()
| [
{
"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 | tests/test_blackrock_rstart.py | sgowda/brain-python-interface |
import pytest
try:
from bots.stocks.due_diligence.supplier import supplier_command
except ImportError:
pytest.skip(allow_module_level=True)
@pytest.fixture(scope="module")
def vcr_config():
return {
"filter_headers": [("User-Agent", None)],
"filter_query_parameters": [
("perio... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",... | 3 | tests/bots/stocks/due_diligence/test_supplier.py | tehcoderer/GamestonkTerminal |
import torch.nn as nn
from ..core.primitives import AbstractPrimitive
class ConvBNReLU(AbstractPrimitive):
def __init__(self, C_in, C_out, kernel_size, stride=1, affine=False):
super().__init__(locals())
pad = 0 if stride == 1 and kernel_size == 1 else 1
self.op = nn.Sequential(
... | [
{
"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": false... | 3 | naslib/search_spaces/hierarchical/primitives.py | NUDTNASLab/NASLib |
#coding:utf-8
from flask import request, Flask
import time
import os
app = Flask(__name__)
@app.route("/", methods=['POST'])
def get_frame():
start_time = time.time()
upload_file = request.files['file']
old_file_name = upload_file.filename
if upload_file:
file_path = os.path.join('./imgtest/', ... | [
{
"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 | transmissionServer.py | crate19970523/yoloKnifeCallPolice- |
import unittest
import compgraph as cg
class GraphTests(unittest.TestCase):
def tearDown(self):
cg.Graph.clear_default()
def test_use_different_graph(self):
new_graph = cg.Graph()
with new_graph.as_default():
node = cg.Node(name='nodo1')
self.assertEqual(len(new_g... | [
{
"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 | tests/graph_test.py | mbsantiago/compgraph |
import atheris
with atheris.instrument_imports():
import sys
import warnings
import mdformat
from mdformat._util import is_md_equal
# Suppress all warnings.
warnings.simplefilter("ignore")
def test_one_input(input_bytes: bytes) -> None:
# We need a Unicode string, not bytes
fdp = atheris.Fu... | [
{
"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 | fuzzer/fuzz.py | jamesquilty/mdformat |
import torch
from torch_geometric.utils import k_hop_subgraph, subgraph
def test_subgraph():
edge_index = torch.tensor([
[0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6],
[1, 0, 2, 1, 3, 2, 4, 3, 5, 4, 6, 5],
])
edge_attr = torch.Tensor([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12])
idx = torch.tensor... | [
{
"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/utils/test_subgraph.py | LingxiaoShawn/pytorch_geometric |
# Copyright 2021 The TensorFlow 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 applica... | [
{
"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 | tensorflow/python/ipu/keras/layers/recomputation.py | chenzhengda/tensorflow |
from os import mkdir
from bottle import route, get, request, static_file, run
from settings import PORT, DIR_CACHE, DIR_GRAPH
from crypkograph import render_graph
@route('/')
@route('/index.html')
def serve_html():
return static_file('index.html', '.')
@route('/static/<filename:path>')
def serve_static(filena... | [
{
"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 | main.py | yuntan/crypkograph |
"""Module with git related utilities."""
import git
class GitRepoVersionInfo:
"""
Provides application versions information based on the tags and commits in the repo
"""
def __init__(self, path: str):
"""
Create an instance of GitRepoVersionInfo
:param path: The path to search... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},... | 3 | step_exec_lib/utils/git.py | giantswarm/step-exec-lib |
from conans import ConanFile, CMake, tools
import os, platform
named_type_version = os.getenv('NAMED_TYPE_VERSION', '1.0')
class NamedTypeConan(ConanFile):
name = "named-type"
license = "MIT"
url = "https://github.com/BentouDev/conan-named-type"
version = named_type_version
description = "NamedTy... | [
{
"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 | conanfile.py | BentouDev/conan-named-type |
# pylint: skip-file
import getpass
import shlex
from subprocess import PIPE # nosec
from django.core.management.base import BaseCommand
from django.utils.autoreload import run_with_reloader
import psutil
def restart_celery():
for proc in psutil.process_iter():
if proc.username() != getpass.getuser(): ... | [
{
"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 | backend/common/management/commands/celery.py | www-norma-dev/idea-box-backend |
import pytest
from qc_utils import QCMetricRecord
from wgbs_pipeline.calculate_average_coverage import (
calculate_average_coverage,
calculate_genome_size,
get_samtools_stats,
make_qc_record,
)
@pytest.mark.filesystem
def test_get_samtools_stats(mocker):
mocker.patch("pysam.stats", return_value="... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer":... | 3 | tests/python/test_calculate_average_coverage.py | procha2/wgbs-pipeline |
import json
from typing import List
import numpy
from ..Spectrum import Spectrum
def save_as_json(spectrums: List[Spectrum], filename: str):
"""Save spectrum(s) as json file.
:py:attr:`~matchms.Spectrum.losses` of spectrum will not be saved.
Example:
.. code-block:: python
import numpy
... | [
{
"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 | matchms/exporting/save_as_json.py | maximskorik/matchms |
import socket
from queue import Queue
import threading
target = ""
queue = Queue()
open_ports = []
def port_scan():
while not queue.empty():
try:
port = queue.get()
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect((target, port))
open_p... | [
{
"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 | port_scanner/port_scanner.py | bagaswastu/misc_python |
from cas.common.models import BuildEnvironment
from typing import Mapping
import logging
class BaseCompiler:
"""
Base compiler class from which all compilers should extend.
"""
def __init__(self, env: BuildEnvironment, config: Mapping, platform: str):
self._env = env
self._config = c... | [
{
"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": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 2... | 3 | cas/common/buildsys/shared.py | ChaosInitiative/CAS |
from typing import Optional
from pytorch_lightning.core.optimizer import is_lightning_optimizer
from pytorch_lightning.plugins.training_type.ddp_spawn import DDPSpawnPlugin
from pytorch_lightning.utilities import _FAIRSCALE_AVAILABLE, rank_zero_only
if _FAIRSCALE_AVAILABLE:
from fairscale.optim import OSS
fr... | [
{
"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 | pytorch_lightning/plugins/training_type/sharded_spawn.py | peblair/pytorch-lightning |
import unittest
from unittest import TestCase
from src.utils.cross_validation_utils import CrossValidationMetricsResultPrinter
from unittest.mock import patch
class TestModelMetricsGenerator(TestCase):
@patch('builtins.print')
def test_should_print_metric_values(self, mock_print):
results = {'test_ac... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
... | 3 | test/utils/CrossValidationUtilsTest.py | gusAGR/machine-learning-tfg |
# Copyright (C) 2017 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
"""Factories for ggrc models.
These are factories for generating regular ggrc models. The factories create a
model and log a post event with the model revision. These do not however
trigger signals. For tes... | [
{
"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 | test/integration/ggrc/models/model_factory.py | Killswitchz/ggrc-core |
# Copyright The PyTorch Lightning team.
#
# 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 i... | [
{
"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": "more_functions_than_classes",
"question": "Does this file define more functions than class... | 3 | flash/text/seq2seq/core/finetuning.py | Darktex/lightning-flash |
import unittest
import complejo
import math
class TestComplejo(unittest.TestCase):
def test_conjugado(self):
c = complejo.Complejo(2.0,5.0)
c.conjugado()
self.assertEqual(c.imaginario, -5.0)
c = complejo.Complejo(2.0,-2.8)
c.conjugado()
self.assertEqual(c.imaginario... | [
{
"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 | pruebas.py | dlara10/DanielLara_Ejercicio20 |
from pyquilted.quilted.section import Section
class Work(Section):
"""The work section in a quilted resume
The work object is a complex section. It contains blocks of jobs
and optionally a list of slugs. As a section it mixes in the
sectionable functionality.
"""
def __init__(self, b... | [
{
"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_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?"... | 3 | pyquilted/quilted/work.py | cocoroutine/pyquilted |
sample = [(2, 5), (1, 2), (4, 4), (2, 3), (2, 1)]
def last(n):
return n[-1]
def tupleSort(items):
sorted_items = sorted(items, key=last)
return sorted_items
print(tupleSort(sample)) | [
{
"point_num": 1,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answe... | 3 | Python/w3resource/Challenge6.py | TakaIzuki/school-work |
import logging
class NullHandler(logging.Handler):
"""
Workaround to support Python 2.6
NullHandler was officially added to the logging package in Python 2.7
"""
def emit(self, record):
pass
class MockHandler(logging.Handler):
def __init__(self, *args, **kwargs):
self.reset(... | [
{
"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 | tests/models.py | chop-dbhi/varify |
'''
Given a string s and an integer k, reverse the first k characters for every 2k characters counting
from the start of the string.
If there are fewer than k characters left, reverse all of them. If there are less than 2k but
greater than or equal to k characters, then reverse the first k characters and left the othe... | [
{
"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 | string/541. Reverse String II.py | JunzhongLin/leetcode_practice |
from cement import App, Controller, ex
from boxmetrics.core.info.cpu import CPUInst as infoCPU
class CPU(Controller):
class Meta:
label = "cpu"
stacked_on = "info"
stacked_type = "nested"
description = "Get CPU info"
arguments = [
(
["-D", "--de... | [
{
"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 | boxmetrics/controllers/info/cpu.py | Laurent-PANEK/boxmetrics-cli |
# TunaBot Ext - Help
from discord.ext import commands
import discord
from aiofiles import open as async_open
from ujson import load, loads
from data import is_admin
JSON_PATH = "data/help.json"
class Help(commands.Cog):
def __init__(self, bot):
self.bot, self.tuna = bot, bot.data
with open(JS... | [
{
"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 | cog/help.py | tasuren/TunaBot |
import os
import tempfile
import logging
from azureml.core.model import Model
import pickle
import pandas as pd
from azureml.core import Run
import os
import mlflow
def init():
global model
model_dir =os.getenv('AZUREML_MODEL_DIR')
model_file = os.listdir(model_dir)[0]
model_path = os.path.join(os.get... | [
{
"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 | src/workshop/core/scoring/batch_score.py | srkasuMsft/MLOpsTemplate |
import paramiko
from getpass import getpass
import time
class SSHConn:
def __init__(self, host, username, password):
self.host = host
self.username = username
self.password = password
def open(self):
remote_conn_pre = paramiko.SSHClient()
remote_conn_pre.set_missing_ho... | [
{
"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 | learning_python/classes/collateral/video_why_classes/class_test.py | fallenfuzz/pynet |
"""Tests for FOOOF core.info."""
from fooof.core.info import *
###################################################################################################
###################################################################################################
def test_get_obj_desc(tfm):
desc = get_obj_desc(... | [
{
"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 | fooof/tests/test_core_info.py | anchandm/fooof |
"""
Part 1 of https://adventofcode.com/2020/day/9
"""
def read_data(filename: str) -> list:
with open(filename, "r") as f:
data = f.read().split("\n")
return data
def sum_to_n(n, options):
"""
Helper function adapted from Day 1 :)
"""
try:
for num in options:
comp... | [
{
"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 | day_09/part1.py | pawlodkowski/advent_of_code_2020 |
import os
# import torch
import argparse
import base64
import sys
import io
import torch
import torch.nn as nn
from torchvision import transforms
from torch.utils.data import DataLoader
from torch.utils.data.sampler import SubsetRandomSampler
def fullmodel2base64(model):
buffer = io.BytesIO()
torch.save(mode... | [
{
"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 | script/app/agg.py | Intelligent-Systems-Lab/ISL-BCFL |
from cirq import circuits, ops, protocols
import cirq
from cirq.contrib.qasm_import import circuit_from_qasm, qasm
import re
import os
from cirq import decompose
from cirq.circuits import Circuit
from pyvoqc.formatting.format_from_qasm import format_from_qasm
from pyvoqc.formatting.rzq_to_rz import rzq_to_rz
from pyvoq... | [
{
"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 | pyvoqc/cirq/voqc_optimization.py | akshajgaur/pyvoqc |
from django.db import models
from django.contrib.auth.models import User
# Token模型 - 用于浏览器扩展
class UserToken(models.Model):
user = models.OneToOneField(User,on_delete=models.CASCADE)
token = models.CharField(verbose_name="token值",max_length=250,unique=True)
def __str__(self):
return self.user
... | [
{
"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 | app_api/models.py | AngusChiang/MrDoc |
"""
This file defines the database models
"""
from .common import db, Field, auth
from py4web import URL
from pydal.validators import IS_NOT_EMPTY, IS_FILE, IS_EMPTY_OR
import datetime
from . import settings
def get_time():
return datetime.datetime.utcnow()
def get_download_url(picture):
return f"images/{p... | [
{
"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 | models.py | Kkeller83/py4web_spa_blog |
import streamlit as st
import tensorflow as tf
from tensorflow.keras.models import model_from_json
from tensorflow.keras.losses import BinaryCrossentropy
import numpy as np
from tensorflow.keras.preprocessing import text
from tensorflow.keras.preprocessing.sequence import pad_sequences
from tensorflow.keras.preprocessi... | [
{
"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 | Streamlit_app.py | Alanapiereid/Streamlit_KERAS_LSTM_Fake_News |
# coding=UTF-8
#全部切成四字及以下
import jieba
def clean_and_append(result_list,word):
# word = word.replace("\n","")
if word == " " or word == "":
return result_list
result_list.append(word)
return result_list
def recursive_cut(line):
line = line.replace("\n", "")
result = []
for big_word... | [
{
"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 | recursive_cut.py | Rokid/better_jieba |
from ..check import Check
_REQUIRED_FIELDS = set(['description'])
_OPTIONAL_FIELDS = set([
'author', 'es5id', 'es6id', 'esid', 'features', 'flags', 'includes',
'info', 'negative', 'timeout'
])
_VALID_FIELDS = _REQUIRED_FIELDS | _OPTIONAL_FIELDS
class CheckFeatures(Check):
'''Ensure tests specify only `fea... | [
{
"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 | tools/lint/lib/checks/features.py | Acidburn0zzz/test262 |
from abc import abstractmethod, ABCMeta
from collections import namedtuple
from cairo import SolidPattern
from zorro.di import has_dependencies, dependency
from .bar import Bar
from tilenol.theme import Theme
@has_dependencies
class Widget(metaclass=ABCMeta):
bar = dependency(Bar, 'bar')
stretched = False
... | [
{
"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 | tilenol/widgets/base.py | paulie-g/tilenol |
# BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE
import pytest # noqa: F401
import numpy as np # noqa: F401
import awkward as ak # noqa: F401
to_list = ak._v2.operations.convert.to_list
def test_broadcast_arrays():
a = ak._v2.Array([[1.1, 2.2, 3.3], [], [4.4, 5.5]], che... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"ans... | 3 | tests/v2/test_0119-numexpr-and-broadcast-arrays.py | douglasdavis/awkward-1.0 |
# coding: utf8
def cache_func(cache_instance, timeout=None):
def dec(func):
def wrapper(*args, **kwargs):
key = '%s:%s|' % (func.__module__, func.__name__) + repr((args, kwargs))
result = cache_instance.get(key)
if result:
return result
else:... | [
{
"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 | api/cache.py | no13bus/bustime |
from Helper.helper import start_text, help_text
from config import bot
from telethon import events
class start():
@bot.on(events.NewMessage(pattern="/start"))
async def event_handler_start(event):
await bot.send_message(
event.chat_id,
start_text,
file='h... | [
{
"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 | Plugins/starter.py | Naim120/Heroku-Manga-DL-Bot |
# Copyright (c) 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
from queue import Queue, Full, Empty
import msgpack
import msgpack_numpy
msgpack_numpy.patch()
def dumps(obj):
re... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than... | 3 | elf_python/utils.py | douglasrizzo/ELF |
from scfmsp.controlflowanalysis.StatusRegister import StatusRegister
from scfmsp.controlflowanalysis.instructions.AbstractInstructionBranching import AbstractInstructionBranching
class InstructionJz(AbstractInstructionBranching):
name = 'jz'
def get_execution_time(self):
return 2
def get_branchi... | [
{
"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 | scfmsp/controlflowanalysis/instructions/InstructionJz.py | sepidehpouyan/SCF-MSP430 |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.8.2
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
im... | [
{
"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 | kubernetes/test/test_v1_ceph_fs_volume_source.py | scele/kubernetes-client-python |
# Copyright 2015-2015 Amazon.com, Inc. or its affiliates. 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. A copy of the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file ... | [
{
"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 | locustfile.py | leandrosiow/eb-locustio-sample |
"""Custom S3 storage backends to store files in subfolders."""
from storages.backends.s3boto3 import S3Boto3Storage
class MediaRootS3BotoStorage(S3Boto3Storage):
location = 'media'
class StaticRootS3BotoStorage(S3Boto3Storage):
location = 'static'
class SitemapRootS3BotoStorage(S3Boto3Storage):
locati... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{... | 3 | oscar_heroku/s3utils.py | ApptecSrl/oscar-heroku |
from . import instance
class SelfConstructor:
def __new__(cls, *args, **kwargs):
if len(args) == 1 and len(kwargs) == 0:
if isinstance(args[0], cls):
inst = args[0]
else:
inst = super().__new__(cls)
inst.initialize(args[... | [
{
"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 | jsonable/self_constructor.py | wikimedia/operations-debs-python-jsonable |
from .drawing import DrawingAdapter
try:
from IT8951 import constants
from IT8951.display import AutoEPDDisplay
has_it8951 = True
except ImportError:
has_it8951 = False
import threading
class DrawingAdapterEPD(DrawingAdapter):
def __init__(self, vcom: float):
if has_it8951:
pri... | [
{
"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 | epaperboard/src/drawing_adapter_epd.py | arroz/epaperboard |
from django.db import models
from ..helpers import wallpapers_dir
class Listino(models.Model):
nome = models.CharField(max_length=200)
def __str__(self):
return f"Listino {self.nome}"
class Meta:
verbose_name = "Listino"
verbose_name_plural = "Listini"
| [
{
"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 | minigest/magazzino/models/listino.py | ctrlmaniac/minigest |
from ducts.spi import EventHandler
from datetime import datetime
from io import BytesIO
import logging
logger = logging.getLogger(__name__)
class Handler(EventHandler):
def __init__(self):
super().__init__()
def setup(self, handler_spec, manager):
handler_spec.set_description('echo back tes... | [
{
"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 | handler/evt_90003_ducts_test_loop_bio.py | iflb/ducts-tutorial-202107 |
from .callbacks import Callback
from timeit import default_timer
from numbers import Number
import sys
overhead = sys.getsizeof(1.23) * 4 + sys.getsizeof(()) * 4
class Cache(Callback):
"""Use cache for computation
Examples
--------
>>> cache = Cache(1e9) # doctest: +SKIP
The cache can... | [
{
"point_num": 1,
"id": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 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 self/... | 3 | dask/cache.py | dgerlanc/dask |
# coding: utf-8
"""
speechapi
Speech APIs enable you to recognize speech and convert it to text using advanced machine learning, and also to convert text to speech. # noqa: E501
OpenAPI spec version: v1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ impor... | [
{
"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 | test/test_text_to_speech_request.py | Cloudmersive/Cloudmersive.APIClient.Python.VoiceRecognition |
# Made by disKret
import sys
from ru.catssoftware.gameserver.model.quest import State
from ru.catssoftware.gameserver.model.quest import QuestState
from ru.catssoftware.gameserver.model.quest.jython import QuestJython as JQuest
qn = "19_GoToThePastureland"
#NPC
VLADIMIR = 31302
TUNATUN = 31537
#ITEMS
BEAST_MEAT = 75... | [
{
"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 | game/data/scripts/quests/19_GoToThePastureland/__init__.py | TheDemonLife/Lineage2Server-Interlude |
import utils
class TXInput(object):
""" Represents a transaction input
Args:
txid (string): Transaction ID.
vout (int): Transaction output value.
sig (string): Signature.
pubkey (string): Public key.
Attributes:
_tx_id (bytes): Transaction 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": "more_functions_than_classes",
"question": "Does this file define more functions than cla... | 3 | blockchain-py/transaction_input.py | andybi7676/blockchain-py |
import ffmpeg
import cv2
import uuid
import os
import base64
import numpy as np
def save_video_to_file(file, vid, fps):
writer = cv2.VideoWriter(file.name, cv2.VideoWriter_fourcc('M','J','P','G'), fps, (vid.shape[2], vid.shape[1]))
for img in vid:
writer.write(np.flip(img, axis=2))
writer.release(... | [
{
"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 | live/gif.py | svenschultze/Colab-Live-Figures |
import numpy as np
def _sample_unit_circle(n_samples: int = 1) -> np.ndarray:
"""
>>> np.isclose(np.linalg.norm(_sample_unit_circle(1)), 1)
True
"""
theta = np.random.rand(n_samples) * 2 * np.pi
x = np.cos(theta)
y = np.sin(theta)
xy = np.array([x, y]).T
assert xy.shape == (n_samp... | [
{
"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 | espaloma/utils/geometry.py | jstaker7/espaloma |
import numpy as np
import torch
from torch import nn as nn
from rlkit.policies.base import Policy
from rlkit.torch.core import eval_np
from rlkit.torch.distributions.tanh_normal import TanhNormal
class TanhPolicy(Policy, nn.Module):
def __init__(
self,
module,
return_raw_actio... | [
{
"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 | rlkit/torch/policies/tanh_policy.py | maxiaoba/rlk |
"""Post table
Revision ID: 79db95db1114
Revises: 148200b7a331
Create Date: 2019-11-21 11:03:05.596270
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '79db95db1114'
down_revision = '148200b7a331'
branch_labels = None
depends_on = None
def upgrade():
# ###... | [
{
"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 | migrations/versions/79db95db1114_post_table.py | Abdulrahmannaser/Micro-blog |
import torch
import torch.nn as nn
import torch.nn.functional as F
class cross_entropy_prob(nn.Module):
def __init__(self):
super(cross_entropy_prob, self).__init__()
def forward(self, pred, soft_targets):
pred = F.log_softmax(pred)
loss = torch.mean(torch.sum(- soft_targets * pred, 1... | [
{
"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 | loss/cross_entropy_prob.py | zwx8981/DBCNN-Pytorch |
import os
import unittest
from satsearch.parser import SatUtilsParser
testpath = os.path.dirname(__file__)
class Test(unittest.TestCase):
""" Test main module """
args = 'search --datetime 2017-01-01 -p eo:cloud_cover=0/20 eo:platform=landsat-8'
@classmethod
def get_test_parser(cls):
""" G... | [
{
"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 | test/test_parser.py | lishrimp/sat-search |
from pyunity import Behaviour, GameObject, SceneManager, Material, Color, Mesh, Vector3, MeshRenderer
class Switch(Behaviour):
def Start(self):
self.a = 3
def Update(self, dt):
self.a -= dt
if self.a < 0:
SceneManager.LoadSceneByIndex(1)
def main():
scene =... | [
{
"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 | pyunity/examples/example7/__init__.py | Knight1632/pyunity |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.