source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
"""
aspen.testing.pytest_fixtures
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import sys
import pytest
from aspen.testing.harness import Harness
from filesystem_tree import Filesy... | [
{
"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 | aspen/testing/pytest_fixtures.py | Acidburn0zzz/aspen-python |
def test_repl(started_standalone_bootstrap_node):
repl_commands = [
'5',
'new s(`rho:io:stdout`) in { s!("foo") }',
'@"listCh"!([1, 2, 3]) | for(@list <- @"listCh"){ match list { [a, b, c] => { new s(`rho:io:stdout`) in { s!(a) } } } }',
]
for repl_cmd in repl_commands:
start... | [
{
"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 | integration-tests/test/test_repl.py | zscole/rchain |
from .... import service_session
from .... import exceptions
import abc
def generator(iterable):
for item in iterable:
yield item
class SimpleStorageServiceSession(service_session.StackServiceSession, abc.ABC):
@abc.abstractmethod
def list_buckets(self, **kwargs):
return generator(())
... | [
{
"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 | buck/stack/services/s3/service_session/abc.py | tombulled/python-buck |
from typing import List, Tuple
from damage_parameters import DamageParameters
from spell import Spell
from stats import Stats
def _dp_knapsack(weights: List[int], values: List[int], W):
N = len(weights)
weights.insert(0, -1)
values.insert(0, -1)
T = [[0 for _ in range(W + 1)] for _ in range(N + 1)]
... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding... | 3 | knapsack.py | charon25/DofusDamageOptimizer |
# VMware vSphere Python SDK
# Copyright (c) 2008-2015 VMware, 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
#
# ... | [
{
"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/__init__.py | nandonov/pyvmomi |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import simplejson as json
from alipay.aop.api.constant.ParamConstants import *
class AnswerModel(object):
def __init__(self):
self._extra = None
self._item_id = None
self._option_id = None
@property
def extra(self):
return se... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
... | 3 | alipay/aop/api/domain/AnswerModel.py | articuly/alipay-sdk-python-all |
from single_version import __version__
from single_version.ver import _REGEX_VERSION
def test_version():
assert __version__ == '1.2.2'
def test_version_regex():
assert _REGEX_VERSION.match('version="1.2"')
def test_version_regex_with_prefix():
assert _REGEX_VERSION.match('version="v1.2"')
def test_v... | [
{
"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/test_single_version.py | shadeofblue/single-version |
import tensorflow as tf
from tensorflow import layers as tfl
from .base_model import BaseModel, Mode
class SimpleClassifier(BaseModel):
input_spec = {
'image': {'shape': [None, None, None, 1], 'type': tf.float32}
}
required_config_keys = []
default_config = {'data_format': 'channels_first... | [
{
"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 | superpoint/models/simple_classifier.py | SwagJ/SuperPoint |
from data.menus.menu import Menu
class OptionsMenu(Menu):
def __init__(self, game):
Menu.__init__(self, game)
self.states = {0 : "Volume", 1 : "Controls"}
self.index, self.newline = 0, 40
self.cursor_rect.center = (self.game.DISPLAY_W/2, self.game.DISPLAY_H/2 )
def di... | [
{
"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 | data/menus/options_menu.py | ChristianD37/PyRacer |
import unittest
from drunken_python import int_to_str, str_to_int
class Test(unittest.TestCase):
def test_int_to_str(self):
self.assertEqual(int_to_str("4"), 4)
self.assertEqual(int_to_str("-4"), -4)
def test_str_to_int(self):
self.assertEqual(str_to_int(4), "4")
self.assertEqu... | [
{
"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 | edabit/medium/drunken_python/test_drunken_python.py | ticotheps/practice_problems |
MORSE_CODE_DICT = { 'A':'.-', 'B':'-...',
'C':'-.-.', 'D':'-..', 'E':'.',
'F':'..-.', 'G':'--.', 'H':'....',
'I':'..', 'J':'.---', 'K':'-.-',
'L':'.-..', 'M':'--', 'N':'-.',
'O':'---', 'P':'.--.', 'Q':'--.-',
... | [
{
"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 | whitehat/cryptography_functions/morse.py | EterNomm/Whitehat |
from typing import Optional
from .typing import McdpError, __version__
class McdpVersionError(McdpError):
__slots__ = []
def __init__(self, msg: Optional[str] = None) -> None:
if msg:
super().__init__(
msg.format(mcdp_version=__version__))
else:
s... | [
{
"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 | mcdp/exception.py | Ovizro/Mcdp |
#!/usr/bin/env python3
"""
List all users registered in <CWL_ICA_REPO_PATH>/config/user.yaml
"""
from classes.command import Command
from utils.logging import get_logger
import pandas as pd
from utils.repo import read_yaml, get_user_yaml_path
import sys
logger = get_logger()
class ListUsers(Command):
"""Usage:... | [
{
"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 | src/subcommands/listers/list_users.py | kevin3/cwl-ica |
import requests
from bs4 import BeautifulSoup
from section import Section
from extract import extract
class Course:
def __init__(self, url):
session = requests.Session()
response = session.get(url)
soup = BeautifulSoup(response.text, 'lxml')
self.set_course_data(soup)
... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"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 | uoft_scraper/course.py | Zylphrex/uoft-scraper |
# Copyright (c) 2019 CloudZero, Inc. All rights reserved.
# Licensed under the MIT License. See LICENSE file in the project root for full license information.
from datetime import datetime, timezone
from decimal import Decimal, ROUND_DOWN
import dateutil.parser as parser
from dateutil.tz import tzutc
def isodatetim... | [
{
"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 | samwise/utils/standards.py | Cloudzero/samwise |
"""
Given a stack, a function is_consecutive takes a stack as a parameter and that
returns whether or not the stack contains a sequence of consecutive integers
starting from the bottom of the stack (returning true if it does, returning
false if it does not).
For example:
bottom [3, 4, 5, 6, 7] top
Then the call of is_... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": fal... | 3 | algorithms/stack/is_consecutive.py | zhengli0817/algorithms |
import logging
import os
import random
import subprocess
import numpy as np
import torch
import torch.distributed as dist
import torch.multiprocessing as mp
from mmcv.runner import get_dist_info
def init_dist(launcher, backend='nccl', **kwargs):
if mp.get_start_method(allow_none=True) is None:
mp.set_sta... | [
{
"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 | old_version/mmdet_apis_env_7ef08d32c0e2f8585b07423c9e027338ca16486f.py | dingmyu/mmdetection |
import frappe
from frappe import _
from chat.utils import validate_token, get_admin_name, get_chat_settings, get_user_settings
import json
@frappe.whitelist(allow_guest=True)
def settings(token):
"""Fetch and return the settings for a chat session
Args:
token (str): Guest token.
"""
config =... | [
{
"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 | chat/api/config.py | MTAS101/chat |
#!/usr/bin/env python3
import os
import sys
from collections import namedtuple
from gooey import Gooey, GooeyParser
from PIL import Image
"""
Instagram can host a single image, or a grouping of images that we create a "gallery" image in the size for Instagram - 1080 x 1080 px
Facebook image size - 1200 x630 ... | [
{
"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 | resize.py | hwine/mg-resize-images-for-social |
from .node import Node
from .stack import Stack
class Stack_Queue:
def __init__(self):
self.stack_front = Stack()
self.stack_back = Stack()
self._size = 0
def enqueue(self, val):
"""This will add a node the back of the queue and increment the ._size"""
try:
... | [
{
"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 | stacked_queue/stack_queue.py | steveflys/data-structures-and-algorithms |
from django.conf import settings
from django.db import models
from django.core.urlresolvers import reverse
from restaurants.models import RestaurantLocation
class Item(models.Model):
# associations
user = models.ForeignKey(settings.AUTH_USER_MODEL)
restaurant = models.ForeignKey(Restaurant... | [
{
"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 | src/menus/models.py | DocteurNo/Try-Django-1.11 |
from PyQt5.QtGui import *
from PyQt5.QtCore import *
from PyQt5.QtWidgets import QColorDialog, QDialogButtonBox
BB = QDialogButtonBox
class ColorDialog(QColorDialog):
def __init__(self, parent=None):
super(ColorDialog, self).__init__(parent)
self.setOption(QColorDialog.ShowAlphaChannel)
... | [
{
"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 | view/libs/colorDialog.py | jsk1107/UDK_labeler |
"""Library information."""
from __future__ import absolute_import
import sys
import os
def _get_lib_name():
if sys.platform.startswith('win32'):
return "vta.dll"
if sys.platform.startswith('darwin'):
return "libvta.dylib"
return "libvta.so"
def find_libvta(optional=False):
"""Find VTA... | [
{
"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 | vta/python/vta/libinfo.py | weberlo/tvm |
import nose
import idiot
import datetime
import time
def setup():
idiot.init()
def teardown():
pass
def test_snooze_intervals():
p = idiot.CheckPlugin()
assert p.snooze_intervals == idiot.config.snooze_intervals
class TestPlugin(idiot.CheckPlugin):
snooze_intervals = [1, 2, 3, 4]
... | [
{
"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 | tests/check_tests.py | snare/idiot |
from pyopenproject.api_connection.exceptions.request_exception import RequestError
from pyopenproject.api_connection.requests.post_request import PostRequest
from pyopenproject.business.exception.business_error import BusinessError
from pyopenproject.business.services.command.grid.grid_command import GridCommand
from p... | [
{
"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 | pyopenproject/business/services/command/grid/create.py | webu/pyopenproject |
# -*- coding: utf-8 -*- #
# Copyright 2019 Google LLC. 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 requir... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
... | 3 | lib/surface/datastore/databases/create.py | google-cloud-sdk-unofficial/google-cloud-sdk |
from typing import Dict, TextIO
from utils.file import write_enum
from utils.string import to_pascal_case
def read_template() -> str:
template_file: TextIO = open("./file_templates/csharp-enum.cs", "r")
return template_file.read()
def as_enum_row(key: object, json: object) -> str:
enum_name = to_pascal... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/... | 3 | platforms/csharp.py | jt28828/-fontawesome-enum-generator |
"""
Test cases for IRIS SJIMap
"""
import pytest
import astropy.units as u
from sunpy.data.test import get_dummy_map_from_header, get_test_filepath
from sunpy.map.sources.iris import SJIMap
from sunpy.util.exceptions import SunpyMetadataWarning
__author__ = 'Pritish C. (VaticanCameos)'
@pytest.fixture
def irismap(... | [
{
"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 | sunpy/map/sources/tests/test_iris_source.py | dgarciabriseno/sunpy |
from webcamlib.Config import Config, ConfigTemperature, ConfigLightSensor
import logging
from pathlib import PosixPath
import datetime
class Annotate:
def __init__(self, config, data):
self.logger = logging.getLogger('annotate')
self.annotate = config
self.data = data
def Annotate(self... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
... | 3 | webcamlib/Annotate.py | mbuckaway/trailcam |
import io
import numpy as np
from PIL import Image
from .. import ImageReader
def create_test_image(output_fn, size_width=50, size_height=50):
from PIL import Image
image = Image.new('RGB', size=(size_width, size_height), color=(155, 0, 0))
with open(output_fn, "wb") as f:
image.save(f, 'jpeg')
... | [
{
"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 | crafters/image/ImageReader/tests/test_imagereader.py | strawberrypie/jina-hub |
import json
import os
import urllib.request
class SampleScraperPipeline(object):
def open_spider(self, spider):
"""
Write the results to a file.
:param spider: The spider used.
:return: None
"""
self.file = open('sample_urls.txt', 'w')
if spider.auto_downloa... | [
{
"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 | sample_scraper/pipelines.py | stephanschielke/beatport-tracks-scraper |
import numpy as np
class Particle(object):
def __init__(self, bounds, weight, cognitiveConstant, socialConstant):
self.position = None # particle position
self.velocity = None # particle velocity
self.best_position = None # best position individual
self.best_error = float('inf')... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cl... | 3 | mlpy/particleSwarmOptimization/structure/particle.py | QuintonWeenink/pso |
import asyncio
class MockMessage:
def __init__(self, value):
self.value = value
class MockReceive:
def __init__(self, messages=None):
self.messages = messages or []
self.index = 0
async def __call__(self):
try:
message = self.messages[self.index]
exce... | [
{
"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 | blacksheep/testing/messages.py | myusko/BlackSheep |
from flask import make_response, jsonify
def register_handler(app):
@app.errorhandler(400)
def bad_request(error):
return make_response(jsonify({
'status': 'fail',
'message': 'bad request'
}), 400)
@app.errorhandler(404)
def not_found(error):
return ma... | [
{
"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 | app/blueprint/handlers.py | yuwern/simple_restapi |
from zeeguu.core.test.model_test_mixin import ModelTestMixIn
from zeeguu.core.test.rules.user_rule import UserRule
from zeeguu.core.model.bookmark_priority_arts import BookmarkPriorityARTS
from zeeguu.core.word_scheduling import arts
class WordsExerciseStatsTest(ModelTestMixIn):
def setUp(self):
super().... | [
{
"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 | zeeguu/core/test/test_words_exercise_stats.py | mircealungu/Zeeguu-API-2 |
import requests
from bs4 import BeautifulSoup
class HtmlUtil:
def __init__(self, url, skip_prep_price=False):
self.url = url
self._prepare_soup()
if not skip_prep_price:
self._prepare_price()
def _prepare_soup(self):
html = requests.get(self.url)
self.soup ... | [
{
"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 | app/helpers/htmlutil.py | Soumya117/finnazureflaskapp |
import cocos.device
import cocos.numerics as cn
import numpy as np
import pytest
test_data = [np.array([[1, 2, 3],
[4, 5, 6],
[7, 8, 20]],
dtype=np.int32),
np.array([[0.2, 1.0, 0.5],
[0.4, 0.5, 0.6],
... | [
{
"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 | cocos/tests/test_numerics/test_data/test_squeeze_reshape.py | michaelnowotny/cocos |
# -*- coding: utf-8 -*-
#
# Copyright @ 0x6c78.
#
# 16-10-20 下午1:27 0x6c78@gmail.com
#
# Distributed under terms of the MIT License
from operator import mul
from itertools import combinations
class Score(object):
def __init__(self):
"""
张峰实验室通过实验获得的每个位置错配的特异性,具体参考网页:
http://crispr.mit.edu/... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/... | 3 | cas9/score.py | cangtu/cot |
import asyncio
import logging
from asyncio.exceptions import CancelledError
from typing import Tuple
import aioreactive as rx
import pytest
from aioreactive.notification import OnCompleted, OnNext
from aioreactive.testing import AsyncTestSubject, AsyncTestObserver, VirtualTimeEventLoop
from aioreactive.types import As... | [
{
"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 | test/test_with_latest_from.py | dbrattli/aioreactive |
from django.test import TestCase
from core.models import Company
from db_manager.utils import database_upload
class DatabaseUploadTests(TestCase):
def setUp(self):
self.company = Company.objects.create(
name="Test",
companyType="test",
employeeCountRange="12",
... | [
{
"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 | app/db_manager/tests/test_utils.py | PragmaticCoder/Linkedin-Analytics |
# Tencent is pleased to support the open source community by making ncnn available.
#
# Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
#
# Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
# in compliance with the License. You may obtain a copy of the... | [
{
"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 | tools/pnnx/tests/test_nn_BatchNorm2d.py | fzyzcjy/ncnn |
"""
左寄せ表記(Left justified)
"""
import os
import numpy as np
# 環境変数
RADIX = int(os.getenv("RADIX", 2))
# 桁揃えに利用。10進数27 を指定したときの見やすさをデフォルトにするぜ(^~^)
count_width = 3
count_str = ""
dec_width = 4
dec_str = ""
radix_str = ""
# 表示した数の個数
count = 0
def update_print_number(dec):
"""表示するテキストの更新"""
global count_width
... | [
{
"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 | lifegame_lj.py | muzudho/collatz |
#!/usr/bin/env python3
# Copyright (c) 2016-2018 The Zenacoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Specialized SipHash-2-4 implementations.
This implements SipHash-2-4 for 256-bit integers.
"""
def r... | [
{
"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 | test/functional/test_framework/siphash.py | syglee7/zenacoin-ver2 |
import logging
import prodtest
class MultipleOutputsTest(prodtest.ProduceTestCase):
"""
Tests the handling of recipes with multiple outputs.
"""
def test_without(self):
"""
Without the outputs attribute, the recipe is run twice, once for each
target, thus two INFO messages are... | [
{
"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 | t/test_multiple_outputs.py | texttheater/produce |
'''
FILE: BaseHandler.py
PURPOSE: Defines the base for rendering HTML files
MODIFIED: 6 March 2014
AUTHOR: Mathee Sivananthan
'''
# IMPORT STATEMENTS
import webapp2
import jinja2
import urllib2
import logging
import time
import json
import os
import sys
import re
from xml.dom import minidom
from string import l... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cl... | 3 | SiteHandler.py | mathee92/unirentalz |
# Copyright 2022 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import print_function
from threading import Thread
import pytest
from pex.compatibility import PY2
from pex.fetcher import URLFetcher
from pex.typing import TYPE_CHECKIN... | [
{
"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": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answe... | 3 | tests/test_fetcher.py | daobook/pex |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.13 on 2018-07-23 13:16
from __future__ import unicode_literals
from waffle.models import Flag
from django.db import migrations
EMBER_WAFFLE_PAGES = [
'dashboard',
'home',
]
def format_ember_waffle_flag_name(page):
return 'ember_{}_page'.format(page)
def... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"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 | osf/migrations/0121_remove_waffle_flags.py | gaybro8777/osf.io |
import tensorflow as tf
import numpy as np
TILE_SIZE = 224
""" Implements smooth L1 on each dimension. Erases loss for negative pixel locations. """
def smooth_L1(box_labels, box_preds, class_labels):
difference = tf.subtract(box_preds, box_labels)
result = tf.where(tf.abs(difference) < 1, tf.multiply(0.5, tf.square... | [
{
"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 | pixor/smooth_L1.py | Dieblitzen/SAMAR-Project |
import datetime
from jasonpi.normalizers import facebook_profile, google_profile
def test_facebook_profile():
"""
Test that facebook_profile computes
a correct profile received from facebook oauth.
"""
data = {
'email': 'some@email.com',
'first_name': 'Alfred',
'last_name'... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true... | 3 | tests/test_normalizers.py | gobadiah/jasonpi |
from .. import cache
def on_command(command_name:str=None, smart_speaker_read_backs:bool=True):
"""Runs whenever a command is called by the smart speaker.
Parameters
----------
`command_name` : str
The actual name the smart speaker will recognise the command as.
`smart_speaker_read_backs`... | [
{
"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 | goldy_smart_house/events/_on_command_.py | THEGOLDENPRO/Goldy-Smart-House |
import logging
class Diagnostic:
id_counter = 1
def __init__(self, target_id, message):
self.DiagnosticId = "AZ_PY_{}".format(Diagnostic.id_counter)
Diagnostic.id_counter+=1
self.Text = message
self.HelpLinkUri = ""
self.TargetId = target_id
def set_text(self, text... | [
{
"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 | packages/python-packages/api-stub-generator/apistub/_diagnostic.py | scbedd/azure-sdk-tools |
from pymongo import MongoClient, DESCENDING
from bcrypt import hashpw, checkpw, gensalt
import builtins
class Users:
""" A class to store and retrieve user info and passwords to MongoDB.
"""
def __init__(self):
self.mongo_client = builtins.tornado_config['mongo_client']
self.mongo_db = se... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"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 | app/db/users.py | bartfrenk/streamingbandit |
#!/usr/bin/env python
#coding:utf-8
import PFoE
import rospy
import os
import random
import math
import sys
from raspimouse_ros.msg import LightSensorValues
from gazebo_msgs.msg import ModelStates
from geometry_msgs.msg import Twist
def sensors_callback(message):
rospy.loginfo("message:%s",message)
rf = mess... | [
{
"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 | simu.py | kato-masahiro/RaspberryPiMouse-on-episode-task |
import retri
import time
class App(retri.App):
def __init__(self):
super().__init__(160, 120, 4)
data = self.bank(0).data
data[0, 0] = 7
data[0, 1] = 3
data[0, 2] = 7
data[1, 0] = 8
data[2, 0] = 7
data[7, 7] = 7
self.x = 0
self.cou... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"ans... | 3 | test.py | eggveloper/retry |
"""
To understand why this file is here, please read:
http://cookiecutter-django.readthedocs.io/en/latest/faq.html#why-is-there-a-django-contrib-sites-directory-in-cookiecutter-django
"""
from django.conf import settings
from django.db import migrations
def update_site_forward(apps, schema_editor):
"""Set site d... | [
{
"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 | microsoft_student_partners/contrib/sites/migrations/0003_set_site_domain_and_name.py | dntandan/Microsoft-Student-Partners |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# File : normal_clsf.py
# Author : Chi Han, Jiayuan Mao
# Email : haanchi@gmail.com, maojiayuan@gmail.com
# Date : 13.08.2019
# Last Modified Date: 18.08.2019
# Last Modified By : Chi Han, Jiayuan Mao
#
# This file is part ... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/... | 3 | experiments/normal/normal_clsf.py | Glaciohound/VCML |
from util import getPrime, inv, gcd
from random import randrange
from time import time
from datetime import timedelta
def gen_keys():
p = getPrime(512)
q = getPrime(512)
p_s = p ** 2
n = p_s * q
phi = (p_s - p) * (q - 1)
e = randrange(1, phi)
g = gcd(e, phi)
while g != 1:
e = r... | [
{
"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 | RSA/multi_power.py | dev-alberto/Computational-Number-Theory |
def code_response(code=1, msg='', data:dict={}):
from django.http.response import JsonResponse
ret = {
'rescode': code,
'resmsg': msg,
}
ret.update(data)
return JsonResponse(ret)
def generate_jwt_token(openid:str='undefined_wx_openid', encode_to_str=True):
import jwt # pip in... | [
{
"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 | tools_http.py | colderleo/pytools |
import time
import re
from datetime import datetime, timedelta
import calendar
REGEX_TIME = r"([0-2])?[0-9]:[0-5][0-9]"
def start_timer(secs=0, mins=0, hrs=0):
return datetime.now() + timedelta(seconds=secs) + timedelta(minutes=mins) + timedelta(hours=hrs)
def is_timer_done(timer):
_time = datetime.fromtim... | [
{
"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 | core/timers.py | thyanin/Discord_Bot |
import requests
import stickerify
from credentials import CREDENTIALS
from errors import NoFace
AZURE_LINK = CREDENTIALS["AZURE_LINK"]
def get_image_info(url):
r = requests.post(AZURE_LINK + url)
return r.json()
def get_sticker_from_photo(url):
image_info = get_image_info(url)
if ('emotion' in imag... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": fal... | 3 | azure_com.py | joelosw/Telegram_Bot |
# -*- coding: utf-8 -*-
"""Domain Driven Design framework."""
from ddd_base import Entity
from .block import Block
from .location import Location
from .exception.server_error import ServerError
class Server(Entity, Block):
def __init__(self, name):
super().__init__()
self.name = name
self... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
... | 3 | ddd_nginx/server.py | sunwei/ddd-nginx |
from LinkedList import LinkedList
class HashTable:
def __init__(self):
self.__length = 16
self.__buckets = []
for _ in range(self.__length):
self.__buckets.append(LinkedList())
def _get_bucket(self, key):
return hash(key) % self.__length
def insert(self, item):
bucket_key = self._get... | [
{
"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": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (ex... | 3 | Class Work/Hash Tables/HashTable.py | Pondorasti/CS-1.2 |
from typing import List
from functools import lru_cache
class Solution:
def canPartitionKSubsets(self, nums: List[int], k: int) -> bool:
numsSum = sum(nums)
if numsSum % k != 0:
return False
else:
subSum = int(numsSum / k)
cntSum = 0
midNums =... | [
{
"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 | Q06__/98_Partition_to_K_Equal_Sum_Subsets/Solution.py | hsclinical/leetcode |
#!/usr/bin/python
'''
(C) Copyright 2017-2019 Intel Corporation.
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 applic... | [
{
"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 | src/tests/ftest/util/check_for_pool.py | gczsjdy/daos |
from pytuya.devices.base import TuyaDevice
class TuyaHeater(TuyaDevice):
"""
Represents a Tuya Heater.
"""
def __init__(self, id, password, local_key, region):
super(TuyaHeater, self).__init__(id, password, local_key, region)
def state(self):
return self._last_reading.get('1', Fal... | [
{
"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/pytuya/devices/heater.py | python-tuya/python-tuya |
import factory
import factory.fuzzy
from faker import Faker
from risk_maker.risk.config import FieldType
from risk_maker.risk.models import RiskField, RiskType, Risk
fake = Faker()
class RiskTypeFactory(factory.django.DjangoModelFactory):
class Meta:
model = RiskType
name = factory.Faker('word')
... | [
{
"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 | risk_maker/risk/tests/factory.py | mashrikt/risk-maker |
import pytest
from fibsem_tools.io.zarr import zarr_n5_coordinate_inference
from xarray import DataArray
import numpy as np
def pixelResolutionAttr(scales, units, **kwargs):
return {"pixelResolution": {"dimensions": scales[::-1], "unit": units[0]}}
def resolutionAttr(scales, **kwargs):
return {"resolution":... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (ex... | 3 | tests/test_xarray.py | janelia-cosem/scripts |
from .orm.utils import get_num_of_tables
from .lineup import Lineup
from .completer import Completer
class Console(object):
def __init__(self, round, segment, table=None):
self.round = round
self.segment = segment
self.start_from_table = table if table is not None else 1
... | [
{
"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 | ql/console.py | michzimny/teamy-quick-lineup |
# Copyright 2021 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0
from endorsement.test.support import SupportApiTest
class TestSupportNotifications(SupportApiTest):
@property
def reverse_id(self):
return 'endorsee_notifications'
def test_statistics(self):
self._test_... | [
{
"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 | endorsement/test/support/test_notifications.py | uw-it-aca/service-endorsement |
# coding: utf-8
"""
Wavefront REST API
<p>The Wavefront REST API enables you to interact with Wavefront servers using standard REST API tools. You can use the REST API to automate commonly executed operations such as automatically tagging sources.</p><p>When you make REST API calls outside the Wavefront REST ... | [
{
"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/test_gcp_configuration.py | httpsgithu/python-client |
import denga.augment as au
import pandas as pd
class Genda():
def __init__(self,filepath):
self.filepath = filepath
self.dataset = None
try:
self.dataset = pd.read_csv(self.filepath, header= None, error_bad_lines=False)
except:
raise Exception("ERROR: File Missing")
self.data = None
def generat... | [
{
"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 | denga/genda.py | ankitshaw/DenGa |
# -*- coding: utf-8 -*-
import re
import csv
from elizabeth.core.providers import Structured
from unittest import TestCase
from elizabeth.core import interdata as common
from ._patterns import STR_REGEX
class StructuredBaseTest(TestCase):
def setUp(self):
self.structured = Structured('en')
def tear... | [
{
"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 | tests/test_data/test_structured.py | el/elizabeth |
from typing import Optional
from pyspark.sql import Column, DataFrame
from pyspark.sql.functions import from_unixtime, to_timestamp
from spark_auto_mapper.data_types.data_type_base import AutoMapperDataTypeBase
from spark_auto_mapper.helpers.value_parser import AutoMapperValueParser
from spark_auto_mapper.type_defini... | [
{
"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 | spark_auto_mapper/data_types/unix_timestamp.py | icanbwell/SparkAutoMapper |
import random
import string
from django.conf import settings
SHORTCODE_MIN = getattr(settings, "SHORTCODE_MIN", 5)
def code_generator(size=SHORTCODE_MIN, chars=string.ascii_lowercase + string.digits + string.ascii_uppercase):
return ''.join(random.choice(chars) for _ in range(size))
def create_shortcode(instance,... | [
{
"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 | shortener/utils.py | Alexmhack/django_url_shorter |
""" Decorator Parametors
In the previous ideos we saw some built-in decorators that can handle some arguments:
@wraps(fn) @lru_cache(maxsize=256) <\
def inner(): def factorial(n): \
... ... \>function call
This should loo... | [
{
"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 | my_classes/ScopesClosuresAndDecorators/.history/Decoraators2_20210716220339.py | minefarmer/deep-Dive-1 |
#!/usr/bin/env python
from decimal import Decimal, getcontext
from fractions import Fraction
digits = 500
getcontext().prec = digits
def leibnitz(n):
"""
Parameters
----------
n : int
Returns
-------
Fraction
Approximation of pi.
"""
pi = Fraction(0)
sign = 1
for... | [
{
"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 | pi/pi.py | saneravi/ML_Stuff |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import re
from keyword import kwlist
from ._compat import isidentifier
dict_list = [x for x in dict.__dict__]
kwset = set(kwlist + dict_list) # this is faster than iskeyword()
pat_identifier = re.compile(r"^[a-zA-Z_]\w*$")
def is_invalid_key(s):
# type: ... | [
{
"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 | pstruct/validity.py | xkortex/pstruct |
#!usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = "Monkey"
from django.contrib.syndication.views import Feed
from django.urls import reverse
from django.utils.feedgenerator import Rss201rev2Feed
from apps.blog.models import Post
class ExtendedRSSFeed(Rss201rev2Feed):
def add_item_elements(self, handler,... | [
{
"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 | djangoBlog/djangoBlog/RSS.py | blackmonkey121/blog |
import pygame
from src.game_objects.game_object import GameObject
class Dynamic(GameObject):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.dx = 0
self.dy = 0
def draw(self):
super().draw()
def update(self):
s... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer"... | 3 | src/game_objects/dynamic.py | ozcer/Project-Ooze |
import abc
import dataclasses
from dataclasses import dataclass
from typing import ClassVar, Dict, Type, TypeVar
from ..features import Features
T = TypeVar("T", bound="TaskTemplate")
@dataclass(frozen=True)
class TaskTemplate(abc.ABC):
# `task` is not a ClassVar since we want it to be part of the `asdict` out... | [
{
"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 | src/datasets/tasks/base.py | zidingz/datasets |
"""[HTTPX](https://www.python-httpx.org/) 驱动适配
```bash
nb driver install httpx
# 或者
pip install nonebot2[httpx]
```
:::tip 提示
本驱动仅支持客户端 HTTP 连接
:::
FrontMatter:
sidebar_position: 3
description: nonebot.drivers.httpx 模块
"""
from typing import Type, AsyncGenerator
from contextlib import asynccontextmanager
fr... | [
{
"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 | nonebot/drivers/httpx.py | mobyw/nonebot2 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
from alipay.aop.api.domain.KbdishMaterialInfo import KbdishMaterialInfo
class KoubeiCateringDishMaterialDeleteResponse(AlipayResponse):
def __init__(self):
super(KoubeiCateringDish... | [
{
"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 | alipay/aop/api/response/KoubeiCateringDishMaterialDeleteResponse.py | snowxmas/alipay-sdk-python-all |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
def fix_sys_path(current_path):
"""
logic to have always the correct sys.path
'', web2py/gluon, web2py/site-packages, web2py/ ...
"""
def add_path_first(path):
sys.path = [path] + [p for p in sys.path if (
not ... | [
{
"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 | gluon/tests/fix_path.py | crimsoncantab/web2py |
from django.db import transaction
from mutagen.mp3 import MP3
from os import path
@transaction.atomic()
def fetch_feed(podcast_pk, url):
from ..validator.utils import find_validator
from .models import Podcast
import requests
import json
response = requests.get(url, stream=True)
response.rais... | [
{
"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 | dpx/hosting/tasks.py | DotPodcast/dotpodcast-dpx |
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community
Edition) available.
Copyright (C) 2017-2020 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in co... | [
{
"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 | pipeline/utils/utils.py | sdgdsffdsfff/bk-sops-tencent |
from Minigames.Minigame import Minigame
from TimerHelper import TimerHelper
class Sabotage3(Minigame):
def __init__(self, parent,sabotagedStation):
super().__init__(parent)
self.parent = parent
self.__target_station = sabotagedStation
self.alreadyScanned = False
def update(sel... | [
{
"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 | Scanner/Minigames/Sabotage3.py | City-College-Norwich/Digi-Yr2-Project-AmongUs |
# -*- coding: utf-8 -*-
import pytest
from dwim.rules.ln_no_hard_link import match, get_new_command
from tests.utils import Command
error = "hard link not allowed for directory"
@pytest.mark.parametrize('script, stderr', [
("ln barDir barLink", "ln: ‘barDir’: {}"),
("sudo ln a b", "ln: ‘a’: {}"),
("sudo ... | [
{
"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 | tests/rules/test_ln_no_hard_link.py | aoeu/DWIM |
import pytest
from src.geometry.line2d import standard_line
def test_standard_line_0():
# One point is not enough to form a line
for i in range(-10, 11):
for j in range(-10, 11):
A, B, C = standard_line(i, j, i, j)
assert A == 0 and B == 0 and C == 0
@pytest.mark.parametrize(... | [
{
"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 | test/test_geometry/test_line2d.py | alisianoi/algos-py |
import json
import sys
import unittest
from contextlib import contextmanager
if sys.version_info[0] < 3:
from StringIO import StringIO
else:
from io import StringIO
from mock import patch
from auth0_client.Auth0Client import Auth0Client as class_to_test
@contextmanager
def captured_output():
new_out, new... | [
{
"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 | test/test_tenants.py | rubelw/auth0_client |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | [
{
"point_num": 1,
"id": "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 | aliyun-python-sdk-dataworks-public/aliyunsdkdataworks_public/request/v20200518/RemoveProjectMemberFromRoleRequest.py | yndu13/aliyun-openapi-python-sdk |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from caffe2.python import core, workspace
import caffe2.python.hypothesis_test_util as hu
from hypothesis import given
import numpy as np
class TestCastOp(hu.Hypothes... | [
{
"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 | caffe2/python/operator_test/cast_op_test.py | wenhaopeter/read_pytorch_code |
#!/usr/bin/python
# mostly a proxy object to abstract how some of this works
import json
from slackclient._server import Server
class SlackClient(object):
def __init__(self, token):
self.token = token
self.server = Server(self.token, False)
def rtm_connect(self):
try:
sel... | [
{
"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 | slackclient/_client.py | lovexi/CodingMonkey-Bot-Python-version |
#!/usr/bin/env python3
# Copyright (c) 2019-2021 The Danxome Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test danxomed aborts if can't disconnect a block.
- Start a single node and generate 3 blocks.
- Delet... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
... | 3 | test/functional/feature_abortnode.py | wilofice/dahomey |
from turtle import Turtle
class Ball(Turtle):
def __init__(self):
super().__init__()
self.shape("circle")
self.color("white")
self.penup()
self.speed_x = 2
self.speed_y = 2
def move(self):
new_x = self.xcor() + self.speed_x
new_y = self.ycor() ... | [
{
"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 | ball.py | nikiis/pong-game |
from checkov.common.models.enums import CheckResult, CheckCategories
from checkov.cloudformation.checks.resource.base_resource_check import BaseResourceCheck
class EKSSecretsEncryption(BaseResourceCheck):
def __init__(self):
name = "Ensure EKS Cluster has Secrets Encryption Enabled"
id = "CKV_AWS_... | [
{
"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 | checkov/cloudformation/checks/resource/aws/EKSSecretsEncryption.py | niradler/checkov |
import os
import pytest
def test_wrong_select_db_index(cli):
cli.sendline("select 1")
cli.expect(["OK", "127.0.0.1"])
cli.sendline("select 128")
cli.expect(["DB index is out of range", "127.0.0.1:6379[1]>"])
if int(os.environ["REDIS_VERSION"]) > 5:
text = "value is not an integer or out ... | [
{
"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 | tests/cli_tests/test_command_input.py | itamarhaber/iredis |
# Global Imports
import json
from collections import defaultdict
# Metaparser
from genie.metaparser import MetaParser
# =============================================
# Collection for '/mgmt/tm/sys/file/ssl-cert' resources
# =============================================
class SysFileSslcertSchema(MetaParser):
s... | [
{
"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 | src/genie/libs/parser/bigip/get_sys_filessl_cert.py | balmasea/genieparser |
import logging
from tests.mocks import EngineEmul
from bzt.modules.jmeter import JMeter, JMeterExecutor
from bzt.utils import get_full_path
class MockJMeter(JMeter):
def __init__(self, has_ctg=None, reaction=None):
jmeter_version = JMeterExecutor.JMETER_VER
jmeter_path = "~/.bzt/jmeter-taurus/{ve... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": ... | 3 | tests/modules/jmeter/__init__.py | 3dgiordano/taurus |
from dagster import (
file_relative_path,
lambda_solid,
pipeline,
InputDefinition,
OutputDefinition,
PresetDefinition,
)
import dagster_pandas as dagster_pd
@lambda_solid(
input_defs=[InputDefinition('num', dagster_pd.DataFrame)],
output_def=OutputDefinition(dagster_pd.DataFrame),
)
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": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer":... | 3 | python_modules/libraries/dagster-pandas/dagster_pandas/examples/pandas_hello_world/pipeline.py | jake-billings/dagster |
class BaseHelper:
def __init__(self, device):
self.device = device
def params(self, locals_: dict):
params = locals_.copy()
params.pop('self')
return params
| [
{
"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": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 lines?",
"answer"... | 3 | pyadb/device/helper/base.py | HsOjo/OjoPyADB |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.