source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
from satsim import Object
class ContainerFull(Exception):
pass
class DuplicateName(Exception):
pass
class CannotDelete(Exception):
pass
class NotContained(Exception):
pass
class Container(Object):
def __init__(self, name, description="", parent=None):
super().__init__(name, descri... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inherita... | 3 | satsim/kernel/container.py | 0saurabh0/p1 |
"""
test_django-geonames-place
------------
Tests for `django-geonames-place` views module.
"""
import unittest
from django.conf import settings
from django.test import Client, TestCase
from django.urls import reverse
from geonames_place.models import Place
@unittest.skipUnless(
settings.GEONAMES_KEY, 'No GEO... | [
{
"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 | tests/test_views.py | kingsdigitallab/django-geonames-place |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2019 The FATE 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/lic... | [
{
"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 | federatedml/linear_model/linear_model_weight.py | peiyong86/FATE |
import numpy as np
from test.util import generate_kernel_test_case, wrap_template
from webdnn.graph.graph import Graph
from webdnn.graph.operators.sigmoid import Sigmoid
from webdnn.graph.order import OrderCNHW, OrderNHWC
from webdnn.graph.variable import Variable
@wrap_template
def template(r=1.0, x_order=OrderNHWC... | [
{
"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 | test/runtime/operators_test/sigmoid_test.py | steerapi/webdnn |
"""
Print basic stats for CLDF dataset <DATASET>, where <DATASET> may be the path to
- a CLDF metadata file
- a CLDF core data file
"""
from clldutils.clilib import Table, add_format
from pycldf.cli_util import add_dataset, get_dataset
def register(parser):
add_dataset(parser)
add_format(parser, default=None... | [
{
"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 | src/pycldf/commands/stats.py | fmatter/pycldf |
class AcceptableNumberOfMethods:
def m1(self):
pass
def m2(self):
pass
def m3(self):
pass
def m4(self):
pass
def m5(self):
pass
def m6(self):
pass
def m7(self):
pass
def m8(self):
pass
def m9(self):
pass
... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer":... | 3 | tests/system/examples/method_count_in_class.py | willprice/pylint-quality |
from zeroconf import ServiceBrowser, Zeroconf
class MyListener:
def remove_service(self, zeroconf, type, name):
print("Service %s removed" % (name,))
def add_service(self, zeroconf, type, name):
info = zeroconf.get_service_info(type, name)
print("Service %s added, service info: %s" %... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
}... | 3 | test_zc.py | eavanvalkenburg/sia-ha |
#definition for music_func goes here
def music_func(music, group, singer):
print("The best kind of music is", music)
print("The best music group is", group)
print("The best lead vocalist is", singer)
def main():
music, group, singer = '', '', ''
while music != 'quit':
try:
music... | [
{
"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 | Exercises/Exercises Chapter 08/8.1.py | tonysulfaro/CSE-231 |
# coding: utf-8
"""
Speech Services API v2.0
Speech Services API v2.0. # noqa: E501
OpenAPI spec version: v2.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import swagger_client
from swagger_client.models.endpoin... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": ... | 3 | test/test_endpoint_data_definition.py | networthdata/generated-swagger-client |
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.distributions import Categorical
class Policy(nn.Module):
def __init__(self, s_size=4, h_size=8, a_size=2):
super(Policy, self).__init__()
self.fc1 = nn.Linear(s_size, h_size)
self.fc2 = nn.Linear(h_size,... | [
{
"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 | policy.py | escribano89/cartpole-REINFORCE |
def prime(interval):
primes = []
for number in range(2,interval):
flag = True
for x in range(2,number):
if x<number:
if number%x != 0:
x+=1
else:
flag = False
else:
break
if flag:
primes.append(number)
... | [
{
"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 | 04 Prime Factorization/prime_factorization.py | kaushalfeb/Capstone_Projects |
# coding=utf8
# Copyright 2018 JDCLOUD.COM
#
# 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 ... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding sel... | 3 | python_code/vnev/Lib/site-packages/jdcloud_sdk/services/iothub/apis/DeleteProductRequest.py | Ureimu/weather-robot |
# utility functions for encoding and decoding messages
# created by Felix Holz, 2018-07-11
import math
# maximum number of characters per packet
MAX_HEX_CHARS = 10
# encode a string to the hexadecimal string used by the protocol
# msg: string to encode
# return: string array of hexadecimal strings. each strin... | [
{
"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 | RNDL/encoder.py | bopopescu/RNDL-Protocol |
import json
import requests
class Tenant(object):
pass
class BusinessGroup(Tenant):
def __init__(self):
pass
@staticmethod
def get_businessgroups(session, tenant=None):
pass
class Reservation(BusinessGroup):
@classmethod
def get_fromid(cls, session, id):
pass
... | [
{
"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 | vralib/tenants.py | stefan-caraiman/vrealize-pysdk |
"""
This code contains test tasks for luigi
Author: Winston Olson-Duvall, winston.olson-duvall@jpl.nasa.gov
"""
import os
import luigi
from emit_main.workflow.workflow_manager import WorkflowManager
from emit_main.workflow.slurm import SlurmJobTask
class ExampleTask(SlurmJobTask):
config_path = luigi.Paramet... | [
{
"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 | emit_main/workflow/test_tasks.py | emit-sds/emit-main |
#!/usr/local/bin/python3.7
# -*- coding: utf-8 -*-
from typing import List
def numberOfSubarrays(nums: List[int], k: int) -> int:
"""前缀和+map"""
length = len(nums)
if length <= 0: return -1
count = 0
#枚举左右边界
# for i in range(0, length):#left
# for j in range(i, length):#right
# ... | [
{
"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 | 1248-count-number-of-nice-subarrays.py | yuenliou/leetcode |
import pytest
from django.urls import resolve, reverse
from ccdj.users.models import User
pytestmark = pytest.mark.django_db
def test_detail(user: User):
assert (
reverse("users:detail", kwargs={"username": user.username})
== f"/users/{user.username}/"
)
assert resolve(f"/users/{user.use... | [
{
"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 | ccdj/users/tests/test_urls.py | hernanramirez/ccdj |
#!/usr/bin/python
################################################################################
# 20c845b0-5cc5-11e4-af55-00155d01fe08
#
# Justin Dierking
# justindierking@hardbitsolutions.com
# phnomcobra@gmail.com
#
# 10/24/2014 Original Construction
################################################################... | [
{
"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 | pcat2py/class/20c845b0-5cc5-11e4-af55-00155d01fe08.py | phnomcobra/PCAT2PY |
import numpy as np
import librosa.display
import librosa.output
import matplotlib.pyplot as plt
import sys
def get_file_audio(in_path, out_path):
data, sr = librosa.load(in_path, sr=44100)
_noise = np.array([])
_data = np.array([])
_flag_start = False
for d in data:
if _flag_start:
... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": fal... | 3 | data/data_with_roise/get_voice.py | angelvalay/asr_commands |
import os
def test_picture(bot):
bot.send(os.getcwd() + "\\Temp\\selenium-python.png","This is a test")
def test_text(bot):
bot.typer(' '.join(bot.message.split(' ')[1:]),bot.textbox) | [
{
"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 | Modules/Test.py | Bamgm14/GarbBot-Framework- |
"""
This file handles searching and adding workouts
"""
from flask import (Blueprint, render_template, flash,
session, request, redirect, url_for, json)
from flaskapp import db
bp = Blueprint('workout', __name__, url_prefix='/workout')
@bp.route('/')
def workout():
"""
Page where user adds... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answ... | 3 | flaskapp/workout.py | Betovef/fitness-tracker |
from __future__ import unicode_literals
from django.test import TestCase
class StartpageTest(TestCase):
def test_get(self):
response = self.client.get('/')
print(response)
self.assertEqual(response.status_code, 302)
class SimpleTest(TestCase):
def test_basic_addition(self):
... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
... | 3 | example/tests/test_example.py | andyzsf/django-shop |
from . import models as _m
from ..base import Client, ModelMixin
class BitexPublic(Client, ModelMixin):
"""Bitex API Doc: https://bitex.la/developers"""
base_url = "https://bitex.la/api-v1/rest/"
error_keys = ["error"]
def ticker(self, market_id: str):
"""Overview of current market prices an... | [
{
"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 | trading_api_wrappers/bitex/client_public.py | delta575/trading-api-wrappers |
import cv2
import numpy as np
import six
import sys
import pickle as pkl
from tqdm import tqdm
def compress(path, output):
with np.load(path, mmap_mode="r", encoding='latin1') as data:
images = data["images"]
array = []
for ii in tqdm(six.moves.xrange(images.shape[0]), desc='compress'):
im = imag... | [
{
"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 | fewshot/data/compress_tiered_imagenet.py | renmengye/inc-few-shot-attractor-public |
"""
Tests for asynchronous vectorized environments.
"""
import gym
import pytest
import os
import glob
import tempfile
from .dummy_vec_env import DummyVecEnv
from .shmem_vec_env import ShmemVecEnv
from .subproc_vec_env import SubprocVecEnv
from .vec_video_recorder import VecVideoRecorder
@pytest.mark.parametrize('kl... | [
{
"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 | baselines/common/vec_env/test_video_recorder.py | bukysun/baseline |
import unittest
class KerrMotorTestCase(unittest.TestCase):
def test_something(self):
self.assertEqual(True, False)
def test_float_to_hexstr(self):
pass
if __name__ == '__main__':
unittest.main()
| [
{
"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 | pychron/hardware/kerr/tests/kerr_motor.py | ael-noblegas/pychron |
# Copyright (C) 2018-2022 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from openvino.tools.mo.front.common.partial_infer.elemental import copy_shape_infer
from openvino.tools.mo.graph.graph import Graph
from openvino.tools.mo.ops.op import Op
class PReLU(Op):
op = 'PReLU'
enabl... | [
{
"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 | tools/mo/openvino/tools/mo/ops/prelu.py | ryanloney/openvino-1 |
import asyncio
import aiofiles
import configargparse
import datetime
async def fetch_chat_messages(chat_url, receive_port, history_filename):
while True:
try:
reader, _ = await asyncio.open_connection(chat_url, receive_port,)
encoded_message = await reader.readline()
no... | [
{
"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 | receive.py | Sam1808/secret_chat |
import numpy as np
from collections import OrderedDict
class TrackState(object): # 轨迹的四种状态
New = 0 # 创建新的轨迹
Tracked = 1 # 追踪状态
Lost = 2 # 丢失
Removed = 3 # 轨迹完成了,将其从当前帧中删除
# 存储一条轨迹信息的基本单元
class BaseTrack(o... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
}... | 3 | src/lib/tracker/basetrack.py | lishuai1993/FairMOT |
from django.contrib.auth import get_user_model
from .test_setup import TestSetUp
User = get_user_model()
class TestViews(TestSetUp):
def test_user_cannot_register_with_no_data(self):
res = self.client.post(self.register_url)
self.assertEqual(res.status_code, 400)
def test_user_can_register_... | [
{
"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 | market/authentications/tests/test_views.py | hbvj99/market-api |
from typing import Any, Dict, List
from bytecash.rpc.rpc_client import RpcClient
class HarvesterRpcClient(RpcClient):
"""
Client to Bytecash RPC, connects to a local harvester. Uses HTTP/JSON, and converts back from
JSON into native python objects before returning. All api calls use POST requests.
No... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer... | 3 | bytecash/rpc/harvester_rpc_client.py | konarshankar07/bytecash-blockchain |
from insertion import insertion
def test_unique_values():
lst = [8,4,23,42,16,15]
expected = [4,8,15,16,23,42]
actual = insertion(lst)
assert actual == expected
def test_duplicate_value():
lst = [8,4,23,42,16,15,8,23]
expected = [4,8,8,15,16,23,23,42]
actual = insertion(lst)
assert act... | [
{
"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 | challenges/insertion/test_insertion.py | glasscharlie/data-structures-and-algorithms |
# type: ignore
import os
from logging.config import fileConfig
from alembic import context
from sqlalchemy import engine_from_config, pool
from learning.entities import Base
# this is the Alembic Config object, which provides
# access to the values within the .ini file in use.
config = context.config
# Interpret th... | [
{
"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 | learning/alembic/env.py | koichiro8/learning |
import torch
from torch import Tensor
from torch.nn import Parameter
class Bounded:
def __init__(self, lower: float, upper: float):
self.lower = lower
self.range = upper - lower
self.parameter = Parameter(torch.randn(1))
def get_value(self) -> Tensor:
return torch.sigmoid(self... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
}... | 3 | torch_kalman/process/utils/bounded.py | Suhwan-Dev/torch-kalman |
"""Base TestCase class for testing Exporters"""
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
import os
from ...tests.base import TestsBase
all_raw_mimetypes = {
"text/x-python",
"text/markdown",
"text/html",
"text/restructuredtext",
"text/l... | [
{
"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 | Lib/site-packages/nbconvert/exporters/tests/base.py | edupyter/EDUPYTER38 |
import fcntl
import time
def get_lock(state):
result = False
file = open('lock', 'r+')
fcntl.flock(file.fileno(), fcntl.LOCK_EX)
Lock = file.readline()
if Lock=='True':
print('other mig in progress !!!')
if state == True and Lock == 'False':
print('acquire lock {} at {}'.format... | [
{
"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 | ryu/app/otherApp/lock.py | yuesir137/SDN-CLB |
# Copyright (C) 2020 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
"""Workflow UI facade."""
from lib import factory, users
from lib.entities import entity_operations, ui_dict_convert
from lib.page.widget import object_page, object_modal
def submit_obj(obj):
"""Submits 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": "every_function_has_docstring",
"question": "Does every function in this file have a docs... | 3 | test/selenium/src/lib/ui/internal_ui_operations.py | MikalaiMikalalai/ggrc-core |
import asyncio
import json
import logging
from aiohttp.web_response import Response
from pybot.plugins.api.request import FailedVerification, SlackApiRequest
logger = logging.getLogger(__name__)
async def slack_api(request):
api_plugin = request.app.plugins["api"]
try:
slack_request = SlackApiRequ... | [
{
"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 | pybot/plugins/api/endpoints.py | harikrishnana2021/operationcode-pybot |
"""empty message
Revision ID: d4c798575877
Revises: 1daa601d3ae5
Create Date: 2018-05-09 10:28:22.931442
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'd4c798575877'
down_revision = '1daa601d3ae5'
branch_labels = None
depends_on = None
def upgrade():
op... | [
{
"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 | migrations/versions/d4c798575877_create_favorites.py | jodevsa/redash |
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution(object):
def levelOrderBottom(self, root):
"""
:type root: TreeNode
:rtype: List[List[int]]
"""
... | [
{
"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 | leetcode/Algorithms/107.BinaryTreeLevelOrderTraversalII/Solution.py | liupangzi/codekata |
import math
def sqr(x):
return x * x
def distance_between(one, two):
return math.sqrt(sqr(two["x"] - one["x"]) + sqr(two['y'] - one['y']))
def manhattan(one, two):
return abs(two["x"] - one["x"]) + abs(two['y'] - one['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": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",... | 3 | maths.py | DAChenScratch/Battlesnake-Marigold |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | [
{
"point_num": 1,
"id": "every_function_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 | aliyun-python-sdk-elasticsearch/aliyunsdkelasticsearch/request/v20170613/UpdatePublicWhiteIpsRequest.py | jia-jerry/aliyun-openapi-python-sdk |
from urlparse import urlparse
from django import forms
from tower import ugettext_lazy as _lazy
import amo
from mkt.api.forms import SluggableModelChoiceField
from mkt.webapps.models import Addon
class ReceiptForm(forms.Form):
app = SluggableModelChoiceField(
queryset=Addon.objects.filter(type=amo.ADDO... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
}... | 3 | mkt/receipts/forms.py | muffinresearch/zamboni |
from kucoin.websocket.websocket import ConnectWebsocket
class KucoinWsClient:
"""
https://docs.kucoin.com/#websocket-feed
"""
def __init__(self):
self._callback = None
self._conn = None
self._loop = None
self._client = None
self._private = False
@classmeth... | [
{
"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 | kucoin/ws_client.py | 1bazinga25/kucoin-python-sdk |
""" Miscellaneous Functions """
import sys
import copy
import warnings
import traceback
from typing import Any, Callable, Dict
from inspect import signature
def warn_ignore(*args, **kwargs): # pylint: disable=unused-argument
"""Function used to ignore all warnings"""
pass
def warn_with_traceback(message, ... | [
{
"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": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (... | 3 | bananas/utils/misc.py | owahltinez/bananas |
# Copyright (c) 2019 Oracle and/or its affiliates.
# This software is made available to you under the terms of the GPL 3.0 license or the Apache 2.0 license.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Apache License v2.0
# See LICENSE.TXT for details.
# GENERATED FILE... | [
{
"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 | plugins/filter/oci_filters.py | A7rMtWE57x/oci-ansible-collection |
# Copyright 2014 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | [
{
"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": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},... | 3 | lib/surface/compute/disks/list.py | bopopescu/SDK |
#! /usr/bin/python3
import tcfl.tc
class _test(tcfl.tc.tc_c):
def eval_00(self):
self.report_info("Hello 1")
def eval_01(self):
self.report_info("Hello 2")
| [
{
"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 | doc/training/test_02.py | sriiora/tcf |
from netapp.netapp_object import NetAppObject
class SnapvaultSoftlockInfo(NetAppObject):
"""
Structure of the snapvault softlock.
"""
_softlock_name = None
@property
def softlock_name(self):
"""
Name of the softlock. This field will be empty if
softlock-name is not ... | [
{
"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 | generated-libraries/python/netapp/snapvault/snapvault_softlock_info.py | radekg/netapp-ontap-lib-get |
from django.core.exceptions import ValidationError
from ..classes import SettingNamespaceMigration
from .literals import TEST_SETTING_VALIDATION_BAD_VALUE
class TestNamespaceMigrationOne(SettingNamespaceMigration):
def smart_settings_test_setting_0001(self, value):
return '{}_0001'.format(value)
class... | [
{
"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 | mayan/apps/smart_settings/tests/mocks.py | atitaya1412/Mayan-EDMS |
# -*- coding: utf-8 -*-
"""Utility functions.
:author: Stefan Lehmann <stlm@posteo.de>
:license: MIT, see license file or https://opensource.org/licenses/MIT
:created on: 2018-06-11 18:15:53
:last modified by: Stefan Lehmann
:last modified time: 2018-07-12 14:11:12
"""
import sys
from ctypes import c_ubyte
def pla... | [
{
"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 | pyads/utils.py | klauer/pyads |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Copyright 2020, Yutong Xie, UIUC.
Using recursion to validate BST
'''
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.rig... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than cla... | 3 | python/Validate-Binary-Search-Tree/recursion.py | yutong-xie/Leetcode-with-python |
from flask import Flask, jsonify
from db import db
from models import User, History
from flask_cors import CORS
from flask import request
from crawler import Crawler
from classifier import predict_class, get_three_docs
from poor_me import reference
from flask_jwt import JWT, jwt_required, current_identity
from datetime... | [
{
"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 | app.py | nina87513/recipe-sorting-hat |
class Pessoa:
def __init__(self,nome,idade,cpf,salario):
self.nome = nome
self.idade = idade
self.cpf = cpf
self.salario = salario
def Aumento(self):
return self.salario *0.05
class Gerente(Pessoa):
def __init__(self,nome,idade,cpf,salario,senha):
... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/... | 3 | Python_OO/Exercicio.py | Madara701/Python_OO |
import vk_api
# import requests
import os
import io
from PIL import Image
class VKSessionClass:
def __init__(self, login, password):
try:
# session = requests.Session()
vk_session = vk_api.VkApi(login, password, captcha_handler=captcha_handler)
try:
# O... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},... | 3 | app/VKSession.py | Ellanity/VK-Utils |
"""
sentry.utils.auth
~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
from django.conf import settings
from django.contrib.auth.backends import ModelBackend
from sentry.models import ... | [
{
"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 | src/sentry/utils/auth.py | erhuabushuo/sentry |
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from __future__ import unicode_literals
from ..convert import Shredder
def test_Shredder_inputs():
input_map = dict(args=dict(argstr='%s',
),
chunksize=dict(argstr='%d',
position=2,
units='NA',
),
environ=dict(nohash=True,
usedefaul... | [
{
"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 | nipype/interfaces/camino/tests/test_auto_Shredder.py | sebastientourbier/nipype |
from pandas import DataFrame
from moonstone.parsers.counts.taxonomy.base import BaseTaxonomyCountsParser
class SunbeamKraken2Parser(BaseTaxonomyCountsParser):
"""
Parse output from `Kraken2 <https://ccb.jhu.edu/software/kraken2/>`_
merge table from `Sunbeam <https://github.com/sunbeam-labs/sunbeam/>`_ pi... | [
{
"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 | moonstone/parsers/counts/taxonomy/kraken2.py | motleystate/moonstone |
from setuptools import find_packages, setup, Command
import os
# get the dependencies and installs
with open("requirements.txt", "r", encoding="utf-8") as f:
requires = []
for line in f:
req = line.split("#", 1)[0].strip()
if req and not req.startswith("--"):
requires.append(req)
... | [
{
"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 | runners/mlcube_k8s/setup.py | davidjurado/mlcube |
#!/usr/bin/env python3
import sys
import re
class Num:
def __init__(self, value):
self.value = value
def __add__(self, num):
return Num(self.value * num.value)
def __mul__(self, num):
return Num(self.value + num.value)
s = 0
for line in sys.stdin:
line = line.replace("+", "... | [
{
"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 | problems/day-18/part_2.py | stringham/advent-of-code-2020 |
"""
find docker-compose.yml files
"""
import fnmatch
import os
def find_yml_files(path):
"""
find docker-compose.yml files in path
"""
matches = {}
for root, _, filenames in os.walk(path, followlinks=True):
for _ in fnmatch.filter(filenames, 'docker-compose.yml'):
key = root.sp... | [
{
"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 | scripts/find_files.py | minh10huy/rpi-dcui |
#!/bin/python
# -*- coding: utf-8 -*-
"""Log client details"""
import logging
class LogClient(object):
"""Docstring for LogClient."""
def __init__(self, arg):
"""Initialise."""
super(LogClient, self).__init__()
self.arg = arg
self.log_client()
def log_client(self):
... | [
{
"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 | utils/log_client.py | shridarpatil/Flask-RestApi |
"""Test main.py
"""
from starlette.testclient import TestClient
from toolz.curried import pipe, curry
from main import app
client = TestClient(app) # pylint: disable=invalid-name
def get(url):
"""Get the response given a file URL
"""
return client.get(f"/get/?url={url}")
@curry
def get_contour(colx,... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self... | 3 | test.py | wd15/pfhub-app |
import torch.nn as nn
import torch.utils.data
import torch.nn.functional as F
from pointnet_utils import PointNetEncoder, feature_transform_reguliarzer
class get_model(nn.Module):
def __init__(self, k=40, normal_channel=True):
super(get_model, self).__init__()
if normal_channel:
... | [
{
"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 | Deep Learning/Implementation_3/models/pointnet_cls.py | rajahaseeb147/3dFacialPartSegmentation |
from django.db import models
from django.contrib.auth.models import User
from django.db.models.signals import post_save
from django.dispatch import receiver
from sorl.thumbnail import ImageField
# Create your models here.
class Profile(models.Model):
user= models.OneToOneField(
User,
on... | [
{
"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 | profiles/models.py | Samyak-jain09/QnA |
import keras
import numpy as np
import math
class PriorProbability(keras.initializers.Initializer):
"""
Initializer applies a prior probability.
"""
def __init__(self, probability=0.01):
self.probability = probability
def get_config(self):
return {
'probability': se... | [
{
"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 | detector/object_detection/keras_retinanet/initializers.py | CianciarusoCataldo/nn-object-detector |
import os
import json
import datetime
from themis.util import timeseries, aws_common
from themis.util.common import *
THIS_FOLDER = os.path.realpath(os.path.dirname(__file__))
def test_cloudwatch_timeseries():
cw = load_json_file(os.path.join(THIS_FOLDER, 'data', 'cloudwatch_kinesis_response.json'))
series =... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"ans... | 3 | test/test_timeseries.py | igor-lema-ifood/themis |
# -*- coding: utf-8 -*-
import os
from v2c.message import info
def list_files(dirs, print_filelist=False):
info('Creating file list in ' + str(len(dirs)) + ' directories...')
entries = set()
for d in dirs:
entries.update(__get_filelist_recursive(d))
entries_sorted = sorted(entries)
if pri... | [
{
"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 | v2c/dir.py | hidakanoko/vm2container |
"""
* Copyright (c) 2019, Autonomous Networks Research Group. All rights reserved.
* contributors:
* Pradipta Ghosh, March 2019
* Wenda Chen, March 2019
* Bhaskar Krishnamachari, March 2019
* Read license file in main directory for more details
"""
import cv2
import numpy as np
import time... | [
{
"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 | scripts/car_detection/car_detection.py | ANRGUSC/MCPDAG |
P = range(4)
C = range(10)
# Stages: Draws
# State: Card we have just drawn; Current board
# Actions: Choosing one of the empty positions to place the card
# Value function: cards() returns the minimum expected value if we get "card"
# when we have board in state "board"
_V = {}
def cards(card, boar... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding sel... | 3 | Dynamic Programming/cards.py | roycek7/operation_research |
from starlette.applications import Starlette
from starlette.responses import HTMLResponse, JSONResponse
from starlette.staticfiles import StaticFiles
from starlette.middleware.cors import CORSMiddleware
import uvicorn, aiohttp, asyncio
from io import BytesIO
from fastai.vision import *
model_file_url = 'https://www.d... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding se... | 3 | app/server.py | shadab4150/google-app-engine-fastai-model-deployment |
# coding: utf-8
from supervisely_lib.geometry.rectangle import Rectangle
from supervisely_lib.geometry.validation import is_2d_int_coords_valid
class SlidingWindows:
def __init__(self, window_shape, min_overlap):
if not is_2d_int_coords_valid([window_shape]):
raise ValueError('window_shape mu... | [
{
"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 | superviselySDK/supervisely_lib/geometry/sliding_windows.py | nicehuster/mmdetection-supervisely-person-datasets |
from typing import Any, Callable, NamedTuple, Tuple
import functools
import jax.numpy as jnp
QFunction = Any
ActionSpace = Tuple[int, ...]
State = jnp.ndarray
class Agent(NamedTuple):
select_action: Callable[[QFunction, State, ActionSpace, float, int], int]
update: Callable[[QFunction, State, int, State, flo... | [
{
"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 | rl/base/agent.py | epignatelli/rl-basics |
# noinspection PyPackageRequirements
import re
from telegram.ext import BaseFilter
class AnimatedSticker(BaseFilter):
def filter(self, message):
if message.sticker and message.sticker.is_animated:
return True
class StaticSticker(BaseFilter):
def filter(self, message):
if message... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?"... | 3 | bot/customfilters.py | Im-zeus/Stickers |
"""
Add UUIDs to workflows
"""
from __future__ import print_function
import logging
from sqlalchemy import Column, MetaData, Table
from galaxy.model.custom_types import UUIDType
log = logging.getLogger(__name__)
metadata = MetaData()
"""
Because both workflow and job requests can be determined
based the a fixed d... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": fals... | 3 | lib/galaxy/model/migrate/versions/0121_workflow_uuids.py | lawrence14701/galaxy |
import time
import asyncore
from ardos.instance.InstanceObject import InstanceObject
from ardos.core.ArdosServer import ArdosServer
class TestObjectIO(InstanceObject):
def __init__(self, parent):
InstanceObject.__init__(self, parent, 'DistributedTestObject')
def getTestMethod(self):
return [None, None]
clas... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"ans... | 3 | ardos/test/TestServerIO.py | Ardos-Project/ardos.libpython |
from tastypie.authorization import Authorization
from tastypie.exceptions import Unauthorized
class CustomAuthorization(Authorization):
def read_list(self, object_list, bundle):
# This assumes a ``QuerySet`` from ``ModelResource``.
print(bundle.request.user)
return object_list
... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/... | 3 | customAuth.py | cartologic/cartoview_tasks_manager |
import sys
from flask import Flask, g
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext import login
sys.path.append('../..')
from social.apps.flask_app.routes import social_auth
from social.apps.flask_app.template_filters import backends
from social.apps.flask_app.default.models import init_social
# App
a... | [
{
"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 | examples/flask_example/__init__.py | SeanHayes/python-social-auth |
import numpy as np
def batch_cosine_similarity(x1, x2):
'''
x1,x2 must be l2 normalized
'''
# https://en.wikipedia.org/wiki/Cosine_similarity
# 1 = equal direction ; -1 = opposite direction
mul = np.multiply(x1, x2)
s = np.sum(mul, axis=1)
# l1 = np.sum(np.multiply(x1, x1),axis=1)... | [
{
"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": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (... | 3 | src/utils/utils.py | yDon96/pepper_assistant |
"""Create new database for the project
Revision ID: 9b6260e9ca85
Revises:
Create Date: 2021-06-21 11:13:54.880591
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '9b6260e9ca85'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# ... | [
{
"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 | migrations/versions/9b6260e9ca85_create_new_database_for_the_project.py | VGichuki/blog_app |
# Copyright 2021 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from pants.backend.codegen import export_codegen_goal
from pants.backend.docker.goals.tailor import rules as tailor_rules
from pants.backend.docker.rules import rules as docker_rules
from ... | [
{
"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 | src/python/pants/backend/experimental/docker/register.py | yoav-orca/pants |
import pytest
from exchange_calendars.exchange_calendar_xshg import XSHGExchangeCalendar
from .test_exchange_calendar import ExchangeCalendarTestBase
from .test_utils import T
class TestXSHGCalendar(ExchangeCalendarTestBase):
@pytest.fixture(scope="class")
def calendar_cls(self):
yield XSHGExchangeCa... | [
{
"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": fals... | 3 | tests/test_xshg_calendar.py | schild/exchange_calendars |
"""create users table
Revision ID: e3a93a4499c3
Revises:
Create Date: 2020-10-06 15:19:53.345448
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'e3a93a4499c3'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto... | [
{
"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 | migrations/versions/e3a93a4499c3_create_users_table.py | arilsonsouza/flask-api |
from unittest import TestCase
from tests import get_data
from pytezos.operation.forge import forge_operation_group
class OperationForgingTestooDRC4(TestCase):
def setUp(self):
self.maxDiff = None
def test_forge_ooDRC4(self):
expected = get_data(
path='operations/ooDRC4Ak... | [
{
"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 | tests/operations/ooDRC4AkfJJG3X5DmmQUH1AnqrAGefFx3DrPxvtipeUV1hQNE3N/test_forge_ooDRC4.py | juztin/pytezos-1 |
"""Tests for Registration."""
from django.test import TestCase
from django.urls import reverse
from django.contrib.auth.models import User
class RegistrationViewTests(TestCase):
"""Tests for sign in and sign up."""
def setUp(self) -> None:
self.credentials = {
'username': 'tester',
... | [
{
"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 | forums/tests/test_view.py | bhokin/ThaiMoung |
# -*- coding: utf-8 -*-
from __future__ import division, print_function
import pytest
import numpy as np
from emcee.autocorr import integrated_time, AutocorrError
def get_chain(seed=1234, ndim=3, N=100000):
np.random.seed(seed)
a = 0.9
x = np.empty((N, ndim))
x[0] = np.zeros(ndim)
for i in rang... | [
{
"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 | emcee/tests/unit/test_autocorr.py | Christopher-Bradshaw/emcee |
#!/usr/bin/env python
from telegraf_pyplug.main import print_influxdb_format
def multiple_fields() -> None:
"""
Prints line:
multiple_fields field_float=1,field_int=123i,field_str="two",field_bool=True
"""
print_influxdb_format(
measurement='multiple_fields',
fields={
... | [
{
"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 | examples/data_types_usage.py | ToolSense/telegraf_pyplu |
from cumulusci.salesforce_api.metadata import ApiRetrieveUnpackaged
from cumulusci.tasks.salesforce import BaseRetrieveMetadata
retrieve_unpackaged_options = BaseRetrieveMetadata.task_options.copy()
retrieve_unpackaged_options.update(
{
"package_xml": {
"description": "The path to a package.xm... | [
{
"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 | cumulusci/tasks/salesforce/RetrieveUnpackaged.py | jdominiczak/CumulusCI |
#!/usr/bin/python
#-*- coding: utf-8 -*-
import pandas as pd
from src.DataManagement.Preprocessing import PreprocessingStrategy
from sklearn.preprocessing import PolynomialFeatures as _PolynomialFeatures
class PolynomialFeatures(PreprocessingStrategy):
def __init__(self,**kwargs):
super().__init__()
... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": ... | 3 | src/DataManagement/Preprocessing/PolynomialFeatures.py | shawnvosburg/IFT712-Projet |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
OpenAPI spec version: v1.14.7
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import unittest
import kube... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"ans... | 3 | kubernetes_asyncio/test/test_v1_stateful_set_list.py | aK0nshin/kubernetes_asyncio |
from Person import Person
#TODO make name private
class Student(Person):
__doc__ = "Student"
points = 0
marks = 0
semester = 0
totalSemesters = 8
totalMarks = 0
modules = []
moduleEnrollments = {}
facult = ""
resultFromSimluation = True # Result from simualtuion: True -> advance to next year; False -> expe... | [
{
"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 | src/model/Student.py | bazilinskyy/agent-based-uni |
class Signal:
def __init__(self, name):
self.name = name
self.callbacks = []
def connect(self, callback):
self.callbacks.append(callback)
def disconnect(self, callback):
for index, cb in enumerate(self.callbacks):
if callback == cb:
del self.call... | [
{
"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 | signals/signals.py | davidcrawford/chronic |
from nltk.corpus import stopwords
from nltk.tokenize import word_tokenize
from nltk import RegexpTokenizer
import re
def regex_clean_ruidos(text):
'''
função manual para eliminação de ruídos através de regex, descartar qualquer coisa
que na composição possua uma 'não letra', como símbolos e núme... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excludi... | 3 | src/slave/preprocess.py | emanuelibiapino/micro_cluster |
"""Application factory for external relations service."""
from flask import Flask, Response, jsonify
from werkzeug.exceptions import HTTPException, Forbidden, Unauthorized, \
BadRequest, MethodNotAllowed, InternalServerError, NotFound
from arxiv.base import Base, logging
from arxiv.base.middleware import wrap, re... | [
{
"point_num": 1,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer... | 3 | relations/factory.py | bonotake/arxiv-external-links |
from math import cos, sin, sqrt
import random
class Atom:
def __init__(self, x, y, z):
self.x = x
self.y = y
self.z = z
self.type = 1
v0 = 2.0
z = random.random()*2.0-1
s = random.random()*3.14*2.0
self.vx = v0*sqrt(1.0-z**2)*cos(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 | generate_config.py | kaityo256/lj_and_wca |
from setuptools import find_packages, setup
def find_required():
with open("requirements.txt") as f:
return f.read().splitlines()
def find_dev_required():
with open("requirements-dev.txt") as f:
return f.read().splitlines()
setup(
name="vedro-allure-reporter",
version="0.2.4",
... | [
{
"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 | setup.py | nikitanovosibirsk/vedro-allure-reporter |
import wx
class MyFrame(wx.Frame):
def __init__(self):
wx.Frame.__init__(self, parent=None, title="CheckBOx Example")
self.mainPanel = wx.Panel(self)
self.checkBold = wx.CheckBox(self.mainPanel, label="Bold")
self.checkBold.SetValue(wx.CHK_CHECKED)
self.checkItalic = wx.CheckBox(self.mainPanel, label="It... | [
{
"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 | CheckBox.py | juhyun0/python_wxPython2 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
import utool as ut
from ibeis import viz
from ibeis.viz import viz_helpers as vh
from plottool import interact_helpers as ih
(print, rrr, profile) = ut.inject2(__name__, '[interact_sver]')
def ishow_sver(ibs, ai... | [
{
"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 | ibeis/viz/interact/interact_sver.py | brmscheiner/ibeis |
import pytest
from flower_bed_designer import create_app
@pytest.fixture
def app():
app = create_app({
'TESTING': True
})
yield app
@pytest.fixture
def client(app):
return app.test_client()
@pytest.fixture
def runner(app):
return app.test_cli_runner()
| [
{
"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/conftest.py | keithly/flower-bed-designer |
import asyncio
from typing import Optional
import aiohttp
from asgiproxy.config import ProxyConfig
class ProxyContext:
semaphore: asyncio.Semaphore
_session: Optional[aiohttp.ClientSession] = None
def __init__(
self,
config: ProxyConfig,
max_concurrency: int = 20,
) -> None:... | [
{
"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": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (exc... | 3 | asgiproxy/context.py | valohai/asgiproxy |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.