source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
#!python
# -*- coding: utf-8 -*-#
"""
Trim the psf to a given size.
@author: Bhishan Poudel
@date: Feb 19, 2018
@email: bhishanpdl@gmail.com
"""
# Imports
import numpy as np
from astropy.io import fits
import sys
def trim_psf(psf,x,y,r,scale_up):
data = fits.getdata(psf)
data_trim = data[y-r:y+r,x-r:x+r] ... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a ty... | 3 | scripts/a1_trim_PSF.py | bhishanpdl/DMstack_obsfile_example |
from abc import ABC, abstractmethod
from sherlockpipe.star.starinfo import StarInfo
class SearchZone(ABC):
"""
Abstract class to be implemented for calculating minimum and maximum search periods for an input star.
"""
def __init__(self):
pass
@abstractmethod
def calculate_period_rang... | [
{
"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 | sherlockpipe/search_zones/SearchZone.py | LuisCerdenoMota/SHERLOCK |
from management.config import config_api_setup
from management.database import Database
class Price_Policies:
"""price_policies class model."""
def __init__(self):
config, config_file = config_api_setup()
config.read(config_file)
self.db = Database(
connector=config['datab... | [
{
"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 | APIs/management/management/models/price_policies.py | matteyeux/MyBookingServices |
from math import sqrt
from random import randrange
arr1 = [i for i in range(1, 11)]
arr2 = [i for i in range(1, 11)]
arr3 = [randrange(i) for i in range(1, 11)]
arr4 = [randrange(i) for i in range(1, 11)]
def avg(data):
return sum(data) / len(data)
def std(data):
mu = avg(data)
std = (sum([(i - mu)**2 f... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (ex... | 3 | 4.py | Michanix/Math-Stat-Homework |
from datetime import datetime, timedelta
class Pubg(object):
def __init__(self):
self.top_history = []
def _last_top(self, players=None):
if not players:
if self.top_history:
return self.top_history[-1]
else:
return None
... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},... | 3 | musicbot/pubg.py | gueishe/music_bot |
from jinja2 import Environment, FileSystemLoader
from os import path
from yaml import SafeLoader, safe_load
CASES_FILENAME = 'cmdline.yml'
TEMPLATE_FILENAME = 'cmdline_gen.jinja'
TEST_FILENAME = 'test_cmdline_gen.c'
ROOT_DIRPATH = path.dirname(path.dirname(path.join(path.abspath(__file__))))
COMMON_DIRPATH = ... | [
{
"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/cmdline_gen.py | ashusharmasigdev/libkernaux |
"""
This puzzle is based on:
https://en.wikipedia.org/wiki/Chinese_remainder_theorem
Reddit told me after I waited for a long long time burning my computer...
"""
import sys
from typing import Tuple
def find_bus_cadence(bus: int, cadence: int, start_time: int, offset: int) -> Tuple[int, int]:
timestamp = star... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined insid... | 3 | 2020/day_13.py | Javitronxo/AdventOfCode |
from django.contrib.sitemaps import Sitemap
from .models import Post
class PostSiteMap(Sitemap):
"""
Just a reminder:
We're (simply) override
the (static) attrs of the class 'Sitemap' :P
Some attrs & methods:
changefreq possible vals: 'al... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},... | 3 | Chapter_01/blog/sitemaps.py | codingEzio/code_py_book_django2_by_example |
import json
from datetime import datetime, timezone
from faust.exceptions import ValueDecodeError
from faust.types.tuples import Message
import pytest
from assertpy import assert_that
from faust_avro import Record
from faust_avro import context as ctx
class Key(Record):
idx: int
class Person(Record):
name... | [
{
"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 | tests/test_serializers.py | EugenePY/faust-avro |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
class AlipayCommerceAntestCaselistQueryResponse(AlipayResponse):
def __init__(self):
super(AlipayCommerceAntestCaselistQueryResponse, self).__init__()
self._data = None
... | [
{
"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 | alipay/aop/api/response/AlipayCommerceAntestCaselistQueryResponse.py | antopen/alipay-sdk-python-all |
# coding: UTF-8
"""
Definition of class Element
"""
class Element:
@property
def description(self):
"""
:return: Description of the element
:rtype: :obj:`str`
"""
return self._description
def __init__(self, description):
self._description = description
| [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
}... | 3 | yeahp-backend/yeahp/element.py | flaudanum/Yet-another-AHP |
import pickle
def load(filename):
with open(filename, 'rb') as f:
return pickle.load(f)
def dump(obj, filename):
with open(filename, 'wb') as f:
return pickle.dump(obj, f) | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docs... | 3 | joblib.py | drop-table-users/wr |
import subprocess
import sys
from distutils.version import LooseVersion
from re import fullmatch
def get_shell_version():
try:
for line in (
subprocess.check_output(["gnome-shell", "--version"]).decode().splitlines()
):
m = fullmatch(r"GNOME Shell (?P<version>[0-9.]+)", lin... | [
{
"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 | src/gnome_extensions_cli/utils.py | essembeh/gnome-extensions-cli |
import DBinterface as DB
import random
import datetime as dt
def print_ranking(my_ranking,ranking_size,top_or_bottom):
Tweet=""
if top_or_bottom == True:
Tweet += ("The first " + ranking_size + " cities with more CO2 emissions due to traffic are: \r\n ")
else:
Tweet += ("The first " ... | [
{
"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 | bots/functions.py | alexvilla00/NASA-BOT |
"""Add filled_contributor_form to user
Revision ID: 723394ace6b5
Revises: 27a2782784d0
Create Date: 2021-04-11 11:48:11.170484
"""
import geoalchemy2
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = "723394ace6b5"
down_revision = "27a2782784d0"
branch_labels = None
d... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answe... | 3 | app/backend/src/couchers/migrations/versions/723394ace6b5_add_filled_contributor_form_to_user.py | thdk/couchers |
#!/usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2010
"cuda"
import os
from waflib import Task
from waflib.TaskGen import extension
from waflib.Tools import ccroot, c_preproc
from waflib.Configure import conf
class cuda(Task.Task):
run_str = '${NVCC} ${CUDAFLAGS} ${CXXFLAGS} ${FRAMEWORKPATH_ST:FRAMEWORKPATH} ... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
}... | 3 | Firmware/ardupilot/modules/waf/playground/cuda/cuda.py | eanswer/LearningToFly |
"""
wxPython についてのサンプルです
wx.App の サブクラス化 について
"""
import wx
from trypython.common.commoncls import SampleBase
# noinspection PyPep8Naming
class MyApp(wx.App):
def __init__(self, redirect=False, filename=None, use_best_visual=False, clear_sig_int=True):
super().__init__(redirect, filename, use_best_visu... | [
{
"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 | trypython/extlib/gui/wx02.py | devlights/try-python-extlib |
"""
space : O(n)
time : O(n)
"""
class RecentCounter:
def __init__(self):
self.history = []
def ping(self, t: int) -> int:
self.history.append(t)
s = t - 3000
while self.history[0] < s:
self.history.pop(0)
return len(self.history)
| [
{
"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 | python3/recent_counter.py | joshiaj7/CodingChallenges |
from quarkchain.utils import sha3_256
from quarkchain.evm import utils
"""
Blooms are the 3-point, 2048-bit (11-bits/point) Bloom filter of each
component (except data) of each log entry of each transaction.
We set the bits of a 2048-bit value whose indices are given by
the low order 11-bits
of the first three double... | [
{
"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 | quarkchain/evm/bloom.py | anshulkusa/pyquarkchain |
class ExploitFrame(object):
"""Exploit object"""
def __init__(self, serviceInfo):
self.serviceInfo = serviceInfo
def exploit(self):
raise NotImplementedError()
def exploitSuccess(self):
raise NotImplementedError()
| [
{
"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 | Akeso/Exploits/ExploitFrame.py | tamuctf/Akeso |
#! python3
# value_propagation_test.py - Test the VALUE Propagation behavior
from behave import *
from hamcrest import *
import numpy
@when('get VALUE from parent after UTIL propagation')
def step_impl(context):
set_up(context)
context.dpop_to_test.util_manager.JOIN = context.util_matrix
@then('should sel... | [
{
"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/features/steps/value_propagation_test.py | muglyon/https-github.com-muglyon-DCOP-Decentralised-Control-of-Intelligent-Devices |
from abc import abstractmethod, ABCMeta
from rummy.player.player import Player
from rummy.ui.view import View
class PlayerController(metaclass=ABCMeta):
@staticmethod
@abstractmethod
def show_start_turn(player: Player):
pass
@staticmethod
@abstractmethod
def show_end_turn(player: Pl... | [
{
"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 | rummy/controller/player_controller.py | sarcoma/Python-Rummy |
#! /usr/bin/env python
"""Test script for the binhex C module
Uses the mechanism of the python binhex module
Based on an original test by Roger E. Masse.
"""
import binhex
import os
import unittest
from test import test_support
class BinHexTestCase(unittest.TestCase):
def setUp(self):
... | [
{
"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 | AppPkg/Applications/Python/Python-2.7.2/Lib/test/test_binhex.py | CEOALT1/RefindPlusUDK |
# Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
# Copyright (C) 2008-2020 German Aerospace Center (DLR) and others.
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License 2.0 which is available at
# https://www.eclipse.org/legal/epl-2.... | [
{
"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 | Co-Simulation/Sumo/sumo-1.7.0/tools/sumolib/files/selection.py | uruzahe/carla |
from abc import abstractmethod
from typing import Any, Optional
from mlagents_envs.base_env import BaseEnv
class BaseRegistryEntry:
def __init__(
self,
identifier: str,
expected_reward: Optional[float],
description: Optional[str],
):
"""
BaseRegistryEntry allows... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/c... | 3 | ml-agents-envs/mlagents_envs/registry/base_registry_entry.py | bobcy2015/ml-agents |
from measurements import Measurement
from pygame.time import get_ticks
from timers import Timer
from units.time import Second
from units.prefixes.small import Milli
class PyGameTimer(Timer):
def __init__(self):
Timer.__init__(self)
def time(self):
measurement = Measurement(1, Second()).convertTo(Milli(... | [
{
"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 | timers/pygame.py | misspellted/enlightened |
# Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the 'License'). You
# may not use this file except in compliance with the License. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the 'license' file acc... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer"... | 3 | test/unit/test_default_inference_handler.py | ericangelokim/sagemaker-inference-toolkit |
from data_collection.management.commands import BaseShpStationsShpDistrictsImporter
class Command(BaseShpStationsShpDistrictsImporter):
council_id = 'E07000098'
srid = 27700
districts_srid = 27700
districts_name = 'PollingDistricts'
stations_name = 'PollingStations.shp'
elections = [
'l... | [
{
"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 | polling_stations/apps/data_collection/management/commands/import_hertsmere.py | chris48s/UK-Polling-Stations |
__author__ = "Rick Sherman"
__credits__ = "Jeremy Schulman"
import unittest
from nose.plugins.attrib import attr
from jnpr.junos.factory.factory_cls import FactoryCfgTable, FactoryOpTable
from jnpr.junos.factory.factory_cls import FactoryTable, FactoryView
@attr('unit')
class TestFactoryCls(unittest.TestCase):
... | [
{
"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 | py-junos-eznc/tests/unit/factory/test_factory_cls.py | fostasha/pynet_test |
import unittest
from day3 import *
class TestDay3Part1(unittest.TestCase):
def test_solve_part_1(self):
self.assertEqual(solve_part_1(), 862)
def test_solve_part_2(self):
self.assertEqual(solve_part_2(), 1577)
| [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answ... | 3 | day3/test_day3.py | chrisb87/advent_of_code_2016 |
import uvicorn
class Server(uvicorn.Server):
async def startup(self, sockets=None):
await super().startup(sockets=sockets)
for f in self.config.loaded_app.startup_funcs:
await f()
async def shutdown(self, sockets=None):
await super().shutdown(sockets=sockets)
for f... | [
{
"point_num": 1,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer... | 3 | tino/server.py | NotSoSmartDev/Tino |
import time, calendar
from datetime import datetime
#
# Decodes UNIX timestamp (UTC secs since epoch) to python datetime and vice versa.
#
class Time(datetime):
def __new__(cls, *x):
return datetime.__new__(cls, *x)
@staticmethod
def decode(json):
assert isinstance(json, int)
retur... | [
{
"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 | raritan/rpc/Time.py | daxm/raritan-pdu-json-rpc |
#!/usr/bin/python
###############################################################################
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. #
# #
# Licensed under the Apache License Version 2.0 (the "License"). Y... | [
{
"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 | source/playbooks/PCI321/ssmdocs/scripts/test/test_pci_get_input_values.py | sybeck2k/aws-security-hub-automated-response-and-remediation |
# -*- coding: utf-8 -*-
'''
# Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information.
#
# This file was generated and any changes will be overwritten.
'''
from __future__ import unicode_literals
from ..one_drive_object_bas... | [
{
"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 | src/onedrivesdk/model/thumbnail.py | meson800/onedrive-sdk-python |
from datetime import date, datetime
import simplejson as json
import numpy as np
class NumpyJSONEncoder(json.JSONEncoder):
"""class to encode the data"""
def default(self, obj):
if isinstance(obj, np.integer):
return int(obj)
elif isinstance(obj, np.floating):
return fl... | [
{
"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 | preprocess/raven_preprocess/np_json_encoder.py | TwoRavens/raven-metadata-service |
import abc
class AbstractClassifier:
""" Abstract class with specific methods for classifier models (training, validation and test) """
def __init__(self):
pass
@abc.abstractmethod
def train(self, config, train_data):
"""
Classifier training.
:param config: Model con... | [
{
"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 | semantic_aware_models/models/classification/abstract_classifier.py | ITAINNOVA/SAME |
class Teammy:
def __init__(self):
self.name = 'T3ammy'
self.lastname = 'Sit_Uncle_Engineer'
self.nickname = 'teammy'
def WhoIAM(self):
'''
นี่คือฟังชั่่นที่ใช้ในการแสดงชื่อของคราสนี้
'''
print('My name is: {}'.format(self.name))
prin... | [
{
"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 | teammy/t3ammy.py | t3ammy/teammy |
from flask import Flask, render_template, request, redirect
import youtube_dl
app = Flask(__name__)
@app.route('/')
def home():
return render_template('index.html')
@app.route('/about')
def about():
return render_template('about.html')
@app.route('/download', methods=["POST", "GET"])
def download():
url = request... | [
{
"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 | app.py | Bajojajo-xD/VIdeo-Downloader |
class Room:
def __init__(self, user, name, password):
self.user = user
self.name = name
self.password = password
self.code = self._create_code()
def _create_code(self):
return self.name
def att_admin(self, admin_ip, admin_port):
self.admin_ip = admin_ip
... | [
{
"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 | server/logic/menu/room.py | joaorura/HangmanGameOnline-HGC |
try:
from PyQt4 import QtGui, QtCore
except ImportError:
from PyQt5 import QtGui, QtCore # untested
class CalendarWidget(QtGui.QWidget):
"""Creates a calendar widget allowing the user to select a date."""
def __init__(self, title="Calendar"):
super(CalendarWidget, self).__init__()
se... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
}... | 3 | easygui_qt/calendar_widget.py | KGerring/easygui_qt_crypto |
import pandas as pd
import os
import io
import yaml
from typing import NamedTuple
def save_csv(df: pd.DataFrame, ticker: str, path: str):
file_path = os.path.join(path, ticker + '.csv').replace('\\', '/')
df.to_csv(file_path, index=False)
def write_yaml(data, file_path, encoding='uft8'):
with io.open(fi... | [
{
"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 | UTIL/FileIO.py | maxwells8/Heptet |
def test_get_empty_collection(client):
empty_response = client.get('/data')
assert empty_response.status_code == 200
assert 'json' in empty_response.content_type
assert empty_response.is_json
assert empty_response.json['href'].startswith('http')
assert empty_response.json['href'].endswith('/data... | [
{
"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 | tests/test_data.py | tsnee/restful-analytics |
"""Add price
Revision ID: 57642bbc5015
Revises: 6b66b7cc2f1f
Create Date: 2021-11-18 17:58:58.263480
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '57642bbc5015'
down_revision = '6b66b7cc2f1f'
branch_labels = None
depends_on = None
def upgrade():
# ### ... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answe... | 3 | CPSC362_Project1/migrations/versions/57642bbc5015_add_price.py | KonechyJ/CPSC-362_Project1 |
import torch.nn as nn
class Generator(nn.Module):
def __init__(self, img_size=32):
super(Generator, self).__init__()
# TODO: update to proper image size
self.init_size = img_size // 4
self.l1 = nn.Sequential(nn.Linear(10, 128 * self.init_size ** 2))
self.conv_blocks = nn.... | [
{
"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 | fltk/nets/fashion_mnist_ls_gan.py | nata1y/fltk-testbed-group-3 |
# -*- coding: utf-8 -*-
# Copyright (c) 2016 Bolke de Bruin
#
# 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 la... | [
{
"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 | venv/lib/python3.5/site-packages/airflow/minihivecluster.py | mesodiar/bello-airflow |
from django.shortcuts import render
from .forms import UsernameForm
from .scraper import Scrape
def query(request):
return render(request, 'templates/query.html')
def result(request):
# if this is a POST request we need to process the form data
if request.method == 'POST':
# create a form insta... | [
{
"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 | courses/views.py | balwanishivam/CodeacademyCourses |
import numpy as np
from deep_learning_101.component.utils import softmax, cross_entropy_error
class ReLU:
def __init__(self):
self.mask = None
def forward(self, x):
self.mask = (x <= 0)
out = x.copy()
out[self.mask] = 0
return out
def backward(self, dout):
... | [
{
"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 | deep_learning_101/component/layer.py | daidaifan/deep-learning-101 |
"""Add 'updated' to packages
Revision ID: 2ca4511880b
Revises: 1fc38fa913a
Create Date: 2014-10-11 13:29:07.675201
"""
# revision identifiers, used by Alembic.
revision = '2ca4511880b'
down_revision = '1fc38fa913a'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Al... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 lines?",
"answer": false
}... | 3 | alembic/versions/2ca4511880b_add_updated_to_packages.py | KnightOS/packages.knightos.org |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.9.3
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
im... | [
{
"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 | kubernetes/test/test_v1_secret_env_source.py | kevingessner/python |
import logging
from datetime import datetime
from pathlib import Path
import inflection
from lib.audio.mp3_recorder import MP3Recorder
from lib.entities import Source
from lib.environment import Environment
from lib.library.file_store import FileStore
from lib.pipeline.ffmpeg_file_processor import FFMpegFileProcessor... | [
{
"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": "all_function_names_snake_case",
"question": "Are all function names in this file written i... | 3 | lib/scheduler/recording_job.py | overholts/tuner |
# -*- coding: utf-8 -*-
from __future__ import annotations
import requests
from validators.url import URL
from abc import ABC, abstractmethod
from requests.adapters import HTTPAdapter
from typing import Text, NoReturn, Callable, Dict
from requests.packages.urllib3.util.retry import Retry
class RequestResponse:
de... | [
{
"point_num": 1,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"an... | 3 | code/clients/requests.py | lpmatos/gitlab-analytics |
import unittest
from hypothesis import given, settings
from hypothesis.strategies import text
from sys import getsizeof
from compressStr import compress_string, decompress_string
class TestMyGzip(unittest.TestCase):
"""
Unit tests for the my_gzip module.
"""
@given(string=text())
@settings(max_ex... | [
{
"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 | tests/test_compress_string_in_memory.py | chrisbrake/PythonSandbox |
import bpy
import mathutils
from .qobject import *
class QSphere(Qobject):
basetype = 4
isSmooth = True
isCentered = True
def copyData(self, _op):
newQ = QSphere(_op)
return newQ
def UpdateMesh(self):
bmeshNew = bmesh.new()
transformS = GetTransf... | [
{
"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 | scripts/addons/QBlocker/qsphere.py | Tilapiatsu/blender-custom_conf |
"""<internal>"""
'''
zlib License
(C) 2020-2021 DeltaRazero
All rights reserved.
'''
# ***************************************************************************************
class _:
'<imports>'
import abc
from . import textio
from .misc import ptr_t
# *******************************************... | [
{
"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": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer"... | 3 | lex2/_intf_matcher.py | DeltaRazero/liblex2-py3 |
import hjson
def read_config(filename: str) -> dict:
with open(filename, 'r') as f:
ret = f.read()
return hjson.loads(ret)
def read_labels(filename: str) -> list:
with open(filename) as f:
lines = f.read().splitlines()
return lines
| [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answe... | 3 | cougar/common/loads.py | Swall0w/cougar |
from datetime import datetime
from typing import List, Dict, Optional
from pydantic import BaseModel, validator, root_validator
class ItemModel(BaseModel):
cve: Dict
configurations: Optional[Dict]
impact: Optional[Dict]
publishedDate: datetime
lastModifiedDate: datetime
class ResultModel(BaseMod... | [
{
"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 | solids/nvd/utils/schema.py | d3vzer0/vulnerabilities-pipeline |
import math
import torch
class TorchModel(torch.nn.Module):
def __init__(self):
super().__init__()
INPUT_CHANNELS: int = 4
CONV_NUM_FILTERS: int = 10
CONV_FILTER_WIDTH: int = 11
FC_NUM_UNITS: int = 100
OUTPUT_UNITS: int = 100
self.conv = torch.nn.Sequentia... | [
{
"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 | docsrc/defs/md/PyTorch/o100-dna1000-conv100-gmp-fc100.py | gifford-lab/seqgra |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | [
{
"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 | sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2019_06_01/models/_policy_client_enums.py | vbarbaresi/azure-sdk-for-python |
import functools
from .events import FunctionEvent
from .formatters import BaseFormatter, DefaultFormatter
def docstringer(
_func=None, *, active=True, formatter: BaseFormatter = DefaultFormatter()
):
"""
A decorator that will output the function docstring, call values and return value when the function... | [
{
"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 | docstringer/decorators.py | ttamg/docstringer |
def metade(valor=0, formato=False):
res = valor/2
return res if formato is False else moeda(res)
def dobro(valor=0, formato=False):
res = valor*2
return res if formato is False else moeda(res)
def aumentar(valor=0, porcentagem=0, formato=False):
res = valor+(valor * porcentagem/100)
return r... | [
{
"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 | 14_Modulos_e_pacotes/ex110/moeda.py | TheCarvalho/Curso-Em-Video-Python |
import util
def run_hostname(stack, value, value2):
name = util.rioRun(stack, value, value2, 'nginx')
return name
def rio_chk(stack, sname):
fullName = (f"{stack}/{sname}")
inspect = util.rioInspect(fullName)
return inspect['hostname']
def kube_chk(stack, service):
fullName = "%s/%s" % ... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fe... | 3 | tests/run/test_hostname.py | vincent99/rio |
import IPet
class Ant(IPet):
def __init__(self):
self.stats = {"hlth": 2, "dmg": 1}
# operator is going to contain the shop, team and board.
def modify_stats(self, dmg_ant, hlth_amnt, is_perm):
if is_perm:
self.stats["dmg"] += dmg_ant
self.stats["hlth"] += hlth_am... | [
{
"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 | Pets/Pets/Ant.py | SAPPhilosopher/Base-Game |
def pixel(num):
def f(s):
return s + '\033[{}m \033[0m'.format(num)
return f
def new_line(s):
return s + u"\n"
def build(*steps, string=""):
for step in steps:
string = step(string)
return string
def main():
cyan = pixel(46)
space = pixel('08')
heart = [new_line,
... | [
{
"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 | heart.py | xxninjabunnyxx/pixel_pop_heart_challenge |
## Copyright 2019 The Rules Protobuf Authors. All rights reserved.
##
## Licensed under the Apache License, Version 2.0 (the "License");
## you may not use this file except in compliance with the License.
## You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless require... | [
{
"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 | proto/workspace.bzl | Yannic/rules_proto |
import os
import re
import codecs
from setuptools import setup, find_packages
current_path = os.path.abspath(os.path.dirname(__file__))
def read_file(*parts):
with codecs.open(os.path.join(current_path, *parts), 'r', 'utf8') as reader:
return reader.read()
def get_requirements(*parts):
with codecs.... | [
{
"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 | setup.py | CyberZHG/torch-same-pad |
class Position:
def __init__(self, index, line, column, filename, input):
self.index = index
self.line = line
self.column = column
self.filename = filename
self.input = input
def step(self, current_char = None):
self.index += 1
self.column += 1
if... | [
{
"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 | Lexer_Position.py | Peetee06/compilerbau_ws2122_hsbochum |
#!/usr/bin/env python
"""
Read a maf file and print the regions covered to a set of bed files (one for
each sequence source referenced in the maf). Only blocks with a positive
percent identity are written out.
TODO: Can this be generalized to be made more useful?
usage: %prog bed_outfile_prefix < maf
"""
from __f... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": fal... | 3 | scripts/maf_covered_regions.py | tweirick/bx-python |
from __future__ import unicode_literals
from django.apps import apps
from django.core.management import CommandError
from django.core.management.color import no_style
from django.core.management.sql import (
sql_all, sql_create, sql_delete, sql_destroy_indexes, sql_indexes,
)
from django.db import DEFAULT_DB_ALIAS... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},... | 3 | tests/commands_sql_migrations/tests.py | gauravbose/digital-menu |
#!/usr/bin/env python3
import urwid
class OverlayEvent(urwid.WidgetWrap):
def __init__(
self,
first_widget,
second_widget,
width = 15,
height = 10,
vertical_align = "middle",
horizontal_align = "center"
):
# Create widget overlay
overlay = ur... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},... | 3 | termapp/overlay_event.py | faintcoder/termapp |
"""
A small Test application to show how to use Flask-MQTT.
"""
import eventlet
import json
from flask import Flask, render_template
from flask_mqtt import Mqtt
from flask_socketio import SocketIO
from flask_bootstrap import Bootstrap
eventlet.monkey_patch()
app = Flask(__name__)
app.config['SECRET'] = 'my secret ... | [
{
"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 | mqtt-servers/server2.py | pranaypareek/cc |
def reverseLists(list1) :
"""
原地用递归的方法反转list
:param list1:
:return:
"""
def helper(list1,left,right) :
if left < right :
list1[left] , list1[right] = list1[right] , list1[left]
helper(list1,left + 1 , right -1)
helper(list1,0,len(list1) - 1)
if __name__ == "... | [
{
"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 | data_structure/recursion/example/example2.py | russellgao/algorithm |
import numpy,csv
def csv(infile,delimiter=','):
'''reads csv with arbitrary delimiter, returns numpy array of strings'''
with open(infile) as f:
rv = [ l.strip().split(delimiter) for l in f
if l.strip() # no empty lines
and not l.startswith('#'... | [
{
"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 | inputfilter/csv.py | ari-s/XpyY |
import unittest
import nzmath.sequence as sequence
class SequenceTest(unittest.TestCase):
def testGeneratorFibonacci(self):
gf = sequence.generator_fibonacci(40)
fibo_40 = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610,
987, 1597, 2584, 4181, 6765, 10946, 17711, 28657,... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"an... | 3 | test/testSequence.py | turkeydonkey/nzmath3 |
# -*- coding: utf-8 -*-
from benedict.core.traverse import traverse
from benedict.utils import type_util
def _get_term(value, case_sensitive):
v_is_str = type_util.is_string(value)
v = value.lower() if (v_is_str and not case_sensitive) else value
return (v, v_is_str)
def _get_match(query, value, exact,... | [
{
"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 | benedict/core/search.py | fabiocaccamo/python-benedict |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
"""
Date: 2021/12/20 14:52
Desc: 南华期货-商品指数历史走势-价格指数-数值
http://www.nanhua.net/nhzc/varietytrend.html
1000 点开始, 用收益率累计
http://www.nanhua.net/ianalysis/varietyindex/price/A.json?t=1574932974280
"""
import time
import requests
import pandas as pd
def futures_nh_index_symbol_t... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"an... | 3 | akshare/futures_derivative/nh_index_price.py | J-Z-Z/akshare |
"""Test the Hardkernel config flow."""
from unittest.mock import patch
from homeassistant.components.hardkernel.const import DOMAIN
from homeassistant.core import HomeAssistant
from homeassistant.data_entry_flow import RESULT_TYPE_ABORT, RESULT_TYPE_CREATE_ENTRY
from tests.common import MockConfigEntry, MockModule, m... | [
{
"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": tru... | 3 | tests/components/hardkernel/test_config_flow.py | liangleslie/core |
import os
import pickle
from .Utils import purify, staticPath
def cacheIn(dir, name, data):
"""
Store given `data` under ./cache/dir/name.pickle file.
Note that `dir` and `name` are "purified" before used!
-dir: string of sub-directory to be created. Cache-file will be stored in it.
It should... | [
{
"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 | Scrap11888/lib/DataManagement/Cacher.py | GeorgeVasiliadis/Scrap11888 |
from __future__ import print_function
from __future__ import division
import math
import torch
import torch.nn as nn
from torch.nn import Parameter
from torchkit.head.localfc.common import calc_logits
class CosFace(nn.Module):
""" Implement of CosFace (https://arxiv.org/abs/1801.09414)
"""
def __init__(s... | [
{
"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 | torchkit/head/localfc/cosface.py | sarvex/TFace |
from typing import Tuple
import numpy as np
import pandas as pd
def split_train_test(X: pd.DataFrame, y: pd.Series, train_proportion: float = .75) \
-> Tuple[pd.DataFrame, pd.Series, pd.DataFrame, pd.Series]:
"""
Randomly split given sample to a training- and testing sample
Parameters
-------... | [
{
"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 | IMLearn/utils/utils.py | zoharmilul/IML.HUJI |
import os
script_path = "C:/Users/Eudes/Documents/scriptTce"
def percorrePastaRetornaListaSQL(caminho):
if not os.path.exists(script_path):
return "Este caminho não Existe."
else:
for diretorio,pasta,listaArquivo in os.walk(caminho):
return [caminho + "/" + x for x in listaArquivo... | [
{
"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 | ConversaoInsertMySQL.py | tie-dados-abertos/tcepe |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Tests for the temporary directory CLI arguments helper."""
from __future__ import unicode_literals
import argparse
import unittest
from plaso.cli import tools
from plaso.cli.helpers import temporary_directory
from plaso.lib import errors
from tests.cli import test_l... | [
{
"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": true... | 3 | tests/cli/helpers/temporary_directory.py | nflexfo/plaso |
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
"""
@__Create Time__ = 2017/12/11 14:38
@__Description__ = " "
"""
from django.views.generic import ListView, DetailView, TemplateView
from ... import models
# 前端首页
class IndexView(ListView):
queryset = models.Article.objects.filter(status=True)
template_name = ... | [
{
"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 | website/views/fg/view.py | luxutao/django-blog |
from . import BaseResult
class RecordResult(BaseResult):
@property
def url(self):
return self.component.url
@property
def duration(self):
return self.component.duration
@property
def size(self):
return self.component.size
| [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},... | 3 | signalwire/relay/calling/results/record_result.py | ramarketing/signalwire-python |
from typing import Callable, Optional
from cannabis.introducer.introducer import Introducer
from cannabis.protocols.introducer_protocol import RequestPeersIntroducer, RespondPeersIntroducer
from cannabis.protocols.protocol_message_types import ProtocolMessageTypes
from cannabis.server.outbound_message import Message, ... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 lines?",
"answer": false... | 3 | cannabis/introducer/introducer_api.py | CannabisChain/cannabis-blockchain |
from flask import request
from lin.exception import ParameterException
from lin.forms import Form
from wtforms import Form as WTForm, IntegerField
from wtforms.validators import DataRequired, NumberRange, AnyOf
class OneProductOfOrder(WTForm):
product_id = IntegerField(validators=[DataRequired(message='商品ID不能为空')... | [
{
"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": false
}... | 3 | app/validators/v1/order_forms.py | zcxyun/snack-api-lin |
import logging
import time
import gym
from aivle_gym.agent_env import AgentEnv
from judge import CartPoleEnvSerializer
class CartPoleAgentEnv(AgentEnv):
def __init__(self, port):
base_env = gym.make("CartPole-v0")
super().__init__(
CartPoleEnvSerializer(),
base_env.action... | [
{
"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 | example/agent.py | edu-ai/aivle-gym |
from __future__ import annotations
import typing
if typing.TYPE_CHECKING:
from typing import Optional, Union, Any, Dict
from pypbbot.driver import AffairDriver
from pypbbot.typing import Event
from pypbbot.utils import Clips
from pypbbot.protocol import GroupMessageEvent, PrivateMessageEvent
from ... | [
{
"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 | pypbbot/affairs/builtin.py | PHIKN1GHT/pypbbot_archived |
from flask import Blueprint, render_template, session, redirect
from app.models import Post
from app.db import get_db
bp = Blueprint('home', __name__, url_prefix='/')
@bp.route('/')
def index():
# gets all the posts
db = get_db()
posts = db.query(Post).order_by(Post.created_at.desc()).all()
return render_tem... | [
{
"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 | app/routes/home.py | zachary-berdell-elliott/py-newsfeed |
import re
import paramiko
class Handler:
'''
A slash command for checking ssh connectivity and rebooting machines.
'''
id = 2
def __init__(self, regexp):
'''
Takes a regexp as an argument, the regexp will then be used to check if the format of the hostname is correct
'''
... | [
{
"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 | app/modules/ssh.py | danielpodwysocki/zoltan |
import rospy
import cv2
from .monitor import Monitor
class PerspectiveMonitor(Monitor):
"""
"""
def __init__(self, internal_simulator, rendering_ratio=(1/10.0)):
"""
"""
super(PerspectiveMonitor, self).__init__(internal_simulator=internal_simulator)
self.rendering_ratio = 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": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answ... | 3 | src/pyuwds3/reasoning/monitoring/perspective_monitor.py | LAAS-HRI/uwds3 |
import json
import os
from mako.template import Template
from models.pomodoro_model import PomodoroModel
from datetime import datetime
class ExportPomsResource:
def on_get(self, req, resp):
"""Handles GET requests"""
resp.content_type = 'text/html'
dir_path = os.path.dirname(os.path.real... | [
{
"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 | pom_tracker/views/export_poms.py | YorBoyBlue/PomTracker |
import random, string, json
global ratelimit
ratelimit = {}
Authorizated = json.load(open("Sources/Json/Authorizated.json", "r"))
def newUrlID(): return "".join(random.choice(string.ascii_lowercase) for i in range(8))
def ratelimitCheck(dbToken):
for auth in Authorizated:
ratelimit[auth] = -1
if not dbToken[... | [
{
"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 | Sources/Python/utility.py | ParliamoDiPC/fasmga |
# Test some subscription scenarios
from typing import List, Tuple, Dict, Union
from numbers import Number
import pytest
from numpy import ndarray
from qcodes.dataset.param_spec import ParamSpec
# pylint: disable=unused-import
from qcodes.tests.dataset.temporary_databases import (empty_temp_db,
... | [
{
"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 | qcodes/tests/dataset/test_subscribing.py | cgranade/Qcodes |
import sqlite3
from os import listdir
import pandas as pd
from transfer_data import pick_path
def database_pipeline(path):
connection = sqlite3.connect("./baseData/allPlayerStats.db")
cursor = connection.cursor()
# See this for various ways to import CSV into sqlite using Python. Pandas used here beca... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 lines?",
"answer": true
... | 3 | scripts/daily_database_update.py | rogersheu/AllLeague-NBA-Predictions |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
class Number:
def __init__(self, start):
self.data = start
def __sub__(self, other):
return Number(self.data - other)
def __neg__(self):
return Number(- self.data)
def __str__(self):
return '[Number: {0}]'.format(self.dat... | [
{
"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 | usefull_scripts/class_operator.py | Furzoom/learnpython |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
OpenAPI spec version: release-1.16
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import unittest
import... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer":... | 3 | kubernetes/test/test_discovery_v1alpha1_api.py | L3T/python |
from classes.fixed_scheduler import FixedScheduler
from classes.concretes.sql_mixin import SqlMixin
from sqlalchemy import Column, create_engine, Table
from sqlalchemy.types import Float
from sqlalchemy.orm import registry, Session
import attr
registry = registry()
@registry.mapped
@attr.s(auto_attribs=True)
class M... | [
{
"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 | fancytimers/tests/sanity.py | LiteralGenie/FancyTimers |
from __future__ import print_function
from IPython.core.magic import (Magics, magics_class, line_magic,
cell_magic, line_cell_magic)
from xvfbwrapper import Xvfb
@magics_class
class XvfbMagics(Magics):
def __init__(self, shell, **xvfb_kwargs):
"""
Initialize the Xv... | [
{
"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 | xvfbmagic.py | arokem/xvfbmagic |
def remove_punctuation(st, case='l'):
""" takes in a string and returns a list of words with no punctuation"""
punctuation = '!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}“”‘’~'
all_words = st.split()
cap_words = []
for c in punctuation:
st = st.replace(c, '')
if case == 'u':
for word in all... | [
{
"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 | Lesson09/x.py | PacktPublishing/Python-Fundamentals |
from flask import Flask
from flask_restful import Api
from flask_sqlalchemy import SQLAlchemy
from flask_jwt_extended import JWTManager
app = Flask(__name__)
api = Api(app)
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///app.db'
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
app.config['SECRET_KEY'] = 'some-... | [
{
"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 | run.py | mitunya/flask-jwt-auth |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.