source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
from django.db.models.fields import Field
from django.urls import NoReverseMatch
from django.urls import reverse
from polymorphic.managers import PolymorphicManager
from common.business_rules import NoBlankDescription
from common.business_rules import UpdateValidity
from common.models.mixins.validity import ValiditySt... | [
{
"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 | common/models/mixins/description.py | uktrade/tamato |
# -*- coding: utf-8 -*-
import xlrd
import pandas as pd
import numpy as np
mirna_sim_path = '../data/miRNA_sim.xlsx'
disease_sim_path = '../data/disease_sim.xlsx'
mirna_disease_ass_path = '../data/miRNA_disease.csv'
mirna_data_dict_path = "../data/mirna_data_dict.npy"
disease_data_dict_path = "../data/disease... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",... | 3 | code/get_data.py | dayunliu/SMALF |
from tests.support.asserts import assert_error, assert_success
def get_window_rect(session):
return session.transport.send(
"GET", "session/{session_id}/window/rect".format(**vars(session)))
def test_no_top_browsing_context(session, closed_window):
response = get_window_rect(session)
assert_erro... | [
{
"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 | webdriver/tests/get_window_rect/get.py | meyerweb/wpt |
from task1.LinkedList import LinkedList
def climbStairs(n):
if n == 1:
return 1
if n == 2:
return 2
return climbStairs(n - 1) + climbStairs(n - 2)
def climbStairs_v2(n):
stairs = LinkedList(size=n)
stairs[0] = 1
stairs[1] = 2
for i in range(2, n):
stairs[i] = sta... | [
{
"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 | excersices/task2/stairs.py | Pyabecedarian/Data_Sructure-Algorithm__Learning |
from django.shortcuts import render
from django.views.generic.list import ListView
from hitcount.views import HitCountDetailView
from .models import Post
class PostListView(ListView):
model = Post
context_object_name = 'posts'
template_name = 'post_list.html'
class PostDetailView(HitCountDetailView):
... | [
{
"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 | posts/views.py | raszidzie/Django-Hitcount-Tutorial |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license
# Copyright (c) 2020 Eka Cahya Pratama <ekapratama93@gmail.com>
from thumbor.loaders import http_loader
from urllib.parse import urlparse
import re
def _normalize_http_scheme(url):
re_url... | [
{
"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 | thumbor_custom_loader/loaders/single_loader/__init__.py | ekapratama93/thumbor-custom-single-loader |
from tool.runners.python import SubmissionPy
class SilvestreSubmission(SubmissionPy):
def run(self, s):
arr = list(map(int, s.splitlines()[0].split()))
def score_node(arr, i_node):
n_child = arr[i_node]
n_meta = arr[i_node + 1]
i_next = i_node + 2
... | [
{
"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 | day-08/part-2/silvestre.py | badouralix/adventofcode-2018 |
"""Draws DAG in ASCII."""
import logging
import os
import pydoc
import sys
from rich.pager import Pager
from dvc.env import DVC_PAGER
from dvc.utils import format_link
logger = logging.getLogger(__name__)
DEFAULT_PAGER = "less"
DEFAULT_PAGER_FORMATTED = (
f"{DEFAULT_PAGER} --chop-long-lines --clear-screen --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": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (exclu... | 3 | dvc/utils/pager.py | jheister/dvc |
# Author: Trevor Sherrard
# Course: Directed Research
# Since: Febuary 14, 2021
# Description: This file contains the class definition for the 1D
# windowed average data stream smoother.
class MovingWindowAverage:
def __init__(self, windowSize):
self.windowSize = windowSize
self.windo... | [
{
"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 | kinect_vision_target_cap/src/WindowedAverage.py | sherrardTr4129/RealSense-BNO055-Pose-Estimation |
"""
PRIVATE MODULE: do not import (from) it directly.
This module contains implementations that do not directly touch the core of
jsons.
"""
from typing import Optional
from jsons._cache import cached
from jsons._common_impl import StateHolder, get_class_name
def suppress_warnings(
do_suppress:... | [
{
"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 | venv/lib/python3.8/site-packages/jsons/_extra_impl.py | tausiftt5238/cs5204_election_guard |
from typing import List
from geniusweb.actions.PartyId import PartyId
from geniusweb.actions.Votes import Votes
from geniusweb.inform.Inform import Inform
class OptIn (Inform):
'''
Informs party that it's time to Opt-in.
'''
def __init__(self, votes:List[Votes] ) :
'''
@param votes a... | [
{
"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 | src/negotiating_agent/venv/lib/python3.8/site-packages/geniusweb/inform/OptIn.py | HahaBill/CollaborativeAI |
class PytestTestRunner(object):
"""Runs pytest to discover and run tests."""
def __init__(self, verbosity=1, failfast=False, keepdb=False, **kwargs):
self.verbosity = verbosity
self.failfast = failfast
self.keepdb = keepdb
def run_tests(self, test_labels):
"""Run pytest and... | [
{
"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 | tests/runner.py | elwoodxblues/saleor |
__author__ = 'chrisprobst'
import unittest
import time
import traceback
import asyncio
HOST = '127.0.0.1'
PORT = 1337
ADDRESS = (HOST, PORT)
class UdpProtocol(asyncio.DatagramProtocol):
def datagram_received(self, data, addr):
print('Datagram received')
def error_received(self, exc):
trace... | [
{
"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": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer":... | 3 | lib/asyncio-0.4.1/test_udp.py | bslatkin/pycon2014 |
#! /usr/bin/env python
import rospy
from sensor_msgs.msg import NavSatFix, Imu
from tf.transformations import euler_from_quaternion
from std_msgs.msg import Float64
from geometry_msgs.msg import Point, Twist
import math
import utm
import numpy as np
x, y, theta = 0.0, 0.0, 0.0
xx, yy = [], []
def newGPS(msg):
g... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",... | 3 | am_driver/scripts/calculate_angle.py | vincent0628/mower |
from Whole import Whole
from Experiment import Experiment
from Tools import dudko_hummer_szabo
class WholeExperiment(Whole):
def __init__(self, filename, number_of_traces, **kwargs):
self._kwargs = kwargs
self._filename = filename
self._number_of_traces = number_of_traces
... | [
{
"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 | WholeExperiment.py | ilbsm/ProtStretch |
# -*- coding: utf-8 -*-
from wtforms.form import Form
from superset.forms import (
CommaSeparatedListField, filter_not_empty_values)
from tests.base_tests import SupersetTestCase
class FormTestCase(SupersetTestCase):
def test_comma_separated_list_field(self):
field = CommaSeparatedListField().bind(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": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
... | 3 | tests/form_tests.py | dizzydes/incubator-superset |
"""Example serializing custom types"""
from datetime import datetime
from event_two import event
import json
# Serializar
def default(obj):
"""Encode datetime to string in YYYY-MM-DDTHH:MM:SS format (RFC3339)"""
if isinstance(obj, datetime):
return obj.isoformat()
return obj
def pairs_hook(pairs... | [
{
"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 | NoteBooks/Curso de Python/Python/Examples/Serialization/JSON/custom.py | Alejandro-sin/Learning_Notebooks |
from urllib.parse import quote
import re
def parse_equation(match):
# Converts a latex expression into something the tex API can understand
eq = match.group(0)
# Curly brackets need to be escaped
eq = eq.replace('{', '\{')
eq = eq.replace('}', '\}')
# Create the url using the quote method wh... | [
{
"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 | github_markdown.py | thomasnilsson/github_markdown |
from collections import Counter, namedtuple
from random import random
DataPoint = namedtuple('DataPoint', ['count', 'compound', 'splitlocs'])
def merge_counts(data):
store = {}
for dp in data:
if dp.compound in store:
store[dp.compound] = dp._replace(count=store[dp.compound].count + dp.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": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answ... | 3 | morfessor/data.py | Waino/morfessor-emprune |
"""add study template
Revision ID: 4f53ec506661
Revises: 4302608638bc
Create Date: 2018-05-23 15:44:01.450488
"""
# revision identifiers, used by Alembic.
revision = '4f53ec506661'
down_revision = '4302608638bc'
branch_labels = None
depends_on = None
from alembic import op
import sqlalchemy as sa
def upgrade(engi... | [
{
"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 | alembic/versions/4f53ec506661_add_study_template.py | jonathanzong/dmca |
def rotate_counterclockwise(array_2d):
list_of_tuples = zip(*array_2d[::])
return [list(elem) for elem in list_of_tuples]
def rotate_clockwise(array_2d):
"""
Code copied by: https://stackoverflow.com/a/48444999/3753724
"""
list_of_tuples = zip(*array_2d[::-1])
return [list(elem) for elem i... | [
{
"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/utils.py | delbio/maze |
from card import Card
class Deck:
def __init__(self):
"""
Encapsulates a list of Card objects
:return: None
"""
self.cards = []
# initialize deck
suits = ['Clubs', 'Diamonds', 'Hearts','Spades']
ranks = ['Ace','2','3','4','5','6','7','8','9',... | [
{
"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 | deck.py | carlzoo/babylist-deck |
import numpy as np
import matplotlib.pyplot as plt
from ctsutils.cparameterspace import CParam, CParameterSpace
def foo(X, Y, Y2):
""" """
return (1 - X / 2 + X ** 5 + (Y + Y2 ) ** 3) * np.exp(-X ** 2 - (Y + Y2 ) ** 2) # calcul du tableau des valeurs de Z
def foo(X, Y, Y2, Y3):
""" """
return (1 -... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (... | 3 | ctsutils/test.py | 534ttl3/ctsutils |
import unittest
from core import collect
class TestCollect(unittest.TestCase):
def test_if_we_get_viz_release(self):
mock_data = {
"name": "a",
"img": "img",
"link": "link",
"publisher": "publisher",
}
response = collect.get_viz()... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answ... | 3 | tests/collect.py | djamaile/mangascan |
# -*- coding: UTF-8 -*-
from __future__ import (
absolute_import, division, print_function, unicode_literals
)
from api.serializers import NoteSerializer
from rest_framework import filters, status, viewsets
from rest_framework.response import Response
class NoteViewSet(viewsets.ModelViewSet):
serializer_clas... | [
{
"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 | api/views/notes.py | chronossc/notes-app |
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 ... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{
... | 3 | app/user/views.py | maxblu/recipe-app-api |
import pickle
from time import time
from sklearn.cross_validation import train_test_split as tts
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.linear_model import SGDClassifier
from sklearn.metrics import classification_report as clsr
from sklearn.neural_network._base import identity
from sk... | [
{
"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 | analyzer/build.py | shobhitagarwal1612/Emotion-Analysis |
class FrugalCollection:
id = None
snapshots = None
def __init__(self, collection_id):
snapshots = {}
self.id = collection_id
def __str__(self):
return "<Collection {0}>".format(self.id) | [
{
"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 | dbl_archive_data_storage/frugal_storer/frugal_collection.py | ubsicap/dbl-archive-data-storage |
from game.pole import PolesObject
from game.agent import Agent
from pygame import Rect
import pygame, struct
import numpy as np
class Game:
def __init__(self, resolution):
self.resolution = resolution
self.screen = pygame.display.set_mode(resolution) # init window
self.playerpos = (0, resol... | [
{
"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": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true... | 3 | game/game.py | fietensen/FlappyAI |
import pytest
from pytest import (
raises,
)
from vyper import (
compiler,
)
from vyper.exceptions import (
ParserException,
StructureException,
)
fail_list = [
"""
@public
def foo() -> uint256:
doesnotexist(2, uint256)
return convert(2, uint256)
""",
"""
@public
def foo() -> uint2... | [
{
"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/parser/syntax/test_functions_call.py | Solexplorer/vyper |
from werkzeug.security import safe_str_cmp
from models.user import UserModel
def authenticate(username, password):
user = UserModel.find_by_username(username)
if user and safe_str_cmp(user.password, password):
return user
def identity(payload):
user_id = payload['identity']
return UserModel.find_by_id(user_id)... | [
{
"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 | Session 6/security.py | valdirsalustino/python-rest-api |
import torch
import dataset
import encoder
import decoder
import torchvision
import torchvision.transforms as transforms
def load_dataset(args):
if args.dataset == 'celebA':
train_transform = transforms.Compose([
transforms.Resize([64, 64]),
transforms.RandomHorizontalFlip(),
transforms.ToTens... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
... | 3 | src/config.py | mbsariyildiz/autoencoder-pytorch |
import pytest
from ml_api.api.app import create_app
from ml_api.api.config import TestingConfig
#Fixtures provide an easy way to setup and teardown resources
@pytest.fixture
def app():
app = create_app(config_object=TestingConfig)
with app.app_context():
yield app
@pytest.fixture
def flask_test_clie... | [
{
"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 | packages/ml_api/tests/conftest.py | iameminmammadov/datacube_bigmart_lighthouse |
"""Module with Kytos Events."""
from kytos.core.helpers import now
class KytosEvent:
"""Base Event class.
The event data will be passed in the `content` attribute, which should be a
dictionary.
"""
def __init__(self, name=None, content=None):
"""Create an event to be published.
... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/c... | 3 | kytos/core/events.py | slinksoft/kytos |
from socketIO_client import SocketIO, LoggingNamespace
#import webbrowser
import webview
import threading
socketIO = SocketIO('f237c8a0.ngrok.io', 80, LoggingNamespace)
def on_connect():
print("Connected.")
def on_thing(data):
if data["devHand"] == True:
print("Received message from Google Assistant"... | [
{
"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 | client.py | devHandApp/client |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import simplejson as json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
class AlipayOpenSmsgDataSetResponse(AlipayResponse):
def __init__(self):
super(AlipayOpenSmsgDataSetResponse, self).__init__()
def parse_response_content(self, ... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},... | 3 | alipay/aop/api/response/AlipayOpenSmsgDataSetResponse.py | articuly/alipay-sdk-python-all |
import numpy as np
class OrnsteinUhlenbeckNoiseProcess:
"""
Taken from https://github.com/openai/baselines/blob/master/baselines/ddpg/noise.py
"""
def __init__(self, mu, sigma, theta=.15, dt=1e-2, x0=None):
self.theta = theta
self.mu = mu
self.sigma = sigma
self.dt = dt... | [
{
"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 | ddpg/action_noise.py | MillionIntegrals/ddpg-tensorflow |
# 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": "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 | aliyun-python-sdk-iot/aliyunsdkiot/request/v20180120/CreateProductTagsRequest.py | sdk-team/aliyun-openapi-python-sdk |
# flake8: noqa
from flask_sqlalchemy import SQLAlchemy
from sqlalchemy.dialects import postgresql
db = SQLAlchemy()
class UserModel(db.Model):
__tablename__ = "user"
username = db.Column(db.String(36), primary_key=True)
password = db.Column(db.String(30))
def __init__(self, username, password):
... | [
{
"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 | server/src/models.py | Jobegiar99/Garden-Palooza |
from api_wrap import ApiWrapper
from garch import MyGARCH
from stock import Stock
def print_movers(companies):
"""
Print obtained companies symbols with responding values to choose
:param companies: list of companies symbols
"""
print("\n------------------- List of companies symbols --------------... | [
{
"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 | main.py | kostyantynHrytsyuk/py-garch |
import base64
import io
import json
import logging
from typing import Any, Dict
import numpy as np
from PIL import Image
from src.app.backend.redis_client import redis_client
logger = logging.getLogger(__name__)
def make_image_key(key: str) -> str:
return f"{key}_image"
def left_push_queue(queue_name: str, ke... | [
{
"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 | chapter4_serving_patterns/asynchronous_pattern/src/app/backend/store_data_job.py | sudabon/ml-system-in-actions |
# Copyright (c) 2021 IBM Corporation
# Henry Feldman, MD (CMO Development, IBM Watson Health)
from databaseUtil import DatabaseUtil
from typing import List
from database_classes import RadiologyReport, EKGReport
class ReportsDao:
"""
the collection of methods to fetch report entities (radiology, EKG...) fro... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answ... | 3 | client-tutorial/client_tutorial/ReportsDao.py | dixonwhitmire/connect-clients |
# -*- coding: utf-8 -*-
"""
create on 2019-03-20 04:19
author @lilia
"""
from sklearn.neural_network import MLPClassifier
from analysis_llt.ml.cv.base import BaseCV
class MLPClassifierCV(BaseCV):
def __init__(self, hidden_layer_sizes=(100,), learning_rate_init=0.001, cv=None, random_state=None, verbose=0,
... | [
{
"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 | analysis_llt/ml/cv/neural_network.py | Tammy-Lee/analysis-llt |
class Env:
__table = None
_prev = None
def __init__(self, n):
self.__table = {}
self._prev = n
def put(self, w, i):
self.__table[w] = i
def get(self, w):
e = self
while e is not None:
found = e.__table.get(w)
if found is not None:
... | [
{
"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 | symbols/Env.py | Vipul97/ProgLang |
import sys
import numpy as np
import pandas as pd
import multiprocessing as mp
from transformers import BertTokenizerFast
from tqdm import tqdm
if __name__ == "__main__":
assert len(sys.argv) == 2
data_shard_idx = int(sys.argv[1])
data_shard_path = f"/data/ajay/contracode/data/hf_data/train_chunks/augmente... | [
{
"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 | scripts/hf_per_train_shard_tokenize.py | myutman/contracode |
# standard library
import threading
# django
from django.core.mail import send_mail
# local django
from user import constants
class SendMail(threading.Thread):
"""
Responsible to send email in background.
"""
def __init__(self, email, HealthProfessional, SendInvitationProfile):
self.email = ... | [
{
"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 | medical_prescription/user/views/sendmail.py | ristovao/2017.2-Receituario-Medico |
#!/usr/bin/env python
# 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, software... | [
{
"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 | test/functional/ios/helper/test_helper.py | apptim/python-client |
""" https://adventofcode.com/2018/day/3 """
def readFile():
l = []
with open(f"{__file__.rstrip('code.py')}input.txt", "r") as f:
line = f.readline()
while line:
s = line.split(" ")
dist = s[2].split(",")
size = s[3].split("x")
fields = []
... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": fal... | 3 | 2018/03/code.py | Akumatic/Advent-of-Code |
# Copyright © 2014-2016 Jakub Wilk <jwilk@jwilk.net>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the “Software”), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, mer... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written... | 3 | tests/test_trim.py | jwilk/mwic |
import subprocess
import sys
import setup_util
from os.path import expanduser
home = expanduser("~")
##############
# start(args)
##############
def start(args, logfile, errfile):
setup_util.replace_text("treefrog/config/database.ini", "HostName=.*", "HostName=" + args.database_host)
setup_util.replace_text("tre... | [
{
"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 | treefrog/setup.py | oberhamsi/FrameworkBenchmarks |
import random
import os
def move_all(data_type, shape):
dirpath = os.path.join(data_type, shape)
os.makedirs(dirpath, exist_ok=True)
for filename in os.listdir(shape):
if filename.endswith('.png'):
os.rename(os.path.join(shape, filename),
os.path.join(data_type, sh... | [
{
"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 | mover.py | ritiek/shapes-classifier |
from airflow.hooks.postgres_hook import PostgresHook
from airflow.utils.decorators import apply_defaults
from airflow.models import BaseOperator
import pathlib
class CreateTablesOperator(BaseOperator):
"""
Operator that creates tables on Amazon Redshift
Attributes
----------
redshift_conn_id : st... | [
{
"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": true
}... | 3 | airflow/plugins/operators/create_tables.py | najuzilu/crypto_report |
import pytest
def test_dog1():
assert True
def test_dog2():
assert True
def test_dog3():
assert True
def test_dog4():
assert True
def test_dog5_failing():
assert False
def test_dog6():
assert True
| [
{
"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 | faketests/animals/test_one_failing_test.py | Djailla/pytest-sugar |
import sys
import time
import numpy as np
from matplotlib.backends.qt_compat import QtCore, QtWidgets, is_pyqt5
if is_pyqt5():
from matplotlib.backends.backend_qt5agg import (
FigureCanvas, NavigationToolbar2QT as NavigationToolbar)
else:
from matplotlib.backends.backend_qt4agg import (
Figure... | [
{
"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 | temp/maintestgraph.py | Pugavkomm/NS-analyst |
"""
models.py
Contains all the models related to tasks
"""
import datetime
from application import db
class Task(db.Model):
id = db.Column(db.Integer, primary_key=True)
user_id = db.Column(db.Integer, db.ForeignKey('user.id'))
description = db.Column(db.String(80), nullable=False)
start_date = db.Col... | [
{
"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 | todo/models.py | ppmadalin/todoweb |
import math
def newton(function,function1,startingInt): #function is the f(x) and function1 is the f'(x)
x_n=startingInt
while True:
x_n1=x_n-function(x_n)/function1(x_n)
if abs(x_n-x_n1)<0.00001:
return x_n1
x_n=x_n1
def f(x):
return math.pow(x,3)-2*x-5
def f1(x):
retur... | [
{
"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 | NeutonMethod.py | cosadiz69/python |
from unittest import TestCase
import pyhavamal
class TestStanzas(TestCase):
def test_stanza_count(self):
self.assertEqual(len(pyhavamal.all()), 165)
def test_all_numbered(self):
self.assertIsInstance(pyhavamal.all(True), dict)
def test_find_good_number(self):
self.assertIsIns... | [
{
"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 | pyhavamal/tests/test_stanzas.py | equinlan/pyhavamal |
import os
import tempfile
import pytest
import json
from ...utilities.macro import substitute_in_file, parse_macro_string
@pytest.mark.parametrize("text, macros, expected", [
(
'This is a ${what} to ensure that macros work. ${A} ${B} ${C}',
{'what': 'test', 'A': 'X', 'B': 'Y', 'C': 'Z'},
... | [
{
"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 | pydm/tests/utilities/test_macro.py | KurtJacobson/pydm |
# coding=utf-8
import os,subprocess,time
import pub.settings as s
import pub.functions.token as t
tmp_path = os.path.join(s.EXE_PATH,'tmp')
compiler = os.path.join(s.EXE_PATH,'EG.exe')
reference = os.path.join(s.EXE_PATH,'src.pub.dll')
def compile(code):
_clean_tmp()
filename = _get_random_file_name('.cs')
... | [
{
"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 | pub/exe/compiler.py | DASTUDIO/MyVHost |
from utils import TreeNode, binary_tree
class Solution:
def __init__(self):
self.index = 0 # 利用[中序遍历左边元素数量 = 左子树节点总数]可以省掉这个计数的字段
def buildTree(self, preorder, inorder):
"""
:type preorder: List[int]
:type inorder: List[int]
:rtype: TreeNode
"""
if not preorder:
return None
def build_node(lo, h... | [
{
"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 | medium/Q105_ConstructBinaryTreeFromPreorderAndInorderTraversal.py | Kaciras/leetcode |
import pandas as pd
import csv
from builelib import airconditioning
import pytest
import json
import xlrd
### テストファイル名 ###
# 辞書型 テスト名とファイル名
testcase_dict = {
"AHU_basic": "./tests/airconditioning/★空調設備テストケース一覧.xlsx",
}
def convert2number(x, default):
'''
空欄にデフォルト値を代入する
'''
if x == "":
x ... | [
{
"point_num": 1,
"id": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 lines?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": ... | 3 | tests/test_airconditioning.py | izumi-system-arai/builelib |
import json
import os
import sys
import time
import aco
from domain import DomainProblem
from state import State
def run(domain, problem, config):
print('==================================================')
print(f'{os.path.split(domain)[-1]} --- {os.path.split(problem)[-1]}')
print('===================... | [
{
"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 | planner.py | ealmuina/acoplanner |
# -*- coding: utf-8 -*-
# (C) 2015 Muthiah Annamalai
# setup the paths
from opentamiltests import *
from solthiruthi.data_parser import *
from solthiruthi.solthiruthi import Solthiruthi
import sys
class CmdLineIO(unittest.TestCase):
def test_CLI_interface_help(self):
return
# find a way to run th... | [
{
"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": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer":... | 3 | tests/solthiruthi_data_parser.py | nv-d/open-tamil |
# encoding: utf-8
"""
bgp.py
Created by Thomas Mangin on 2014-06-22.
Copyright (c) 2014-2014 Exa Networks. All rights reserved.
"""
from exabgp.configuration.engine.registry import Raised
from exabgp.configuration.engine.section import Section
# =================================================================== bm... | [
{
"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 | lib/exabgp/configuration/bmp/__init__.py | PowerDNS/exabgp |
#!/usr/bin/env python
from ansible_collections.terryhowe.hashivault.plugins.module_utils.hashivault import hashivault_argspec
from ansible_collections.terryhowe.hashivault.plugins.module_utils.hashivault import hashivault_client
from ansible_collections.terryhowe.hashivault.plugins.module_utils.hashivault import hashiv... | [
{
"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 | plugins/modules/hashivault_rekey_verify.py | fastlorenzo/ansible-modules-hashivault |
import unittest
import random
import subprocess
import signal
import sys
import os
import thread_affinity
# Test results may vary if executed in different systems
# with different amount of CPUUs
def get_random_mask():
"""Return a random, valid affinity mask
Which is a subset of {0, 1, ..., 2 ** num_procs - 1}
""... | [
{
"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 | test/TestThreadAffinityLibrary.py | srgrr/thread_affinity |
import pytest
from traitlets import TraitError
from ipygany import PolyMesh, IsoColor
from .utils import get_test_assets
def test_default_input():
vertices, triangles, data_1d, data_3d = get_test_assets()
poly = PolyMesh(vertices=vertices, triangle_indices=triangles, data=[data_1d, data_3d])
colored_... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"ans... | 3 | tests/test_isocolor.py | CagtayFabry/ipygany |
class file:
def __init__(self, dir: str, description: str = "", permission = -1):
self.dir = dir
self.description = description
self.permission = permission
def get_dir(self):
return self.dir
def get_description(self):
return self.description
def get_permission... | [
{
"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 | package/deb/file.py | congard/nvidia-system-monitor-qt |
from django import forms
from .models import Comment
import mistune
class CommentForm(forms.ModelForm):
nickname = forms.CharField(max_length=50, label='昵称', widget=forms.widgets.Input(
attrs={
'class': 'form-control',
'style': 'width: 60%;'
}
))
email = forms.CharF... | [
{
"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 | typeidea/comment/forms.py | MiracleWong/typeidea |
import pytest
from django.test import Client
from applications.tests.conftest import * # noqa
from oidc.tests.factories import EAuthorizationProfileFactory, OIDCProfileFactory
@pytest.fixture
def oidc_profile():
return OIDCProfileFactory()
@pytest.fixture
def eauthorization_profile():
return EAuthorizatio... | [
{
"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 | backend/kesaseteli/oidc/tests/conftest.py | SuviVappula/kesaseteli |
#!/usr/bin/env python
# coding: utf-8
# In[8]:
import pandas as pd
import numpy as np
import os
import sqlite3
pt = os.getcwd()
alarm = pt + "\\C.csv"
def conv_2_list(ls1, ls2, ls3):
ToDf = pd.DataFrame(zip(ls1, ls2, l3))
print(Todf)
l0 = ["0", "1", "2", "3", "4"]
l1 = ["Amar", "Barsha", "Carlos", "... | [
{
"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 | Z_ALL_FILE/Jy1/1092020-80-XAQ-Untitled.py | omikabir/omEngin |
# Copyright 2021 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0
from django.conf import settings
from django.utils.timezone import (
get_default_timezone, localtime, is_naive, make_aware)
from datetime import datetime
from uw_sws import SWS_DAO, sws_now
from abc import ABC, abstractmethod
... | [
{
"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 | course_grader/dao/__init__.py | uw-it-aca/gradepage |
from __future__ import unicode_literals
import colorama
import logging
logger = logging.getLogger(__name__)
def fix_subparsers(subparsers):
"""Workaround for bug in Python 3. See more info at:
https://bugs.python.org/issue16308
https://github.com/iterative/dvc/issues/769
Args:
... | [
{
"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": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
... | 3 | dvc/command/base.py | gyliu513/dvc |
from __future__ import absolute_import, division, unicode_literals
import socket
from .base import StatsClientBase, PipelineBase
class Pipeline(PipelineBase):
def __init__(self, client):
super(Pipeline, self).__init__(client)
self._maxudpsize = client._maxudpsize
def _send(self):
d... | [
{
"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 | statsd/client/udp.py | cclauss/pystatsd-1 |
from __future__ import absolute_import, division, print_function
import gzip
from datashape import discover, dshape
from collections import Iterator
from toolz import partial, concat
import os
from ..compatibility import unicode
from ..chunks import chunks
from ..drop import drop
from ..append import append
from ..co... | [
{
"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 | into/backends/text.py | quasiben/odo |
import requests
import tempfile
from multiprocessing.pool import ThreadPool
from typing import NoReturn, List, Optional
from urllib.parse import urlparse
def download_image(url: str, timeout_ms: int) -> Optional[bytes]:
try:
response = requests.get(url, timeout=(timeout_ms * 0.001, timeout_ms * 0.001))
... | [
{
"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 | yandex_images_download/download.py | andy-landy/yandex-images-download |
class Solution:
def isHappy(self, n: int) -> bool:
x=[]
def Happy(n,x):
t,k=0,0
while n>0:
t=n%10
n=n//10
k=k+t*t
if k==1:
return True
else:
if k in x:
... | [
{
"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 | HashTable/202. Happy Number.py | thewires2/Leetcode |
"""
a base class whose attributes are read-only,
unless use the context _context_allow_change to change attributes
"""
from contextlib import contextmanager
class AttributeReadOnlyError(Exception):
def __init__(self, obj: object, attr: str):
self.obj = obj
self.attr = attr
def __str__(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": "all_function_names_snake_case",
"question": "Are all function names in this file written... | 3 | api/BackendAPI/ReadOnlySpace.py | AutoCoinDCF/NEW_API |
import copy,os
from collections import OrderedDict
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d.axes3d import Axes3D
from matplotlib import cm
from pypospack.pyposmat.data import PyposmatDataFile
from pypospack.pyposmat.data import PyposmatConfigurationFile
from pypospack.pyposmat.visua... | [
{
"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 | tests/pyposmat/visualization/Pyposmat3DScatterWithProjections/make_2d_scatter_plot.py | eragasa/pypospack |
#!/usr/bin/env python
"""
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");... | [
{
"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 | ambari-server/src/main/resources/stacks/PHD/3.0.0.0/services/OOZIE/package/scripts/oozie_client.py | kennyballou/ambari |
"""
Ensemble the predictions from different model outputs.
"""
import argparse
import json
import pickle
import numpy as np
from collections import Counter
from data.loader import DataLoader
from utils import scorer, constant
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument('pred_file... | [
{
"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 | ensemble.py | ivan-bilan/tac-self-attention |
import torch
from torch import nn
from exptorch.utils.itertools import pairwise
class LinearNet(nn.Module):
"""Linear feed-forward neural network, i.e. linear regression model."""
def __init__(self, input_dim, output_dim):
super().__init__()
self.linear = nn.Linear(input_dim, output_dim)
... | [
{
"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 | examples/models.py | paulaurel/exptorch |
import os
class Service(object):
"""
The base class for all services. All services inherit from this class
"""
def __init__(self, prefix, artifacts, graph):
self._artifacts = artifacts
self._prefix = prefix
self._proc = None
self._graph = graph
def start(self, arg... | [
{
"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 | alveo/neptune/service.py | asirasa-xilinx/Vitis-AI |
import unittest
from pyregex.file_extensions import is_audio, is_img
class FileExtTests(unittest.TestCase):
def test_1(self):
self.assertEqual(is_audio("Nothing Else Matters.mp3"), False)
def test_2(self):
self.assertEqual(is_audio("NothingElseMatters.mp3"), True)
def test_3(self):
... | [
{
"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 | tests/pyregex/test_file_ext.py | BrianLusina/PyCharm |
import poplib
import email
import time
class MailHelper:
def __init__(self, app):
self. app = app
def get_mail(self, username, password, subject):
for i in range(5):
pop = poplib.POP3(self.app.config['james']['host'])
pop.user(username)
pop.pass_(password)... | [
{
"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 | fixture/mail.py | shark-x/py_mantis_traning |
from collections import OrderedDict
from utility.printable import Printable
class Transaction(Printable):
"""A transaction which can be added to a block in the blockchain.
Attributes:
:sender: The sender of the coins.
:recipient: The recipient of the coins.
:signature: The signature o... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding ... | 3 | transaction.py | screwyterror83/python_blockchain_learning_1 |
"""
Checker functions
"""
import numpy as np
import torch
PI = 3.1415
DIM = 64.0
SCALE = 255.0
FIXED_CIRCLE = False
class CentroidFunction(torch.nn.Module):
def __init__(self, bs, ch, sx, sy):
super(CentroidFunction, self).__init__()
self.x_lin = torch.nn.Parameter(torch.linspace(0, sx, sx).expa... | [
{
"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 | models/checkers.py | chomd90/invnet |
import sys
from functools import lru_cache
from decorators import print_time
import click
@click.group()
def cli():
pass
@cli.command()
@click.option('--n', default=1, help='0 based index of a fibanacci sequence')
def recursive(n: int)-> int:
click.echo(_recursive(n))
@print_time
def _recursive(n: int)-> int... | [
{
"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 | fibonacci.py | aboichev/python-cs-problems |
from paste.urlmap import *
from paste.fixture import *
import six
def make_app(response_text):
def app(environ, start_response):
headers = [('Content-type', 'text/html')]
start_response('200 OK', headers)
body = response_text % environ
if six.PY3:
body = body.encode('asc... | [
{
"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_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
... | 3 | third_party/Paste/tests/test_urlmap.py | tingshao/catapult |
from abc import ABCMeta, abstractmethod
class AbstractClient(metaclass=ABCMeta):
@abstractmethod
def connect(self):
pass
@abstractmethod
def get(self, table_name, key):
pass
@abstractmethod
def set(self, table_name, data):
pass
@abstractmethod
def update(self... | [
{
"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 | hotline/db/db_abstract.py | wearhacks/hackathon_hotline |
import instaloader
import os
class InstaStories():
def __init__(self):
self.obj = instaloader.Instaloader(save_metadata=False,
filename_pattern="{owner_username}_{date_utc}", download_video_thumbnails='')
self.obj.load_session_from_file(os.getenv('SESSION_NAME'))
def upda... | [
{
"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 | src/download_stories.py | Vemestael/gerrel_insta_bot |
from arm.logicnode.arm_nodes import *
class MergeNode(ArmLogicTreeNode):
"""Activates the output when any connected input is activated.
@option New: Add a new input socket.
@option X Button: Remove the lowermost input socket."""
bl_idname = 'LNMergeNode'
bl_label = 'Merge'
arm_section = 'flow'... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/c... | 3 | blender/arm/logicnode/logic/LN_merge.py | niacdoial/armory |
#!/usr/bin/env python
import numpy as np
from base.simulator import Simulator
class Linear2(Simulator):
def __init__(
self, num_samples, num_features, correlated=False, binarize=False
) -> None:
super().__init__(num_samples, num_features, correlated, binarize)
def formula(self, X):
... | [
{
"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 | {{cookiecutter.project_name}}/src/templates/simulation/linear_2.py | hclimente/cookiecutter-data-science |
"""A custom Sphinx HTML Translator for Bootstrap layout
"""
from distutils.version import LooseVersion
from docutils import nodes
import sphinx
from sphinx.writers.html5 import HTML5Translator
from sphinx.util import logging
from sphinx.ext.autosummary import autosummary_table
logger = logging.getLogger(__name__)
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 | pydata_sphinx_theme/bootstrap_html_translator.py | rossbar/pydata-sphinx-theme |
import logging
import flask
from flask import _app_ctx_stack as context_stack
from .topic_queue_poller import TopicQueuePoller
# -----------------------------------------------------------------------------
UNDEFINED = object()
CTX_PAYLOAD_KEY = "payload"
# ---------------------------------------------------------... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
... | 3 | tqp/flask.py | 4Catalyzer/tqp |
from enum import Enum
from .utils import ParamReprMixin
class Edge(ParamReprMixin):
DIRECTIONS = Enum('DIRECTIONS', ('forward', 'backward'))
def __init__(self, backward_node, forward_node, direction=None):
self.backward_node = backward_node
self.forward_node = forward_node
self.direc... | [
{
"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 | nopol/edge.py | daphtdazz/nopol |
#
# SensApp::Storage
#
# Copyright (C) 2018 SINTEF Digital
# All rights reserved.
#
# This software may be modified and distributed under the terms
# of the MIT license. See the LICENSE file for details.
#
import yaml
import logging
import logging.config
from storage.queues import QueueListener
from storage.db im... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"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 | storage/log.py | fchauvel/storage |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# WPSeku: Wordpress Security Scanner
#
# @url: https://github.com/m4ll0k/WPSeku
# @author: Momo Outaadi (M4ll0k)
#
# WPSeku is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Found... | [
{
"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 | Module/WPSeku/modules/discovery/themes/wplisting.py | vishnudxb/Yuki-Chan-The-Auto-Pentest |
'''
Vulnerability Scanner Class
'''
class VulnScan(object):
scanning=True
def set_scanning(self, val):
self.scanning = val
def get_scanning(self):
return self.scanning
| [
{
"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 | libs/VulnScan.py | glaudsonml/kurgan-ai |
import rethinkdb as r
class BibleCrawlerConnection(object):
def __init__(self, version: str, url: str, books):
self.connection = r.connect("localhost", 28015)
self.DB = r.db("bible")
self.table = self.setup_table(version)
self.create_books(books)
def setup_table(self, bible_v... | [
{
"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 | backend/backend/database/db_connections/bible/bible_crawler_connection_rethink.py | ppeetteerrs/LivingWater |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.