source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
from rest_framework import generics, authentication, permissions
from rest_framework.authtoken.views import ObtainAuthToken
from rest_framework.settings import api_settings
from user.serializers import UserSerializer, AuthTokenSerializer
class CreateUserView(generics.CreateAPIView):
"""Create a new user in the s... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
}... | 3 | app/user/views.py | frankRose1/recipe-app-api |
from django.shortcuts import render
from rest_framework.views import APIView
from rest_framework.response import Response
from rest_framework import exceptions
from common.serializers import UserSerializer
from core.models import User,Product,Link,OrderItem,Order
from common.authentication import JWTAuthentication
from... | [
{
"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 | ambassador/views.py | cforcross/django-vue-admin |
"""
* GTDynamics Copyright 2021, Georgia Tech Research Corporation,
* Atlanta, Georgia 30332-0415
* All Rights Reserved
* See LICENSE for the license information
*
* @file test_print.py
* @brief Test printing with DynamicsSymbol.
* @author Gerry Chen
"""
import unittest
from io import StringIO
from unittest.m... | [
{
"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 | python/tests/test_print.py | borglab/GTDynamics |
import unittest
from trove_classifiers import classifiers
from .. import types
class TypesTest(unittest.TestCase):
def test_classifiers_are_valid(self) -> None:
for license in types.KNOWN_LICENSES:
if license.trove_classifier:
with self.subTest(msg=license.shortname):
... | [
{
"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 | infer_license/tests/types.py | dfetch-org/infer-license |
from typing import List, Union, Optional
from mason.clients.responsable import Responsable
from mason.clients.response import Response
class ExecutedJob(Responsable):
def __init__(self, id: str, message: Optional[str] = None, logs: Optional[Union[List[Union[str, dict]], List[str]]] = None):
self.id = id
... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},... | 3 | mason/engines/execution/models/jobs/executed_job.py | kyprifog/mason |
# Copyright (c) 2012-2013, Mark Peek <mark@peek.org>
# All rights reserved.
#
# See LICENSE file for full license.
from aws import Action as BaseAction
from aws import BaseARN
service_name = 'Amazon Managed Service for Prometheus'
prefix = 'aps'
class Action(BaseAction):
def __init__(self, action=None):
... | [
{
"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_class_has_docstring",
"question": "Does every class in this file have a docstring?... | 3 | awacs/aps.py | mtrspringer/awacs |
# views.team.team
from flask import redirect, url_for, request, flash
from app.forms import CreateTeam as CreateTeamForm
from app.util import session as session_util, team as team_util
from .team import TeamView
class CreateTeamView(TeamView):
"""Create a team.
"""
def get_form(self):
return C... | [
{
"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 | app/views/team/create.py | FSU-ACM-OSSG/Contest-Server |
import unittest
from lambdata_axel.ds_tools import DSDataFrame
data = {'numbers': [0, 1, 2, 3, 4, 5, 6, 7],
"alphabet": ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h']}
class TestDSDataFrame(unittest.TestCase):
def setUp(self):
self.df = DSDataFrame(data)
def test_check_nulls(self):
column... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
... | 3 | test/DSDataFrame_test.py | axefx/lambdata-axel |
import sys
import warnings
warnings.filterwarnings('ignore')
from PyQt5 import QtCore, QtWidgets
from PyQt5.QtWidgets import QMainWindow, QLabel, QSlider
from PyQt5.QtCore import QSize, Qt, pyqtSlot, pyqtSignal
from PyQt5.uic import loadUi
class HelloWindow(QMainWindow):
pushButtonClicked = pyqtSignal()
val... | [
{
"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 | PXL_DIGITAL_JAAR_2/AI & Robotics/Week 5/code/from_ui_file.py | Limoentaart/PXL_IT |
from rctk.toolkit import Toolkit
from rctk.util import resolveclass
class AppException(Exception):
pass
class AppNotCallable(AppException):
""" The application is not callable. I.e. it's not a class """
pass
class AppNotRunnable(AppException):
""" The application does not have a run() method """
... | [
{
"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 | rctk/app.py | rctk/rctk |
# -*- coding: utf-8 -*-
# @创建时间 : 19/2/2018
# @作者 : worry1613(549145583@qq.com)
# GitHub : https://github.com/worry1613
# @CSDN : http://blog.csdn.net/worryabout/
from optparse import OptionParser
from gensim.models import word2vec
import logging
logging.basicConfig(format='%(asctime)s : %(levelname)s : %(messa... | [
{
"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 | w2v_model.py | worry1613/nlp-sentiment-analysis |
import os
import typer
from streamdeck_manager.core import Core
def end_sample_callback():
exit(0)
def main(asset_path: str=os.path.join(os.path.dirname(__file__), "..", "assets"),
photo: str="Harold.jpg"):
core = Core()
if len(core.streamdecks) <= 0:
print("Not Stream deck found")
... | [
{
"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 | streamdeck_manager/samples/tiled_image.py | vgonisanz/streamdeck_manager |
import tensorflow.keras as tfk
import tensorflow as tf
import tensorflow.keras.layers as layers
import json
import collections
from datetime import datetime
import os
class LrStepDecay(tfk.callbacks.Callback):
def __init__(self,
decay_rate,
decay_at):
super(L... | [
{
"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/callbacks.py | hz512/Smart-Parking-Enforcement-System |
# -*- coding: utf-8 -*-
"""Tests.
"""
import operator
from functools import partial, reduce
from mss.core.class_synonyms import Synonyms
def test_synonyms_creation(synonyms):
assert str(synonyms) == 'Synonyms<2 groups>'
def test_synonyms_iteration(synonyms):
assert list(synonyms) == [frozenset({'b', 'a'})... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
... | 3 | tests/core/test_synonyms.py | IgorZyktin/MediaStorageSystem |
from promissory_note.entities import Beneficiary, Emitter, PromissoryNote
from promissory_note.value_objects import Name, Cpf, Email
class IssuePromissoryNote:
def __init__(self, image_generation_service, email_promissory_note_issued):
self._image_generation_service = image_generation_service
self... | [
{
"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 | promissory_note/use_cases.py | flaviogf/promissory_note |
from __future__ import absolute_import
from flask import Blueprint, render_template
from webgrid_ta.extensions import gettext as _
main = Blueprint('main', __name__)
@main.route('/')
def index():
from webgrid import NumericColumn
from webgrid_ta.grids import PeopleGrid as PGBase
from webgrid_ta.model.e... | [
{
"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_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": ... | 3 | webgrid_ta/views.py | sourcery-ai-bot/webgrid |
import unittest
from rfapi.error import JsonParseError, MissingAuthError
class ApiClientTest(unittest.TestCase):
def test_json_parse_error(self):
resp = type('', (object,), {"content": ""})()
msg = "Could not parse"
e = JsonParseError(msg, resp)
self.assertEqual(str(e), msg)
d... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
}... | 3 | rfapi/test/test_errors.py | cestrada-rf/rfapi-python |
from django.shortcuts import render, redirect
from django.template.loader import get_template
from django.core.mail import EmailMessage
def home_page(request):
return render(request, 'bootstrap/home_page.html')
def features_page(request):
return render(request, 'bootstrap/features_page.html')
def pricing_page(r... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excludi... | 3 | django_webapp/views.py | Alexmhack/bootstrap_django |
# BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE
import sys
import pytest # noqa: F401
import numpy as np # noqa: F401
import awkward as ak # noqa: F401
def test_iterator():
content = ak.layout.NumpyArray(np.array([1.1, 2.2, 3.3]))
offsets = ak.layout.Index32(np.ar... | [
{
"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 | tests/test_0006-deep-iteration.py | colesbury/awkward-1.0 |
#!/usr/bin/python3
# -*- coding:utf-8 -*-
from ckuser import client,server
import os
def print_client_menu():
print("用户菜单:")
print("-"*25)
print("0"+"-"*10+"显示用户菜单"+"-"*10)
print("1"+"-"*10+"显示服务菜单"+"-"*10)
print("2"+"-"*10+"用户登录系统"+"-"*10)
print("3"+"-"*10+"用户修改信息"+"-"*10)
print("4"+"-"*10+"用户注册信息"+"-"*10)
pr... | [
{
"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 | app.py | ds19991999/CKUser |
from rest_framework import generics, authentication, permissions
from rest_framework.authtoken.views import ObtainAuthToken
from rest_framework.settings import api_settings
from user.serializers import UserSerializer, AuthTokenSerializer
class CreateUserView(generics.CreateAPIView):
serializer_class = UserSeria... | [
{
"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 | app/user/views.py | divae/recipe-app-api-me |
import sys
from ingenialink.ethercat.network import EthercatNetwork
def connect_slave():
net = EthercatNetwork("\\Device\\NPF_{192D1D2F-C684-467D-A637-EC07BD434A63}")
servo = net.connect_to_slave(
target=1,
dictionary='../../resources/dictionaries/cap-net-e_eoe_0.7.1.xdf')
return servo, n... | [
{
"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 | examples/ethercat/ecat_load_save_config.py | ingeniamc/ingenialink-python |
'''
Created by auto_sdk on 2016.05.10
'''
from top.api.base import RestApi
class AlibabaBaichuanAppeventUploadRequest(RestApi):
def __init__(self,domain='gw.api.taobao.com',port=80):
RestApi.__init__(self,domain, port)
self.appid = None
self.bizid = None
self.params = None
def getapiname(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": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
... | 3 | taobao_wechat_bot/top/api/rest/AlibabaBaichuanAppeventUploadRequest.py | zyphs21/myPythonPractise |
import subprocess
import os
class new_fifo_window():
def __init__(self, fifo_path):
self.fifo_path = fifo_path
try:
os.mkfifo(fifo_path)
except:
print('fifo already exists, but continue')
self.proc = subprocess.Popen(['xterm', '-e', 'cat %s' % fifo_path])
self.fd = open(fifo_path, 'w')
def write(... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
... | 3 | lib/io.py | xzhng120/Distributed_IGMP |
import logging
from unittest import TestCase
from tests.utils.hvac_integration_test_case import HvacIntegrationTestCase
class TestWrapping(HvacIntegrationTestCase, TestCase):
TEST_AUTH_METHOD_TYPE = 'approle'
TEST_AUTH_METHOD_PATH = 'test-approle'
def setUp(self):
super(TestWrapping, self).setUp... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
... | 3 | tests/integration_tests/api/system_backend/test_wrapping.py | ddeka2910/hvac |
from inspect import signature
def get_function_attr_values(function, attrs=None):
# Fetch default values from function attributes
# In:
# function: function module, function where values are fetched
# attrs: None returns all, str returns only the one specified... | [
{
"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 | utils/functions.py | doslindos/ml_crapwrap |
from __future__ import absolute_import, unicode_literals
import os
import sys
from opencc.clib import opencc_clib
__all__ = ['OpenCC', 'CONFIGS', '__version__']
__version__ = opencc_clib.__version__
_thisdir = os.path.dirname(os.path.abspath(__file__))
_opencc_share_dir = os.path.join(_thisdir, 'clib', 'share', 'op... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
... | 3 | lib-opencc-android/src/main/jni/OpenCC/python/opencc/__init__.py | huxiaomao/android-opencc |
from flask import jsonify, request, g, current_app, Response
from . import api
@api.route("/provider", methods=["GET"])
def get_provider():
return jsonify(provider=current_app.config["LIGHT_PROVIDER"])
@api.route("/lights/<int:lid>/color", methods=["POST"])
def set_color(lid):
params = request.json
red... | [
{
"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 | lioght/blueprints/api/views.py | Ketouem/lioght |
import pytest
import sys
from math import isclose
from mock import patch, call
from pathlib import Path
from textwrap import dedent
from phykit.phykit import Phykit
here = Path(__file__)
@pytest.mark.integration
class TestTotalTreeLength(object):
@patch("builtins.print")
def test_total_tree_length0(self, mo... | [
{
"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/integration/tree/test_total_tree_length_integration.py | yuzhenpeng/PhyKIT |
from struct import unpack
def calc8bitFletcherChecksum(msgBytes):
"""Calculate 8-bit Fletcher checksum for Li-1 radio packets.
Args:
msgBytes: Raw message bytes to calculate checksum of.
"""
ck_A = 0
ck_B = 0
for msgByte in msgBytes:
ck_A += int(msgByte)
ck_B += ck_A
... | [
{
"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 | python/mesh/generic/checksum.py | MinesJA/meshNetwork |
from hazelcast.serialization.bits import *
from hazelcast.protocol.client_message import ClientMessage
from hazelcast.protocol.codec.transactional_map_message_type import *
REQUEST_TYPE = TRANSACTIONALMAP_GET
RESPONSE_TYPE = 105
RETRYABLE = False
def calculate_size(name, txn_id, thread_id, key):
""" Calculates t... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer":... | 3 | hazelcast/protocol/codec/transactional_map_get_codec.py | buraksezer/hazelcast-python-client |
# -*- coding: utf-8 -*-
"""
Contains a case converter mode.
"""
from pyqode.core.api import TextHelper
from pyqode.core.api.mode import Mode
from pyqode.qt import QtCore, QtWidgets
class CaseConverterMode(Mode):
""" Provides context actions for converting case of the selected text.
Converts selected text to ... | [
{
"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 | pyqode/core/modes/case_converter.py | SunChuquin/pyqode.core |
s="23"
dic={"0":"0","1":"1","2":"abc","3":"def","4":"ghi","5":"jkl",
"6":"mno","7":"pqrs","8":"tuv","9":"wxyz","*":"+","#":"#"}
def fun1(s):
n=len(s)
ans=[]
if not s:
return []
fun2(ans,s,"",0)
return ans
def fun2(ans,s,cur,start):
if start==len(s):
ans.append(cu... | [
{
"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 | BACKTRACKING/Letter Phone.py | rajansh87/Algorithms-Implementations |
#!/usr/bin/python
import sys, argparse, os
from subprocess import call
from multiprocessing.dummy import Pool as ThreadPool
###################################################################
#This is a phython script to download fastq files from ENA
#You can use this directly with the enaFileParser output
##########... | [
{
"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 | get_url.py | tracysmith/RGAPepPipe |
# Defines functionality used by all types of log artifacts, these
# can be things like SOQL Queries, Code Units, Debug Statements, etc
class Token:
def __init__(self, text):
self.text = text
self.segments = text.split('|')
self.type = None if len(self.segments) < 2 else self.segments[1]
... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding se... | 3 | src/tokens.py | ncino/force-tools |
# Copyright (c) 2015 Kurt Yoder
# See the file LICENSE for copying permission.
from . import common
class Path(common.NaiveRepr):
def __init__(self, *args, **kwargs):
# initialize all fields as None
(self.inode, self.blocks, self.perms, self.link_count, self.owner,
self.group, self.size... | [
{
"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 | bassist/bassist/systems/path.py | Doveps/mono |
import unittest
import numpy as np
from nlpatl.sampling.certainty import MostConfidenceSampling
class TestSamplingConfidence(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.data = np.array(
[
[0.01689184, 0.02989921, 0.92348951, 0.0158317, 0.01388775],... | [
{
"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/sampling/certainty/test_most_confidence.py | dumpmemory/nlpatl |
# -*- coding: utf-8 -*-
"""Test configs."""
from openair.app import create_app
from openair.settings import DevConfig, ProdConfig
def test_production_config():
"""Production config."""
app = create_app(ProdConfig)
assert app.config['ENV'] == 'prod'
assert app.config['DEBUG'] is False
assert app.co... | [
{
"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 | tests/test_config.py | kraeki/openair-jac |
from glouton.infrastructure.satnogClient import SatnogClient
import os
import requests
class SatnogDbClient(SatnogClient):
def __init__(self):
SatnogClient.__init__(self)
self._url = self.config['DEFAULT']['DB_API_URL']
def get(self, url, params=None):
return requests.get(url, params=... | [
{
"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 | glouton/infrastructure/satnogDbClient.py | DL4PD/glouton-satnogs-data-downloader |
import pytest
from djcookie_demo_proj.users.models import User
from djcookie_demo_proj.users.tests.factories import UserFactory
@pytest.fixture(autouse=True)
def media_storage(settings, tmpdir):
settings.MEDIA_ROOT = tmpdir.strpath
@pytest.fixture
def user() -> User:
return UserFactory()
| [
{
"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": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
}... | 3 | djcookie_demo_proj/conftest.py | muutttu/djcookie_demo_proj |
"""
Load or save values to a file.
Shelves work well for storing data, but they are slow to access
repeatedly - especially for large data sets. This module allows
you to store data to a file and then load it back into the workspace.
When the data is stored, a python module is also created as the
"namespace for the da... | [
{
"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 | scipy/io/data_store.py | lesserwhirls/scipy-cwt |
class TestResults:
def __init__(self, name):
self.name = name
self.results = []
def add_result(self, result):
self.results.append(result) | [
{
"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/indor/test_results.py | nokia-wroclaw/innovativeproject-resttest |
"""Move (v)tpm_policy to JSONPickleType
Revision ID: f35cdd35eb83
Revises: 7d5db1a6ffb0
Create Date: 2021-08-02 15:26:34.427156
"""
import sqlalchemy as sa
from alembic import op
import keylime
# revision identifiers, used by Alembic.
revision = "f35cdd35eb83"
down_revision = "7d5db1a6ffb0"
branch_labels = None
dep... | [
{
"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 | keylime/migrations/versions/f35cdd35eb83_move_v_tpm_policy_to_jsonpickletype.py | kkaarreell/keylime |
"""
Insertion:
insert_one_bit(num, bit, i): insert exact one bit at specific position
For example:
Input: num = 10101 (21)
insert_one_bit(num, 1, 2): 101101 (45)
insert_one_bit(num, 0 ,2): 101001 (41)
insert_one_bit(num, 1, 5): 110101 (53)
insert_one_bit(num, 1, 0): 101011 (43)
insert_mult_bits(num, bits, len, i): 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_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding se... | 3 | algorithms/bit/insert_bit.py | zhengli0817/algorithms |
# -*- coding: utf-8 -*-
"""Version information for :mod:`geometric_graphs`.
Run with ``python -m geometric_graphs.version``
"""
import os
from subprocess import CalledProcessError, check_output # noqa: S404
__all__ = [
"VERSION",
"get_version",
"get_git_hash",
]
VERSION = "0.0.4-dev"
def get_git_has... | [
{
"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 | src/geometric_graphs/version.py | cthoyt/geometric-graphs |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from functools import lru_cache
from time import time
from typing import Tuple
import nevergrad as ng
from llvm_autotuning.optimization_target... | [
{
"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": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (e... | 4 | examples/llvm_autotuning/autotuners/nevergrad_.py | sogartar/CompilerGym |
### Errors ###################################################################
class ZincError(object):
def __init__(self, code, message):
self.code = code
self.message = message
# TODO: might be worst python ever
class ZincErrors(object):
OK = ZincError(0, "OK")
INCORRECT_SHA = ZincError... | [
{
"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 | src/zinc/errors.py | mindsnacks/Zinc |
#!/usr/bin/env python3
import sys
import io
def decompress(stream):
output = io.BytesIO()
planes = 0
while planes < 0x30 * 2:
favourite = stream.read(1)
control = stream.read(1)[0]
for x in range(8):
if control & 0x80:
output.write(stream.read(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": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": tru... | 3 | menu/spof.py | Jolmberg/fn22snesticle |
# -*- coding: UTF-8 -*-
"""
此脚本用于随机生成线性模型数据、定义模型以及其他工具
"""
import numpy as np
import tensorflow as tf
def generateLinearData(dimension, num):
"""
随机产生线性模型数据
参数
----
dimension :int,自变量个数
num :int,数据个数
返回
----
x :np.array,自变量
y :np.array,因变量
"""
np.random.seed(1024)... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer"... | 3 | ch06-sgd/utils.py | GaoX2015/intro_ds |
"""Converts MNIST data to TFRecords file format with Example protos."""
import os
import tensorflow as tf
from PIL import Image
import numpy as np
from matplotlib.pyplot import imshow
def gen_image(arr):
try:
two_d = (np.reshape(arr, (28, 28)) * 255).astype(np.uint8)
img = Image.fromarray(two_d, 'L... | [
{
"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 | Modules/3 - Distributed Training with TensorFlow Notebook/utils.py | kendoo-solutions/amazon-sagemaker-workshop |
import pexpect
class Ser2NetConnection():
def __init__(self, device=None, conn_cmd=None, **kwargs):
self.device = device
self.conn_cmd = conn_cmd
def connect(self):
pexpect.spawn.__init__(self.device,
command='/bin/bash',
ar... | [
{
"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 | devices/ser2net_connection.py | premandfriends/boardfarm-1 |
class Factory:
class __Factory:
def __init__(self):
self._extend_registry = {}
self._class_registry = {}
def extend(self, object_name, extend_class, parent_class):
if object_name not in self._extend_registry:
self._extend_registry[object_name] = [... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false... | 3 | synergine/lib/factory/factory.py | buxx/synergine |
import cv2
class MaskedFaceDrawer:
def __init__(self, mask_detector, face_detector):
self.mask_detector = mask_detector
self.face_detector = face_detector
def rectangle_faces(
self,
image,
mask_color=(0, 255, 0),
no_mask_color=(255, 0, 0),
mask_threshol... | [
{
"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 | mask_detector/drawers.py | osamhack2021/AI_Mask_Detector |
import os
import re
import subprocess
import tempfile
def backups(destination, prefix):
name_re = re.compile(r'^{}(?:\.[0-9]+)?$'.format(prefix))
def _key(name):
return [int(char) if char.isdigit() else char
for char in re.split(r'([0-9]+)', name)]
paths = []
for name in sor... | [
{
"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 | poor_mans_time_machine/__init__.py | neuroid/poor-mans-time-machine |
from Models.Analysis import Analysis
from Models.Detection import Detection
from Services.Writers.ReportWriter import ReportWriter
class CSVReportWriter(ReportWriter):
def __init__(self, analysis: Analysis, separator=";", shape=Detection.DefaultDetectionShape()):
self._separator = separator
... | [
{
"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 | Services/Writers/CSVReportWriter.py | shell-done/Spongo_IHM |
from flask import render_template, send_from_directory, request, jsonify
from app import app
import hashlib, uuid
import game
from app import __config__ as config
def compare_password(password, correct_hash):
"""
Compares password with hash
"""
hashed_password = hashlib.sha512(password).hexdigest()
... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 lines?",
"answer": false... | 3 | app/views.py | rdelfin/zork-cortana |
#!/usr/bin/env python
"""Voted ensembling for tagging."""
from typing import Iterable
import argparse
import collections
import logging
import sys
import ensembling
import textproto
def vote(all_tags: Iterable[str]) -> str:
"""Max-voting ensembling strategy.
This implements an unweighted max-voting scheme... | [
{
"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 | vote_ensemble.py | kylebgorman/SOTA-taggers |
# -*- coding: utf-8 -*-
"""
Created on Tue May 8 16:44:03 2018
@author: Muhammad Yahya
"""
class Example:
name = "Example"
@staticmethod
def static():
print ("%s static() called" % Example.name)
class Offspring1(Example):
name = "Offspring1"
class Offspring2(Example):
name = "Offspring... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class 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": false
},
{... | 3 | untitled0.py | vcarehuman/tf-pose-estimation-master |
class BooleanData:
def __init__(self, objects):
self.objects = list(objects)
@ property
def head(self):
return(self.objects[0])
@ property
def tail(self):
if len(self.objects) > 1:
return self.objects[1:]
else:
return []
class BooleanUnion(... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answ... | 3 | src/spacemapping_curve/combinations.py | wenqian157/spacemapping_curve |
"""anjou.config
Reads and parses the configuration YAML.
Functions:
read_config(str) -> dict (throws ConfigException)
"""
from cerberus import Validator
from cerberus.validator import DocumentError
from yaml import safe_load
from anjou.model import CONFIG_SCHEMA, ConfigException
def _is_valid(config: dict) ->... | [
{
"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 | anjou/config.py | donaldacmartin/anjou |
# -*- coding: utf-8 -*-
"""
File Name: copyRandomList
Author : jing
Date: 2020/4/13
复杂链表的复制
https://leetcode-cn.com/problems/copy-list-with-random-pointer/
"""
# Definition for a Node.
class Node:
def __init__(self, x: int, next: 'Node' = None, random: 'Node' = None):
... | [
{
"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 | jianzhioffer/copyRandomList.py | summer-vacation/AlgoExec |
import threading
# 28 - 98.52, 15.6 - 36.67
class ZeroEvenOdd:
def __init__(self, n):
self.n = n
self.turn = 0
self.cv = threading.Condition()
self.odds = (i for i in range(1, n + 1) if i & 1)
self.evens = (i for i in range(1, n + 1) if not i & 1)
# print... | [
{
"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 | Python/Concurrency/1116.py | DimitrisJim/leetcode_solutions |
import sys
import traceback
import json
import time
import asyncio
import logging
import pprint
import ssl
import pathlib
import functools
import websockets
import threading
import random
logger = logging.getLogger(__name__)
async def hello(websocket, path, q):
while True:
try:
message_str... | [
{
"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/peers/server.py | bcgov/switchover-agent |
from typing import Generator
from app.db.session import SessionLocal
from fastapi import Depends, HTTPException, status
from fastapi.security import OAuth2PasswordBearer
from app.core.config import settings
from sqlalchemy.orm import Session
from jose import jwt
from pydantic import ValidationError
from app import cru... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return t... | 3 | backend-service/users-service/app/app/api/deps.py | abhishek70/python-petclinic-microservices |
# _*_ coding: utf-8 _*_
"""
Created by Allen7D on 2018/6/17.
"""
from sqlalchemy import Column, Integer, String, ForeignKey
from app.models.base import Base
from app.models.image import Image
__author__ = 'Allen7D'
class Theme2Product(Base):
__tablename__ = 'theme_product'
theme_id = Column(Integer, ForeignKey(... | [
{
"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 | app/models/m2m.py | zhangadrian/mini-shop-server |
import json
from pywps import Process, LiteralInput, ComplexOutput, Format
class TestJson(Process):
def __init__(self):
inputs = [LiteralInput('name', 'Input name', data_type='string')]
outputs = [ComplexOutput('output', 'Referenced Output',
supported_formats=[Format('application... | [
{
"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 | processes/jsonprocess.py | talos-gis/talos_api |
import shutil
import sys
import hashlib
import pathlib
import json
import base64 as encoder
import os
import time
from pathlib import Path
def zip_code(output: pathlib.Path, to_zip: pathlib.Path):
shutil.make_archive(output, 'zip', to_zip)
with open(output + '.zip',"rb") as f:
bytes = f.read()
... | [
{
"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 | deployment/metadata/compress_code.py | hyperglance/azure-rule-automations |
from objectives.results._objective_result import *
from objectives.results._add_sub_stat import add_stat_character, sub_stat_character
STAMINA_ADDRESS = 0x161c
character_add = {}
character_sub = {}
def add_stamina(character):
if character not in character_add:
character_add[character] = add_stat_characte... | [
{
"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 | objectives/results/stamina_random.py | HansGR/WorldsCollide |
from abc import ABCMeta, abstractmethod
class Serializable:
"""Interface for Serialization.
"""
__metaclass__ = ABCMeta
@abstractmethod
def read(self, in_stream: bytes):
"""Convert from bytes to Serializable
Args:
in_stream (bytes): Input of bytes to deserialize
... | [
{
"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 | python/edna/src/edna/serializers/__init__.py | asuprem/edna |
from Locators.cart_locators import CartLocators
from Objects.product import Product
from Pages.base_page import BasePage
class CartPage(BasePage):
def __init__(self, driver):
super().__init__(driver)
def get_product_info(self, index):
name = self.get_text(CartLocators.LABEL_PRODUCT_NAME(index))
desc ... | [
{
"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 | Pages/cart_page.py | tienn321/saucedemo |
"""
Provides access to /etc/cwlogd.ini config values
"""
import configparser
CONFIG_PATH = "/etc/cwlogd.ini"
_config = None
def _get_config():
"""
Either returns an already loaded configparser
Or creates a configparser and loads ini config at /etc/cwlogd.ini
"""
global _config
if _config is N... | [
{
"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 | daemon/globus_cw_daemon/config.py | sirosen/globus-cwlogger |
from dipy.core.ndindex import ndindex
import numpy as np
from numpy.testing import assert_array_equal
def test_ndindex():
x = list(ndindex((1, 2, 3)))
expected = [ix for ix, e in np.ndenumerate(np.zeros((1, 2, 3)))]
assert_array_equal(x, expected)
def test_ndindex_0d():
x = list(ndindex(np.array(1)... | [
{
"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 | dipy/core/tests/test_ndindex.py | martcous/dipy |
import torch
import torch.nn as nn
"""
usage
z_rand = generate_noise([1,nzx,nzy], device=opt.device)
z_rand = z_rand.expand(1,3,Z_opt.shape[2],Z_opt.shape[3])
z_prev1 = 0.95*Z_opt +0.05*z_rand
"""
def upsampling(im, sx, sy):
m = nn.Upsample(size=[round(sx), round(sy)], mode='... | [
{
"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 | src/augment/basic_augmentation/noise.py | TencentYoutuResearch/SelfSupervisedLearning-DSM |
from typing import List
from shapely.geometry import Point, MultiPoint, Polygon, MultiPolygon, LineString, MultiLineString
from shapely.geometry.base import BaseGeometry
def assign_all() -> bool:
geoms = [Point, MultiPoint, Polygon, MultiPolygon, LineString, MultiLineString]
assign_udt_shapely_objects(geoms=... | [
{
"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_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
... | 3 | geo_pyspark/utils/prep.py | Imbruced/geo_pyspark |
#!/usr/bin/env python
"""pattern.py: An example like <Rolling an image> in Pillow document.
"""
import os.path
from PIL import Image
def run(filepath):
"""Create a wallpaper image from a PNG file."""
src = Image.open(filepath)
target = swap_quadrants(src)
paste_with_alpha(target, src, (0, 0), 0x10)
... | [
{
"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 | source/_sample/pillow/pattern.py | showa-yojyo/notebook |
class Pessoa:
def __init__(self, *filhos, nome=None, idade=35):
self.idade = idade
self.nome = nome
self.filhos = list(filhos)
def cumprimentar(self):
return f'Olá {id(self)}'
if __name__ == '__main__':
brenda = Pessoa(nome='Brenda', idade=26)
ricardo = Pessoa(brenda,no... | [
{
"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 | oo/pessoa.py | ricardozattera/pythonbirds |
class Solution(object):
def longestValidParentheses(self, s):
"""
:type s: str
:rtype: int
"""
def length(it, start, c):
depth, longest = 0, 0
for i in it:
if s[i] == c:
depth += 1
else:
... | [
{
"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 | April 2021/Longest Valid Parentheses.py | parikshitgupta1/leetcode |
from old.vl8.function.bound_function import BoundFunction
import unittest
class TestBoundFunction(unittest.TestCase):
def test_a_simple_function(self):
f = BoundFunction(
'test.old.function.test_function.simp(required: true)'
)
assert f.missing == set()
assert tuple(f('... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"ans... | 3 | test/old/function/test_bound_function.py | rec/sorta |
#pylint: disable=too-few-public-methods
""" Kwargs is the only True python micro-framework that doesn't limit your creativity™. """
def run(callback, *args, **kwargs):
""" Alias for App.run """
return callback(*args, **kwargs)
class App(object):
""" App represents Kwargs application instance. """
de... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answ... | 3 | Backend/equation test/venv/Lib/site-packages/kwargs/__init__.py | chehansivaruban/Cyber---SDGP |
"""Common test functions."""
from unittest.mock import MagicMock, PropertyMock, patch
import pytest
from supervisor.bootstrap import initialize_coresys
# pylint: disable=redefined-outer-name
@pytest.fixture
def docker():
"""Mock Docker API."""
with patch("supervisor.coresys.DockerAPI") as mock:
yie... | [
{
"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/conftest.py | gdrapp/supervisor |
import hashlib
import threading
import string
import SocketServer
import Crypto.Cipher
import Crypto.Random.random
import base64
from secret import iv, pk
def encrypt(message):
return base64.b64encode(Crypto.Cipher.AES.new(pk, Crypto.Cipher.AES.MODE_CFB, iv).encrypt(message))
def check_proof(prefix, proof):
... | [
{
"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 | problem13/code.py | jacor-/TuentiChallenge5 |
from django.db import models
import pytz
from django.utils import timezone
# Create your models here.
class Task(models.Model):
# Fields
created_at = models.DateTimeField(editable=False, auto_now_add=True)
updated_at = models.DateTimeField(editable=False, auto_now=True)
title = models.CharField(max_le... | [
{
"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 | tasks/models.py | Quill-ToDo/App |
import pytest
import numpy as np
import context
from sequentations.augmentations.transforms import RandomGamma, ColorJitter, Normalize
def test_random_gamma():
arr = np.full((2, 100, 100, 3), fill_value=127, dtype=np.uint8)
aug = RandomGamma()
data = aug(image=arr, force_apply=True)['image']
assert ... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer"... | 3 | tests/test_augmentations_transform.py | PUTvision/sequentations |
"""Unit tests for decorators."""
import pytest
from taukit.base.decorators import interface
@interface({
'x': {'type': 'string'},
'y': {'type': 'integer'}
})
def tfunc(x, y, z):
return x*(y+int(z))
tfunc2 = interface({'z': {'type': 'integer'}})(tfunc)
class A:
@interface({
'x': {'type': 'str... | [
{
"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 | test/base/test_decorators.py | sztal/taukit |
import unittest
def one_away(str1, str2):
count = 0
str1, str2 = (str1, str2) if (len(str1) > len(str2)) else (str2, str1)
for c in str1:
if c not in str2:
count += 1
if count > 1:
return False
return True
class Test(unittest.TestCase):
'''Test Cases'''
data = [('pale', 'ple', Tr... | [
{
"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 | internships/CtCI/ch1/one_away.py | AmrMKayid/KayAlgo |
import argparse
import json
import os
import _jsonnet
import tqdm
from seq2struct import datasets
from seq2struct import models
from seq2struct.utils import registry
from seq2struct.utils import vocab
class Preprocessor:
def __init__(self, config):
self.config = config
self.model_preproc = regist... | [
{
"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 | rat-sql-gap/seq2struct/commands/preprocess.py | JuruoMP/gap-exp |
#!/usr/bin/python3
#https://practice.geeksforgeeks.org/problems/stepping-numberswrong-output/0
def bfs(x, n, res):
"""
The stepping number is generated from existing stepping numbers
for ex: 1 generates 12, 10
2 generates 21, 23
"""
q = []
q.append(x)
while q:
p = q.p... | [
{
"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 | full-problems/steppingNumber.py | vikas-t/DS-Algo |
#!/usr/bin/env python
"""Functions for test_tester.py"""
from shatter.solver import *
__author__ = 'juan pablo isaza'
@solve()
def collision(a):
pass
@solve()
def non_collision(a, b, c, d):
pass
@solve()
def basic_if(a, b):
pass
| [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding sel... | 3 | tests/generated_code/tester_functions.py | jisazaTappsi/mastermind |
import random
import socket
import sys
import crypto
class Client:
def __init__(self, name: str):
self.name = name
def register(self):
sock = socket.socket()
sock.connect(('localhost', 8081))
n = int.from_bytes(sock.recv(16), sys.byteorder)
sock.send('register'.encode... | [
{
"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 | 4course/inf_protection/course/client.py | soul-catcher/sibsutis |
import os
class MockRequests:
def __init__(self):
return
def get(self, source):
source_no_http = source.replace("http://","")
test_website_path = f"{os.path.dirname(os.path.abspath(__file__))}/test_data/test_website/{source_no_http}"
with open(test_website_path,'r') ... | [
{
"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 | tests/mock_requests.py | OtGabaldon/multiSourceWordMaps |
"""add third party roles to lemur
Revision ID: 5bc47fa7cac4
Revises: c05a8998b371
Create Date: 2017-12-08 14:19:11.903864
"""
# revision identifiers, used by Alembic.
revision = "5bc47fa7cac4"
down_revision = "c05a8998b371"
from alembic import op
import sqlalchemy as sa
def upgrade():
op.add_column(
"... | [
{
"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 | lemur/migrations/versions/5bc47fa7cac4_.py | rajatsharma94/lemur |
from typing import Optional
from cryptoxlib.exceptions import CryptoXLibException
class AAXException(CryptoXLibException):
pass
class AAXRestException(AAXException):
def __init__(self, status_code: int, body: Optional[dict]):
super().__init__(f"Rest API exception: status [{status_code}], response [{body}]")
... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class 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": false
},
{... | 3 | cryptoxlib/clients/aax/exceptions.py | PetrZufan/cryptoxlib-aio |
from pytest import raises
from poetcli.main import PoetCLITest
def test_poetcli():
# test poetcli without any subcommands or arguments
with PoetCLITest() as app:
app.run()
assert app.exit_code == 0
def test_poetcli_debug():
# test that debug mode is functional
argv = ['--debug']
... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer"... | 3 | tests/test_poetcli.py | jkerola/poetcli |
import sqlite3
conn = sqlite3.connect("mhd.db")
def insert_user(name, password):
global users
users = count_users()
conn.execute(
"INSERT INTO USERS (ID,NAME,PASSWORD) VALUES ("
+ str(users + 1)
+ ", '"
+ name
+ "', '"
+ password
+ "')"
... | [
{
"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 | insert_functions.py | MHD-Team/MHD-Backend |
class Solution:
def groupAnagrams(self, strs):
if not strs or len(strs)==0:
return strs
memo=dict()
for i in strs:
temp=self.sortString(i)
if memo.get(temp):
memo[temp].append(i)
else: memo[temp]=[i]
return memo.values... | [
{
"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 | Math/Leetcode49.py | Rylie-W/LeetRecord |
#!/usr/bin/env python
from datetime import datetime
from email.utils import parsedate
from time import mktime
from circuits.web import Controller
from .helpers import urlopen
class Root(Controller):
def index(self):
self.expires(60)
return "Hello World!"
def nocache(self):
self.exp... | [
{
"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/web/test_expires.py | spaceone/circuits |
# GENERATED BY KOMAND SDK - DO NOT EDIT
import insightconnect_plugin_runtime
import json
class Component:
DESCRIPTION = "Convert HTML to Markdown"
class Input:
HTML = "html"
HTML_STRING = "html_string"
class Output:
MARKDOWN = "markdown"
MARKDOWN_STRING = "markdown_string"
class Html... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class 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": false
},
{... | 3 | plugins/markdown/komand_markdown/actions/html_to_markdown/schema.py | lukaszlaszuk/insightconnect-plugins |
#from time import *
from grovepi import *
from paho.mqtt.client import *
buzzer = 3
pinMode(buzzer, "OUTPUT")
MQTT_BROKER = "192.168.56.1" #The ip address will be vary based on where and how you connect to the Internet
#MQTT_BROKER = "broker.emqx.io" #using public mqtt broker to act as subsriber
MQTT_TOPIC =... | [
{
"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 | BAIT2123 Internet Of Things/Practical/Practical 7/test10.py | loozixuan/SoftwareSystemsDevelopment-Y2S1 |
import logging
from dataclasses import dataclass, field
from dulwich import porcelain
from dulwich.porcelain import GitStatus
from dulwich.repo import Repo
from itertools import chain
from pathlib import Path
from typing import Any
from .anki_repo import AnkiRepo
logger = logging.getLogger(__name__)
@dataclass
cla... | [
{
"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 | crowd_anki/history/dulwich_repo.py | katrinleinweber/CrowdAnki |
from sqlalchemy import Column
from sqlalchemy import ForeignKey
from sqlalchemy import Integer
from sqlalchemy import LargeBinary
from sqlalchemy import String
from chainerui import database
class Bindata(database.BASE):
__tablename__ = 'bindata'
id = Column(Integer, primary_key=True)
asset_id = Column(... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self... | 3 | chainerui/models/bindata.py | chainer/chainerui |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.