source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
# ๊ณ์ฐ๊ธฐ ์์ . ์ค๋ฒ๋ผ์ด๋์ ํ์ฉ.
class Cal(object):
_history = []
def __init__(self, v1, v2):
if isinstance(v1, int):
self.v1 = v1
if isinstance(v2, int):
self.v2 = v2
def add(self):
result = self.v1+self.v2
Cal._history.append("add : %d+%d=%d" % (self.v1, sel... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?... | 3 | opentutorials_python2/opentutorials_python2/19_Override/2_Override_deepen.py | dongrami0425/Python_OpenCV-Study |
import os
from sanic import Sanic, response as res
from sanic.exceptions import NotFound
from sanic.websocket import ConnectionClosed
import json
from database import get_messages, post_message
# initiate the sanic app
app = Sanic('app')
# list of connected clients
clients = set()
# function that sends a websocket m... | [
{
"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 | main.py | andreaskvam/python-chat |
#!/usr/bin/env python3
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# sof... | [
{
"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 | empower/cli/lomm_lns_commands/list_lenddevs.py | ericbrinckhaus/empower-runtime-modified |
class Person:
somePublicProp = 32
# Costruttore; il primo parametro deve essere il self (this in C++)
def __init__(self, name, age):
self.name = name
self.age = age
p1 = Person("Davide", 23)
print(p1.name)
print(p1.age)
# Per cancellare l'oggetto p1
del p1
class Student(Person):
def __init__(self, name, ag... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true... | 3 | oop.py | LoZioo/PythonExamples |
from conans import ConanFile, CMake, tools
import os
class TestPackageConan(ConanFile):
settings = "os", "arch", "compiler", "build_type"
generators = "cmake", "cmake_find_package_multi"
def build_requirements(self):
if self.settings.os == "Macos" and self.settings.arch == "armv8":
# ... | [
{
"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 | recipes/librasterlite/all/test_package/conanfile.py | dpronin/conan-center-index |
import pytest
import numpy as np
from numpy.testing import assert_allclose
from astropy.stats.lombscargle.implementations.mle import design_matrix, periodic_fit
@pytest.fixture
def t():
rand = np.random.RandomState(42)
return 10 * rand.rand(10)
@pytest.mark.parametrize('freq', [1.0, 2])
@pytest.mark.parame... | [
{
"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 | astropy/stats/lombscargle/implementations/tests/test_mle.py | b1quint/astropy |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# (c) Camille Scott, 2019
# File : conftest.py
# License: MIT
# Author : Camille Scott <camille.scott.w@gmail.com>
# Date : 12.12.2019
import os
import shutil
import pytest
from .utils import hmmscan_cmd, run_shell_cmd
TEST_DIR = os.path.dirname(__file__)
DATA_DIR... | [
{
"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/conftest.py | camillescott/fuckitall |
from env_checker_error import EnvCheckerError
class ProcessRunningError(Exception):
def __init__(self, process_name):
self.process_name = process_name
def resolve(self):
raise EnvCheckerError(
"`%s` cannot be running while Ice is being run" %
self.process_name)
| [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
... | 3 | ice/error/process_running_error.py | reavessm/Ice |
class UnpackException(Exception):
"""Base class for some exceptions raised while unpacking.
NOTE: unpack may raise exception other than subclass of
UnpackException. If you want to catch all error, catch
Exception instead.
"""
class BufferFull(UnpackException):
pass
class OutOf... | [
{
"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 | TimeWrapper_JE/venv/Lib/site-packages/pip/_vendor/msgpack/exceptions.py | JE-Chen/je_old_repo |
import pathlib
import numpy as np
from context import RESOURCE_PATH
import rmsd
def test_kabash_fit_pdb():
filename_p = pathlib.PurePath(RESOURCE_PATH, "ci2_1r+t.pdb")
filename_q = pathlib.PurePath(RESOURCE_PATH, "ci2_1.pdb")
p_atoms, p_coord = rmsd.get_coordinates_pdb(filename_p)
q_atoms, q_coord... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"ans... | 3 | tests/test_kabsch_weighted.py | hengwei-chan/rmsd-to-calculate-structural-difference-between-2-cmps |
import os
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from .base import Base
class MapperBase():
user = os.getenv("MYSQL_USER")
key = os.getenv("MYSQL_KEY")
host = os.getenv("MYSQL_HOST")
port = os.getenv("MYSQL_PORT")
def __init__(self, database):
self.... | [
{
"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 | api/insights/insights/infrastructure/mysql/orm/mapper_base.py | manisharmagarg/qymatix |
"""
Pylibui test suite.
"""
from pylibui.controls import Slider
from tests.utils import WindowTestCase
class SliderTest(WindowTestCase):
def setUp(self):
super().setUp()
self.slider = Slider(0, 100)
def test_value_initial_value(self):
"""Tests the sliders's `value` initial value is... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
... | 3 | tests/test_slider.py | Yardanico/pylibui-cffi |
from __future__ import unicode_literals
from django.contrib.auth.models import AbstractBaseUser
from django.db import models
class TestUser(AbstractBaseUser):
identifier = models.CharField(max_length=40, unique=True, db_index=True)
uid_number = models.IntegerField()
USERNAME_FIELD = 'identifier'
de... | [
{
"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 | tests/models.py | ThibaultVigier/django-auth-ldap |
import cv2
class VideoCamera(object):
def __init__(self):
# Using OpenCV to capture from device 0. If you have trouble capturing
# from a webcam, comment the line below out and use a video file
# instead.
# self.video = cv2.VideoCapture(0)
self.image = None
self.cach... | [
{
"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 | camera.py | fanzhe98/FaceRecoCamera |
import unittest
import cpmpy as cp
from cpmpy.expressions import *
from cpmpy.expressions.core import Operator
class TestSum(unittest.TestCase):
def setUp(self):
self.iv = cp.intvar(0, 10)
def test_add_int(self):
expr = self.iv + 4
self.assertIsInstance(expr, Operator)
self.a... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": tru... | 3 | tests/test_expressions.py | hakank/cpmpy |
import os
from ibm_watson import LanguageTranslatorV3
from ibm_cloud_sdk_core.authenticators import IAMAuthenticator
from dotenv import load_dotenv
load_dotenv()
apikey = os.environ['apikey']
url = os.environ['url']
authenticator = IAMAuthenticator(apikey)
translator_instance = LanguageTranslatorV3(
version='201... | [
{
"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 | final_project/machinetranslation/translator.py | SlenderShield/xzceb-flask_eng_fr |
from . import common
from audio_toolbox import sox
class PitchDeformer:
SUFFIX = '.pitch@n'
def __init__(self, input_files_key, output_files_key, semitones):
self.input_files_key = input_files_key
self.output_files_key = output_files_key
self.semitones = semitones
def execute(sel... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a ty... | 3 | jobs/pitch_deformer.py | nSimonFR/spoken_language_dataset |
#!/usr/bin/env python
import gtk
import Editor
def main(filenames=[]):
"""
start the editor, with a new empty document
or load all *filenames* as tabs
returns the tab object
"""
Editor.register_stock_icons()
editor = Editor.EditorWindow()
tabs = map(editor.load_document, filenames)
... | [
{
"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 | odml/gui/__main__.py | carloscanova/python-odml |
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import get_object_or_404, render
from django.urls import reverse
from django.template import loader
from django.contrib import messages
from django.views import generic
from django.views.generic.base import TemplateView
from django.utils i... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"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 | SecuriTree/views.py | davymaish/django-SecuriTree |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import gzip
import sys
from astropy.extern.six import StringIO
from astropy.extern.six.moves import urllib
from astropy.io import fits
__all__ = ['chunk_report','chunk_read']
def chunk_report(bytes_so_far, chunk_size, total_size):
if total_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": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer"... | 3 | astroquery/utils/progressbar.py | wschoenell/astroquery |
import sys
class SimpleProgressBar:
def __init__(self):
self.displayed = False
def update(self, percent):
self.displayed = True
bar_size = 40
percent *= 100.0
if percent > 100:
percent = 100.0
dots = int(bar_size * percent / 100)
plus = percent / 100 * bar_size - dots
if plus > 0.8:
plus = '='... | [
{
"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 | lixian_progress.py | 1py/xunlei-lixian |
from keras.models import load_model
import h5py
import numpy as np
import matplotlib.pyplot as plt
import cv2
from keras.optimizers import Adam
import os
from keras import backend as K
import tensorflow as tf
def PSNR(y_true, y_pred):
max_pixel = 1.0
return 10.0 * tf_log10((max_pixel ** 2) / (K.mean(K.sq... | [
{
"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 | neural_net/fsrcnn_predict.py | matthewli125/SRCFD |
import chex
import jax
import jax.numpy as np
import numpy as onp
import objax
import pytest
from rbig_jax.transforms.conv import Conv1x1Householder
seed = 123
rng = onp.random.RandomState(123)
generator = objax.random.Generator(123)
@pytest.mark.parametrize("n_channels", [1, 3, 12])
@pytest.mark.parametrize("hw", ... | [
{
"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 | tests/transforms/test_conv1x1ortho.py | alexhepburn/rbig_jax |
import os
import re
# room, sector, checksum
p = re.compile("([\w-]+)-(\d+)\[(\w+)\]")
def checksum(room_name):
counts = {}
for char in room_name.replace('-', ''):
if char in counts:
counts[char] += 1
else:
counts[char] = 1
result = []
for item in sorted(counts.items(), key=lambda pair: (-pair[1], pa... | [
{
"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 | day4/day4.py | chrisb87/advent_of_code_2016 |
import click
from cmsis_svd.parser import SVDParser
MCU_OPTIONS = [
'STM32F0xx',
]
MCU2VENDOR_FILE = {
'STM32F0xx': ('STMicro', 'STM32F0xx.svd'),
}
ALL = 'show_all'
def show_register(register):
fields = []
for field in register.fields:
upper_index = field.bit_offset + field.bit_width - 1
... | [
{
"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 | cmsis-svd-parsing/main.py | michael-christen/prototypes |
from helpers.executor import Executor
from helpers.util import *
import itertools
from itertools import *
import re
from re import *
import numpy as np
from typing import Any, Callable, Generator, Sequence
day, year = None, None # TODO: Update day and year for current day
split_seq = '\n'
class Solution(Executor)... | [
{
"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 | src/solutions/template.py | etillison3350/advent-of-code-2020 |
# add path to the main package and test battery.py
if __name__ == '__main__':
from __access import ADD_PATH
ADD_PATH()
import unittest
import psutil
from battery import Battery
class TestBattery(unittest.TestCase):
""" Test battry module """
def test_Battery_constructor(self):
if not (has_b... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
... | 3 | tests/test_battery.py | bexxmodd/vizex |
def add(a, b):
print(f"ADDING {a} + {b}")
return a + b
def subtract(a, b):
print(f"SUBTRACTING {a} - {b}")
return a - b
def multiply(a, b):
print(f"MULTIPLYING {a} * {b}")
return a * b
def divide(a, b):
print(f"DIVIDING {a} / {b}")
return a / b
print("Let's do some math with just fu... | [
{
"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 | ex21/ex21-3.py | taylorcreekbaum/lpthw |
from django.db import models
class CapitalizeField(models.CharField):
def __init__(self, *args, **kwargs):
super(CapitalizeField, self).__init__(*args, **kwargs)
def pre_save(self, model_instance, add):
value = getattr(model_instance, self.attname, None)
if value:
value =... | [
{
"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 | apps/common/models.py | kwanj-k/ctrim_api |
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Copyright (c) Contributors to the Open 3D Engine Project.
For complete copyright and license terms please see the LICENSE at the root of this distribution.
SPDX-License-Identifier: Apache-2.0 OR MIT
"""
import sys
import os
from clr import *
sys.path.append("..")
import te... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"... | 3 | tests/Advanced/typeof-vardecl-udt.py | aws-lumberyard-dev/o3de-azslc |
# coding: utf-8
"""Test that tokenizer exceptions and emoticons are handles correctly."""
from __future__ import unicode_literals
import pytest
@pytest.mark.parametrize('text', ["auf'm", "du's", "รผber'm", "wir's"])
def test_de_tokenizer_splits_contractions(de_tokenizer, text):
tokens = de_tokenizer(text)
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": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (exclu... | 3 | spacy/tests/lang/de/test_exceptions.py | cmgreivel/spaCy |
from datetime import timedelta
from epsilon.extime import Time
from nevow.page import renderer
from nevow.loaders import stan
from nevow.tags import div
from nevow.athena import LiveElement
from xmantissa.liveform import TEXT_INPUT, LiveForm, Parameter
class CalendarElement(LiveElement):
docFactory = stan(di... | [
{
"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 | doc/listings/interstore/webcal.py | jonathanj/mantissa |
# Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.
#
# This software is licensed under the Apache License, Version 2.0 (the
# "License") as published by the Apache Software Foundation.
#
# You may not use this file except in compliance with the License. You may
# obtain a copy of the License at... | [
{
"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 | supertokens_python/recipe/jwt/utils.py | girish946/supertokens-python |
# read csv to model
import tensorflow as tf
import numpy as np
import os
def read_csv(batch_size, file_name, record_defaults=1):
fileName_queue=tf.train.string_input_producer(os.path.dirname(__file__)+"/"+file_name)
reader = tf.TextLineReader(skip_header_lines=1)
key, value=reader.read(fileName_queue,name... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined insid... | 3 | read_csv.py | yangzhou95/learn-tensorflow |
"""Author: Brandon Trabucco, Copyright 2019"""
import tensorflow as tf
from mineral.algorithms.tuners.tuner import Tuner
class EntropyTuner(Tuner):
def __init__(
self,
policy,
**kwargs
):
Tuner.__init__(self, **kwargs)
self.policy = policy
def update_algorithm(
... | [
{
"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 | mineral/algorithms/tuners/entropy_tuner.py | brandontrabucco/jetpack |
import Anton as aen
import numpy as np
import matplotlib.pyplot as plt
import os
from scipy.stats import linregress
def changeCelsius(path):
files = aen.searchfiles(path, '.npy')
files.sort()
for i in files:
fname,name = os.path.split(i)
if 'Celsius' in name:
nm = name.split('C... | [
{
"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 | 2 - data2graph/evaluateData/changeNames.py | Tocha4/HSM-Solubility |
import toga
import time
import toga
from colosseum import CSS
tab_style = CSS(flex=1, padding=20)
def build(app):
font = toga.Font('Helvetica', 40)
return toga.Box(children=[toga.Button('Button')])
def main():
return toga.App('Test Font', 'org.pybee.font', startup=build)
if __name__ == '__main__':
... | [
{
"point_num": 1,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answe... | 3 | font/font/app.py | Ocupe/toga_test_app_collection |
try:
from unittest import mock
except ImportError:
import mock
from graphql_ws.gevent import GeventConnectionContext, GeventSubscriptionServer
class TestConnectionContext:
def test_receive(self):
ws = mock.Mock()
connection_context = GeventConnectionContext(ws=ws)
connection_conte... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},... | 3 | tests/test_gevent.py | kahkeng/graphql-ws |
import uuid
from django import template
from django.forms.widgets import Media
from django.utils.safestring import mark_safe
from django.core.urlresolvers import reverse
from settings import PROGRESSBARUPLOAD_INCLUDE_JQUERY
register = template.Library()
@register.simple_tag
def progress_bar():
"""
progress... | [
{
"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 | afterflight/progressbarupload/templatetags/progress_bar.py | foobarbecue/afterflight |
import torch
from ptstat.core import RandomVariable, _to_v
class Categorical(RandomVariable):
"""
Categorical over 0,...,N-1 with arbitrary probabilities, 1-dimensional rv, long type.
"""
def __init__(self, p=None, p_min=1E-6, size=None, cuda=False):
super(Categorical, self).__init__()
... | [
{
"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 | ptstat/dist/categorical.py | timmyzhao/ptstat |
import pytest
from django.urls import resolve, reverse
from django_machinelearning.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(... | [
{
"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 | django_machinelearning/users/tests/test_urls.py | daaawx/django_machinelearning |
import numpy as np
import tensorflow as tf
from tensorflow.python.ops.array_grad import _TileGrad
from tensorflow.python.framework import ops
def shape(x):
if isinstance(x, tf.Tensor):
return x.get_shape().as_list()
return np.shape(x)
@ops.RegisterGradient("TileDense")
def tile_grad_dense(op, grad):... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (ex... | 3 | src/schnet/nn/utils.py | Yidansong/SchNet |
from django.http.response import HttpResponseRedirect
from .forms import MyForm
from django.shortcuts import get_object_or_404, render
from .models import Flower
# Create your views here.
def index(request):
q = request.GET.get("q" , None)
if q is None or q == '':
flowers = Flower.objects.all()
e... | [
{
"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 | myapp/views.py | free20064u/flower |
from django.template import Library
from django.template.defaultfilters import floatformat
from django.contrib.humanize.templatetags.humanize import intcomma
from django.utils.encoding import force_unicode
register = Library()
@register.filter(name='addcss')
def addcss(value, arg):
return value.as_widget(attrs={... | [
{
"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/main/templatetags/formtags.py | HenriqueLR/payments |
# coding: utf-8
"""
CONS3RT Web API
A CONS3RT ReSTful API # noqa: E501
The version of the OpenAPI document: 1.0.0
Contact: apiteam@swagger.io
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import unittest
import openapi_client
from openapi_client.mode... | [
{
"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 | test/test_full_disk.py | cons3rt/cons3rt-python-sdk |
from anytree import Node
from csv import reader
from pickle import dump
def make_category_tree(path_to_data):
parents = {}
nodes = {}
with open(path_to_data + '/categories.csv', newline='') as csvfile:
rdr = reader(csvfile, delimiter=',')
for row in rdr:
if (row[1] == 'id'):
... | [
{
"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 | utils/category_tree.py | comptech-winter-school/online-store-redirects |
#!/usr/bin/python
# coding: utf-8
# -------------------------------------------------------------------
# Encryption365 AutoRenewal Client For ๅฎๅกLinux้ขๆฟ
# -------------------------------------------------------------------
# Copyright (c) 2020-2099 ็ฏๆบไธญ่ฏโข All rights reserved.
# ------------------------------------------... | [
{
"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 | src/AutoDelLogs.py | zhiiker/Encryption365_Baota |
import pytest
from thefuck.rules.git_remote_seturl_add import match, get_new_command
from thefuck.types import Command
@pytest.mark.parametrize('command', [
Command('git remote set-url origin url', "fatal: No such remote")])
def test_match(command):
assert match(command)
@pytest.mark.parametrize('command', ... | [
{
"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 | tests/rules/test_git_remote_seturl_add.py | HiteshMah-Jan/thefuck |
import logging
from datetime import datetime
from dateutil.relativedelta import relativedelta
from .period import Period, Granularity
from .week import Week
class Year(Period):
granularity = Granularity.YEAR
def __init__(self, year):
self.start_datetime = datetime(year, 1, 1)
self.end_date... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer":... | 3 | periods/year.py | iloob/python-periods |
from guillotina import app_settings
from guillotina import configure
from guillotina.content import get_cached_factory
from guillotina.interfaces import IConstrainTypes
from guillotina.interfaces import IDatabase
from guillotina.interfaces import IResource
from typing import List
from typing import Optional
from zope.i... | [
{
"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 | guillotina/constraintypes.py | rboixaderg/guillotina |
# Implements I/O over asynchronous sockets
from time import time
from sys import exc_info
from traceback import format_exception
from asyncore import socket_map
from asyncore import loop
from pysnmp.carrier.base import AbstractTransportDispatcher
from pysnmp.error import PySnmpError
class AsyncoreDispatcher(AbstractTr... | [
{
"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 | scalyr_agent/third_party/pysnmp/carrier/asyncore/dispatch.py | code-sauce/scalyr-agent-2 |
from checkov.common.models.enums import CheckResult, CheckCategories
from checkov.terraform.checks.resource.base_resource_check import BaseResourceCheck
class PasswordPolicyExpiration(BaseResourceCheck):
def __init__(self):
name = "Ensure IAM password policy expires passwords within 90 days or less"
... | [
{
"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 | checkov/terraform/checks/resource/aws/PasswordPolicyExpiration.py | gustavotabares/checkov |
# coding: utf-8
"""
Healthbot APIs
API interface for Healthbot application # noqa: E501
OpenAPI spec version: 3.1.0
Contact: healthbot-feedback@juniper.net
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import swagg... | [
{
"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 | docs/jnpr_healthbot_swagger/test/test_topic_field_capture_schema.py | Juniper/healthbot-py-client |
#!/usr/bin/env python
# coding: utf-8
# In[ ]:
from django.shorcurts import render
from django.http import Http404
from models import contato
def index(request):
contatos = Contato.objects.all()
return render(request, 'contatos/index.html', {
'contatos': contatos
})
def ver_contato(request, co... | [
{
"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 | Levantando erros 404.py | dimagela29/Python-POO |
import sys
sys.path.append('../G26/Reportes')
from graphviz import Graph
class Grafo():
def __init__(self, index):
self.index = index
self.dot = Graph()
self.dot.attr(splines='false')
self.dot.node_attr.update(shape = 'circle')
self.dot.edge_attr.update(color = 'blue4')
... | [
{
"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 | parser/team26/G26/Reportes/graph.py | webdev188/tytus |
from transformers import EvalPrediction
from sklearn.metrics import precision_recall_fscore_support
import numpy as np
def compute_metrics(pred: EvalPrediction):
"""Compute recall at the masked position
"""
mask = pred.label_ids != -100
# filter everything except the masked position and flatten tensor... | [
{
"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/lm/metrics.py | source-data/soda-roberta |
import os
from aiohttp import web
from app.utility.logger import Logger
class FileSvc:
def __init__(self, payload_dirs, exfil_dir):
self.payload_dirs = payload_dirs
self.log = Logger('file_svc')
self.exfil_dir = exfil_dir
async def download(self, request):
name = request.he... | [
{
"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 | app/service/file_svc.py | FumblingBear/caldera |
from dowel import logger
import numpy as np
from garage.sampler.utils import truncate_paths
from tests.fixtures.logger import NullOutput
class TestSampler:
def setup_method(self):
logger.add_output(NullOutput())
def teardown_method(self):
logger.remove_all()
def test_truncate_paths(se... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer"... | 3 | tests/garage/sampler/test_sampler.py | st2yang/garage |
"""Add locale to user table
Revision ID: aefa596e7114
Revises: d5715c70e375
Create Date: 2020-10-08 12:06:27.967777
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "aefa596e7114"
down_revision = "d5715c70e375"
branch_labels = None
depends_on = 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": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?... | 3 | migrations/versions/aefa596e7114_add_locale_to_user_table.py | mutalisk999/Flog |
from metrics import MetricFunctionNYUv2, print_single_error
from model import SupervisedLossFunction
from torch.utils.data import DataLoader
from torchvision import transforms
from nyuv2 import NYUv2
from tqdm import tqdm
from general import generate_layers, load_checkpoint, tensors_to_device
import torch
from torchvis... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (ex... | 3 | fcntest.py | alexjercan/unsupervised-segmentation |
from django.shortcuts import render, redirect
from django.http import HttpResponse
from django.core.paginator import Paginator
from .models import Subject
import json
def index(request):
if request.method == "POST":
value = request.POST.get("subject_title")
subject_list = Subject.objects.filter(ti... | [
{
"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 | finder/views.py | plaunezkiy/unibase |
from django.db import models
from django.contrib.auth.models import AbstractBaseUser
from django.contrib.auth.models import PermissionsMixin
from django.contrib.auth.models import BaseUserManager
from django.conf import settings
# Create your models here.
class UserProfileManager(BaseUserManager):
""" Managere fo... | [
{
"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 | profiles_api/models.py | Chinmay-395/profiles-rest-api |
from unittest import TestCase
import simplejson as json
class TestBigintAsString(TestCase):
values = [(200, 200),
((2 ** 53) - 1, 9007199254740991),
((2 ** 53), '9007199254740992'),
((2 ** 53) + 1, '9007199254740993'),
(-100, -100),
((-2 ** 53)... | [
{
"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 | misc/seqan_instrumentation/bin/classes/simplejson/tests/test_bigint_as_string.py | weese/seqan |
from finesm import StateMachine, State
class SimpleStateMachine(StateMachine):
waiting = State(default=True)
running = State()
def __init__(self):
super(SimpleStateMachine, self).__init__()
self.foo = False
self.bar = False
self.updoot = 0
@waiting.on_message('start')... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},... | 3 | tests/test_state_machine.py | wesleyks/fine_sm |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
"""
@author: Alan
@time: 2021/05/18
"""
from concurrent.futures import ThreadPoolExecutor, wait, ALL_COMPLETED
import traceback
class MultiThread(ThreadPoolExecutor):
def __init__(self, max_workers=None, thread_name_prefix=''):
super().__init__(max_worker... | [
{
"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 | WebSpider/threads.py | bianQ/similarweb |
from __future__ import print_function
import argparse
import sys
from costar_task_plan.simulation import GetSimulationParser
def GetLaunchOptions():
'''
These are the files that actually set up the environment
'''
return ["ur5","husky","fetch"]
def GetExperimentOptions():
'''
Each of these n... | [
{
"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 | costar_simulation/python/costar_simulation/parse.py | cpaxton/costar_plan |
import unittest
from grains import (
square,
total,
)
# Tests adapted from `problem-specifications//canonical-data.json`
class GrainsTest(unittest.TestCase):
def test_grains_on_square_1(self):
self.assertEqual(square(1), 1)
def test_grains_on_square_2(self):
self.assertEqual(square(... | [
{
"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 | exercises/practice/grains/grains_test.py | highb/python |
from threading import Thread, Event
from time import sleep
def func1():
sleep(2) # Initially sleep for 2 secs
myeventobj.set() # E2
print("func1 sleeping for 3 secs....")
sleep(3) # E3
myeventobj.clear() # E4
def func2():
print("Initially myeventobj is: ", myeventobj.isSet()) # E1
m... | [
{
"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 | Chapter 10/Chap10_Example10.38.py | Anancha/Programming-Techniques-using-Python |
from ....constants import BINARY, MULTICLASS, REGRESSION
from autogluon.core import Categorical, Real, Int
def get_default_searchspace(problem_type, num_classes=None):
if problem_type == BINARY:
return get_searchspace_binary().copy()
elif problem_type == MULTICLASS:
return get_searchspace_mult... | [
{
"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 | tabular/src/autogluon/tabular/models/fastainn/hyperparameters/searchspaces.py | RuohanW/autogluon |
from django.utils.functional import wraps
from caseworker.core.constants import Permission
from core.exceptions import PermissionDeniedError
from caseworker.core import helpers
def has_permission(permission: Permission):
"""
Decorator for views that checks that the user has a given permission
"""
de... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding... | 3 | caseworker/core/decorators.py | django-doctor/lite-frontend |
import turtle
def draw_square(some_turtle):
for i in range(1,5):
some_turtle.forward(100)
some_turtle.right(90)
def draw_art():
window = turtle.Screen()
window.bgcolor("blue")
img_tt = turtle.Turtle()
img_tt.shape("turtle")
img_tt.color("white")
img_tt.speed(2)
for i in... | [
{
"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 | drawer.py | janakhpon/LearnPyDacity |
""" Exceptions mapped to error codes the JSON-rpc 2 spec.
-32768 to -32000 are reserved for pre-defined errors
code: -32700 message: Parse Error -> invalid json received by the server. Error occurred while parsing the json text
code: -32600 message: Invalid Request -> Json sent is not a valid Request object
code... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": true
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
... | 3 | deo/exceptions.py | bsnacks000/deo |
# Copyright 2010-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# This file is licensed under the Apache License, Version 2.0 (the "License").
# You may not use this file except in compliance with the License. A copy of the
# License is located at
#
# http://aws.amazon.com/apache2.0/
#
# This f... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": fal... | 3 | archived/elasticache/Redis/counter.py | DS3Lab/LambdaML |
import base64
def makeEncryptString(Crypto, createLogger):
def encryptString(publicKey, string):
logger = createLogger(__name__)
pubKey = Crypto.PublicKey.RSA.importKey(str.encode(publicKey))
encryptedString = pubKey.encrypt(string.encode('utf-8'),5000)
base64StringEncrypted = ... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined insid... | 3 | api/use_cases/encryption/makeEncryptString.py | potofpie/message-frame |
from Classes_1 import Myclass_1
from Classes_1 import Myclass_2
from Classes_1 import MyClass_3
from Classes_1 import MyNomber
from Classes_1 import MyPercentClass
from Classes_1 import example
from Classes_1 import example_3
from Classes_1 import equations_1
from Classes_1 import equations_2
from Classes_1 im... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 lines?",
"answer": true
... | 3 | def_for_Classes_1.py | AlekseyVinokurov/python_lesson_2 |
import websocket
import threading
from time import sleep
def on_message(ws, message):
print(message)
def on_close(ws):
print("closed")
if __name__ == "__main__":
websocket.enableTrace(True)
ws = websocket.WebSocketApp("ws://localhost:9001", on_message = on_message, on_close = on_close)
wst = thre... | [
{
"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 | non_block_client.py | baset-sarker/python-socket-smt |
from sqlalchemy import *
from migrate import *
import migrate.changeset
def upgrade(migrate_engine):
metadata = MetaData()
metadata.bind = migrate_engine
package_relationship_table = Table('package_relationship',
metadata, autoload=True)
package_relationship_rev... | [
{
"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 | ckan/migration/versions/019_pkg_relationships_state.py | florianm/ckan |
from task import *
from my_numpy import np, my_list
import copy
# push tests here
def get_standart_der(f1):
def der(u):
der = []
eps = 0.0000001
for i in range(0, len(u)):
u1 = copy.copy(u)
u1[i] = u1[i]+eps
der.append((f1(u1)-f1(u))/eps)
u1[i... | [
{
"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... | 3 | tests.py | ariolwork/uni_conditional_gradient |
#!/usr/bin/env python
"""
A very simple progress bar which keep track of the progress as we consume an
iterator.
"""
import os
import signal
import time
from prompt_toolkit import HTML
from prompt_toolkit.key_binding import KeyBindings
from prompt_toolkit.patch_stdout import patch_stdout
from prompt_toolkit.shortcuts ... | [
{
"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 | examples/progress-bar/custom-key-bindings.py | gousaiyang/python-prompt-toolkit |
from drink_robot.controllers.index import bp as index
from drink_robot.controllers.recipe import bp as recipe
from drink_robot.controllers.bottle import bp as bottle
from drink_robot.controllers.pour import bp as pour
import pigpio
def init_pins(app):
if app.config['DEBUG']:
return
gpio = pigpio.pi()
... | [
{
"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 | drink_robot/controllers/__init__.py | cactode/drink_robot |
# Copyright 2019 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | [
{
"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 | tensorflow/compiler/mlir/tensorflow/tests/tf_saved_model/exported_python_args.py | yage99/tensorflow |
# Toolkit used for Classification
# Importing Libraries
from sklearn.linear_model import LogisticRegression
from sklearn.svm import SVC
from sklearn.ensemble import RandomForestClassifier
# Logistic Regression Classification
def logRegress(X_train, y_train, X_test, y_test):
# Fitting Logistic Regression to the Tr... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docst... | 3 | src/NCAAClassification.py | parekhmitchell/NCAA-ML |
from __future__ import annotations
import dataclasses
import logging
from typing import Dict, Text, Any
import rasa.shared.utils.io
from rasa.engine.graph import GraphComponent, ExecutionContext
from rasa.engine.storage.resource import Resource
from rasa.engine.storage.storage import ModelStorage
logger = logging.get... | [
{
"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_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
}... | 3 | rasa/graph_components/providers/rule_only_provider.py | praneethgb/rasa |
from pymongo import MongoClient
import json
from newsapi.database import mongo
class UserModel:
def __init__(self, _id, username, password):
self.id = _id
self.username = username
self.password = password
@classmethod
def find_by_username(cls, username):
result = mongo.db... | [
{
"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 | newsapi/user/models.py | rubiagatra/news-api |
from . import compat
have_greenlet = False
if compat.py3k:
try:
import greenlet # noqa F401
except ImportError:
pass
else:
have_greenlet = True
from ._concurrency_py3k import await_only
from ._concurrency_py3k import await_fallback
from ._concurrency_py3k i... | [
{
"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 | lib/sqlalchemy/util/concurrency.py | Dreamsorcerer/sqlalchemy |
from test.utilities.env_vars import set_env_vars
from test.utilities.excel import Excel
def test_simple_script_for_addition(xll_addin_path):
with set_env_vars('basic_functions'):
with Excel() as excel:
excel.register_xll(xll_addin_path)
(
excel.new_workbook()
... | [
{
"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 | test/test_execute_python.py | RuneLjungmann/excelbind |
import numpy as np
import matplotlib.pyplot as plt
def train_test_splitter(X, y, ratio = 0.8, random_seed = 0):
assert(len(X) == len(y)), "The number of points in feature matrix and target vector should be the same."
np.random.seed(random_seed)
n = len(y)
idx = np.arange(n)
np.random.shuffl... | [
{
"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 | utils.py | leimao/Logistic_Regression_Python |
from flask import render_template, flash, redirect, url_for, request
from flask.views import MethodView
from app.middleware import auth
from app.models.user import User
from app.validators.register_form import RegisterForm
from app.services import avatar_service
class RegisterController(MethodView):
@auth.optional... | [
{
"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": true
},... | 3 | app/controllers/auth/register.py | TheSynt4x/flask-blog |
#
# Copyright (c) 2019 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
from cgtsclient.common import base
class KubeUpgrade(base.Resource):
def __repr__(self):
return "<kube_upgrade %s>" % self._info
class KubeUpgradeManager(base.Manager):
resource_class = KubeUpgrade
@stati... | [
{
"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 | sysinv/cgts-client/cgts-client/cgtsclient/v1/kube_upgrade.py | albailey/config |
# 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": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true... | 3 | aliyun-python-sdk-domain/aliyunsdkdomain/request/v20180129/AcknowledgeTaskResultRequest.py | yndu13/aliyun-openapi-python-sdk |
import pytest
from django.urls import reverse
from coruscant_django.users.models import User
pytestmark = pytest.mark.django_db
class TestUserAdmin:
def test_changelist(self, admin_client):
url = reverse("admin:users_user_changelist")
response = admin_client.get(url)
assert response.stat... | [
{
"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 | coruscant_django/users/tests/test_admin.py | Jarbton/coruscant-django |
# the class to build the graph, as already described in main.py
class Graph:
def __init__(self):
self.nodes = set()
self.edges = set()
self.neighboors = {}
self.weight_edges = {}
self.coord_nodes = {}
def add_node(self, node):
self.nodes.add(nod... | [
{
"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 | graph.py | michelemeo/ADM-HW5 |
""" Module containing DocumentPublisher class """
from ..common.common import SectionHandler
# pylint: disable=too-few-public-methods
class DocumentPublisher(SectionHandler):
""" Responsible for converting the DocumentPublisher section:
- /cvrf:cvrfdoc/cvrf:DocumentPublisher
"""
type_category_mappi... | [
{
"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 | cvrf2csaf/section_handlers/document_publisher.py | sthagen/csaf-tools-CVRF-CSAF-Converter |
from django.core.management.base import BaseCommand
import random
from faker import Faker
import pandas as pd
from pandas import DataFrame
import time
from BookClub.management.commands.helper import get_top_n_books, get_top_n_users_who_have_rated_xyz_books, get_top_n_books_shifted
from BookClub.models.user import User... | [
{
"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": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": fals... | 3 | BookClub/management/commands/importuserstargeted.py | amir-rahim/BookClubSocialNetwork |
import sys
from PyQt5.QtWidgets import QDialog, QApplication
from demoRadioButton2 import *
class MyForm(QDialog):
def __init__(self):
super().__init__()
self.ui = Ui_Dialog()
self.ui.setupUi(self)
self.ui.radioButtonMedium.toggled.connect(self.dispSelected)
se... | [
{
"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 | Chapter01/callRadioButton2.pyw | houdinii/Qt5-Python-GUI-Programming-Cookbook |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import xml.etree.ElementTree as ET
import lxml.html
from lxml import etree
from lxml.html.soupparser import fromstring
import re
_badtags = set(["script", 'style' , 'iframe'])
_have_a_chars = re.compile(r'\w', re.UNICODE)
_splitter_chars = re.compile(r'[\s,]', re.UNICODE)
... | [
{
"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 | docato/docato/Crawlers/LJ/Crawler/crawler_tokenize.py | pavlovma007/docato |
from django.contrib import admin
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
from . import filters
from .. import models
@admin.register(models.RefreshToken)
class RefreshTokenAdmin(admin.ModelAdmin):
list_display = ['user', 'token', 'created', 'revoked', 'is_expired... | [
{
"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 | ariadne_jwt/refresh_token/admin/__init__.py | abaumg/ariadne-jwt |
from django.views.generic.detail import DetailView
from django.views.generic.edit import CreateView
from django.views.generic.edit import UpdateView
from django.views.generic import ListView
from django.urls import reverse
from myapp.models import Bike
class BikeDetailView(DetailView):
model = Bike
template_n... | [
{
"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 | week07/myproject/myapp/views.py | wasit7/dsi202_2021 |
from highcliff.actions.actions import AIaction
class MonitorTemperature(AIaction):
effects = {"problem_with_temperature": False}
preconditions = {}
def behavior(self):
# decide if medication is needed and update the world accordingly
raise NotImplementedError
def __adjustment_needed(... | [
{
"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 | highcliff/temperature/temperature.py | sermelo/Highcliff-SDK |
import logging
import threading
import time
import random
LOG_FORMAT = '%(asctime)s %(threadName)-17s %(levelname)-8s %(message)s'
logging.basicConfig(level=logging.INFO, format=LOG_FORMAT)
items = []
event = threading.Event()
class Pasien(threading.Thread):
def __init__(self, *args, **kwargs):
super().... | [
{
"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 | Chapter02/1194029 Nur Ikhsani Suwandy Futri 3a D4 TI studi_kasus/Event.py | nurikhsanisf/Python-Pararel_SISTER |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.