source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
from __future__ import absolute_import
import re
import os
from datetime import datetime
from .data import Data
NAME_REGEX = re.compile(
r'^:(?P<attribute>[a-z\-_]+)'
r'(?:\[(?P<type>[a-z]+)\])?:'
r'\s*(?P<value>.*)$'
)
def _read_file(path):
with open(path) as fp:
return fp.readlines()
de... | [
{
"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 | staticpy/page/reader.py | toddsifleet/staticpy |
import threading
import traceback
from camera.sdk_gige_hikvision.GrabImage import MVS_Cam # 工业相机SDK读流
class hikCamera(threading.Thread):
def __init__(self, ip_name):
threading.Thread.__init__(self)
self.ip_name = ip_name
# 初始化摄像头
self.device_camera = MVS_Cam(self.ip_name)
... | [
{
"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 | hikvision.py | simpletask1/video_stream |
import unittest
from .context import BasicEndpointTestSuite
class EndPointScoring(BasicEndpointTestSuite):
def test_dice(self):
response = self.client.post("/scoring/dice?run_sync=true")
assert response.status_code == 200
def test_sum(self):
response = self.client.post("/scoring/sum?... | [
{
"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 | tests/unit/endpoints/test_scoring.py | finalelement/MONAILabel |
import pytest
# integration tests requires nomad Vagrant VM or Binary running
def test_get_nodes(nomad_setup):
assert isinstance(nomad_setup.nodes.get_nodes(), list) == True
def test_get_nodes_prefix(nomad_setup):
nodes = nomad_setup.nodes.get_nodes()
prefix = nodes[0]["ID"][:4]
nomad_setup.nodes.ge... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"ans... | 3 | tests/test_nodes.py | commarla/python-nomad |
# Author: Martin McBride
# Created: 2022-01-22
# Copyright (C) 2022, Martin McBride
# License: MIT
from generativepy.color import Color
from generativepy.drawing import make_image, setup
import math
from generativepy.geometry import Polygon, Transform
def create_spiro(a, b, d):
dt = 0.01
t = 0
pts = []
... | [
{
"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 | blog/geometric/spirograph.py | sthagen/martinmcbride-generativepy |
import requests
import os
class IntegrationDiscordDriver:
_scope = ''
_state = ''
def scopes(self, scopes):
pass
def send(self, request, state='', scopes=('identify',)):
self._scope = scopes
self._state = state
return request.redirect('https://discordapp.com/api/oaut... | [
{
"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 | app/integrations/IntegrationDiscordDriver.py | josephmancuso/gbaleague-masonite2 |
from io import StringIO
from django.core.management import call_command
from django.test import TestCase
class InventoryManagementCommandsTest(TestCase):
def test_cleanup_inventory_history(self):
out = StringIO()
call_command('cleanup_inventory_history', stdout=out)
result = out.getvalue()... | [
{
"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 | tests/inventory/test_management_commands.py | janheise/zentral |
"""
File: 648.py
Title: Replace Words
Difficulty: Medium
URL: https://leetcode.com/problems/replace-words/
"""
import unittest
from typing import List
class Solution:
def replaceWords(self, dict: List[str], sentence: str) -> str:
tree = {}
for root in dict:
current =... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": ... | 3 | leetcode/648.py | GihwanKim/Baekjoon |
#!/usr/bin/env python3
#
# Copyright (c) 2019 Roberto Riggio
#
# 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 applicabl... | [
{
"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 | empower/cli/apps_commands/list_apps.py | 5g-empower/empower-runtime |
from typing import List, Any
def transform(
data: List[dict]
) -> List[tuple]:
return [
(key, value)
for dict_item in data
for key, value in dict_item.items()
]
def main():
data = [
{"key": "value", "123": 123},
{"another_key": "another_value", "key": "value"}... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": fals... | 3 | Python/pyworkout/comprehensions/ex31_mod2.py | honchardev/Fun |
#!/usr/bin/python3
"""
We are given two sentences A and B. (A sentence is a string of space separated
words. Each word consists only of lowercase letters.)
A word is uncommon if it appears exactly once in one of the sentences, and does
not appear in the other sentence.
Return a list of all uncommon words.
You may ... | [
{
"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_return_types_annotated",
"question": "Does every function in this file have a return... | 3 | 884 Uncommon Words from Two Sentences.py | krishna13052001/LeetCode |
import os
import pytest
import shutil
import textwrap
from tests.lib.util import rand_str, create_file, execute
root = os.path.dirname(os.path.dirname(__file__))
@pytest.fixture
def repo_dir(tmpdir):
repo_dir = str(tmpdir.mkdir(rand_str()))
# collect coverage data
with open(os.path.join(root, ".coverage... | [
{
"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/conftest.py | bruno-fs/setuptools-git-versioning |
# -*- coding: utf-8 -*-
"""Gtk.ListBox()."""
import gi
gi.require_version(namespace='Gtk', version='3.0')
from gi.repository import Gtk
class Handler:
def __init__(self):
listbox_1 = builder.get_object(name='listbox_1')
listbox_2 = builder.get_object(name='listbox_2')
# Loop para cria... | [
{
"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 | src/gtk3/listbox/glade/MainWindow.py | alexandrebarbaruiva/gui-python-gtk |
# (C) Datadog, Inc. 2020-present
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
import os
import pytest
import requests
from datadog_checks.dev import docker_run
from datadog_checks.dev.conditions import CheckDockerLogs, WaitFor
from datadog_checks.dev.utils import load_jmx_config
f... | [
{
"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 | hazelcast/tests/conftest.py | vbarbaresi/integrations-core |
# Copyright 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from __future__ import absolute_import
import re
from telemetry.internal.browser import web_contents
def UrlToExtensionId(url):
return re.match(r"(chrom... | [
{
"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 | telemetry/telemetry/internal/browser/extension_page.py | Martijnve23/catapult |
import io
import os
from setuptools import setup
from setuptools.command.test import test as TestCommand
import sys
import pyasq
here = os.path.abspath(os.path.dirname(__file__))
def read(*filenames, **kwargs):
encoding = kwargs.get('encoding', 'utf-8')
sep = kwargs.get('sep', '\n')
buf = []
for fil... | [
{
"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 | setup.py | textbook/pyasq |
import komand
from .schema import ConnectionSchema, Input
# Custom imports below
from google.oauth2 import service_account
import apiclient
import json
class Connection(komand.Connection):
def __init__(self):
super(self.__class__, self).__init__(input=ConnectionSchema())
def connect(self, params):
... | [
{
"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 | plugins/google_docs/icon_google_docs/connection/connection.py | lukaszlaszuk/insightconnect-plugins |
import heapq
from operator import attrgetter
class Beam(object):
def __init__(self, maxsize, key=attrgetter("score")):
self.key = key
self.maxsize = maxsize
self.beam = []
def push(self, x):
key = self.key(x)
if len(self.beam) < self.maxsize:
heapq.heappush... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false... | 3 | beam.py | draplater/empty-parser |
# Author: Jochen Gast <jochen.gast@visinf.tu-darmstadt.de>
import torch
import torch.nn as nn
from losses import factory
class ClassificationLoss(nn.Module):
def __init__(self, args, topk=(1, 2, 3), reduction='mean'):
super().__init__()
self.args = args
self.cross_entropy = t... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": ... | 3 | losses/classification_losses.py | visinf/deblur-devil |
import numpy
import scipy.constants as Const
def AtmLayers(hG):
Layers = ([0, 11e3, 25e3, 47e3, 53e3, 79e3, 90e3, 105e3])
FHght = numpy.digitize(hG,Layers)
switcher = {
1: numpy.array([False, -6.5e-3]),
2: numpy.array([True, 216.66]),
3: numpy.array([False, 3e-3]),
4: numpy.a... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding se... | 3 | ISA.py | PabloGomez96/ISAtmosphere |
from django.core.management.base import BaseCommand, CommandError
from data_ocean.command_progress import CommandProgress
from data_ocean.savepoint import Savepoint
from person.controllers import ConnectorsController, SOURCES
class Command(BaseCommand):
help = '---'
def add_arguments(self, parser):
p... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": tru... | 3 | person/management/commands/run_person_connector.py | AlenaYanish/Data_converter |
from django.test import TestCase
from django.contrib.auth import get_user_model
from django.urls import reverse
from django.test import Client
from organization.models import Organization
class AdminSiteTests(TestCase):
def setUp(self):
admin_email = 'admin@pnsn.org'
admin_pass = 'password123'
... | [
{
"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 | app/core/tests/tests_admin.py | pnsn/squac_api |
import chess.pgn
from models.time_control import TimeControl
DEFAULT_ELO_RATING = 1500
def get_result(game: chess.pgn.Game) -> str:
return game.headers["Result"]
def _get_elo(game: chess.pgn.Game, key: str) -> int:
elo = game.headers.get(key)
if elo == "?" or elo is None:
return DEFAULT_ELO_RA... | [
{
"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_return_types_annotated",
"question": "Does every function in this file have a return... | 3 | python_chess_utils/header_utils.py | kennethgoodman/lichess_downloader_api |
"""Copyright (c) 2018, Haavard Kvamme
2021, Schrod Stefan"""
import numpy as np
from torch import nn
class DenseVanillaBlock(nn.Module):
def __init__(self, in_features, out_features, bias=True, batch_norm=True, dropout=0., activation=nn.ReLU,
w_init_=lambda w: nn.init.kaiming_no... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true... | 3 | bites/utils/Simple_Network.py | sschrod/BITES |
from abc import abstractmethod
from typing import List
from selenium.webdriver.chrome.webdriver import WebDriver
from .deafults import default_driver, default_store_path
from .Event import Event
class Source:
"""Abstract class used as super class and to create custom sources classes
Paramaters
---------... | [
{
"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_function_names_snake_case",
"question": "Are all function names in this file written i... | 3 | auto_events/Source.py | fedecech/form_automator |
import pytest
from click.testing import CliRunner
from cpplibhub.cli import main
@pytest.fixture(scope="module")
def runner():
return CliRunner()
def test_main(runner):
# assert main([]) == 0 # run without click
result = runner.invoke(main)
# result = runner.invoke(main, ['--name', 'Amy'])
as... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
... | 3 | tests/test_cpplibhub.py | iotanbo/cpplibhub |
import pytest
import itertools
import pandas as pd
import numpy as np
from scTenifoldXct.core import null_test
def generate_fake_df_nn(n_ligand=3000, n_receptors=3000, n_cands=200):
gene_names = [f"GENE{i}" for i in range(max(n_ligand, n_receptors))]
iteration = itertools.product(gene_names, gene_names)
... | [
{
"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 | tests/test_stat.py | cailab-tamu/scTenifoldXct |
import pytest
from naturalnets.brains.i_layer_based_brain import ILayerBasedBrainCfg
from tests.pytorch_brains import IPytorchBrainCfg
@pytest.fixture
def torch_config() -> IPytorchBrainCfg:
return IPytorchBrainCfg(type="GRU_PyTorch", num_layers=3,
hidden_size=8,
... | [
{
"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/conftest.py | bjuergens/NaturalNets |
from unittest import TestCase
from unittest.mock import MagicMock, patch
class TestS3BucketObjectFinder(TestCase):
@patch('boto3.client')
@patch('justmltools.s3.aws_credentials.AwsCredentials', autospec=True)
def test_get_matching_s3_objects(
self,
aws_credentials_mock: MagicMock,
... | [
{
"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 | tests/s3/test_s3_bucket_object_finder.py | BigNerd/justmltools |
import os
import time
import numpy as np
import pandas as pd
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.utils.data import Dataset
from torch.utils.data import DataLoader
from torchvision import datasets
from torchvision import transforms
import matplotlib.pyplot as plt
from PIL i... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": ... | 3 | dlfairness/original_code/FairALM/Experiments-CelebA/label_ablation/fcn.py | lin-tan/fairness-variance |
from flask.ext.bcrypt import generate_password_hash, \
check_password_hash
def authenticate_user(password, user):
return not user.locked and checkpw(password, user.password)
def hashpw(password):
return generate_password_hash(password, 10).decode('utf-8')
def checkpw(password, hashed_password):
re... | [
{
"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 | app/encryption.py | robot2051/dto-digitalmarketplace-api |
import re
import os
from scrapy.spider import BaseSpider
from scrapy.selector import HtmlXPathSelector
from scrapy.http import Request, HtmlResponse
from scrapy.utils.response import get_base_url
from scrapy.utils.url import urljoin_rfc
from urllib import urlencode
import hashlib
import csv
from product_spiders.item... | [
{
"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 | portfolio/Python/scrapy/seapets/thepetexpress.py | 0--key/lib |
from Number_Theory.optimized_gcd import *
import numpy as np
##################################################################
# Function : mod_inv
# Utilizes the extended gcd function defined in optimized_gcd.py
# to find the modular inverse of a mod(n) when a and n are
# relatively prime.
#
# Throws an error if a a... | [
{
"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 | Number_Theory/mod_inv.py | SherwynBraganza31/csc514-crypto |
from selenium import webdriver
from bs4 import BeautifulSoup
import pandas as pd
from Domain.website import Website
from selenium.webdriver.firefox.options import Options
from Repository.file_repository import FileRepository
class WebsiteService:
def __init__(self, website_repository: FileRepository):
s... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than clas... | 3 | Service/website_service.py | H0R4T1U/SRI |
import discord, json, requests
from discord.ext import commands
from utils import checks, rpc_module as rpc
class Wallet:
def __init__(self, bot):
self.bot = bot
self.rpc = rpc.Rpc()
@commands.command(hidden=True)
@commands.check(checks.is_owner)
async def wallet(self):
"""Sho... | [
{
"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 | cogs/wallet_info.py | MUEDEV/MUE-Discord-Tips |
import os
os.environ['CUDA_VISIBLE_DEVICES'] = '-1'
import pytest
import jax.numpy as jnp
from jaxga.mv import MultiVector
from jaxga.signatures import positive_signature
def _jaxga_mul(a, b):
return a * b
def _mv_ones(num_elements, num_bases):
return MultiVector(
values=jnp.ones([nu... | [
{
"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 | benchmarks/test_jaxga.py | RobinKa/jaxga |
from pavo_cristatus.tests.doubles.module_fakes.module_fake_class import ModuleFakeClass
from trochilidae.interoperable_with_metaclass import interoperable_with_metaclass_future
__all__ = ["ModuleFakeClassWithNestedAnnotatedCallables"]
class ModuleFakeClassWithNestedAnnotatedCallables(interoperable_with_metaclass_fut... | [
{
"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_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
... | 3 | pavo_cristatus/tests/doubles/module_fakes/non_annotated/module_fake_class_with_nested_annotated_callables.py | MATTHEWFRAZER/pavo_cristatus |
import base64
from wptserve.utils import isomorphic_decode
# Use numeric references to let the HTML parser take care of inserting the correct code points
# rather than trying to figure out the necessary bytes for each encoding. (The latter can be
# especially tricky given that Python does not implement the Encoding St... | [
{
"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 | url/resources/percent-encoding.py | xi/wpt |
#!/usr/bin/env python3
"""generate data"""
import random
class Data():
"""generate data"""
file_name = "./data.csv"
def __init__(self):
pass
def generate(self):
"""generate data"""
with open(self.file_name, "w") as file:
print("pid,hindex,hindex2,hindex3,hindex4,d... | [
{
"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 | data.py | garethcmurphy/ml-quality |
# Copyright (C) 2018-2022 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import numpy as np
from openvino.tools.mo.front.common.partial_infer.utils import is_fully_defined
from openvino.tools.mo.graph.graph import Node, Graph
from openvino.tools.mo.ops.op import Op
class ConstantFill(Op):
""" Constant ... | [
{
"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 | tools/mo/openvino/tools/mo/ops/constant_fill.py | ryanloney/openvino-1 |
from typing import Any
from allauth.account.adapter import DefaultAccountAdapter
from allauth.socialaccount.adapter import DefaultSocialAccountAdapter
from django.conf import settings
from django.http import HttpRequest
class AccountAdapter(DefaultAccountAdapter):
def is_open_for_signup(self, request: HttpReque... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},... | 3 | yoongram/users/adapters.py | happyjy/yoonGram |
import matplotlib.pyplot as plt
import numpy as np
def format_plot(func):
def func_wrapper(*args):
func(*args)
plt.ylabel("Intensity [dBm]")
plt.xlabel("Wavelength [nm]")
plt.tight_layout()
plt.show()
return func
return func_wrapper
def format_ani_plot(func):... | [
{
"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 | handlers/plotting.py | manuelprogramming/OSA |
"""Transfer Out item definition."""
from gaphas.geometry import Rectangle
from gaphor.core import gettext
from gaphor.core.modeling import DrawContext
from gaphor.diagram.presentation import (
Classified,
ElementPresentation,
from_package_str,
)
from gaphor.diagram.shapes import Box, IconBox, Text, stroke... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
... | 3 | gaphor/RAAML/fta/transferout.py | Texopolis/gaphor |
import re
def pairup(str):
results=[]
for i in range(len(str)-1):
results.append(str[i]+str[i+1])
return results
def ascending(seq):
for i in range(len(seq)-1):
if (int(seq[i])>int(seq[i+1])):
return False
return True
def check_tripple(seq):
if len(seq) == 1:
... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined insid... | 3 | Day4/adventofcode4.py | oomoepoo/Adventofcode2k19 |
from django.db.models.aggregates import Sum
from django.forms.models import model_to_dict
from .models import LdaSimilarity
from .lda_model_builder import LdaModelManager
from django.db.models import Q
class ContentBasedRecommender():
def __init__(self, min_sim=0.1):
self.min_sim = min_sim
@st... | [
{
"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 | recommender/dimadb/content_based_recommender.py | cnam0203/trivi-backend |
# third-party
from flask import render_template, url_for, request, jsonify
# locals
from . import warehouse
@warehouse.route('/element_types', methods=['GET'])
def index():
return render_template("warehouse/element_types.html")
@warehouse.route('/element_type', methods=['POST'])
def create_new_element_type():
... | [
{
"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 | warehouse/views.py | thiagolcmelo/dynamic |
import websocket
try:
import thread
except ImportError: #TODO use Threading instead of _thread in python3
import _thread as thread
import time
import sys
def on_message(ws, message):
print(message)
def on_error(ws, error):
print(error)
def on_close(ws):
print("### closed ###")
def on_open(w... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding ... | 3 | examples/echoapp_client.py | yarshure/websocket_client |
""" Topological Sort
Topological sorting for Directed Acyclic Graph (DAG) is a linear ordering of
vertices such that for every directed edge uv, vertex u comes before v in
the ordering. Topological Sorting for a graph is not possible if the graph is
not a DAG.
"""
def topological_sort(graph):
""" topological sort... | [
{
"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 | graph/topological_sort.py | x899/algorithms |
import pdftables.line_segments as line_segments
from nose.tools import assert_equals, raises
from pdftables.line_segments import LineSegment
def segments(segments):
return [line_segments.LineSegment.make(a, b) for a, b in segments]
def test_segments_generator():
seg1, seg2 = segs = segments([(1, 4), (2, 3... | [
{
"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 | test/test_linesegments.py | tessact/pdftables |
from django.conf import settings
from places.models import Place
import requests
PLACES_API_ROOT = "https://maps.googleapis.com/maps/api/place"
PLACES_DETAILS_URL = "{ROOT_URL}/details/json?inputtype=textquery&key={key}&place_id={place_id}&fields={fields}"
PLACES_PHOTO_URL = "{ROOT_URL}/photo?key={key}&photoreference... | [
{
"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/places/google_places_helper.py | nuwen/saveourfaves-server |
import importlib
import numpy as np
from game import MTD_Game
from utils import *
__author__ = "Sailik Sengupta"
class Strategy:
def __init__(self, game_to_play=MTD_Game(), gamma=0.5):
self.game = game_to_play
self.DISCOUNT_FACTOR = gamma
self.lib = importlib.import_module('gurobi')
... | [
{
"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 | src/zero_sum/strategy.py | sailik1991/MarkovGameSolvers |
import unittest
import requests_mock
from canvasapi import Canvas
from canvasapi.todo import Todo
from tests import settings
@requests_mock.Mocker()
class TestTodo(unittest.TestCase):
def setUp(self):
self.canvas = Canvas(settings.BASE_URL, settings.API_KEY)
self.todo = Todo(
self.c... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},... | 3 | tests/test_todo.py | damianfs/canvasapi |
from rest_framework.views import APIView
class BlindDetail(APIView):
def get(self):
pass
def put(self):
pass
def post(self):
pass
def delete(self):
pass
| [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer"... | 3 | blinds/views.py | BoraDowon/BackendBlackberry |
import time
def execution_time(method, repeat_count=1):
def timed(*args, **kwargs):
for i in range(repeat_count):
ts = time.time()
result = method(*args, **kwargs)
te = time.time()
print('>>> function %r executed in %2.2f ms <<<' % (method.__name__, (te - ts... | [
{
"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": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 lines?",
"answer": false
... | 3 | parchments/core/debug.py | idlelosthobo/parchment |
import yaml
def load_config_data(path: str) -> dict:
with open(path) as f:
cfg: dict = yaml.load(f, Loader=yaml.FullLoader)
return cfg
def save_config_data(data: dict, path: str) -> None:
with open(path, "w") as f:
yaml.dump(data, f)
| [
{
"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_return_types_annotated",
"question": "Does every function in this file have a return... | 3 | l5kit/l5kit/configs/config.py | xiaoxiaoheimei/l5kit |
#!/usr/bin/env python3
def ceil_div(n, k):
return n//k + (n%k!=0)
def lowbit(x):
return x & (-x)
def sum_until(rs, n):
c = 0
while n > 0:
c += rs[n]
n -= lowbit(n)
return c
def increase(rs, n):
while n < len(rs):
rs[n] += 1
n += lowbit(n)
def method_a(ls... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"... | 3 | acm/livearchive/6604-airport-sort.py | neizod/problems |
#!/usr/bin/python
################################################################################
# 20de4144-5cc5-11e4-af55-00155d01fe08
#
# Justin Dierking
# justindierking@hardbitsolutions.com
# phnomcobra@gmail.com
#
# 10/24/2014 Original Construction
################################################################... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": tru... | 3 | pcat2py/class/20de4144-5cc5-11e4-af55-00155d01fe08.py | phnomcobra/PCAT2PY |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import markdown
from django import template
from portfolio.models import (Artifact, FileArtifact, ImageArtifact,
TextArtifact)
register = template.Library()
@register.assignment_tag()
def get_artifact_list(project, artifa... | [
{
"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 | portfolio/templatetags/portfolio_tags.py | raymcbride/django-portfolio |
import numpy as np
import matplotlib.pyplot as plt
from one_a import one_a
from one_b import one_b
from one_c import one_c
from one_d import one_d
from one_e import one_e
def random_generator(seed, m=2 ** 64 - 1, a=2349543, c=913842, a1=21, a2=35, a3=4, a4=4294957665):
"""
Generates psuedorandom numbers w... | [
{
"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 | one.py | jacobbieker/NUR_Handin2 |
import os
import numpy as np
from maskrcnn.lib.data.preprocessing import mold_inputs
from maskrcnn.lib.config import cfg
from maskrcnn.lib.utils import io_utils
def test_mold_inputs_ones():
image = np.ones((cfg.IMAGE.MAX_DIM, cfg.IMAGE.MAX_DIM, 3), dtype=np.uint8) * 255
molded_images, image_metas = mold... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
... | 3 | tests/data/test_processing.py | quanhua92/maskrcnn-pytorch |
import json
from database.database import Database, Inspector
class HIT:
def __init__(self, task_id=None, hit_id=None):
super().__init__()
if task_id is not None:
self.task_id = task_id
self.inspector = Inspector(task_id)
self.__dict__.update(self.info)
... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": ... | 3 | app/database/hit.py | yooli23/MTurk |
import os,shutil, pyzipper
from datetime import datetime
## gatting time object
now = datetime.now()
# dd/mm/YY H:M:S
dt_string = now.strftime("%m%d%y")
## function to compress file
def compressFile(folder_name):
zip_file_location = f"./{dt_string}.zip"
zipPW = "latenight"
to_zip = list()
with pyzippe... | [
{
"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 | blueTeam/backup.py | cloudfellows/stuxnet-sandworm |
""" Module for image operations """
import numpy as np
import tensorflow as tf
def apply_grey_patch(image, top_left_x, top_left_y, patch_size):
"""
Replace a part of the image with a grey patch.
Args:
image (numpy.ndarray): Input image
top_left_x (int): Top Left X position of the applied ... | [
{
"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 | tf_explain/utils/image.py | sicara/mentat |
import datetime
import numpy as np
"""
Class to define a 'RiskAssessment' from FHIR.
Currently only produces JSON.
{
"date": date assesment was made in ISO format yyyy-mm-dd,
"results": {
"five_year_abs": Five year Absolute Risk for this patient as decimal
"five_year_ave"... | [
{
"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 | RiskAssessment.py | VisExcell/riskmodels |
import sys
class PrintUtils:
progress = 0
total_progress = 0
@classmethod
def print_progress_bar(cls, iteration, total, prefix = '', suffix = '', decimals = 1, length = 100, fill = '█', print_end = "\r"):
"""
Call in a loop to create terminal progress bar
@params:
i... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than clas... | 3 | print_utils.py | FieryRider/matrix-archive |
import logging
from airflow.contrib.hooks.gcs_hook import GoogleCloudStorageHook
from airflow.models import BaseOperator
from airflow.utils import apply_defaults
class GoogleCloudStorageDownloadOperator(BaseOperator):
"""
Downloads a file from Google Cloud Storage.
"""
template_fields = ('bucket','obj... | [
{
"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 | airflow/contrib/operators/gcs_download_operator.py | djeps/airflow |
from webapp.user.models import User
from webapp.db import db
class Category(db.Model):
__tablename__ = 'categories'
id = db.Column(db.Integer, primary_key=True)
user_id = db.Column(db.Integer, db.ForeignKey(User.id))
name = db.Column(db.String(50), nullable=False)
is_income = db.Column(db.Boolean,... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answ... | 3 | webapp/main/models.py | mign0n/super_budget |
import uuid
from typing import Any, Dict
from loguru import logger
from analytics.signal import analytic_signal
from users.models import CustomUser
class UserInterface:
@staticmethod
def get_username(*, user_id: uuid.UUID) -> Dict[str, Any]:
return {"username": CustomUser.objects.get(user_uuid=user_... | [
{
"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 | e_learning/interfaces.py | Mohamed-Kaizen/django_playground |
from collections import defaultdict
import psutil
from system_monitor.msg import Cpu as CpuMsg
_prev_total = defaultdict(int)
_prev_busy = defaultdict(int)
def collect_all():
"""
parse /proc/stat and calculate total and busy time
(more specific USER_HZ see man 5 proc for further information )
"""
... | [
{
"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 | bitbots_misc/system_monitor/src/system_monitor/cpus.py | MosHumanoid/bitbots_thmos_meta |
import logging
import shelve
from ftplib import FTP
import requests
import requests_cache
from io import BytesIO
_cache_file_path = None
def set_cache_http(cache_file_path):
requests_cache.install_cache(cache_file_path)
def open_url(url):
return requests.get(url).text
def set_cache_ftp(cache_file_path):... | [
{
"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 | src/urlcaching.py | chris-ch/sec-edgar |
# Copyright Materialize, Inc. and contributors. All rights reserved.
#
# Use of this software is governed by the Business Source License
# included in the LICENSE file at the root of this repository.
#
# As of the Change Date specified in that file, in accordance with
# the Business Source License, use of this software... | [
{
"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 | misc/python/materialize/cli/scratch/mine.py | moyun/materialize |
import pytest
import numpy as np
from astropy.utils.data import download_file
from jdaviz.app import Application
# This file is originally from
# https://data.sdss.org/sas/dr14/manga/spectro/redux/v2_1_2/7495/stack/manga-7495-12704-LOGCUBE.fits.gz
URL = 'https://stsci.box.com/shared/static/28a88k1qfipo4yxc4p4d40v4ax... | [
{
"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 | jdaviz/configs/cubeviz/plugins/tests/test_data_retrieval.py | check-spelling/jdaviz |
from django.contrib import admin
class BaseOwnerAdmin(admin.ModelAdmin):
"""
自动补充owner字段
用来针对queryset过滤当前用户的数据
"""
exclude = ('owner',)
def get_queryset(self, request):
qs = super(BaseOwnerAdmin, self).get_queryset(request)
return qs.filter(owner=request.user)
def save_m... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self... | 3 | blog/blog/base_admin.py | drunkwretch/python_learning |
import pymc3 as pm
from .helpers import SeededTest
import numpy as np
import theano
class TestShared(SeededTest):
def test_deterministic(self):
with pm.Model() as model:
data_values = np.array([.5, .4, 5, 2])
X = theano.shared(np.asarray(data_values, dtype=theano.config.floatX), bo... | [
{
"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 | pymc3/tests/test_shared.py | MaximeJumelle/pymc3 |
# -*- coding: utf-8 -*-
#
# Copyright © Spyder Project Contributors
# Licensed under the terms of the MIT License
# (see spyder/__init__.py for details)
"""Help Plugin Configuration Page."""
# Third party imports
from qtpy.QtWidgets import QGroupBox, QVBoxLayout
# Local imports
from spyder.config.base import _
from ... | [
{
"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 | spyder/plugins/history/confpage.py | ximion/spyder |
# Copyright 2019 The Johns Hopkins University
#
# 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 agr... | [
{
"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 | craedl/__init__.py | craedl/craedl-sdk-python |
import tempfile
from subprocess import call
from isbntools.app import get_isbnlike
from isbntools.app import get_canonical_isbn
from . import utils
from .errors import ISBNNotFoundError
def _pdf_to_text_tool(pdf_file, output, first_page, last_page):
first_page, last_page = map(str, (first_page, last_page))
... | [
{
"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 | bookpy/pdfhandler.py | stsewd/bookpy |
#!/usr/bin/env python
# ------------------------------------------------------------------------------------------------------%
# Created by "Thieu Nguyen" at 15:39, 20/04/2020 %
# ... | [
{
"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 | opfunu/cec/cec2005/F8.py | ElliottP-13/opfunu |
"""
Sample Hook to provide helpful message that project generated successfully.
"""
from __future__ import print_function
import os
TERMINATOR = "\x1b[0m"
INFO = "\x1b[1;33m [INFO]: "
SUCCESS = "\x1b[1;32m [SUCCESS]: "
HINT = "\x1b[3;33m"
def remove_optional_files():
filenames = ["event.json"]
for file... | [
{
"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 | hooks/post_gen_project.py | adjogahm/cookiecutter-aws-sam-python |
# coding=utf-8
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
from unittest import TestCase
from po_localization.strings import escape, unescape, UnescapeError
class EscapeTextCase(TestCase):
def test_empty(self):
self.assertEqual("",... | [
{
"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 | po_localization/tests/test_strings.py | movermeyer/po-localization |
#!/usr/bin/env python3
# This script was created with the "basic" environment which does not support
# adding dependencies with pip.
# Taken from https://iterm2.com/python-api/examples/theme.html
import asyncio
import iterm2
async def update(connection, theme):
# Themes have space-delimited attributes, one of w... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (ex... | 3 | Library/Application Support/iTerm2/Scripts/AutoLaunch/change_color_preset_on_theme_change.py | timriley/dotfiles |
from unittest import TestCase
from dataclass_bakery.generators import defaults
from dataclass_bakery.generators.random_int_generator import RandomIntGenerator
class TestRandomIntGenerator(TestCase):
def setUp(self):
self.random_int_generator = RandomIntGenerator()
def test_generate_int_ok(self):
... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
}... | 3 | src/tests/dataclass_bakery/generators/test_random_int_generator.py | miguelFLG13/dataclass-bakery |
from django.test import TestCase
from dojo.tools.acunetix.parser import AcunetixParser
from dojo.models import Test
class TestAcunetixParser(TestCase):
def test_parse_without_file(self):
parser = AcunetixParser()
findings = parser.get_findings(None, Test())
self.assertEqual(0, len(findings... | [
{
"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 | dojo/unittests/tools/test_acunetix_parser.py | brunoduruzup/django-DefectDojo |
from discord.ext import commands
import os
import discord
import random
token = 'token'
bot = discord.Client()
bot = commands.Bot(command_prefix='!')
bot.remove_command('help')
for file in os.listdir("cogs"):
if file.endswith(".py"):
name = file[:-3]
bot.load_extension(f"cogs.{name}... | [
{
"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 | hat_bot.py | Ghrek/Hat |
from uuid import uuid4
from sqlalchemy_jsonapi.errors import (RelationshipNotFoundError,
ResourceNotFoundError)
def test_200_result_of_to_one(post, client):
response = client.get(
'/api/blog-posts/{}/author/'.format(post.id)).validate(
200)
assert respon... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excludi... | 3 | sqlalchemy_jsonapi/tests/test_related_get.py | jimbobhickville/sqlalchemy-jsonapi |
import torch
import torch.nn as nn
class MNIST(nn.Module):
def __init__(self):
super(MNIST, self).__init__()
self.shared_encoder = torch.nn.Sequential(
nn.Conv2d(in_channels=1, out_channels=32, kernel_size=5, padding=2),
nn.ReLU(inplace=True),
nn.MaxPo... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": fals... | 3 | models/fedsp/mnist/MNIST.py | tdye24/LightningFL |
from crdt import CRDT
class DistributedCounter(CRDT):
def add(self, number):
return self + number
def remove(self, number):
return self - number
def inc(self):
"""
Increase the counters value by one
"""
return self + 1
def dec(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_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cl... | 3 | couchcrdt/counter.py | drsm79/couch-crdt |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 5/15/20 4:49 PM
# @File : grover.py
# qubit number=2
# total number=9
import cirq
import cirq.google as cg
from typing import Optional
import sys
from math import log2
import numpy as np
#thatsNoCode
from cirq.contrib.svg import SVGCircuit
# Symbols for ... | [
{
"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 | data/p2DJ/New/R2/benchmark/startCirq85.py | UCLA-SEAL/QDiff |
# web_app/routes/company_routes.py
import pandas as pd
from flask import Blueprint, jsonify, request, render_template #, flash, redirect
from web_app.models import *
company_routes = Blueprint("company_routes", __name__)
@company_routes.route("/div_yield")
def seeDivYield():
return render_template("highest_DivYi... | [
{
"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 | web_app/routes/company_routes.py | ssbyrne89/DIYInvestmentPrimer |
# ------ Python standard library imports ---------------------------------------
from typing import Optional
import os
# ------ External imports ------------------------------------------------------
# ------ Imports from own package or module ------------------------------------
from movieverse.movieverse import Movie... | [
{
"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": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 2... | 3 | movieverse/public_datasets.py | KoenBaak/movieverse |
# -*- coding: utf-8 -*-
"""
Created on Fri Dec 22 18:44:02 2017
@author: Tirthajyoti Sarkar
Simple selection sort with counter for total number of operations (finding minimum and swapping)
Accepts user input on minimum and maximum bound of the array and the size of the array.
"""
import random
def find_min(array):
... | [
{
"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 | Selection_sort.py | anantvikram/General_Code |
"""Simple quantum computations simulation."""
import numpy as np
def I():
"""Identity operator."""
return np.identity(2)
def X():
"""X-rotation, negation operator."""
return np.identity(2)[..., ::-1]
def H():
"""Adamara operator, superposition."""
return np.array([[1, 1], [1, -1]]) / np.sqrt(2)
def SW... | [
{
"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 | quantum.py | duboviy/misc |
import unittest
import user
import task
import project
C_NAME = "Test Name"
t1 = task.Task("t1", 1, 'text')
t2 = task.Task("t2", 2, 'text2')
C_TASKS = [t1, t2]
p1 = project.Project
C_PROJECTS = [p1]
class UserTest(unittest.TestCase):
def setUp(self):
self.u = user.User()
self.u.name = C_NAME
... | [
{
"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 | tests/test_user.py | MeViMo/TeamRocket |
"""Helper functions for the various strategies
"""
import structlog
class StrategyUtils():
"""Helper functions for the various strategies
"""
def __init__(self):
"""Initializes Utils class
"""
self.logger = structlog.get_logger()
def get_high_prices(self, historical_data):
... | [
{
"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 | app/indicators/analyzers/utils.py | cristian-codorean/crypto-signal |
from . import commands
from re import match
from logging import debug
from .commandtools import execute
def command_mode(document):
pass
commands.commandmode = command_mode
def publics(obj):
"""Return all objects in __dict__ not starting with '_' as a dict"""
return dict((name, obj) for name, obj in var... | [
{
"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 | fate/commandmode.py | Mattias1/fate |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# author: owefsad@huoxian.cn
# datetime: 2021/7/16 下午12:17
# project: dongtai-engine
from dongtai.utils import const
class Replay:
"""
封装重放操作为单独的类
"""
def __init__(self, replay):
self.replay = replay
self.vul = None
@staticmethod
d... | [
{
"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 | core/replay.py | Maskhe/DongTai-engine |
"Example extension, also used for testing."
from idlelib.config import idleConf
ztext = idleConf.GetOption('extensions', 'ZzDummy', 'z-text')
class ZzDummy:
## menudefs = [
## ('format', [
## ('Z in', '<<z-in>>'),
## ('Z out', '<<z-out>>'),
## ] )
## ]
... | [
{
"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 | toolchain/riscv/MSYS/python/Lib/idlelib/zzdummy.py | zhiqiang-hu/bl_iot_sdk |
#!/usr/bin/env python
# encoding: utf-8
"""
Plot distributions of difference pixels.
"""
import os
import numpy as np
import astropy.io.fits
from matplotlib.figure import Figure
from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas
import matplotlib.gridspec as gridspec
def plot_diffs(mosaic_d... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding... | 3 | skyoffset/diffplot.py | jonathansick/skyoffset |
from __future__ import division
import unittest
import numpy as np
from wyrm.types import Data, BlockBuffer
from wyrm.processing import append_cnt
from functools import reduce
class TestBlockBuffer(unittest.TestCase):
def setUp(self):
self.empty_dat = Data(np.array([]), [], [], [])
self.dat_1 ... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": ... | 3 | test/test_blockbuffer.py | jscastanoc/wyrm |
import boto3
def get_event_client(access_key, secret_key, region):
"""
Returns the client object for AWS Events
Args:
access_key (str): AWS Access Key
secret_key (str): AWS Secret Key
region (str): AWS Region
Returns:
obj: AWS Cloudwatch Event Client Obj
"""
r... | [
{
"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 | installer/core/providers/aws/boto3/cloudwatch_event.py | dabest1/pacbot |
End of preview. Expand in Data Studio
code-judge-ast-python-15k-it1
15k examples of Python code + yes/no structural property questions with deterministic AST ground truth. 3 points per example, balanced to 40-60% per property.
Source: The Stack v1 (deduplicated Python).
- Downloads last month
- 26