source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
import logging
import traceback
import config
import pathlib
class Logger(logging.getLoggerClass()):
def __init__(self, name, level=logging.NOTSET):
super().__init__(name, level=logging.DEBUG)
formatter = logging.Formatter('%(levelname)s %(asctime)s [ %(name)s ] %(message)s')
... | [
{
"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 | misc/logger.py | abraker95/ultimate_osu_analyzer |
from pytezos.operation.forge import forge_operation
hard_gas_limit_per_operation = 1040000
hard_storage_limit_per_operation = 60000
minimal_fees = 100
minimal_nanotez_per_byte = 1
minimal_nanotez_per_gas_unit = .1
def calculate_fee(content, consumed_gas, extra_size, reserve=10):
size = len(forge_operation(conten... | [
{
"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 | pytezos/operation/fees.py | juztin/pytezos-1 |
"""
Solution 04
Objective:
- Understand the concept of abstraction and how it can be used to reduce
code duplication and maintenance.
Documentation:
- https://docs.python.org/3.7/library/turtle.html
"""
import turtle
jim = turtle.Turtle()
canvas = jim.getscreen()
def start():
reset()
draw_squa... | [
{
"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 | solution04.py | hsanson/logo-playground |
import numpy as np
import math
class Cache():
def __init__(self, max_size=10):
self.cache = []
self.size = 0
self.max_size=max_size
def add(self, element):
self.cache.append(element)
self.size+=1
if self.size > self.max_size:
del self.cache[0]
... | [
{
"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 | cache.py | greerviau/HackUMass |
from discord.ext import commands
'''
Copyright (c) 2020 nizcomix
https://github.com/niztg/CyberTron5000
under the terms of the MIT LICENSE
'''
def check_admin_or_owner():
def predicate(ctx):
if ctx.message.author.id == 670564722218762240:
return True
elif ctx.message.author.permission... | [
{
"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 | cogs/utils/checks.py | blitzwolfz/DevilBot |
# Generated by Django 2.1.9 on 2019-07-03 11:43
from django.db import migrations, models
import wagtail.core.fields
def copy_description_to_catalog_details(apps, schema_editor):
"""
Copy the existing page description to the new `catalog_details`
field.
"""
CoursePage = apps.get_model("cms", "Cour... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inherit... | 3 | cms/migrations/0039_product_page_catalog_details.py | mitodl/mit-xpro |
from typing import Optional
from bomber_monkey.features.board.board import Tiles, TileEffect, Cell
from bomber_monkey.features.physics.collision import Collision
from bomber_monkey.features.player.stronger import Stronger
from bomber_monkey.game_config import GameConfig
from python_ecs.ecs import System, Simulator, Co... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (... | 3 | bomber_monkey/features/player/crunch.py | MonkeyPatchIo/bomber-monkey |
from typing import Any
from werkzeug.http import HTTP_STATUS_CODES
_sentinel = object()
# TODO Remove these shortcuts when pin Flask>=2.0
def route_shortcuts(cls):
"""A decorator used to add route shortcuts for `Flask` and `Blueprint` objects.
Includes `get()`, `post()`, `put()`, `patch()`, `delete()`.
... | [
{
"point_num": 1,
"id": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 lines?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls... | 3 | apiflask/utils.py | johntheprime/apiflask |
from flask import Flask
from flask import request
from flask import jsonify
from flask import make_response
from flask import abort
from . controller import create_user
app = Flask(__name__)
def _assert(condition, status_code, message):
if condition: return
data = {
"message": message,
"stat... | [
{
"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 | serverquest/app.py | paulomaateus/quest-backend |
from flask import Blueprint, jsonify, request
from financial.models import User, users_schema
from financial import db
user = Blueprint('user', __name__, url_prefix='')
@user.route("/user", methods=['GET'])
def get():
users = User.query.all()
result = users_schema.dump(users)
return jsonify(user=result.... | [
{
"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 | financial/views/user.py | dritux/financial-tools |
from app.utils import db
import click
from config import get_env
from app import create_app
from flask_script import Manager
from app.utils.auth import Auth
from flask_migrate import Migrate, MigrateCommand
from app.utils.seeders.seed_database import SEED_OPTIONS, seed_db
app = create_app(get_env("APP_ENV"))
migrate =... | [
{
"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 | run.py | Maxcutex/pm_api |
import os.path
from yt.testing import assert_equal
from yt.utilities.answer_testing.framework import (
FieldValuesTest,
data_dir_load,
requires_ds,
)
# from yt.frontends.owls_subfind.api import OWLSSubfindDataset
_fields = (
"particle_position_x",
"particle_position_y",
"particle_position_z",... | [
{
"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 | yt/frontends/owls_subfind/tests/test_outputs.py | tukss/yt |
'''
Classes from the 'IOAccelerator' framework.
'''
try:
from rubicon.objc import ObjCClass
except ValueError:
def ObjCClass(name):
return None
def _Class(name):
try:
return ObjCClass(name)
except NameError:
return None
IOAccelMTLEvent = _Class('IOAccelMTLEvent')
| [
{
"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 | Lib/objc/_IOAccelerator.py | kanishpatel/Pyto |
import numpy as np
import torch
from typing import Tuple, Union
Indexable = Union[np.ndarray, torch.Tensor, list]
class TorchDataset(torch.utils.data.Dataset):
def __init__(self, *indexables: Tuple[Indexable, ...]) -> None:
self.indexables = indexables
def __getitem__(self, idx: int) -> Union[Tuple[... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer... | 3 | alibi_detect/utils/pytorch/data.py | sugatoray/alibi-detect |
import os
import json
__author__ = 'Manfred Minimair <manfred@minimair.org>'
class JSONStorage:
"""
File storage for a dictionary.
"""
file = '' # file name of storage file
data = None # data dict
indent = ' ' # indent prefix for pretty printing json files
def __init__(self, path, n... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docst... | 3 | netdata/workers/json_storage.py | mincode/netdata |
from flask import Flask,render_template,url_for,request
import pandas as pd
import pickle
import numpy as np
import re
filename = "model.pkl"
cv = pickle.load(open('transform.pkl',"rb"))
clf = pickle.load(open(filename,"rb"))
app = Flask(__name__)
@app.route('/')
def home():
return render_template('... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": fals... | 3 | app.py | SuryanshNaugraiya/Twitter-Sentiment-Analysis |
from tkinter import *
from tkinter.ttk import *
class Stats:
def __init__(self, gui) -> None:
self.gui = gui
self.bars, self.labels = [None] * 10, [None] * 10
def init(self) -> None:
for i in range(10):
self.labels[i] = LabelFrame(self.gui, text=str(i))
self.b... | [
{
"point_num": 1,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer"... | 3 | gui/stats.py | janaSunrise/MNIST-Digit-Recognizer-Tensorflow |
from api.tests.base import BaseTestCase
class TestUserViews(BaseTestCase):
""" Test Profile views """
def test_get_profile(self):
""" Test can get single user profile """
self.create_user(self.new_user)
response = self.test_client().get('/api/v1/accounts/baduism/profile/')
self... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true... | 3 | src/api/tests/test_profile_views.py | ThaDeveloper/grind |
from starlette.status import HTTP_302_FOUND
from app.routers.invitation import get_all_invitations, get_invitation_by_id
class TestInvitations:
NO_INVITATIONS = b"You don't have any invitations."
URL = "/invitations/"
def test_view_no_invitations(self, invitation_test_client):
resp = invitation_... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inherit... | 3 | tests/test_invitation.py | issac211/calendar |
from ..node import WarpQNode
from pyvad import vad
class WarpQVADNode(WarpQNode):
def __init__(self, id_: str, ref_sig_key: str, deg_sig_key: str,
**kwargs):
super().__init__(id_)
self.ref_sig_key = ref_sig_key
self.deg_sig_key = deg_sig_key
self.type_ = "WarpQ... | [
{
"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 | nodes/warpq_nodes/warpqvadnode.py | JackGeraghty/AQP-Research |
from django.db import models
from django.contrib.auth.models import User
from django.conf import settings
from django.utils import timezone
# Create your models here.
class Article(models.Model):
title=models.CharField(max_length=100)
slug=models.SlugField(blank=True)
body= models.TextField()
... | [
{
"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 | articles/models.py | Blaise-design/Django-Hospital-Project |
from django.core.management.base import BaseCommand
from sorl.thumbnail import default
from sorl.thumbnail.images import delete_all_thumbnails
VALID_LABELS = ['cleanup', 'clear', 'clear_delete_referenced', 'clear_delete_all']
class Command(BaseCommand):
help = "Handles thumbnails and key-value store"
missi... | [
{
"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": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 lines?",
"answer": t... | 3 | sorl/thumbnail/management/commands/thumbnail.py | julianwachholz/sorl-thumbnail |
import logging
class TestResult:
def __init__(self, component, config, status):
self.component = component
self.config = config
self.status = status
@property
def __test_result(self):
return "PASS" if self.status == 0 else "FAIL"
def __str__(self):
return '| {... | [
{
"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 | src/test_workflow/test_result/test_result.py | Rishikesh1159/opensearch-build |
# Copyright 2015 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
... | 3 | lib/surface/meta/apis/collections/describe.py | bopopescu/Google-Cloud-SDK-1 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Create the word stems of the individual words of the tweet.
Created on Wed Oct 6 16:32:45 2021
@author: laura
"""
from code.preprocessing.preprocessor import Preprocessor
from code.util import TOKEN_DELIMITER
from nltk.stem import PorterStemmer
class Stemmer(Prepr... | [
{
"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 | code/preprocessing/stemmer.py | jlinkemeyer/MLinPractice |
import typing
import numba as nb
import numpy as np
@nb.njit((nb.i8,) * 7, cache=True)
def solve(
n: int,
h: int,
a: int,
b: int,
c: int,
d: int,
e: int,
) -> typing.NoReturn:
inf = 1 << 60
mn = inf
for x in range(n + 1):
y = (n * e - h - (b + e) * x... | [
{
"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": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter tha... | 3 | jp.atcoder/abc013/abc013_3/26241874.py | kagemeka/atcoder-submissions |
from django.apps import registry
from django.conf import settings
from django.urls import reverse
from . import settings as app_settings
def menu_items(request):
menu = build_menu(request)
return {
'openwisp_menu_items': menu,
'show_userlinks_block': getattr(
settings, 'OPENWISP_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": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answ... | 3 | openwisp_utils/admin_theme/context_processor.py | ManishShah120/openwisp-utils |
from ..IPacket import IPacket
class AllyHit(IPacket):
"Sent by client when an ally has been hit by a projectile"
def __init__(self):
self.time = 0
self.projectileID = 0
self.objectID = 0
def Read(self, r):
self.time = r.ReadInt32()
self.projectileID = ... | [
{
"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 | darzalib/Outgoing/AllyHit.py | swrlly/Midnight |
import regex as re
class ssfparser:
def __init__(self, filename):
with open(filename, 'r') as file:
self.data = file.read()
def fs_func(self, fs):
fs_parts, fs_map = re.findall(' ([^\s>]*\=[^\s>]*)', fs), {}
for part in fs_parts:
pair = part.split('=')
... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
}... | 3 | ssf_parser.py | redb17/ssf_parser |
# -*- coding: utf-8 -*-
# Author: XuMing <xuming624@qq.com>
# Brief:
import sys
sys.path.append("../")
import os
from pycorrector.eval import *
pwd_path = os.path.abspath(os.path.dirname(__file__))
bcmi_path = os.path.join(pwd_path, '../pycorrector/data/cn/bcmi.txt')
clp_path = os.path.join(pwd_path, '../pycorrector... | [
{
"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/eval_test.py | zouning68/pycorrector |
import logging
import datetime
from sqlalchemy.exc import IntegrityError, DataError, InvalidRequestError
from totalimpactwebapp import db
from totalimpactwebapp.json_sqlalchemy import JSONAlchemy
logger = logging.getLogger("ti.product_deets")
class ProductDeets(db.Model):
id = db.Column(db.Integer, primary_key... | [
{
"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 | totalimpactwebapp/product_deets.py | ourresearch/total-impact-webapp |
from typing import TYPE_CHECKING
from django.db import models
from posthog.models.utils import UUIDModel, sane_repr
if TYPE_CHECKING:
from posthog.models.organization import OrganizationMembership
class ExplicitTeamMembership(UUIDModel):
class Level(models.IntegerChoices):
"""Keep in sync with Orga... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
... | 3 | ee/models/explicit_team_membership.py | brave-care/posthog |
# flake8: noqa
"""
Copyright 2020 - Present Okta, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in ... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
}... | 3 | okta/models/application_settings_notifications.py | corylevine/okta-sdk-python |
import datetime
import json
from sqlalchemy.event import listens_for
from backend.models.base import db, Column
class CTimestampMixin(object):
created_at = Column(db.DateTime(True), default=db.func.now())
updated_at = Column(db.DateTime(True), default=db.func.now())
def serialize_time(self, column):
... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
... | 3 | backend/models/mixins.py | XiaoYang1127/flask-server-in-python |
from django.shortcuts import render
# Create your views here.
from .models import BallotText, Candidate, District
def index(request):
districts = District.objects.all
context = {'districts': districts}
return render(request, 'vote/index.html', context)
def ballot(request, district_num):
ballot_lis... | [
{
"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 | nc_vote/vote/views.py | dave-a-fox/VoteNC2020 |
import os
import shlex
import subprocess
import unittest
import numpy
import lue
import lue_test
class TestCase(unittest.TestCase):
@classmethod
def dataset_name(self,
module_name,
filename):
return "{}.lue".format(
os.path.join(os.path.dirname(module_name), filena... | [
{
"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 | source/data_model/python/test/lue_test/test_case.py | OliverSchmitz/lue |
from chalicelib.utils.helper import environ
import jwt
from chalicelib.utils import helper
from chalicelib.utils.TimeUTC import TimeUTC
from chalicelib.core import tenants
from chalicelib.core import users
def jwt_authorizer(token):
token = token.split(" ")
if len(token) != 2 or token[0].lower() != "bearer":... | [
{
"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 | ee/api/chalicelib/core/authorizers.py | champkeh/openreplay |
# Copyright The PyTorch Lightning team.
#
# 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 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": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (exc... | 3 | tests/trainer/flags/test_check_val_every_n_epoch.py | KyleGoyette/pytorch-lightning |
# The content of this file was generated using the Python profile of libCellML 0.2.0.
from enum import Enum
from math import *
__version__ = "0.3.0"
LIBCELLML_VERSION = "0.2.0"
STATE_COUNT = 1
VARIABLE_COUNT = 1
class VariableType(Enum):
VARIABLE_OF_INTEGRATION = 1
STATE = 2
CONSTANT = 3
COMPUTED_... | [
{
"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 | tests/resources/generator/ode_const_var_on_rhs/model.py | nickerso/libcellml |
import logging
import requests
from django.conf import settings
from django.contrib.sitemaps import ping_google
logger = logging.getLogger(__name__)
class SpiderNotify():
@staticmethod
def baidu_notify(urls):
try:
data = '\n'.join(urls)
result = requests.post(settings.BAIDU_N... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer"... | 3 | djangoblog/spider_notify.py | n1celll/DjangoBlog |
from webob import status_map as _STATUS
from web.dispatch.resource import Collection as _Collection
from marrow.mongo.query import Ops as _Ops
from ..resource.domain import Domain as _Domain
class Redirections(_Collection):
"""A collection for the management of redirections on a per-domain basis."""
__resource_... | [
{
"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 | web/app/redirect/collection/redirections.py | marrow/web.app.redirect |
"""Test a PoOT built on a mongoDB lattice"""
import pymongo
import cPickle
from .. import poot
from .. import data
import test_poot
class TestMongoPoOT(test_poot.TestPoOT):
def setUp(self):
# development-specific configuration
db = pymongo.MongoClient().rankomatic
self.p = poot.PoOT(lat_d... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer":... | 3 | ot/test/test_mongo_poot.py | cjeffers/OT |
import clr
clr.AddReference("System.Net")
class NetworkInterfaceWrapper:
def __init__(self, networkInterface) -> None:
self.__ni = networkInterface
@property
def Id(self) -> str:
return self.__ni.Id
@property
def Description(self) -> str:
return self.__ni.Description
... | [
{
"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": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
... | 3 | src/ihcWrappers/networkInterface.py | F9R/ihcpmslib-wrappers |
"""The test project for the SkewYInterface class.
Command examples:
$ python test_projects/SkewYInterface/main.py
"""
import sys
sys.path.append('./')
import os
from types import ModuleType
from typing_extensions import TypedDict
import apysc as ap
from apysc._file import file_util
this_module:... | [
{
"point_num": 1,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer... | 3 | test_projects/SkewYInterface/main.py | ynsnf/apysc |
# coding: utf-8
"""
Seldon Deploy API
API to interact and manage the lifecycle of your machine learning models deployed through Seldon Deploy. # noqa: E501
OpenAPI spec version: v1alpha1
Contact: hello@seldon.io
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future... | [
{
"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 | python/test/test_cinder_volume_source.py | adriangonz/seldon-deploy-sdk |
import re
from scripts.features.feature_extractor import FeatureExtractor
from bs4 import BeautifulSoup
class ItemizationCountExtractor(FeatureExtractor):
def extract(self, post, extracted=None):
soup = BeautifulSoup(post.rendered_body, "html.parser")
count = len(soup.find_all("ul"))
ret... | [
{
"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 | scripts/features/structure_extractor.py | chakki-works/elephant-sense |
from django.db import models
from events_framework.models import EventModel
from .events import PersonEvents
class Person(models.Model):
name = models.CharField(max_length=64)
activation_link_sent = models.BooleanField(default=False)
def save(self) -> None:
from .events import generators as even... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{... | 3 | test_app/models.py | Reve/django-events-framework |
try:
from gmpy2 import is_strong_prp
except ImportError:
is_strong_prp = None
def odd_primes_below_n(n):
""" Returns a list of odd primes less than n. """
sieve = [True] * (n // 2)
for i in range(3, int(n ** 0.5) + 1, 2):
if sieve[i // 2]:
sieve[i * i // 2::i] = [False] * ((n-i... | [
{
"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 | lib/chiavdf/inkfish/primes.py | davision/chia-blockchain |
from opentuner.resultsdb.models import *
class DriverBase(object):
"""
shared base class between MeasurementDriver and SearchDriver
"""
def __init__(self,
session,
tuning_run,
objective,
tuning_run_main,
args,
**kwargs)... | [
{
"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 | opentuner/driverbase.py | HansGiesen/opentuner |
import torch
import numpy as np
from PIL import Image
from glob import glob
from image.dataquantizer import quantize
def load_image(location):
img = Image.open(location)
img.load()
data = np.asarray(img, dtype="int32")
return data
def save_image(image, location):
if isinstance(image, torch.Tenso... | [
{
"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 | image/imagequantizer.py | xinyandai/structural-nn |
import src.c2oObject as Node
##-----------------------------BatchNormalization层 = BatchNorm + Scale-------------------------------------##
#获取超参数
def getBNAttri(layer):
#超参数字典
dict = {"epsilon": layer.batch_norm_param.eps, # 滑动系数
"momentum": layer.batch_norm_param.moving_average_fraction
... | [
{
"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 | src/OPs/BatchNorm.py | just-hjkwon/caffe-onnx |
import numpy as np
from utils.test_env import EnvTest
class LinearSchedule(object):
def __init__(self, eps_begin, eps_end, nsteps):
"""
Args:
eps_begin: initial exploration
eps_end: end exploration
nsteps: number of steps between the two values of eps
""... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true... | 3 | q_learning/utils/schedule.py | DarseZ/DL_hw5 |
"""Plotting routines."""
from pyvista import MAX_N_COLOR_BARS
from .colors import (color_char_to_word, get_cmap_safe, hex_to_rgb, hexcolors,
string_to_rgb, PARAVIEW_BACKGROUND)
from .export_vtkjs import export_plotter_vtkjs, get_vtkjs_url
from .helpers import plot, plot_arrows, plot_compare_four, ... | [
{
"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 | pyvista/plotting/__init__.py | fgallardo-mpie/pyvista |
import unittest
import mxnet.gluon.nn as nn
import mxnet as mx
import mxfusion.components as mfc
from mxfusion.components.functions import MXFusionGluonFunction
import mxfusion as mf
class FactorTests(unittest.TestCase):
"""
Tests the MXFusion.core.variable.Factor class.
"""
def test_replicate_factor... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
}... | 3 | testing/core/factor_test.py | meissnereric/MXFusion |
from django.db import models
from django.db.models.fields import CharField, DateTimeField
from ..Appliances.models import Appliance
from ..Properties.models import Property
class ServiceRequest(models.Model):
job = CharField(max_length=100)
details = CharField(max_length=300)
serviceCompany = CharField(m... | [
{
"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 | homepairs/HomepairsApp/Apps/ServiceRequest/models.py | YellowRainBoots/2.0 |
import pytest
def pytest_addoption(parser):
parser.addoption(
"--master", action="store", default="", help="IP address of GKE master")
parser.addoption(
"--namespace", action="store", default="", help="namespace of server")
parser.addoption(
"--service", action="store", default="",
help... | [
{
"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 | xgboost_ames_housing/test/conftest.py | qq2016/kubeflow_learning |
import numpy as np
import torch
CONST = 100000.0
def calc_dist(p, q):
return np.sqrt(((p[1] - q[1])**2)+((p[0] - q[0]) **2)) * CONST
def get_ref_reward(pointset):
if isinstance(pointset, torch.cuda.FloatTensor) or isinstance(pointset, torch.FloatTensor):
pointset = pointset.detach().numpy()
num... | [
{
"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 | tsp_heuristic.py | CSI-Woo-Lab/PandaSchedulingModel |
import unittest
import os
import pyopenms
class TestMSSpectrumAndRichSpectrum(unittest.TestCase):
def setUp(self):
dirname = os.path.dirname(os.path.abspath(__file__))
def testMSSpectrum(self):
spec = pyopenms.MSSpectrum()
p = pyopenms.Peak1D()
p.setMZ(500.0)
p.setIn... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer":... | 3 | src/pyOpenMS/tests/unittests/test_MSSpectrumAndRichSpectrum.py | tomas-pluskal/openms |
class Event:
name = 'event'
class StartEvent(Event):
name = 'start'
class QuitEvent(Event):
name = 'start'
class AddQuestionEvent(Event):
name = 'add_question'
def __init__(self, question: str, answers: list, choice: int=None, bot_name: str=None):
self.question = question
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_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
... | 3 | game_bot/events.py | Nachtalb/energy_game |
f = open('d04.in', 'r')
def calculateScore(card, number):
for i in range(5):
if sum(card[i::5]) == -5 or sum(card[i*5:i*5+5]) == -5:
return sum([x for x in card if x != -1]) * number
return -1
def calculateFinalScore(cards, number):
for card in cards:
score = calculateScore(ca... | [
{
"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 | day04/d04.py | jcisio/adventofcode2021 |
import hashlib
def get_hash(data):
"""md5 hash of Python data. This is limited to scalars that are convertible to string and container
structures (list, dict) containing such scalars. Some data items are not distinguishable, if they have
the same representation as a string, e.g., hash(b'None') == hash('No... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": tru... | 3 | servo/utilities/hashing.py | DanielHHowell/servox |
# coding: utf-8
"""
Talon.One API
The Talon.One API is used to manage applications and campaigns, as well as to integrate with your application. The operations in the _Integration API_ section are used to integrate with our platform, while the other operations are used to manage applications and campaigns. #... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
... | 3 | test/test_campaign_group_entity.py | talon-one/talon_one.py |
from django.test import TestCase
from rockit.core import holders
from rockit.core import models
class MixesHolderTestCase(TestCase):
def setUp(self):
self.association = models.Association.objects.create(name = 'my_node', namespace='test')
self.holder = holders.MixesHolder(self.association)
... | [
{
"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 | rockit/core/tests/test_holder_mixes.py | acreations/rockit-server |
#
# 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... | [
{
"point_num": 1,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?... | 3 | airflow/migrations/versions/45ba3f1493b9_add_k8s_yaml_to_rendered_templates.py | ChaseKnowlden/airflow |
import unittest
from functools import wraps
def score_with(score):
def decorator(fn):
def decorated(*args,**kwargs):
ret = fn(*args,**kwargs)
if ret:
args[0].__class__._increase_score(score)
return ret
return decorated
return dec... | [
{
"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 | prover.py | hv10/reverseengineering1819 |
from abyss import abyss_filter_t
import ida_lines, ida_pro
FUNC_NAMES = [
"memcpy", "memmove", "strcpy", "gets", "malloc", "free",
"realloc", "sprintf", "system", "popen"]
class funcname_colorizer_t(abyss_filter_t):
"""example filter which makes function names stand out visually"""
def proc... | [
{
"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 | abyss_filters/func_colorizer.py | CrackerCat/abyss |
'''
Salt-Based Web Crawler
'''
# Import python libs
import logging
import urllib2
import random
import time
log = logging.getLogger(__name__)
def __virtual__():
'''
Basic Python libs are all that are needed
'''
return 'crawler'
def fetch(urls=None, wait=0, random_wait=False):
'''
Fetch a U... | [
{
"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 | salt/modules/crawler.py | techhat/salt-crawler |
#!/usr/bin/env python3
import i3ipc
import subprocess
import os
import signal
CZ_LAYOUT = 1
US_LAYOUT = 0
KEYBOARD_ID = "65261:38924:TMK._FC980C_Alt_Controller"
us_window_ids = [
"org.kde.krdc",
"Alacritty",
"foot",
"assistant", # Qt Assistant
]
in_game = False
ipc = i3ipc.Connection()
def altmeta... | [
{
"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 | sway/.config/sway/keyboard-layout-switcher.py | nowrep/dotfiles |
class Color(object):
"""Class used for colouring terminal output."""
def __init__(self):
pass
PURPLE = '\033[95m'
CYAN = '\033[96m'
DARK_CYAN = '\033[36m'
BLUE = '\033[94m'
GREEN = '\033[92m'
YELLOW = '\033[93m'
RED = '\033[91m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m... | [
{
"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 | velarium/color.py | holthe/velarium |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# GUI backend for fd_replicator, based on QT5.
import logging
import os
import sys
from config.config import LOGFILE
from PyQt5.QtWidgets import QApplication
from widgets.main_widget import MainWidget
def logging_init():
log_dir = os.path.split(LOGFILE)[0]
if n... | [
{
"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 | replicator_qt.py | pihentagyu/fd_replicator |
# def tallest_people(**user_data):
# for key, value in sorted(user_data.items()):
# if max(user_data.values()) == value:
# print(key, value, sep=' : ')
# tallest_people(Jackie=176, Wilson=185, Saersha=165, Roman=185, Abram=169)
def calculate_linear(k, b, x):
return k * x + b
def cal... | [
{
"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 | self-learning/based/00000008.py | vladspirin/python-learning |
# coding=utf8
# Copyright 2018 JDCLOUD.COM
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed ... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excl... | 3 | jdcloud_sdk/services/vm/apis/StopInstanceRequest.py | Tanc009/jdcloud-sdk-python |
import os.path
from jinja2 import FileSystemLoader
from jinja2.environment import Environment
class BaseObject(object):
@property
def version(self):
try:
with open(os.path.join(os.path.dirname(__file__), 'VERSION')) as fin:
return fin.readline().strip()
except:
... | [
{
"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 | xunit_tools/render_objects.py | charlesthomas/xunit_tools |
# automatically generated, do not modify
# namespace: NamespaceA
import flatbuffers
class SecondTableInA(object):
__slots__ = ['_tab']
# SecondTableInA
def Init(self, buf, pos):
self._tab = flatbuffers.table.Table(buf, pos)
# SecondTableInA
def ReferToC(self):
o = flatbuffers.nu... | [
{
"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 | tests/namespace_test/NamespaceA/SecondTableInA.py | shivvis/flatbuffers |
import pygame
class Menu:
def __init__(self, screen):
self.menu_time = 0
self.screen = screen
self.time = 100
self.menu = pygame.image.load("img/menu_principal.jpg").convert_alpha()
self.menu = pygame.transform.scale(self.menu, self.screen.get_size())
def run(self):
... | [
{
"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 | menu.py | EinSlen/pykemon |
# -*- coding: utf-8 -*-
"""
test
~~~~
Flask-Cors tests module
"""
from ..base_test import FlaskCorsTestCase
from flask import Flask, Response
from flask_cors import *
from flask_cors.core import *
class ResponseHeadersOverrideTestCaseIntegration(FlaskCorsTestCase):
def setUp(self):
self.app ... | [
{
"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/core/test_override_headers.py | rtshilston/flask-cors |
#!/usr/bin/python
import csv
import getopt
import json
import sys
# Get Command Line Arguments
def main(argv):
input_file = ''
output_file = ''
format = ''
try:
opts, args = getopt.getopt(
argv, "hi:o:f:", ["ifile=", "ofile=", "format="])
except getopt.GetoptError:
p... | [
{
"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 | datasets/sentiment/Sentiment140/csv2json.py | vandurme/TFMTL |
class Brb():
data = 'teste'
def format_brb(self):
return self.data
def __str__(self):
return self.data
from modules.load_config import load_config
config = load_config()
| [
{
"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 | sdt2/stations/brb.py | helvecioneto/sdt2 |
"""Tests for the justatest2.my_module module.
"""
import pytest
from justatest2.my_module import hello
def test_hello():
assert hello('nlesc') == 'Hello nlesc!'
def test_hello_with_error():
with pytest.raises(ValueError) as excinfo:
hello('nobody')
assert 'Can not say hello to nobody' in str(ex... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",... | 3 | tests/test_my_module.py | sverhoeven/justatest2 |
from django.contrib.syndication.views import Feed
from django.urls import reverse_lazy
from .models import Job
class JobFeed(Feed):
""" Python.org Jobs RSS Feed """
title = "Python.org Jobs Feed"
description = "Python jobs from Python.org"
link = reverse_lazy('jobs:job_list')
def items(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_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answe... | 3 | jobs/feeds.py | buketkonuk/pythondotorg |
import falcon
import json
from .base import BaseResource
class ConfigResource(BaseResource):
'''Falcon resource to get form entries'''
def __init__(self, *args, **kwargs):
super(ConfigResource, self).__init__(*args, **kwargs)
def on_get(self, req, resp):
'''Get configuration page to crea... | [
{
"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": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answ... | 3 | paperboy/resources/config.py | datalayer-externals/papermill-paperboy |
import torch
import torch.nn as nn
from typing import List
class FCNN(nn.Module):
"""Class that describe the architecture and behavior of the neural network"""
neurons_per_layer: int = 0 # number of neurons per layer
layers: List[nn.Module] # Ordered list of the network layers
sequence: n... | [
{
"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 | network_architecture.py | AlbanOdot/DeepPhysics-article |
from django.contrib.auth.mixins import PermissionRequiredMixin
from django.urls import reverse_lazy
from church_site.views import AdminListView, BaseCreateView, BaseUpdateView
from churches.models import Church
from churches.selectors import get_member_churches
class ChurchesAdminListView(PermissionRequiredMixin, A... | [
{
"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 | churches/views.py | mennonitengemeinde/church_site |
import logging
from openfunction.function_runtime import OpenFunctionRuntime
def dapr_output_middleware(context):
"""Flask middleware for output binding."""
def dapr_output_middleware(response):
if not context or not context.outputs or not context.is_runtime_knative():
return response
... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answ... | 3 | src/openfunction/dapr_output_middleware.py | OpenFunction/functions-framework-python |
# Copyright 2014 Charles Noneman
#
# 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 writin... | [
{
"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 | test/test_companions.py | xelrach/DASaveReader |
"""Tests for our main k2a CLI module."""
from subprocess import PIPE, Popen as popen
from unittest import TestCase
from k2a import __version__ as VERSION
class TestHelp(TestCase):
def test_returns_usage_information(self):
output = popen(['k2a', '-h'], stdout=PIPE).communicate()[0]
self.assertTr... | [
{
"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 | tests/test_cli.py | K-7/cura-cli |
import asyncio
from unittest import IsolatedAsyncioTestCase
from aiodiskdb import exceptions
from aiodiskdb.aiodiskdb import AioDiskDB
from aiodiskdb.local_types import EventsHandlers
class TestEventsHandlerStrictTyping(IsolatedAsyncioTestCase):
def setUp(self) -> None:
self.sut = EventsHandlers()
... | [
{
"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_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},... | 3 | test/test_events.py | mempoolco/aiodiskdb |
# coding=utf-8
# --------------------------------------------------------------------------
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
from ... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class 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 | lib/jammy/models/azurefirewall/cloud_error_py3.py | girishmotwani/jammy |
from .base import BaseTransform
from PIL import Image
import numpy as np
class VFlipTransform(BaseTransform):
"""Class used for creating a vertical flipped copies of images."""
def __init__(self):
"""Constructs an instance of VFlipTransform."""
BaseTransform.__init__(self)
def execute(self... | [
{
"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": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answ... | 3 | src/ipynta/transform/vflip.py | allanchua101/ipynta |
# pylint: disable=missing-docstring
from resolwe.flow.models import Data, DescriptorSchema, Process
from resolwe.test import TestCase
class DescriptorTestCase(TestCase):
def setUp(self):
super().setUp()
self.process = Process.objects.create(
name="Dummy process", contributor=self.cont... | [
{
"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 | resolwe/flow/tests/test_descriptors.py | plojyon/resolwe |
from typing import List
class StandardOcr:
"""
StandardOcr is a helper class for the raw "standard" preset config OCR result. Enables easy extraction
of common datapoints into usable objects.
"""
def __init__(self, standardocr: dict):
"""
standardocr dict: standard result object f... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"ans... | 3 | indico_toolkit/ocr/standard_object.py | IndicoDataSolutions/Indico-Solutions-Toolkit |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2022 CERN.
#
# Invenio-Requests is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see LICENSE file for more
# details.
"""Request views decorators module."""
from functools import wraps
from flask import g
from invenio_requests... | [
{
"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 | invenio_requests/views/decorators.py | max-moser/invenio-requests-1 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
from commands.basecommand import BaseCommand
class Ports(BaseCommand):
def __init__(self):
self.__name__ = 'Ports'
def run_ssh(self, sshc):
res = self._ssh_data_with_header(sshc, '/ip service print detail')
sus_... | [
{
"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 | commands/ports.py | retr0-13/routeros-scanner |
import torchvision
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
def display_and_save_batch(title, batch, data, save=True, display=True):
"""Display and save batch of image using plt"""
im = torchvision.utils.make_grid(batch, nrow=int(batch.shape[0]**0.5))
plt.title(title)
plt.im... | [
{
"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 | Implementations/Conditional-Variational-Autoencoder/plot_utils.py | jaywonchung/Learning-ML |
from django.db import models
from django.contrib.auth.models import User
# Create your models here.
class Product(models.Model):
_id = models.AutoField(primary_key=True, editable=False)
name = models.CharField(max_length=200)
category = models.CharField(max_length=200, blank=True, null=True)
descript... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
... | 3 | manavsepeti_django/products/models.py | irembuz/manavsepeti-django-react |
import discord
from discord.ext import commands
from mainDiscord import botPrefix
from loguru import logger
class HelpDiscord(commands.Cog):
def __init__(self, client):
self.client = client
@commands.command()
async def help(self, ctx):
yiskiHelpEmbed = discord.Embed(title="Yiski Help",
... | [
{
"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 | discordCommands/help.py | asoji/Yiski |
from pyquil.parser import parse
from pyquil.api._qac import AbstractCompiler
from pyquil import Program
def parse_equals(quil_string, *instructions):
expected = list(instructions)
actual = parse(quil_string)
assert expected == actual
class DummyCompiler(AbstractCompiler):
def get_version_info(self):... | [
{
"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 | pyquil/tests/utils.py | joshcombes/pyquil |
"""empty message
Revision ID: 425803e3d9cd
Revises: 0f846b00d0db
Create Date: 2020-10-21 17:12:57.595639
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '425803e3d9cd'
down_revision = '0f846b00d0db'
branch_labels = None
depends_on = None
def upgrade():
# ... | [
{
"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 | backend/migrations/versions/425803e3d9cd_.py | cclauss/lineage |
from office365.runtime.client_value import ClientValue
class SPSiteCreationRequest(ClientValue):
def __init__(self, title, url, owner=None):
super(SPSiteCreationRequest, self).__init__()
self.Title = title
self.Url = url
self.WebTemplate = "SITEPAGEPUBLISHING#0"
self.Owner... | [
{
"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 | office365/sharepoint/portal/site_creation_request.py | rikeshtailor/Office365-REST-Python-Client |
from time import sleep
from random import randint
numeros = []
def sorteio():
c = 0
while True:
n = randint(0, 20)
numeros.append(n)
c = c+1
if c == 5:
break
print('=-'*20)
print('SORTEANDO OS 5 VALORES DA LISTA:', end=' ')
for n in numeros:
slee... | [
{
"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 | ex100 sorteio e soma.py | joaoschweikart/python_projects |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.