source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
import sys
import os
import shutil
def exit_cli(print_func, message):
print_func("%s" % message)
sys.exit(0)
def display_file(file_name):
"""
Open given file with default user program.
"""
if sys.platform.startswith("linux"):
os.system("xdg-open %s" % file_name)
elif sys.platfor... | [
{
"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 | felicette/utils/sys_utils.py | blac-siren/felicette |
"""Blueprint for HacsRepositoryThemes."""
# pylint: disable=too-many-instance-attributes,invalid-name,broad-except,access-member-before-definition
import logging
from .hacsrepositorybase import HacsRepositoryBase
from ..hacsbase.exceptions import HacsRequirement
_LOGGER = logging.getLogger("custom_components.hacs.rep... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answ... | 3 | custom_components/hacs/repositories/hacsrepositorytheme.py | sjabby/home-assistant-conf |
# -*- coding: utf-8 -*-
from qcloudsdkcore.request import Request
class BgpipQueryResourcesRequest(Request):
def __init__(self):
super(BgpipQueryResourcesRequest, self).__init__(
'bgpip', 'qcloudcliV1', 'BgpipQueryResources', 'bgpip.api.qcloud.com')
def get_region(self):
return s... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer"... | 3 | qcloudsdkbgpip/BgpipQueryResourcesRequest.py | f3n9/qcloudcli |
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under ... | [
{
"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 | src/main/python/apache/aurora/client/commands/help.py | zmanji/incubator-aurora |
import numpy as np
from qtrader.utils.numpy import eps
def _mu_p(w: np.ndarray, r: np.ndarray) -> float:
"""Portfolio Returns."""
return np.dot(w.T, r)
def _sigma_p(w: np.ndarray, Sigma: np.ndarray) -> float:
"""Portoflio Variance"""
return np.dot(np.dot(w.T, Sigma), w)
def _trans_costs(w: np.nda... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/c... | 4 | qtrader/agents/pretrainer/objectives.py | aaron8tang/qtrader |
from elasticsearch import Elasticsearch, helpers
import os
class ElasticSearch:
def __init__(self, index):
es_host = os.environ['es_hostname']
es_port = os.environ['es_port']
if es_host is None:
exit('You need to export Elasticsearch hostname')
if es_port is None... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self... | 3 | Elastic_Search.py | duckwed/attack-to-elk |
"""
__new__()方法, 对象创建的过程,
1- new方法返回一个对象 2- init利用new返回的对象进行属性的添加
"""
class Person(object):
# 监听创建一个实例对象的过程,需要返回一个对象赋值给xiaoming
# new中不return的话,那么久不会执行init方法
def __new__(cls, *args, **kwargs):
print("new")
print((object.__new__(cls)))
return object.__new__(cls)
# 构造方法... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true... | 3 | 00Python/day11/basic02.py | HaoZhang95/PythonAndMachineLearning |
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy
# of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the... | [
{
"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 | magnum/conf/cinder.py | mail2nsrajesh/magnum |
from collections import namedtuple
Prediction = namedtuple('Prediction', 'label confidence')
Face = namedtuple('Face', 'top_prediction bb all_predictions')
BoundingBox = namedtuple('BoundingBox', 'left top right bottom')
def top_prediction(idx_to_class, probs):
top_label = probs.argmax()
return Prediction(la... | [
{
"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 | face_recognition/face_recogniser.py | jagannath-sahoo/face-recognition- |
from json import JSONEncoder
import json
from iip import Serializer
import MyConnMachineIn
class MyConnMachineInSerializer(Serializer):
"""JSON transport serializer for MyConnMachineIn.
Generated by: EASy-Producer."""
class MyConnMachineInEncoder(JSONEncoder):
"""JSON encoder class for MyCo... | [
{
"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 | Plugins/EASy-Producer/ScenariosTest/testdata/real/IIP-Ecosphere/nov21/expected/SerializerConfig1/MyAppExample/src/main/python/MyConnMachineInSerializer.py | SSEHUB/EASyProducer |
import ocdskingfisherprocess.cli.commands.base
import ocdskingfisherprocess.database
from ocdskingfisherprocess.transform import TRANSFORM_TYPE_UPGRADE_1_0_TO_1_1
class NewTransformUpgrade10To11CLICommand(ocdskingfisherprocess.cli.commands.base.CLICommand):
command = 'new-transform-upgrade-1-0-to-1-1'
def co... | [
{
"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 | ocdskingfisherprocess/cli/commands/new_transform_upgrade_1_0_to_1_1.py | matiasSanabria/kingfisher-process |
from services.game_service import GameService
from test.mocks.mock_objects import MockEndgameService
def test_play_works_with_no_hand(default_user_data):
service = GameService(default_user_data, MockEndgameService())
response = service.play()
assert response is not None
assert len(service.hand()) == 2... | [
{
"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 | test/services_tests/test_game_service.py | rhsu/slackjack |
# logcall.py
from functools import wraps
def logged(func):
# Idea: Give me a function, I'll put logging
# around it
print('Adding logging to', func.__name__)
@wraps(func)
def wrapper(*args, **kwargs):
print('You called', func.__name__)
return func(*args, **kwargs)
return wra... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": true
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?"... | 3 | pythonprog/code/12/12.2/logcall.py | davidyshuang/python3 |
#!/usr/bin/env python
import rospy
import datetime
from pibot import srv
def get_cpu_temp():
file = open("/sys/class/thermal/thermal_zone0/temp")
temp = float(file.read()) / 1000.0
file.close()
return temp
def handle_system_server(request):
response = srv.systemResponse()
now = datetime.date... | [
{
"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 | src/srv_system.py | psby233/PiBot |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
# -*- coding: utf-8 -*-
import io
import pytest
from astropy import units
asdf = pytest.importorskip('asdf', minversion='2.0.0')
from asdf.tests import helpers
def roundtrip_quantity(yaml, quantity):
buff = helpers.yaml_to_asdf(yaml)
with asdf... | [
{
"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 | astropy/io/misc/asdf/tags/unit/tests/test_quantity.py | rkiman/astropy |
from urllib.parse import quote_plus as url_quoteplus
from urllib.parse import urlsplit
from selenium.webdriver.common.by import By as WebBy
from selenium.webdriver.support.ui import Select as WebSelect
def allow_flash(driver, url):
def _base_url(url):
if url.find("://") == -1:
url = "http://{}... | [
{
"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 | utils/allow_flash.py | TestOpsFeng/selenium_framework |
import math
from utils.solution_base import SolutionBase
class Solution(SolutionBase):
def solve(self, part_num: int):
self.test_runner(part_num)
func = getattr(self, f"part{part_num}")
result = func(self.data)
return result
def test_runner(self, part_num):
test_input... | [
{
"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 | solutions/day13.py | nitekat1124/advent-of-code-2020 |
# Copyright 2019-2022 Simon Zigelli
#
# 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... | [
{
"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 | app/stage/timeout.py | zigellsn/JWConfStage |
from . import SentenceEvaluator
from typing import Iterable
class SequentialEvaluator(SentenceEvaluator):
"""
This evaluator allows that multiple sub-evaluators are passed. When the model is evaluated,
the data is passed sequentially to all sub-evaluators.
All scores are passed to 'main_score_function... | [
{
"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 | sentence_transformers/evaluation/SequentialEvaluator.py | dd-dos/sentence-transformers |
# Code generated by lark_sdk_gen. DO NOT EDIT.
from pylark.lark_request import RawRequestReq, _new_method_option
from pylark import lark_type, lark_type_sheet, lark_type_approval
import attr
import typing
import io
@attr.s
class GetDriveFolderChildrenReq(object):
types: typing.List[str] = attr.ib(
factor... | [
{
"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 | pylark/api_service_drive_folder_children_get.py | chyroc/pylark |
import glob,os,re,shutil,tempfile
from functools import reduce
def sorted_number_split(html_base, assetdir, ext):
assetfiles = glob.glob(f"{html_base}{assetdir}/*.{ext}")
filenames = map(os.path.basename, assetfiles)
numberfiles = filter(lambda line: re.match(re.compile(f"[0-9]+\.{ext}"), line), fi... | [
{
"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 | split_asset_line.py | kay1759/split_asset_line |
# Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | [
{
"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 | clif/testing/python/t10_test.py | wangxf123456/clif |
from __future__ import absolute_import
from django.conf import settings
import ujson
from zproject.backends import password_auth_enabled, dev_auth_enabled, google_auth_enabled, github_auth_enabled
def add_settings(request):
realm = request.user.realm if hasattr(request.user, "realm") else None
return {
... | [
{
"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 | zerver/context_processors.py | yicongwu/zulip |
import sys
import os
_force_color = None
def set_force_color(force_color):
global _force_color
_force_color = force_color
def support_color():
if _force_color is not None:
return _force_color
if not sys.stdout.isatty():
return False
if os.name == 'posix':
re... | [
{
"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 | libra/cli/color.py | MaslDi/libra-client |
# Time: O(n)
# Space: O(1)
import collections
class Solution(object):
def majorityElement(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
idx, cnt = 0, 1
for i in xrange(1, len(nums)):
if nums[idx] == nums[i]:
cn... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self... | 3 | Python/majority-element.py | black-shadows/LeetCode-Solutions |
from reamber.quaver.lists.notes import QuaHoldList
from tests.test.qua.test_fixture import qua_map
def test_type(qua_map):
assert isinstance(qua_map.holds, QuaHoldList)
def test_df_names(qua_map):
assert {'offset', 'column', 'length', 'key_sounds'}, set(qua_map.holds.df.columns)
def test_to_yaml(qua_map):
... | [
{
"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/test/qua/test_hold_list.py | Eve-ning/reamber_base_py |
from django.db import models
# models from other Apps
from account.models import User
# python packages
import datetime
# ------------------------- COURSE MODEL -----------------------------------------
class Course(models.Model):
course_name = models.CharField("course name", max_length=60)
course_code = m... | [
{
"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 | registration/models.py | sravanireddy1102/peerevaluationsystem |
import os
import shutil
from webpack.conf import settings
def write_file(file_name, content):
with open(file_name, 'w') as _file:
_file.write(content)
def read_file(file_name):
with open(file_name, 'r') as _file:
return _file.read()
def clean_output_root():
# Clean out any files genera... | [
{
"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 | tests/utils.py | markfinger/python-webpack |
#!/usr/bin/env python
# Copyright 2014 The Swarming Authors. All rights reserved.
# Use of this source code is governed by the Apache v2.0 license that can be
# found in the LICENSE file.
import logging
import os
import sys
import tempfile
import shutil
import unittest
import re
# Import this first before manipulatin... | [
{
"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 | appengine/swarming/swarming_bot/logging_utils_test.py | pombreda/swarming |
import json
def process_data(data):
member_dict = {}
def process_post(post):
if 'comments' in post:
for comment in post['comments']['data']:
commenter_id = comment['from']['id']
if commenter_id not in member_dict:
member_dict[commenter_id] = comment['from']
member_dic... | [
{
"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 | process-whispers.py | yangshun/nuswhispers-leaderboard |
# -*- coding: utf-8 -*-
"""
Created on Thu Nov 12 22:03:22 2020
@author: kelli
"""
from binarytodmx import *
import unittest
import filecmp
class TestDMX(unittest.TestCase):
def test_volcano(self):
""" test with frame data in np array from volcano.sc2
uses rc2 tools to... | [
{
"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 | binarytodmx_test.py | me701/project-1-kellim521 |
import logging
from troposphere.events import Rule, Target
from buildlib.helpers.client_helper import ClientHelper
class EventsHelper(object):
def __init__(self, template, project, session=None):
self.client = ClientHelper.get_client('events', session)
self.project = project
self.templat... | [
{
"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 | buildlib/helpers/events.py | ForwardLine/backup-nanny |
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, x):
# self.val = x
# self.next = None
class Solution:
def __init__(self, head: ListNode):
"""
@param head The linked list's head.
Note that the head is guaranteed to be not null, so it contains ... | [
{
"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 | LeetCodeSolutions/LeetCode_0382.py | lih627/python-algorithm-templates |
import arcade
class MyGame(arcade.Window):
def __init__(self, width, height, title, bg_color):
super().__init__(width, height, title)
arcade.set_background_color(bg_color)
self.width = width
self.height = height
self.x = 0
self.y = 0
self.velocity = 1
... | [
{
"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 | up_direction/game.py | ramalho/arcade_tutorial |
from django.db import models
from django.urls import reverse
from nautobot.core.models import BaseModel
from nautobot.extras.utils import extras_features
from nautobot.extras.models import ObjectChange
from nautobot.utilities.utils import serialize_object
@extras_features("graphql")
class DummyModel(BaseModel):
... | [
{
"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 | examples/dummy_plugin/dummy_plugin/models.py | jfach/nautobot |
#!/usr/bin/env py.test
# -*- coding: utf-8 -*-
__author__ = "Varun Nayyar <nayyarv@gmail.com>"
import numpy as np
import pytest
import NN.layerversions.layers4 as layer
def test_fc():
l1 = layer.FullyConnected(5, 10)
x = np.ones((100, 5))
y, c = l1.forward(x)
assert y.shape == (100, 10)
assert ... | [
{
"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/test_layers4.py | nayyarv/CodeANet |
import tensorflow as tf
# from tensorflow.python.framework.ops import disable_eager_execution
# disable_eager_execution()
from tensorflow.keras import backend as K
def jaccard_tensorflow(y_true, y_pred):
"""Jaccard score of Tensor in tensorflow for graph mode.
"""
intersection = tf.sets.intersection(y_tru... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self... | 3 | metric.py | rangsimanketkaew/learning-to-smell |
from django.contrib import admin
from adminsortable2.admin import SortableInlineAdminMixin
from places.models import Place, Image
class ImageInline(SortableInlineAdminMixin, admin.TabularInline):
model = Image
readonly_fields = ["image_preview"]
fields = ("image_file", "image_preview", "image_order")
... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},... | 3 | where_to_go/places/admin.py | delphython/where-to-go |
#!/usr/bin/env python3
# Copyright (c) 2015-2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test p2p mempool message.
Test that nodes are disconnected if they send mempool messages when bloom
fi... | [
{
"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/functional/p2p_mempool.py | Pirontechv/Bitchain |
"""
This module defines the user model and associated functions
"""
from werkzeug.security import generate_password_hash
from .base_models import BaseModels
class UserModel(BaseModels):
"""
This class encapsulates the functions of the user model
"""
def __init__(self):
"""Initializes databas... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a ty... | 3 | app/api/v2/models/user_models.py | erick-maina/Questioner_API |
import json
from pkg_resources import resource_filename
def load_resource(name):
with open(resource_filename('ffmpeg_db', name)) as f:
return json.load(f)
def ext_to_codecs_json():
return load_resource('data/ext-to-codecs.json')
def codec_info_json():
return load_resource('data/codec-info.jso... | [
{
"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 | ffmpeg_db/ffmpeg_db.py | audo-ai/ffmpeg-db |
# encoding: utf-8
"""
Test process execution and IO redirection.
"""
__docformat__ = "restructuredtext en"
#-----------------------------------------------------------------------------
# Copyright (C) 2008-2009 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full license is
#... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"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 | IPython/deathrow/oldfrontend/tests/test_process.py | adgaudio/ipython |
import secrets
import boto3
import moto
import pytest
from helpers import bulk_delete_dynamo_items, delete_dynamo_item
@pytest.fixture
def client():
with moto.mock_dynamodb2():
yield boto3.resource("dynamodb", region_name="eu-west-1").meta.client
def test_can_delete_single_item(client):
client.cre... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
... | 3 | scripts/tests/test_dynamo.py | h4l/storage-service |
from typing import Union
from asphalt.core import Context
from asphalt.serialization.api import Serializer
from asphalt.serialization.serializers.json import JSONSerializer
from motor.motor_asyncio import AsyncIOMotorClient
from typeguard import check_argument_types
from asphalt.feedreader.api import FeedStateStore
... | [
{
"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 | asphalt/feedreader/stores/mongodb.py | asphalt-framework/asphalt-feedreader |
#
# Copyright (C) 2019 Databricks, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answ... | 3 | databricks/koalas/tests/test_etl.py | WeichenXu123/koalas |
from starlette.status import HTTP_200_OK, HTTP_403_FORBIDDEN
from starlite import RouteHandler, create_test_client, get
from starlite.exceptions import PermissionDeniedException
from starlite.request import Request
async def local_guard(_: Request, route_handler: RouteHandler) -> None:
if not route_handler.opt o... | [
{
"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 | tests/test_guards.py | JonasKs/starlite |
import sanitize_sheet
import pytest
def test_check_info():
info = ['abcdef']
assert(sanitize_sheet.check_sampleNames(info))
info = ['abcdefghijklmnopqrstuvwxy1234']
with pytest.raises(Exception):
sanitize_sheet.check_info(info)
def test_check_for_sequence():
assert(sanitize_sheet.check_for_... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer"... | 3 | test_sanitize_sheet.py | RobertSchaffer1/lsdc |
# Copyright 2021 Huawei Technologies Co., Ltd
#
# 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... | [
{
"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 | MindElec/examples/physics_driven/frequency_domain_maxwell/src/model.py | mindspore-ai/mindscience |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# 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": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": fals... | 3 | keystoneclient/tests/v3/test_domains.py | citrix-openstack-build/python-keystoneclient |
import datetime
from django.db import models
from django.utils import timezone
class Question(models.Model):
question_text = models.CharField(max_length=200)
pub_date = models.DateTimeField('date published')
def __str__(self):
return self.question_text
def was_published_recently(self):
... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": ... | 3 | mysite/polls/models.py | 3ng7n33r/DjangoTutorial |
# --------------------------
# UFSC - CTC - INE - INE5603
# Exercício Processa Números
# --------------------------
# Classe responsável por verificar se lista não possui números repetidos.
from view.paineis.painel_abstrato import PainelAbstrato
from model.processa_numeros import sem_repeticoes
class PainelSemRepetic... | [
{
"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 | tarefas-poo/lista-02/processa-numeros/view/paineis/painel_sem_repeticoes.py | victoriaduarte/POO_UFSC |
import boto3
from datetime import datetime, timedelta
from os import environ
from src.functions.csv_dump import send_sql
rds_client = boto3.client("rds-data")
ddb_resource = boto3.resource("dynamodb")
shub_table = ddb_resource.Table(environ.get("TABLE_SHUB"))
shub_index = environ.get("SHUB_INDEX")
db_name = environ.ge... | [
{
"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 | src/functions/fixtures_offload.py | Gilbertly/kickoffai-sls-dataml |
import configparser
import unittest
import adform
class AuthorizeTestCase(unittest.TestCase):
def setUp(self):
config = configparser.ConfigParser()
config.read('config.ini')
self.client_id = config['DEFAULT']['CLIENT_ID']
self.client_secret = config['DEFAULT']['CLIENT_SECRET']
... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
}... | 3 | tests/test_authorize.py | dutkiewicz/adform-api |
# -*- coding: utf-8 -*-
import sys
from PyQt5.QtWidgets import QApplication, QWidget
from PyQt5.QtGui import QPainter, QBrush, QPen
from PyQt5.Qt import QColor
class MyWindow(QWidget):
def __init__(self, parent=None, title=None, size=(640, 480)):
super().__init__()
self.resize(*size)
... | [
{
"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 | Simple/qtTest.py | Chachay/Python-GUI-Toolkits-Comparison |
from recipe_scrapers.purelypope import PurelyPope
from tests import ScraperTest
class TestPurelyPopeScraper(ScraperTest):
scraper_class = PurelyPope
def test_host(self):
self.assertEqual("purelypope.com", self.harvester_class.host())
def test_canonical_url(self):
self.assertEqual(
... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
... | 3 | tests/test_purelypope.py | mathiazom/recipe-scrapers |
import pook
import pytest
import requests
def test_json_operator(should):
with pook.use():
pook.get('foo.com', reply=200, response_json={'foo': 'bar'})
res = requests.get('http://foo.com')
res | should.have.json.equal.to({'foo': 'bar'})
with pytest.raises(AssertionError):
... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answ... | 3 | tests/operators/json_body_test.py | angelneo/http |
from __future__ import unicode_literals
from django.db import models
from django.conf import settings
from .player import Player
from django.core.urlresolvers import reverse
Q = models.Q
class Game(models.Model):
name = models.CharField(max_length=128, db_index=True)
product_key = models.CharField(max_length... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answ... | 3 | gge_proxy_manager/models/common.py | mrcrgl/gge-storage |
'''
Link or unlink a prexisting functionapp with a static webapp. Also known as "Bring your own Functions."
'''
from ... pyaz_utils import _call_az
def link(function_resource_id, name, resource_group, force=None):
'''
Link an Azure Function to a static webapp. Also known as "Bring your own Functions." Only one... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"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 | pyaz/staticwebapp/functions/__init__.py | py-az-cli/py-az-cli |
from rest_framework import status
from django.contrib.auth import get_user_model
from rest_framework.reverse import reverse
from .basetest import BaseTestCase
User = get_user_model()
signup_url = reverse("authentication:signup")
login_url = reverse("authentication:login")
class UserApiTestCase(BaseTestCase):
d... | [
{
"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 | authors/apps/authentication/tests/test_login.py | andela/ah-backend-thanos |
from transmute_core.exceptions import NoSerializerFound
class SerializerSet(object):
"""
composes multiple serializers, delegating commands to one
that can handle the desired content type.
SerializerSet implements a dict-like interface. Retrieving
serializers is done by get the content type item:... | [
{
"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 | transmute_core/contenttype_serializers/serializer_set.py | yunstanford/transmute-core |
import argparse
import os
from liquidcss.workspace import WorkSpace
from liquidcss.settings import Settings, Messages
from liquidcss.utils import display_output
"""
Command: liquidcss init
Description:
Initializes the WorkSpace.
Optional Arguments:
[--reset -r] : Resets the WorkSpace.
[--hard, -hr] : Re... | [
{
"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 | liquidcss/commands/init.py | saradzhyanartur/liquidcss |
# -*- coding: utf-8 -*-
"""
Test Composite Map
"""
import os
import pytest
import numpy as np
import astropy.units as u
from astropy.coordinates import SkyCoord
import matplotlib.pyplot as plt
import sunpy
import sunpy.map
import sunpy.coordinates
import sunpy.data.test
from sunpy.tests.helpers import figure_test
fr... | [
{
"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 | sunpy/map/tests/test_compositemap.py | Swapnil99007/sunpy |
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def lowestCommonAncestor(self, root: 'TreeNode', p: 'TreeNode', q: 'TreeNode') -> 'TreeNode':
"""
Time Complexity:
... | [
{
"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 | 235-lowest-common-ancestor-of-a-binary-search-tree/235-lowest-common-ancestor-of-a-binary-search-tree.py | jurayev/data-structures-algorithms-solutions |
import numpy as np
import numpy.random as nr
from plaidrl.exploration_strategies.base import RawExplorationStrategy
class OUStrategy(RawExplorationStrategy):
"""
This strategy implements the Ornstein-Uhlenbeck process, which adds
time-correlated noise to the actions taken by the deterministic policy.
... | [
{
"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 | plaidrl/exploration_strategies/ou_strategy.py | charliec443/plaid-rl |
# Adopted from
# https://github.com/pytorch/fairseq/blob/master/fairseq/distributed_utils.py
import pickle
import torch
MAX_SIZE_LIMIT = 65533
BYTE_SIZE = 256
def enc_obj2bytes(obj, max_size=4094):
"""
Encode Python objects to PyTorch byte tensors
"""
assert max_size <= MAX_SIZE_LIMIT
byte_tens... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/c... | 3 | pythia/utils/objects_to_byte_tensor.py | caodoanh2001/uit-mmf |
from .component.appearance import color
from .component.geometry import sigma
from .primitive import Primitive
class BaseNeRF(Primitive):
def __init__(self, multires=10, multires_views=4, netdepth=8, netwidth=256) -> None:
self.geometry = sigma.Sigma(multires, netdepth, netwidth, netwidth, [4])
se... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (exclu... | 3 | python_api/primitive/base_nerf.py | openNGP/openNGP |
# -*- coding: utf-8 -*-
'''
____ ___ ____________ ___ ___ ____ _________________
/ __ \/ _ | / __/ _/ __/ / _ \/ _ \/ __ \__ / / __/ ___/_ __/
/ /_/ / __ |_\ \_/ /_\ \ / ___/ , _/ /_/ / // / _// /__ / /
\____/_/ |_/___/___/___/ /_/ /_/|_|\____/\___/___/\___/ /_/
Operational Aid Source ... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true... | 3 | sample/race_tasks.py | HyechurnJang/pygics |
import jinja2
from honcho.export.base import BaseExport
from honcho.export.base import File
class Export(BaseExport):
def get_template_loader(self):
return jinja2.PackageLoader(__name__, 'templates/supervisord')
def render(self, processes, context):
context['processes'] = processes
f... | [
{
"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 | honcho/export/supervisord.py | mchristen-astranis/honcho |
import os
from xml.etree.ElementInclude import include
from flask import Flask
from .db import mongo
def create_app(test_config=None):
# create and configure the app
app = Flask(__name__, instance_relative_config=True)
app.config.from_mapping(
SECRET_KEY='testing',
)
if test_config is No... | [
{
"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_has_docstring",
"question": "Does every function in this file have a docstring?",
"answ... | 3 | bcMathSociety/flaskr/__init__.py | kennywang01/BCMS |
import asyncio
import httpx
import time
import zeep
from zeep.transports import AsyncTransport
def run_async():
print("async example")
print("=============")
result = []
def handle_future(future):
result.extend(future.result())
loop = asyncio.get_event_loop()
client = zeep.AsyncC... | [
{
"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 | examples/async_client.py | vascohenriques/python-zeep |
import os
import time
from click.testing import CliRunner
from bin.throne import cli as throne
runner = CliRunner()
shodan_key = os.getenv('SHODAN_KEY')
throne_user = os.getenv('THRONE_USER')
throne_pass = os.getenv('THRONE_PASS')
def test_throne_setapi():
print("Testing: throne api setapi")
response = runne... | [
{
"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 | tests/create_config.py | throne/throne-cli |
from tweepy import TweepError
from ultron.actions import Action
from ultron.exception.twitterexceptions import InvalidUserException
from ultron.helpers.twitter_helper import load_api
class FollowUser(Action):
def __init__(self, screen_name):
self.api = load_api()
self.follow_status = False
... | [
{
"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 | ultron/actions/twitter/followuser.py | Prakash2403/ultron |
from cement import Controller
from cement.utils.version import get_version_banner
from ..core.version import get_version
VERSION_BANNER = """
Add Dependencies and Extensions for Hashicorp Packer %s
%s
""" % (get_version(), get_version_banner())
class Base(Controller):
class Meta:
label = 'base'
d... | [
{
"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 | removalist/controllers/base.py | convenia/removalist |
# -*- coding: utf-8 -*-
"""
用数组实现队列queue:用数组实现的队列是顺序队列,主要操作有入队和出队操作。
"""
from typing import Optional
class DynamicQueue:
"""
算法步骤:
1.入队列
(1)判断尾指针大小是否位等于队列存储容量
是
(1.2)判断头指针是否位于队列开头,
是,队列已满,无法插入
否,队列未满,将队列进行前部搬移
a.数据整段往前重新复制搬移
... | [
{
"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 | array_queue.py | KAIKAIZHANG/Algorithm |
import pytest
def test_home(client, auth):
# log in as teacher and see teacher home Page
# with list of courses
auth.login()
response = client.get('/home')
assert b'Teacher Home Page' in response.data
# course not owned by teacher
assert b'ENG 101' in response.data
# course owned by te... | [
{
"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 | tests/test_main.py | jczimmerman/tsct-portal |
import sys
import time
import torch
from torch.utils.data import IterableDataset
import numpy as np
def worker_init_fn(worker_id):
'''Helper function to launch each worker's env with a different seed'''
gym = __import__('gym')
worker_info = torch.utils.data.get_worker_info()
ds = worker_info.dataset
... | [
{
"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 | dedo/internal/datasets.py | Nishantjannu/dedo |
class FastqParser(object):
"""A class for parsing and handling fastQ files.
Currently only taking care of the sequences not the quality
strings. Only four line entries can be handled
"""
def entries(self, fastq_fh):
"""Go line by line though the file and return fastq entries. """
c... | [
{
"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 | reademptionlib/fastq.py | Tillsa/READemption |
import time
from dataclasses import dataclass
import jwt
from util.enum_util import EnumBase
class Role(EnumBase):
USER = "USER"
ADMIN = "ADMIN"
class Perm(EnumBase):
NONE = "NONE"
READ_MSG = "READ_MSG"
WRITE_MSG = "WRITE_MSG"
@dataclass
class Identity:
user: str
role: Role.to_enum()... | [
{
"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_return_types_annotated",
"question": "Does every function in this file have a return... | 3 | fastapi_example/util/auth_util.py | pkyosx/fastapi-example |
# Problem 142: Perfect Square Collection
# https://projecteuler.net/problem=142
memo_i_max = 500
memo = [i**2 for i in range(memo_i_max+1)] # note: contains 0**2
def sq(i):
global memo_i_max
if i > memo_i_max:
for j in range(memo_i_max+1, i+100+1):
memo.append(j**2)
me... | [
{
"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 | p142.py | yehnan/project_euler_python |
from typing import Callable
import django
from django.http import HttpRequest
try:
from django.utils.datastructures import CaseInsensitiveMapping
except ImportError:
from .datastructures import CaseInsensitiveMapping
# HttpHeaders copypasted from django 3.0 codebase
class HttpHeaders(CaseInsensitiveMapping)... | [
{
"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 | ninja/compatibility/request.py | kmlee78/django-ninja |
"""
Revision ID: 101b182bd0ce
Revises: 3aecef07d21a
Create Date: 2020-07-15 15:13:13.020740
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '101b182bd0ce'
down_revision = '3aecef07d21a'
branch_labels = None
depends_on = None
def upgrade():
# ### commands ... | [
{
"point_num": 1,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?... | 3 | alembic/versions/101b182bd0ce_.py | seamless-io/seamless-web |
import pygame
from snake.resources.constants import BLOCK_SIZE, WIDTH, HEIGHT
from snake.resources.directions import Direction
class Point:
def __init__(self, x, y):
self.x = x
self.y = y
self.f = 0
self.g = 0
self.h = 0
self.neighbors = []
self.origin = Non... | [
{
"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 | snake/main/point.py | megh-khaire/SnakeAIs |
from django.core.urlresolvers import reverse
from oscar.core.loading import get_model
from oscar.test.testcases import WebTestCase, add_permissions
from oscar.test.factories import (
CategoryFactory, PartnerFactory, ProductFactory, ProductAttributeFactory)
from hooks.test.factories import (
HookEventFactory,... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
... | 3 | tests/functional/dashboard/test_hook.py | cage1016/django-oscar-hooks |
# Copyright Pincer 2021-Present
# Full MIT License can be found in `LICENSE` at the project root.
"""sent when a message is deleted in a subscribed text channel"""
from __future__ import annotations
from typing import TYPE_CHECKING
from ..objects.events.message import MessageDeleteEvent
from ..utils.conversion impor... | [
{
"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 | pincer/middleware/message_delete.py | shivamdurgbuns/Pincer |
"""
BETA test commands
"""
# dependancies
import asyncio
import discord
from discord.ext import commands
# util
from utility.cog.player.player import Player
from utility.cog.combat_system.cpu import CPU
# characters
from utility.cog.character.list import c001_sabimen
from utility.cog.character.list import c002_sabim... | [
{
"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 | cog/command/beta.py | DrLarck/DiscordBallZ_ |
from algorithms.genetic import Genome
from collections import namedtuple
Thing = namedtuple('Thing', ['name', 'value', 'weight'])
first_example = [
Thing('Laptop', 500, 2200),
Thing('Headphones', 150, 160),
Thing('Coffee Mug', 60, 350),
Thing('Notepad', 40, 333),
Thing('Water Bottle', 30, 192),
]
... | [
{
"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 | problems/knapsack.py | hcchengithub/genetic-algorithms |
import cv2
import numpy as np
from copy import deepcopy as dp
aqua=(255,255,0)
marine=(116,139,69)
banana=(87,207,277)
blue=(255,0,0)
almond=(205,235,255)
brown=(64,64,255)
blue1=(255,245,152)
green=(0,100,0)
orange=(0,140,255)
orchid=(139,34,104)
pink=(147,20,255)
gold=(0,215,255)
gray=(127,127,127)
... | [
{
"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 | 56_interactive_watershed.py | amit-bohra/Interactive-Image-Segmentation-with-OpenCV-Watershed-Algorithm-in-Python3 |
from django.db import models
from servers.models import Server
from django.conf import settings
import os
import hashlib
import string
class Share(models.Model):
"""A share"""
server = models.ForeignKey(Server)
name = models.CharField(max_length=255)
path = models.CharField(max_length=255, help_t... | [
{
"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 | samba/models.py | PolyLAN/azimut-gestion |
import logging
import random
from telegram.ext import Updater, CommandHandler, MessageHandler, Filters
import urllib.request
import json
import imdb
import os
BOT_TOKEN = os.environ.get("BOT_TOKEN")
OMDB_API_KEY = '558c75c8'
ia = imdb.IMDb()
logging.basicConfig(format='%(asctime)s - %(name)s - %(levelname)s - %(mess... | [
{
"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 | bot.py | Soebb/IMDb_bot |
from behave import *
from src.Pages.LoginPage import Login
from src.Locators.LoginPage import LoginPage
@when('I click link "Forgot your password"')
def step_impl(context):
context.login_page.click(LoginPage.Login.forgot_link)
@step("input my email in window")
def step_impl(context):
context.login_page.inpu... | [
{
"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 | src/features/steps/forgot_password_steps.py | kirasdad/Hacathon18_09 |
class Enterprise:
def __init__(self, name):
if len(name.strip()) == 0:
raise ValueError("Name must be specified.")
self._name = name
def get_name(self):
return self._name
| [
{
"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 | structurizr/model/enterprise.py | sixty-north/structurizr-python |
from __future__ import absolute_import
from rest_framework.response import Response
from sentry.api.serializers import serialize
from sentry.api.bases import OrganizationEndpoint
from sentry.discover.models import DiscoverSavedQuery
from sentry import features
from sentry.discover.endpoints.bases import DiscoverSaved... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inherita... | 3 | src/sentry/discover/endpoints/discover_saved_queries.py | evanspjz/sentry |
# from twilio.rest import Client
# # Your Account SID from twilio.com/console
# account_sid = "AC4100c72954a1f9949fc4700a8d0594bb"
# # Your Auth Token from twilio.com/console
# auth_token = "e1529115d0f1a57b6b8e6b17644f6087"
# client = Client(account_sid, auth_token)
# message = client.messages \
# .create(
# ... | [
{
"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 | silverstrike/views/twilio1.py | JinHash5/ExpenseIt |
import random
### Advantage Logic ###
def advantage(rollfunc):
roll1 = rollfunc
roll2 = rollfunc
if roll1 > roll2:
return roll1
else:
return roll2
### Disadvantage Logic ###
def disadvantage(rollfunc):
roll1 = rollfunc
roll2 = rollfunc
if roll1 < roll2:
return roll1
... | [
{
"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 | DieRolls.py | bwnelb/dnd5e |
import uuid
from datetime import datetime
from django.db import models
from django.utils import timezone
from .game import Game
from .player import Player
from .util import generate_code
class SupplyCodeManager(models.Manager):
def create_supply_code(self, game: Game, value: 5, code: None) -> 'SupplyCode':
... | [
{
"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 | app/models/supply_code.py | uwhvz/uwhvz |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.11.1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
i... | [
{
"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 | kubernetes/test/test_v1beta1_network_policy_list.py | reymont/python |
import json
import configparser
import re
import logging
from modules.exceptions import SettingsError
log = logging.getLogger(__name__)
def readjson(jfile):
"""... just for reading json file and return data :)"""
with open(jfile) as descriptor:
data = json.load(descriptor)
return data
def read... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docst... | 3 | modules/file_utils.py | Efemache/Mercenaries-Hearthstone-game-bot |
#
# Copyright (c) 2016-2021 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
from django.utils.translation import ugettext_lazy as _
import horizon
from openstack_dashboard.api import base
from openstack_dashboard.dashboards.admin import dashboard
class SoftwareManagement(horizon.Panel):
name ... | [
{
"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 | starlingx-dashboard/starlingx-dashboard/starlingx_dashboard/dashboards/admin/software_management/panel.py | starlingx/gui |
# -*- coding: utf-8 -*-
import unittest
from datetime import date
from rdcache.ext import RedisCache, RedisPool
redis = RedisPool({
"default": {
"host": "127.0.0.1",
"port": 6379,
"password": "",
"db": 0,
},
})
backend = redis.get('default')
cache = RedisCache(backend, touch = ... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"ans... | 3 | tests/test_redis.py | azhai/rdcache |
"""Demonstrates partial run when some input data not there.
"""
from remake import Remake, TaskRule
ex8 = Remake()
class CannotRun(TaskRule):
rule_inputs = {'in1': 'data/inputs/input_not_there.txt'}
rule_outputs = {'out': 'data/inputs/ex8_in1.txt'}
def rule_run(self):
input_text = self.inputs['i... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answ... | 3 | remake/examples/ex8.py | markmuetz/remake |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.