source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
"""empty message
Revision ID: 389d93b40de8
Revises: 02f39724427a
Create Date: 2017-08-25 09:08:04.637729
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '389d93b40de8'
down_revision = '02f39724427a'
branch_labels = None
depends_on = None
def upgrade():
# ... | [
{
"point_num": 1,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answe... | 3 | migrations/versions/389d93b40de8_.py | sathyanmurugan/songspotting |
'''
Problem 36
31 January 2003
The decimal number, 585 = 1001001001 (binary), is palindromic in both bases.
Find the sum of all numbers, less than one million, which are palindromic in base 10 and base 2.
(Please note that the palindromic number, in either base, may not include leading zeros.)
-------------... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer":... | 3 | python/src/problem036.py | arturh85/projecteuler |
from Deck import Deck
class Player:
def getFirstName(self):
return self.__first_name
first_name = property(getFirstName)
def getLastName(self):
return self.__last_name
last_name = property(getLastName)
def getVictories(self):
return self.__victories
def setVictorie... | [
{
"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 | war/Player.py | Nayed/war |
from .currency_class import CurrencyClass
class EURClass(CurrencyClass):
def __init__(self, balance):
self.currency = super().eur_currency
self.balance = balance
def converter(self):
return round(self.balance * self.currency, 2)
def info(self):
return (
"[EUR]... | [
{
"point_num": 1,
"id": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 lines?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": ... | 3 | Course I/Алгоритмы Python/Part2/семинары/pract2/задание/modules/task19/eur_class.py | GeorgiyDemo/FA |
# from model.base.fcn import CustomFcn
# from model.best.fcn import DeepLabv3Fcn
# from model.better.fcn import Resnet101Fcn
# from model.sota.fcn import LightFcn
from model.alexnet.alexnet_model import AlexNet
from model.lenet5.lenet_5_model import LeNet5
from model.vggnet.vggnet16 import VGG16
from model.densenet.den... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"... | 3 | pytorch_basic_template/model/model_entry.py | ldylab/deep_learning_with_pytorch |
# This Python file uses the following encoding: utf-8
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from builtins import bytes
from builtins import object
from beemgraphenebase.py23 import py23_bytes, bytes_types
from... | [
{
"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 | engine/config_storage.py | hive-engine/distribution-engine-smt |
"""
I use Nox here to reformat the code.
"""
import nox
files = ["noxfile.py", "main.py", "setup.py"]
@nox.session(name="keep-codebase-clean")
def keep_codebase_clean(session):
"Run formatters."
session.install("-r", "test-requirements.txt")
session.run("isort", *files)
session.run("blac... | [
{
"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 | noxfile.py | HarshNarayanJha/diddi-and-the-bugs |
# 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_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 | kubernetes/test/test_v1_service_account_token_projection.py | reymont/python |
from __future__ import absolute_import
import six
from django.db import models
from django.utils import timezone
from sentry.db.models import Model
from django.utils.functional import cached_property
import semaphore
class Relay(Model):
__core__ = True
relay_id = models.CharField(max_length=64, unique=Tru... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
... | 3 | src/sentry/models/relay.py | learninto/sentry |
# -*- coding: utf-8 -*-
u"""ファイル操作関連"""
from __future__ import absolute_import, division, print_function
from squid.vendor.Qt import QtGui
import os
_SIZE_SUFFIXES = ["B", "KB", "MB", "GB", "TB", "PB"]
_FILE_PROTOCOL = "file:///"
def convert_readable_file_size(nbytes):
u"""HumanReadableなファイルサイズを返す
Args:
... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer":... | 3 | libs/files.py | tm8r/MayaSquidCore |
from __future__ import absolute_import
import pytest
import logging
import mock
from sentry.logging.handlers import StructLogHandler
@pytest.fixture
def handler():
return StructLogHandler()
@pytest.fixture
def logger():
return mock.MagicMock()
def make_logrecord(**extra):
kwargs = dict(
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": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answ... | 3 | tests/sentry/logging/test_handler.py | learninto/sentry |
# This file is part of Neotest
# See http://www.neotest.io for more information
# This program is published under the MIT license
from .wrapper import LogClientBase, LoggerThread, logging
__all__ = ["start", "stop", "getLogger", "getQueue", "LogClientBase"]
__logth_instance = None
def start(level=logging.PRINT):
... | [
{
"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 | neotest/logging/__init__.py | neotest-io/neotest |
def main():
codes_file = open('A3 Codes.txt', 'r')
validateCode(codes_file)
codes_file.close()
def validateCode(codes_file):
valid_codes = []
invalid_codes = []
invalid_restricted_codes = []
code = codes_file.readline().rstrip()
while code != '':
if len(code) >= 1... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"ans... | 3 | Library.py | Dkaban/Python-Validate-Codes |
from collections import OrderedDict
from .attributetable import AttributeTable
from .method import Method
from .constantpool import ConstantType
__all__ = ['MethodTable']
class MethodTable(OrderedDict):
def __init__(self, parent):
OrderedDict.__init__(self)
self._parent = parent
self.re... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"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 | pjp/methodtable.py | fesh0r/pjp |
import os
import re
import cv2
import random
import numpy as np
import matplotlib.pyplot as plt
def read_pgm(filename, byteorder='>'):
"""Return image data from a raw PGM file as numpy array.
Format specification: http://netpbm.sourceforge.net/doc/pgm.html
"""
with open(filename, 'rb') as f:
... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than ... | 3 | tools.py | VieVie31/face_detection |
from rest_framework import serializers
from gestion.models.providerOrder import ProviderOrder
from auth_app.serializers.userSerializer import UserSerializer
from gestion.serializers.providerSerializer import ProviderSerializer
from auth_app.models.user import User
from gestion.models.provider import Provider... | [
{
"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": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",... | 3 | server/gestion/serializers/providerOrderSerializer.py | JetLightStudio/Jet-Gest-stock-management |
#!/usr/bin/env python3
# encoding: utf-8
"""This file contains compatibility code to stay compatible with as many python
versions as possible."""
import vim
def _vim_dec(string):
"""Decode 'string' using &encoding."""
# We don't have the luxury here of failing, everything
# falls apart if we don't retur... | [
{
"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 | sources_non_forked/ultisnips/pythonx/UltiSnips/compatibility.py | khatchad/vimrc |
import html
import json
import urllib
import sparql
class WikiWrapper():
@staticmethod
def download_pages_name(q):
result = sparql.query('http://dbpedia.org/sparql', q)
names = []
for item in result.fetchall():
row = sparql.unpack_row(item)
names.append(row[0].... | [
{
"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 | wikiapi.py | nicoloverardo/historical-events-detection |
def hello_world():
return "Hello world from a module"
def some_other_function(x):
# Do stuff here
return x
| [
{
"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 | example_module.py | greenkitkat/Final-Project |
from enum import Enum
from typing import List, Optional
from uuid import UUID
from pydantic import BaseModel, Field
from stake.common import BaseClient, SideEnum, camelcase
from stake.constant import Url
class EquityCategory(str, Enum):
ETF = "ETF"
STOCK = "Stock"
class EquityPosition(BaseModel):
avai... | [
{
"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 | stake/equity.py | stabacco/stake-python |
# coding: utf-8
"""
Isilon SDK
Isilon SDK - Language bindings for the OneFS API # noqa: E501
OpenAPI spec version: 10
Contact: sdk@isilon.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import isi_sdk_9_0_0
from ... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
... | 3 | isi_sdk_9_0_0/test/test_cluster_node_drive_firmware.py | mohitjain97/isilon_sdk_python |
from flask import Flask, render_template
from flask_sqlalchemy import SQLAlchemy
from jinja2 import Template, Environment, PackageLoader, select_autoescape
import json
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI']='sqlite:///site.db'
with open("./static/experience.json") as f:
XP=json.load(f)
env =... | [
{
"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 | app.py | bosogabriel/my_flask_web_cv |
"""
Q062
Unique Paths
Medium
A robot is located at the top-left corner of a m x n grid
(marked 'Start' in the diagram below).
The robot can only move either down or right at any point
in time. The robot is trying to reach the bottom-right
corner of the grid (marked 'Finish' in the diagram below).
How many possible u... | [
{
"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 | Q062.py | Linchin/python_leetcode_git |
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community
Edition) available.
Copyright (C) 2017-2019 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in co... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 lin... | 3 | pipeline/builder/flow/gateway.py | ZhuoZhuoCrayon/bk-nodeman |
# Copyright 2018 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import hashlib
import json
import os
_ENV_DIR = '/var/db/factory/umpire'
_CONFIG_PATH = os.path.join(_ENV_DIR, 'active_umpire.json')
def SaveNewActive... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"... | 3 | py/umpire/server/migrations/0010.py | arccode/factory |
# -*- coding: utf-8 -*-
"""
:author: Grey Li (李辉)
:url: http://greyli.com
:copyright: © 2018 Grey Li <withlihui@gmail.com>
:license: MIT, see LICENSE for more details.
"""
from threading import Thread
from flask import current_app, render_template
from flask_mail import Message
from albumy.extensions ... | [
{
"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 | albumy/emails.py | AkioSky/albumy-test |
"""
Unit tests for tensorflow backend.
"""
import geomstats.backend as gs
import geomstats.tests
@geomstats.tests.tf_only
class TestBackendTensorFlow(geomstats.tests.TestCase):
def test_vstack(self):
import tensorflow as tf
with self.test_session():
tensor_1 = tf.convert_to_tensor([[1... | [
{
"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 | tests/test_backend_tensorflow.py | opeltre/geomstats |
__author__ = 'Aaron Yang'
__email__ = 'byang971@usc.edu'
__date__ = '8/11/2020 6:29 PM'
import sys
def get_num_of_one(num):
count = 0
for i in bin(num)[2:]:
if i == '1':
count += 1
return count
def has_same_one(val, size):
val_size = get_num_of_one(val)
if val_size >= size:
... | [
{
"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 | records/08-11/adasda.py | AaronYang2333/CSCI_570 |
import numpy as np
import os
import pandas as pd
from ecg_classify.constants import DIM, heartbeat_factory, CLASS_NUM, TRAIN_SIZE, TEST_SIZE, LABEL_LIST
from ecg_classify.gen_feature import gen_feature
def read_data(force=False):
if (not (os.path.isfile('train.csv') and os.path.isfile('test.csv'))) or force:
... | [
{
"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 | ecg_classify/gen_data.py | ChitandaXu/ECG_classify |
# Copyright 2018 The Cornac Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by 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 | tests/cornac/datasets/test_movielens.py | carmanzhang/cornac |
from django.db import models
# Create your models here.
# http://api.soundcloud.com/tracks/13158665.json?client_id=a43d27e75fbd64533f57428dd7be3ba5
from django.db import models
from wham.fields import WhamTextField, WhamIntegerField
from wham.models import WhamModel
class SoundcloudMeta:
base_url = 'http://api... | [
{
"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 | wham/apis/soundcloud/models.py | PaulWay/django-wham |
import io
import os
import re
from setuptools import find_packages, setup
VERSION_RE = re.compile(r"__version__\s*=\s*\"(.*?)\"")
HERE = os.path.abspath(os.path.dirname(__file__))
def read(*args):
"""Reads complete file contents."""
return io.open(os.path.join(HERE, *args), encoding="utf-8").read()
def g... | [
{
"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_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer... | 3 | setup.py | SofienM/py-gitguardian |
"""
Code ajoutant les compteurs à la collection d'images.
"""
import cv2
import numpy as np
def genFilledRegion(height=520, width=720, channelCount=None, dtype=np.uint8, fill_value=0):
shape = [height, width]
if channelCount is not None:
shape.append(channelCount)
return np.full(shape=shape, dty... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding... | 3 | src/devint/counter.py | mathieucaroff/metravision |
from mmcv.utils import Registry, build_from_cfg
BBOX_ASSIGNERS = Registry('bbox_assigner')
BBOX_SAMPLERS = Registry('bbox_sampler')
BBOX_CODERS = Registry('bbox_coder')
def build_assigner(cfg, **default_args):
return build_from_cfg(cfg, BBOX_ASSIGNERS, default_args)
def build_sampler(cfg, **default_... | [
{
"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 | mmdet/core/bbox/builder.py | fengyouliang/wheat_detection |
# Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import unittest
import mock
from infra_libs.ts_mon.common import http_metrics
from infra_libs.ts_mon.common import interface
from infra_libs.ts_mon.common ... | [
{
"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 | packages/infra_libs/infra_libs/ts_mon/common/test/http_metrics_test.py | mithro/chromium-infra |
import mechanize
from DictUtils import listToDict
from Scraper import Scraper
import pprint
prettyPrinter = pprint.PrettyPrinter(indent=4, width=50)
class HeadlessScraper():
def __init__(self, username):
self.browser = mechanize.Browser()
self.browser.set_handle_robots(False)
self.baseUr... | [
{
"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 | core/HeadlessScraper.py | ransomwarezz/instagram-scraper |
from aiogram import types
from aiogram.dispatcher import FSMContext
from loader import dp
# Эхо хендлер, куда летят текстовые сообщения без указанного состояния
@dp.message_handler(state=None)
async def bot_echo(message: types.Message):
await message.answer(f"Эхо без состояния."
f"Сообще... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 2... | 3 | handlers/users/echo.py | RSk141/exchange_bot |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import shutil
PROJECT_NAME = "MyNewProject"
def create_dir(path: str) -> None:
if not os.path.isdir(path):
os.mkdir(path)
return
def create_file(path: str) -> None:
exception = False
try:
if not os.path.isfile(path) and '.' in... | [
{
"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 | create_python_project_layout.py | vijayanandrp/python-project-layout |
# Class definition for Book entity
class Book:
bookId = 1
def __init__(self, title, publisher, author, edition, publishedOn):
self.__title = title
self.__publisher = publisher
self.__author = author
self.__edition = edition
self.__publishedOn = publishedOn
self._... | [
{
"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": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer":... | 3 | Library Management System/Book.py | AtharvaJoshi21/PythonPOC |
# -*- coding: utf-8 -*-
# @Time: 2020/4/20 12:38
# @Author: GraceKoo
# @File: 401_binary-watch.py
# @Desc:https://leetcode-cn.com/problems/binary-watch/
from typing import List
class Solution:
def readBinaryWatch(self, num: int) -> List[str]:
def count_binary_1(i):
return bin(i).count("1")
... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
}... | 3 | Codes/gracekoo/401_binary-watch.py | liuxiaohui1221/algorithm |
# Copyright 2019-2021 Canaan 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 writ... | [
{
"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/importer/onnx/basic/test_matmul.py | FusionBolt/nncase |
from typing import List, Optional
class ComponentFunction:
__slots__ = ('mapped_base', 'virtual_addr', 'symbol_name', )
def __init__(self, mapped_base: int, virtual_addr: int, symbol_name: Optional[str]=None):
self.mapped_base = mapped_base
self.virtual_addr = virtual_addr
self.symbo... | [
{
"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 | angrmanagement/plugins/bughouse/data/component_tree.py | DennyDai/angr-management |
from forums.models import Forum, Comment
from django.views import View
from django.views import generic
from django.shortcuts import render, get_object_or_404, redirect
from django.urls import reverse
from django.contrib.auth.mixins import LoginRequiredMixin
from forums.forms import CommentForm
from myarts.owner imp... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/... | 3 | forums/views.py | wajihma/django |
from direct.directnotify import DirectNotifyGlobal
from direct.showbase import DirectObject
from otp.chat.ChatGlobals import *
from otp.nametag.NametagConstants import *
import ChatUtil
class TalkAssistant(DirectObject.DirectObject):
notify = DirectNotifyGlobal.directNotify.newCategory('TalkAssistant')
def de... | [
{
"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 | otp/chat/TalkAssistant.py | CrankySupertoon01/Toontown-2 |
from abc import abstractmethod
"""
NOTES:
- Thickcrust and Thincrust are pizza, changing description and implement
your own price
- description in class Pizza is used as a default
- As an abstract method, cost should be implemented by subclasses.
It is used to formalize a contract between subclasse... | [
{
"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 | head_first_design_patterns/decorator/pizza/pizza.py | incolumepy-cursos/poop |
import sys
import os
from diskcache import Cache
sys.path.append("..")
from config import DEFAULT_TABLE
from logs import LOGGER
# Get the path to the image
def get_imgs(path):
pics = []
for f in os.listdir(path):
if ((f.endswith(extension) for extension in
['.png', '.jpg', '.jpeg', '.PNG... | [
{
"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 | solutions/reverse_image_search/quick_deploy/server/src/operations/load.py | want-fly/bootcamp |
import math
def rotate(point, angle):
ox = 0
oy = 0
px, py = point
qx = ox + math.cos(angle) * (px - ox) - math.sin(angle) * (py - oy)
qy = oy + math.sin(angle) * (px - ox) + math.cos(angle) * (py - oy)
return [qx, qy]
with open("12/nav.txt") as f:
lines = [x.strip() for x in f.readline... | [
{
"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 | 12/nav-2.py | vaerl/advent-of-code-2020 |
#!/usr/bin/env python
"""
Modified by CSE to fit ASSEMBLYLINE service
"""
from pdf_id.pdfid.pdfid import cPluginParent, AddPlugin
# 2014/10/13
class cPDFiDEmbeddedFile(cPluginParent):
# onlyValidPDF = True
name = 'EmbeddedFile plugin'
def __init__(self, oPDFiD, options):
self.oPDFiD = oPDFiD
... | [
{
"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 | pdf_id/pdfid/plugin_embeddedfile.py | CybercentreCanada/assemblyline-service-pdfid |
import pytest
import unittest
import os
from sqlalchemy.orm import sessionmaker
from sqlalchemy import create_engine
from ai_research.mag.mag_orm import Base
from dotenv import load_dotenv, find_dotenv
load_dotenv(find_dotenv())
class TestMag(unittest.TestCase):
"""Check that the MAG ORM works as expected"""
... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",... | 3 | tests/test_mag_orms.py | nestauk/ai_research |
import numpy as np
class vector:
def cross(v):
v1, v2, v3 = v.squeeze()
return np.array([
[0, -v3, v2],
[v3, 0, -v1],
[-v2, v1, 0]
])
class quaternion:
def from_theta(e, theta):
n = 1 if not hasattr(theta, '__len__') else len(theta)
... | [
{
"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 | python/quaternion.py | msc5/attitudes |
from django.shortcuts import render
from rest_framework.views import APIView
from rest_framework.response import Response
from rest_framework import permissions
# from django.views.decoraors.csrf import ensure_csrf_cookie, csrf_protect
from django.middleware.csrf import get_token
# Create your views here.
def welcome(... | [
{
"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_return_types_annotated",
"question": "Does every function in this file have a return type annotation?... | 3 | argo_sys/argonaute/views.py | viallymboma/argo |
###############################################################################
#
# Tests for XlsxWriter.
#
# SPDX-License-Identifier: BSD-2-Clause
# Copyright (c), 2013-2021, John McNamara, jmcnamara@cpan.org
#
from ..excel_comparison_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompar... | [
{
"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 | xlsxwriter/test/comparison/test_chart_scatter03.py | Rippling/XlsxWriter-1 |
from rest_framework import status
from apps.photo.models import ImageFile
from utils.testhelpers import dummy_image
api_path = '/api/upload/'
def test_upload_list(staff_client):
"""Listview does not support GET"""
response = staff_client.get(api_path)
assert response.status_code == status.HTTP_405_METHO... | [
{
"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 | django/api/tests/test_image_upload.py | Haakenlid/tassen |
#!/usr/bin/python
#-*-coding=utf-8-*-
def pyramid(n):
most = 2*n - 1
for i in range(1,n+1):
star = 2*i - 1
space = n - i
print(" "*space + "*"*star)
def test():
pyramid(3)
pyramid(4)
pyramid(5)
if __name__ == "__main__":
test()
| [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"... | 3 | task/learn-python/pyramid.py | jiangdapeng/netease |
from lark import Lark, Transformer, v_args
from lark.visitors import Interpreter, visit_children_decor
p = Lark.open("rules.lark", parser="lalr", rel_to=__file__)
code = """
// Firrst win in my book
b = 4;
a = b*2;
print a+1
x = 7;
p = [1, 2, 3, 4]
print p
"""
tree = p.parse(code)
@v_args(inline=True)
class MyEval... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class 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 self/cls)... | 3 | tests/cmdexpr/ruler.py | RLToolsWorkshop/tunnel-arrow |
# This file is not meant for public use and will be removed in SciPy v2.0.0.
# Use the `scipy.sparse` namespace for importing the functions
# included below.
import warnings
from . import _data
__all__ = [ # noqa: F822
'isscalarlike',
'matrix',
'name',
'npfunc',
'spmatrix',
'validateaxis',
]... | [
{
"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 | scipy/sparse/data.py | lorentzenchr/scipy |
"""
Combine all yaml files listed in _all_.yaml
into one file: all.yaml and all.json
usage: python _yaml2json.py _all_.yaml
Author: Yuhang(Steven) Wang
Date: 11-11-2016
"""
import json
import yaml
import sys
import copy
from plot.tk.fnTK import reduce
from plot.tk.dictTK import merge
def read_yaml(file):
with o... | [
{
"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 | bitirmetezi/venv/Lib/site-packages/plot/parameter/_yaml2json.py | busraltun/IMPLEMENTATIONOFEYECONTROLLEDVIRTUALKEYBOARD |
from theplease.rules.ls_all import match, get_new_command
from theplease.types import Command
def test_match():
assert match(Command('ls', ''))
assert not match(Command('ls', 'file.py\n'))
def test_get_new_command():
assert get_new_command(Command('ls empty_dir', '')) == 'ls -A empty_dir'
assert get... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"ans... | 3 | tests/rules/test_ls_all.py | WorkInProgress-Development/theplease |
"""Creates a new table of passengers of in PostGreSQL from passengers
in a table in sqlite3"""
import sqlite3
import psycopg2
DBNAME = 'ytwptqxp'
USER = 'ytwptqxp'
PASSWORD = 'jDQN23vmEUoCbvVehUkGRmCm11QTuIup'
HOST = 'suleiman.db.elephantsql.com'
create_titanic_table = """ CREATE TABLE titanic_passengers
(
... | [
{
"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 | insert_titanic.py | Lopez-John/lambdata-Lopez-John |
import numpy as np
import torch
from dltranz.data_load import IterableProcessingDataset
class TakeFirstTrx(IterableProcessingDataset):
def __init__(self, take_first_fraction=0.5, seq_len_col=None, sequence_col=None):
"""
Args:
take_first_fraction: control the fraction of transactions ... | [
{
"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 | dltranz/data_load/iterable_processing/take_first_trx.py | KirillVladimirov/pytorch-lifestream |
#!/usr/bin/env python
#
# -*- coding: utf-8 -*-
"""
__author__ = 'CodeFace'
"""
from typing import NamedTuple
from .storage import ModelStorage
from . import vipstarcoin
from . import constants
class Token(NamedTuple):
contract_addr: str
bind_addr: str
name: str
symbol: str
decimals: int
balan... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding s... | 3 | electrum/tokens.py | VIPSTARCOIN-electrum/VIPSTARCOIN-electrum |
from C3_Decorator_Pattern.StarBuzzWithSize.Beverages.Beverages import Beverages
from C3_Decorator_Pattern.StarBuzzWithSize.Beverages.Size import Size
from C3_Decorator_Pattern.StarBuzzWithSize.Condiments.Condiments import Condiments
class Mocha(Condiments):
def __init__(self, beverage: Beverages):
self.b... | [
{
"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 | C3_Decorator_Pattern/StarBuzzWithSize/Condiments/Mocha.py | sarada92/Design_Pattern |
''' Стандартные модули '''
import sys
''' Пользовательские модули '''
import pygame
class Window ():
''' Класс-обертка для управления открывающимся при запуске игры окном '''
def __init__(self, field):
''' Инициализация окна '''
self.field = field; # Отображаемое в окне игрвое поле
def handleEvents(self):
... | [
{
"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 | window.py | LambaKean/Petry-dish-game |
"""A python client interface for ProofAssistantService."""
from __future__ import absolute_import
from __future__ import division
# Import Type Annotations
from __future__ import print_function
import grpc
import tensorflow as tf
from deepmath.proof_assistant import proof_assistant_pb2
from deepmath.proof_assistant im... | [
{
"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 | deepmath/deephol/public/proof_assistant.py | LaudateCorpus1/deepmath |
# Helper file to initialize Kafka producer
"""
Adapted from kafka_helpers.py https://github.com/gfrolov/aiven-kafka/blob/master/kafka_helpers.py
"""
from kafka import KafkaProducer
from json import dumps
from os import environ
def get_kafka_broker():
"""
Parses the KAFKA_URL and returns a hostname: port tha... | [
{
"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 | helpers/init_kafka.py | jchiare/sa_aiven_demo |
from redbot.core import checks, commands
from redbot.core.utils.chat_formatting import box, pagify
class Playground(commands.Cog):
def __init__(self, bot, *args, **kwargs):
super().__init__(*args, **kwargs)
self.bot = bot
async def red_get_data_for_user(self, *, user_id):
"""Get a user... | [
{
"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 | playground/playground.py | RheingoldRiver/misc-cogs |
from LnkParse3.target.lnk_target_base import LnkTargetBase
# https://github.com/libyal/libfwsi/blob/master/documentation/Windows%20Shell%20Item%20format.asciidoc#37-uri-shell-item
# TODO: rename to uri
class Internet(LnkTargetBase):
# TODO Not implemented
def __init__(self, *args, **kwargs):
self.name... | [
{
"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 | LnkParse3/target/internet.py | Matmaus/LnkParse |
from datetime import datetime
def strip_parentheses(date): # deleting parentheses
return date.split('(')[0].strip()
def convert_date(date):
if isinstance(date, list): # checking if there are double or more dates
date = date[0]
date_str = strip_parentheses(date)
fmts = ['%B %d, %Y', '%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 | Data Collection/date_conversion.py | Gsak3l/Movie-Dataset-Creation-and-Movie-Recommendation-Engine |
import attr
from marshmallow_annotations.ext.attrs import AttrsSchema
@attr.s(auto_attribs=True, kw_only=True)
class Tag:
tag_name: str
def __init__(self, tag_name: str):
self.tag_name = tag_name
class TagSchema(AttrsSchema):
class Meta:
target = Tag
register_as_scheme = True
| [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{... | 3 | search_service/models/tag.py | verdan/amundsensearchlibrary |
import http.server
import socketserver
from os import listdir
import os
import pathlib
import sys
import webbrowser
def runserver(app_name, settings_path):
sys.path.append(os.path.dirname(settings_path))
import dipor_settings
settings_tmp = dipor_settings.instance
settings = { key: settings_tmp[key] f... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"... | 3 | dipor/server.py | veedhee/dipor |
def heap_sort(nums):
# convert nums to heap
length = len(nums) - 1
least_parent = length // 2
for i in range(least_parent, -1, -1):
move_down(nums, i, length)
# flatten heap into sorted array
for i in range(length, 0, -1):
if nums[0] > nums[i]:
swap(nums, 0... | [
{
"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 | heap_sort.py | YufeiHu/algorithms-python |
from enum import Enum
#
# This code was taken from:
# https://gist.github.com/cr0hn/89172938b7ac42c3100f4980ad881a24
#
class Serializable:
def _clean_dict_(self,
data = None,
clean_or_raw: str = "clean") -> dict:
# DICT
if type(data) is dict:
r... | [
{
"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 | c42_csr2postman/models/interfaces.py | 42c-presales/42c-report-scan-to-postman |
# -*- coding: utf8 -*-
def mufunc(end=25, multiple=2, non_multiple=5):
for i in range(0, end + 1, multiple):
if i % non_multiple:
yield i
def main() -> None:
for i in mufunc():
print(i)
if __name__ == '__main__':
main()
| [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docst... | 3 | src/Python3/Q115251/exsample.py | umyuu/Sample |
# Copyright Tom SF Haines, Reinier de Blois, Aaron Snoswell
#
# 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": "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 | game/plugins/amblight/amblight.py | danieldugas/naith |
''' Create a binary file with name and roll number. Search for a given roll
number and display the name, if not found display appropriate message.
'''
import pickle
import os
from utils import drive_menu
students = {}
filename = ''
def init(path: str) -> None:
''' Load the file. If file does not exist, creates... | [
{
"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 | practicals/python/q08_studentBin.py | aahnik/cbse-xii-cs-proj |
"""Tests for Codecov API interface."""
from agithub import base as agithub_base
import unittest
from unittest import mock
import env
from apis import codecov
class TestCodecovApi(unittest.TestCase):
def setUp(self):
super(TestCodecovApi, self).setUp()
mock.patch.object(
env, 'get', side_effect={... | [
{
"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 | project-metrics/metrics_service/apis/codecov_test.py | fossabot/amp-github-apps |
from styler import Styler
from .information import Information
s = Styler()
class Header(Information):
justifies = {
"left": "{0} {1}",
"right": "{1} {0}",
"center": "{1} {0} {1}"
}
def __init__(
self,
text,
width=30,
align="center"... | [
{
"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 | information/header.py | Arphnut/CLImate |
import pytest
from bgmi.lib.fetch import DATA_SOURCE_MAP
from bgmi.website import mikan
from bgmi.website.base import BaseWebsite
from bgmi.website.model import SubtitleGroup, WebsiteBangumi
@pytest.mark.parametrize("source", DATA_SOURCE_MAP.keys())
def test_info(source, data_source_bangumi_name):
w = DATA_SOURC... | [
{
"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/test_data_source.py | codysk/BGmi |
#!/usr/bin/env python
from tree import TreeNode
class BST:
def __init__(self):
self.root = None
def put(self, val):
self.root = self.put_int(self.root, val)
def put_int(self, node, val):
if node == None:
return TreeNode(val)
if val < node.val:
nod... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inherit... | 3 | interview/leet/BST.py | eroicaleo/LearningPython |
# -*- coding: utf-8 -*-
# Copyright (c) 2018-2021, earthobservations developers.
# Distributed under the MIT License. See LICENSE for more info.
class _GetAttrMeta(type):
# https://stackoverflow.com/questions/33727217/subscriptable-objects-in-class
def __getitem__(cls, x):
return getattr(cls, x)
de... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{... | 3 | wetterdienst/util/parameter.py | meteoDaniel/wetterdienst |
import tensorflow as tf
import numpy as np
from problems.problem import *
name = "center inpainting"
g_tf_info_placeholder = tf.placeholder(tf.float32, [None], name='g_transform_info')
def problem_loss(x_tformed, g_tformed):
return tf.reduce_mean(tf.abs(x_tformed-g_tformed),[1,2,3])
def m... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docs... | 3 | problems/center_inpainting.py | 11BP11/inverse_problems_GAN |
"""empty message
Revision ID: ae566f24d973
Revises: 838f47fa598e
Create Date: 2020-02-18 17:02:08.574872
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'ae566f24d973'
down_revision = '838f47fa598e'
branch_labels = None
depends_on = None
def upgrade():
# ... | [
{
"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 | backend/migrations/versions/ae566f24d973_.py | sartography/star-drive |
"""
Tests for Advent of Code Day 24.
https://adventofcode.com/2018/day/24
"""
from os import path
from .day24 import run_part1, run_part2
_CURRENT_FILE_DIR = path.dirname(__file__)
_TEST_DATA = [
'Immune System:',
'17 units each with 5390 hit points (weak to radiation, bludgeoning) with an attack that does '... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true... | 3 | 2018/day24/test_day24.py | kfarnung/advent-of-code |
# encoding: utf-8
from flask import jsonify, request
from application import app
from application.models.window import Window
from application.routes.widget import format_response_dict
import json
def _format_response_dict (record, rules = ('-widgets.windows',)):
dictionary = record.to_dict(rules = rules)
widge... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"... | 3 | server/application/routes/window.py | coloration-production/basic-saas |
from collections import deque
class MyStack:
def __init__(self):
"""
Initialize your data structure here.
"""
self.stack = deque()
def push(self, x: int) -> None:
"""
Push element x onto stack.
"""
self.stack.append(x)
def pop(self) -> int:... | [
{
"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 | StacksAndQueues/ImplementStackusingQueues.py | mamoudmatook/Leetcode |
"""
Twilio SMS platform for notify component.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/notify.twilio_sms/
"""
import logging
from homeassistant.components.notify import (
ATTR_TARGET, DOMAIN, BaseNotificationService)
from homeassistant.helpers... | [
{
"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 | homeassistant/components/notify/twilio_sms.py | beschouten/home-assistant |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import absolute_import, division, print_function, unicode_literals
from numpy.testing import assert_allclose
from ...stats import (
significance_to_probability_normal,
probability_to_significance_normal,
probability_to_significa... | [
{
"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 | gammapy/stats/tests/test_significance.py | qpiel/gammapy |
import torch
from .builder import CUDAOpBuilder
class QuantizerBuilder(CUDAOpBuilder):
BUILD_VAR = "DS_BUILD_QUANTIZER"
NAME = "quantizer"
def __init__(self, name=None):
name = self.NAME if name is None else name
super().__init__(name=name)
def absolute_name(self):
return f'd... | [
{
"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 | op_builder/quantizer.py | jglaser/DeepSpeed |
import boto3
import botocore
class S3:
def __init__(self, key, secret, bucket):
self.Key = key
self.Secret = secret
self.Bucket = bucket
return
def upload_file(self, local_file, remote_file):
s3 = boto3.resource(
's3',
aws_access_key_id=self.Ke... | [
{
"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 | SidToS3/aws/s3.py | brian-nelson/SupersidUtilities |
import cv2 as cv
def fast_true(img):
# Initiate FAST object with default values
fast = cv.FastFeatureDetector_create()
return fast_analyser(img, fast)
def fast_false(img):
fast = cv.FastFeatureDetector_create()
# Disable nonmaxSuppression
fast.setNonmaxSuppression(0)
return fast_analyser... | [
{
"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 | algorithms/FASTdetector.py | chandniagarwal/image_analyser |
# -*- coding: utf-8 -*-
""" Testing the Dynamic DynamoDB scaling methods """
import unittest
from dynamic_dynamodb.core.table import scale_reader
class TestScaleReader(unittest.TestCase):
""" Test the scale reader method """
def __init__(self):
self.value = {0: 0, 0.25: 5, 0.5: 10, 1: 20, 2: 50, 5: ... | [
{
"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 | dynamic_dynamodb/test_scaling_metrics.py | Afterverse/dynamic-dynamodb |
class Position:
def __init__(self, line, column):
self._line = line
self._column = column
@property
def line(self):
return self._line
@line.setter
def line(self, line):
self._line = line
@property
def column(self):
return self._column
@column.s... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": ... | 3 | bbpyp/ll_combinator/model/position.py | BloggerBust/bbpyp |
from django import forms
from django.utils.translation import ugettext as _
from cms.plugin_base import CMSPluginBase
from cms.plugin_pool import plugin_pool
from arkestra_utilities.generic_models import ArkestraGenericPlugin
from arkestra_utilities.generic_models import ArkestraGenericPluginForm
from arkestra_utilit... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": true
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
... | 3 | vacancies_and_studentships/cms_plugins.py | techdragon/Arkestra |
import discord
from discord.ext import commands
class Mod:
"""Useful moderation commands to keep the server under control."""
def __init__(self, bot):
self.bot = bot
@commands.command()
@commands.guild_only()
@commands.has_permissions(kick_members=True)
async def kick(self, ctx, us... | [
{
"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 | cogs/mod.py | bananaboy21/LadyBug-Bot |
#!/usr/bin/env python3
import glob
import re
import subprocess
import collections
import argparse
def gen(wildcard, outpath, urlbase):
dd = sorted(glob.glob(wildcard))
print("Found {:} files by '{}'".format(len(dd), wildcard))
res = []
for d in dd:
with open(d) as f:
text = f.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": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/... | 3 | doc/dashboard/gen_data.py | ChristopherKotthoff/Aphros-with-GraphContraction |
import plotly_study
import os
import shutil
import pytest
# Fixtures
# --------
@pytest.fixture()
def setup():
# Reset orca state
plotly_study.io.orca.config.restore_defaults(reset_server=False)
here = os.path.dirname(os.path.abspath(__file__))
# Run setup before every test function in this file
pytestmar... | [
{
"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 | plotly_study/tests/test_orca/test_sg_scraper.py | lucasiscovici/plotly_py |
from datetime import datetime, timedelta
import re
import pyyjj
DATETIME_FORMAT = '%Y-%m-%d %H:%M:%S.%N'
NANO_PER_SECOND = 1000000000
SECOND_PER_MINUTE = 60
NANO_PER_MINUTE = NANO_PER_SECOND * SECOND_PER_MINUTE
EPOCH = datetime.fromtimestamp(0)
SESSION_DATETIME_FORMAT = '%Y-%m-%d %H:%M:%S'
DURATION_FORMAT = '%H:%M... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than... | 3 | core/python/kungfu/yijinjing/time.py | yunnant/kungfu |
#Simple bot to keep track of Wins and Losses for something
import discord,asyncio
import functions
client=discord.Client()
def save_stats():
functions.edit_json('stats',stats)
stats=functions.read_json('stats')
if 'wins' not in stats.keys():
stats['wins']=0
save_stats()
if 'losses' not in stats.keys():
stats['l... | [
{
"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 | Win-Loss/discord_bot.py | stroupbslayen/Other-Discord-Bots-async |
"""
Slixmpp: The Slick XMPP Library
Copyright (C) 2011 Nathanael C. Fritz
This file is part of Slixmpp.
See the file LICENSE for copying permission.
"""
import base64
from slixmpp.util import bytes
from slixmpp.xmlstream import StanzaBase
class Success(StanzaBase):
"""
"""
name = 'suc... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answe... | 3 | slixmpp/features/feature_mechanisms/stanza/success.py | isabella232/slixmpp |
#
# Copyright 2019, Institute for Systems Biology
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | [
{
"point_num": 1,
"id": "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 | apiv4/main_routes.py | isb-cgc/ISB-CGC-API |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.