source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
from typing import Dict
from spinta import commands
from spinta.components import Config
from spinta.components import Node
from spinta.manifests.components import Manifest
@commands.get_error_context.register(Config)
def get_error_context(config: Config, *, prefix='this') -> Dict[str, str]:
return {
'co... | [
{
"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 | spinta/manifests/commands/error.py | atviriduomenys/spinta |
class Pessoa:
def __init__(nome, idade):
self._nome = nome
self._idade = idade
@property
def nome(self):
return self._nome
@property
def idade(self):
return self._idade
class Cliente(Pessoa):
def __init__(self, nome, idade):
super().__init__(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_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?"... | 3 | cliente.py | janderteodoro/exercicio_POO |
# 033
# Ask the user to enter two numbers. Use whole number division to divide
# the first number by the second and also work out the remainder and
# display the answer in a user-friendly way
# (e.g. if they enter 7 and 2 display “7 divided by 2 is 3
# with 1 remaining”).
from typing import List
def check_num_list(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": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding... | 3 | 150-Challenges/Challenges 27 - 34/Challenge 33.py | DGrifferty/Python |
from replit import db
from locales import locales
# ========================================================
# Posts message to discord channel (translated according to channel)
# ========================================================
async def say(channel, message, arguments=None):
message = locales.get(get_chann... | [
{
"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 | channel.py | michael-riess/language-proctor-bot |
from heapq import heappush, heappop
class Solution:
def findItinerary(self, tickets: List[List[str]]) -> List[str]:
flights = collections.defaultdict(list)
result = []
for ticket in tickets:
heappush(flights[ticket[0]], ticket[1])
self.dfs("JFK", flights, result)
... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
... | 3 | AlgorithmProblems/0332. Reconstruct Itinerary/PythonSolution.py | lynnli92/leetcode-group-solution |
import os
import typing
from importlib import util
from Site_NeonOcean_NOC_Mods_Distribution.Tools import Formatting
from Site_NeonOcean_NOC_Mods_Distribution import Paths
class FormattingDict(dict):
def __missing__ (self, key):
return "{" + key + "}"
def BuildModIndex (modNamespace: str) -> str:
automationModul... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true... | 3 | Automation/NeonOcean.NOC.Mods.Distribution/Site_NeonOcean_NOC_Mods_Distribution/Scripts/ModIndex.py | NeonOcean/NOC.Mods.Distribution |
# coding: utf-8
#
# Copyright 2022 :Barry-Thomas-Paul: Moss
#
# 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 applicab... | [
{
"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 | ooobuild/dyn/script/module_info.py | Amourspirit/ooo_uno_tmpl |
from django.core.management.base import BaseCommand
from django.db import transaction
from ...models import IdentificationGuide
class Command(BaseCommand):
help = 'Adds ID guides'
@transaction.atomic
def handle(self, *args, **options):
self.import_id_guides()
def import_id_guides(self):
... | [
{
"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 | WildlifeObservations/observations/management/commands/import_id_guides.py | jen-thomas/wildlife-observations |
import cocotb
from cocotb.clock import Clock
from cocotb.triggers import RisingEdge, FallingEdge, Edge, Timer
from cocotb.binary import BinaryValue
import random
import numpy as np
import zlib
def randbytes(n):
for _ in range(n):
yield random.getrandbits(8)
async def do_crc(dut, data):
dut.rst <= 1
... | [
{
"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 | tb/CRC32/test_CRC32.py | nmk456/fpga-sdr |
import termformat
from unittest import TestCase
class UtilsTestCase(TestCase):
def test_is_valid_atom(self):
self.assertTrue(termformat.is_atom(":foo"))
self.assertTrue(termformat.is_atom(u":foo"))
self.assertTrue(termformat.is_atom(":Bar"))
def test_is_invalid_atom(self):
self.assertFalse(termf... | [
{
"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 | tests/test_utils.py | dveselov/termformat |
#!/usr/bin/env python3
################################################################
# This test can be used to get the information of the current
# version which is running on the target address.
#
# This file is part of Qvain project.
#
# Author(s):
# Juhapekka Piiroinen <juhapekka.piiroinen@csc.fi>
#
# Copyri... | [
{
"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_version.py | CSCfi/qvain-ops |
# -*- coding: utf-8 -*-
"""Test configs."""
from bpapp.app import create_app
from bpapp.settings import DevConfig, ProdConfig
def test_production_config():
"""Production config."""
app = create_app(ProdConfig)
assert app.config['ENV'] == 'prod'
assert app.config['DEBUG'] is False
assert app.config... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answ... | 3 | tests/test_config.py | AlexandreCarlos/bpapp |
from app import create_app,db
from flask_script import Manager,Server
from app.models import User, Joke, Commentjoke, Debate, Commentdebate, Pickup, Commentlines
from flask_migrate import Migrate, MigrateCommand
#Creating app instance
# app = create_app('development')
app = create_app('production')
# app = create_ap... | [
{
"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 | manage.py | 299hannah/Pitch |
from ...abc import Expression
from ..value.valueexpr import VALUE
class STARTSWITH(Expression):
Attributes = {
"What": ["str"],
"Prefix": ["str"],
}
Category = "String"
def __init__(self, app, *, arg_what, arg_prefix):
super().__init__(app)
if isinstance(arg_what, Expression):
self.What = arg_what... | [
{
"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 | bspump/declarative/expression/string/startswith.py | LibertyAces/BitSwanPump |
#!/usr/bin/env python3
# -*- coding: utf-8 -*
import numpy as np
from vpython import sphere, vector, color, rate
from box_utils import build_box, check_wall_hit
def create_balls(N: int=1, r: float=.2) -> list[sphere]:
balls = []
for i in range(N):
ball = sphere(color=color.green, radius=r, make_tra... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 lines?",
"answer": true
},... | 3 | simul/hard_spheres.py | riccardoscheda/py-utils |
from typing import List
from urllib.request import urlopen
import altair as alt
from .chart import Chart, LayerChart
import json
def get_chart_spec_from_url(url: str) -> List[str]:
"""
For extracting chart specs produced by the research sites framework
"""
response = urlopen(url)
content = respons... | [
{
"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 | charting/download.py | mysociety/notebook_helper |
import unittest
import numpy as np
import transforms3d as t3d
import open3d as o3
from probreg import l2dist_regs
from probreg import transformation as tf
class SVRTest(unittest.TestCase):
def setUp(self):
pcd = o3.io.read_point_cloud('data/horse.ply')
pcd = pcd.voxel_down_sample(voxel_size=0.01)
... | [
{
"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 | tests/test_svr.py | OscarPellicer/probreg |
# Copyright 2017-2018 Google Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in t... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answ... | 3 | python/tests/episode_time_test.py | xuyanbo03/lab |
# automatically generated by the FlatBuffers compiler, do not modify
# namespace: tflite
import flatbuffers
from flatbuffers.compat import import_numpy
np = import_numpy()
class SubOptions(object):
__slots__ = ['_tab']
@classmethod
def GetRootAsSubOptions(cls, buf, offset):
n = flatbuffers.encod... | [
{
"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 | tflite-onnx/onnx_tflite/tflite/SubOptions.py | jwj04ok/ONNX_Convertor |
from typing import Optional
from overrides import overrides
import torch
from allennlp.training.metrics.metric import Metric
@Metric.register("entropy")
class Entropy(Metric):
def __init__(self) -> None:
self._entropy = 0.0
self._count = 0
@overrides
def __call__(
self, # type:... | [
{
"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 | allennlp/training/metrics/entropy.py | tianjianjiang/allennlp |
import unittest
import sys
import os
import glob
root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(root)
from ResultsWriter import ImageWithBoundingBoxes
class TestResultsWriter(unittest.TestCase):
def test_basic_box_drawing(self):
writer = ImageWithBoundingBoxes()
... | [
{
"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 | src/tests/TestResultsWriter.py | mjyeaney/CustomVisionParallelScoring |
def can_build(plat):
return plat=="android"
def configure(env):
if (env['platform'] == 'android'):
env.android_add_dependency("compile 'com.google.android.gms:play-services-ads:8.3.0'")
env.android_add_java_dir("android")
env.android_add_to_manifest("android/AndroidManifestChunk.xml")
env.disable_module()
| [
{
"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 | admob/config.py | Mavhod/GodotAdmob |
import torchvision.transforms as transforms
def get_train_transform(size):
train_transform = transforms.Compose(
[
transforms.RandomGrayscale(),
transforms.Resize((256, 256)),
transforms.RandomAffine(5),
transforms.ColorJitter(hue=0.05, saturation=0.05),
... | [
{
"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 | utils/transform.py | PengjunW/colon_cancer_image_classification |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed unde... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"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 | senlinclient/common/format_utils.py | openstack/python-senlinclient |
"""empty message
Revision ID: 306f880b11c3
Revises: 255f81eff867
Create Date: 2018-08-03 15:07:44.354557
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = '306f880b11c3'
down_revision = '255f81eff867'
branch_labels = None
depends_on = None
def upgrade():
op.... | [
{
"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 | migrations/versions/306f880b11c3_.py | eubr-bigsea/stand |
import sys
import numpy as np
n, h, a, b, c, d, e = map(int, sys.stdin.read().split())
def cost(x, y):
return a * x + c * y
def main():
x = np.arange(n + 1, dtype=np.int64)
y = (n * e - (b + e) * x - h + (d + e)) // (d + e)
y = np.maximum(y, 0) # マイナス日食べることはできない
y = np.minimum(... | [
{
"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 | jp.atcoder/abc013/abc013_3/8806609.py | kagemeka/atcoder-submissions |
import ref_bot.cog.articlerefs
import importlib
import conf
from discord.ext import commands
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
def setup_dbsession():
engine = create_engine(conf.ini_config.get('sqlalchemy', 'connection_string'))
sessionm = sessionmaker()
... | [
{
"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 | ref_bot/extension.py | tser0f/ref_bot |
def is_it_5(self, chromosome):
"""A very simple case test function - If the chromosome's gene value
is equal to 5 add one to the chromosomes overall fitness value.
"""
# Overall fitness value
fitness = 0
for gene in chromosome:
# Increment fitness is the gene's value is 5
if g... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"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 | EasyGA/examples/Fitness.py | danielwilczak101/EasyGA |
# coding=utf-8
# Copyright 2018 The Tensor2Tensor Authors.
#
# 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... | [
{
"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 | tensor2tensor/data_generators/gym_problems_test.py | mikita95/tensor2tensor |
"""
Manages the user configuration.
"""
from .application import AbstractApplicationConfig
from .chrome import ChromeConfig
from .command import CommandConfig
from .hotkey import HotKeyConfig
from .workgroup import WorkGroupConfig
class ConfigType(object):
def get_workgroup_for_display(self, monitors):
"... | [
{
"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 | old_stuff/petronia/config/config_type.py | groboclown/petronia |
"""empty message
Revision ID: 156b555e16b7
Revises: fc1cedce5988
Create Date: 2020-05-04 10:39:56.803842
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '156b555e16b7'
down_revision = 'fc1cedce5988'
branch_labels = None
depends_on = None
def upgrade():
# ... | [
{
"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 | migrations/versions/156b555e16b7_.py | barackmaund1/Pitches-app |
class Reader:
def __init__(self, checker, size: int):
self.checker = checker
self.size = size
def read(self, path: str):
f = open(path, 'rb')
data = [0] * self.size
for i in range(self.size):
data[i] = [0] * self.size
col = 0
row = 0
... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},... | 3 | src/reader.py | Tk-rotich/Sudoku |
from typing import List
class Solution:
def numSplits(self, s: str) -> int:
#initialize variables
count = 0
len_s = len(s)
for i in range(len_s):
if len(set(s[0:i+1])) == len(set(s[i+1:])):
count += 1
return count
class SecondSolution:
def... | [
{
"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": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or few... | 3 | src/my_project/medium_problems/from1to50/number_good_ways_to_split_string.py | ivan1016017/LeetCodeAlgorithmProblems |
import lzma
import os
from collections import defaultdict
from unittest.mock import patch
from parameterized import parameterized
from torchtext.datasets import CC100
from torchtext.datasets.cc100 import VALID_CODES
from ..common.case_utils import TempDirMixin, zip_equal, get_random_unicode
from ..common.torchtext_te... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": true... | 3 | test/datasets/test_cc100.py | abhinavarora/text |
# This is a generated file! Please edit source .ksy file and use kaitai-struct-compiler to rebuild
from pkg_resources import parse_version
import kaitaistruct
from kaitaistruct import KaitaiStruct, KaitaiStream, BytesIO
if parse_version(kaitaistruct.__version__) < parse_version('0.9'):
raise Exception("Incompati... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inherita... | 3 | compiled/python/imports_circular_b.py | smarek/ci_targets |
from __future__ import annotations
from .data_structures import Stack
from .operation import Operation
class HistoryManager:
def __init__(self):
self.undo_stack: Stack[Operation] = Stack()
self.redo_stack: Stack[Operation] = Stack()
def add_operation(self, operation_instance: Operation):
... | [
{
"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 | amulet/api/history.py | Podshot/Amulet-Core |
def encode(json, schema):
payload = schema.Main()
payload.notifications.campfire.secure = \
json['notifications']['campfire']['secure']
payload.notifications.irc.secure = \
json['notifications']['irc']['secure']
payload.notifications.flowdock.secure = \
json['notifications']['... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
... | 3 | benchmark/travisnotifications/protobuf/run.py | sourcemeta/json-size-benchmark |
from typing import List
from backend.infrastructure.contracts import QueryProduct
from backend.infrastructure.schemas import ProductSchema
class MockProductRepository:
def select_one(self, query: QueryProduct) -> ProductSchema:
return None
def select_all(self, query: QueryProduct) -> List[ProductSch... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer"... | 3 | backend/infrastructure/repository/mock/product.py | uesleicarvalhoo/Ecommerce |
import requests
from requests.auth import HTTPBasicAuth
import json
from builtins import range
from pynxos.errors import NXOSError
# requests.packages.urllib3.disable_warnings()
class RPCClient(object):
def __init__(self, host, username, password, transport=u'http', port=None, verify=True):
if transport ... | [
{
"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 | pynxos/lib/rpc_client.py | networktocode/pynxos |
# -*- coding: utf-8 -*-
from datetime import datetime
from parser import Model
from parser.cmds.cmd import CMD
from parser.utils.corpus import Corpus
from parser.utils.data import TextDataset, batchify
import torch
class Predict(CMD):
def add_subparser(self, name, parser):
subparser = parser.add_parser... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/... | 3 | parser/cmds/predict.py | Jacob-Zhou/spw-parser |
class BuildError(Exception):
def __init__(self, message="Build error."):
self.message = message
class TestError(Exception):
def __init__(self, message="Test error."):
self.message = message
class InstallError(Exception):
def __init__(self, message="Install error."):
self.message ... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"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 | koan_lib/errors.py | koans-for-pebble/koans-for-pebble |
from django.shortcuts import render, redirect
from django.views.generic.detail import DetailView
from .models import Fly,Airport
from django.db.models import Q
from django.contrib import messages
from django.contrib.auth.decorators import login_required
# Create your views here.
@login_required(login_url='/login/'... | [
{
"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 | prova/relazioni/views.py | mary023010/prova_django |
# This action will put CORS Configuration information for a Cloud Object Storage bucket.
# If the Cloud Object Storage service is not bound to this action or to the package
# containing this action, then you must provide the service information as argument
# input to this function.
# Cloud Functions actions accept a si... | [
{
"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 | runtimes/python/bucket-cors-put.py | eweiter/package-cloud-object-storage |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import dask.dataframe as ddf
import pandas as pd
import time
from sklearn.neighbors.kde import KernelDensity
from scipy.optimize import curve_fit
import numpy as np
def infer_distribution_from_contig(contacts, K, K0):
"""
"""
longest_contig_name = contacts.loc[... | [
{
"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 | scaffold/infer-distribution.py | ryought/3d-dna |
import ast
def ast_attr(fields):
""" fields is string of attrs (e.g. 'self.call.me.now') or list of ast args"""
if isinstance(fields, str):
if "." in fields:
fields_list = fields.split(".")
return ast.Attribute(attr=fields_list[-1], value=ast_attr(".".join(fields_list[:-1])))
... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"ans... | 3 | bzt/modules/apiritif/ast_helpers.py | sbesedkov/taurus |
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from .....testing import assert_equal
from ..specialized import BRAINSTransformFromFiducials
def test_BRAINSTransformFromFiducials_inputs():
input_map = dict(args=dict(argstr='%s',
),
environ=dict(nohash=True,
usedefault=True,
),
fixedLandm... | [
{
"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 | nipype/interfaces/semtools/registration/tests/test_auto_BRAINSTransformFromFiducials.py | Conxz/nipype |
# -*- encoding: utf-8 -*-
import re
from oops.utils import sudo_support
@sudo_support
def match(command, settings):
return ('command not found' in command.stderr.lower()
and u' ' in command.script)
@sudo_support
def get_new_command(command, settings):
return re.sub(u' ', ' ', command.script)
| [
{
"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 | oops/rules/fix_alt_space.py | lardnicus/oops |
# Example of a LinkedList
class Node:
def __init__(self, value, next):
self.value = value
self.next = next
def printNode(self):
print(self.value, '-', self.next)
class LinkedList:
def __init__(self, a):
self.head = None
tail = None
for i in 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_function_names_snake_case",
"question": "Are all function names in this file written... | 3 | Data-Structures/Linked List/3. Link list.py | Mo-Shakib/DSA |
#!/usr/bin/env python
import sys
import string
from collections import defaultdict
def freq(iterable):
"""
Returns a dictionary of counts for each item in an iterable.
>>>freq("ACGTTTAAA")
{'A': 4, 'C': 1, 'G': 1, 'T': 3}
"""
ret = defaultdict(int)
for el in iterable:
ret[el] += 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": "more_functions_than_classes",
"question": "Does this file define more functions than cla... | 3 | python/misc.py | dnbh/kpg |
class Solution:
def sumOfLeftLeaves(self, root: TreeNode) -> int:
return self.dfs(root, 0, False)
def dfs(self, root, presum, isLeft):
if not root:
return 0
if not root.left and not root.right and isLeft:
return presum + root.val
else:
ret... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than cla... | 3 | 404-Sum-of-Left-Leaves/solution.py | alfmunny/leetcode |
"""
Expression for matching.
"""
import re
from abc import ABC
from typing import Callable, Text, Tuple
from slrp.combos import Combinable
class RegExpr(Combinable):
"""
Regular expression matcher.
"""
def __init__(self, pattern):
self.pattern = pattern
def match(self, expr):
_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_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": true
},
{
... | 3 | slrp/expressions.py | thomasmatecki/parsley |
from django.db import models
from .score import Score
from .exam import Exam
from .competitor import Competitor
# Only used for AI Round
class MiniRoundScore(models.Model):
score = models.ForeignKey(Score, related_name="miniroundscores", on_delete=models.CASCADE)
miniround = models.IntegerField()
points = ... | [
{
"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 | website/models/miniroundscore.py | czhu1217/cmimc-online |
# Program to implement queue data structure in python -
class queue:
# Constructor to initialize a queue
def __init__(self):
self.items = []
# Function to enqueue elements -
def enqueue(self, item):
self.items.insert(item)
# Function to dequeue elements -
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": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answ... | 3 | Projects/queue.py | SanjanaSogimatt/Python |
""" WebSocket Client """
import json
import asyncio
import websockets
def project_request(project_id):
return json.dumps({"type": "project", "project_id": project_id})
async def request_project(project_id):
uri = "ws://localhost:8765"
async with websockets.connect(uri) as websocket:
await webso... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?... | 3 | scripts/simple_client.py | johnhkchen/python-basics |
# _*_ coding:utf-8 _*_
'''
csv文件的合并和去重
主要是针对测试用例增加使用此脚本
'''
import pandas as pd
import glob
#输出文件
outputfile = '/Users/huaan720/Downloads/百度网盘/xmind2testcase-master/docs/case_csvfile/new.csv'
#合并csv的文件夹
csv_list = glob.glob('/Users/huaan720/Downloads/百度网盘/xmind2testcase-master/docs/case_csvfile/*.csv')
print(u'共发现%s个C... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"ans... | 3 | webtool/tow_csvfile_compare.py | renyixiang/xmind_to_testcase |
import torch
import numpy as np
class AverageMetric(object):
def __init__(self, threshold=0.5):
self.dice_scores = []
self.threshold = threshold
def update(self, outputs, labels):
with torch.no_grad():
probs = torch.sigmoid(outputs)
dice_score = self.dice_metr... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written... | 3 | utils/metric.py | toandaominh1997/understanding_cloud_organization |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | [
{
"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 | zun/tests/policy_fixture.py | bbrfkr/zun |
from django.db import models
from rest_framework import serializers
class Tag(models.Model):
"""
Post tag model
"""
name = models.CharField(max_length=50, unique=True, primary_key=True)
backend_tag = models.BooleanField(default=False)
def __str__(self):
return self.name
class TagSer... | [
{
"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 | blogging_api/models/tag.py | mustafmst/plain-blog |
from pyml.keywords import true
from pyml.widgets.item import Item
class Window(Item):
def _init_raw_props(self):
super()._init_raw_props()
self.color = '#ffffff'
self.visile = true
def _init_custom_props(self):
self.size = (0, 0)
| [
{
"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 | archived_projects_(dead)/pyml_unknown_state_01/widgets/windows/window.py | likianta/declare-qtquick |
from __future__ import unicode_literals
import frappe
from toolz.curried import compose, unique, map, filter
def on_submit(doc, method):
_update_booking_orders(
[x for x in doc.references if x.reference_doctype == "Sales Invoice"]
)
def on_cancel(doc, method):
_update_booking_orders(
[x ... | [
{
"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 | gg_custom/doc_events/payment_entry.py | libermatic/gg_custom |
# Classe
class Pessoa:
# Atributo de Classe / default
olhos = 2
# Inicialização
def __init__(self, *filhos, nome=None, idade=29): # Atributo de objeto / instância
self.nome = nome
self.idade = idade
self.filhos = list(filhos)
def cumprimentar(self): # Método de instância ... | [
{
"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 | oo/pessoa.py | thiagoof39/pythonbirds |
import math
class Math:
@staticmethod
def add(x,y):
return x+y
@staticmethod
def remove(x,y):
return x-y
@staticmethod
def mulitiply(x,y):
return x*y
@staticmethod
def divide(x,y):
return x/y
def calculate():
var = ("+","-","*","/")
take = input... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than cla... | 3 | calculator.py | Sengolda/Basic-Calculator- |
from .utils import current_authenticated_entity
from .abstract import AbstractPrivilege
class AndPrivilege(AbstractPrivilege):
def __init__(self, *privileges):
self._privileges = privileges
def check(self):
for privilege in self._privileges:
if not privilege.check():
... | [
{
"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 | flask_modular_auth/privilege.py | fabian-rump/flask_modular_auth |
# -*- coding: utf-8 -*-
'''
# Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information.
#
# This file was generated and any changes will be overwritten.
'''
from __future__ import unicode_literals
from ..one_drive_object_bas... | [
{
"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 | models/hashes.py | MIchaelMainer/msgraph-v10-models-python |
import datetime
import json
from django.contrib import admin
from django.conf import settings
from django.utils import timezone
from .models import CachedTransaction, Memo, IPTracker
from django.utils.safestring import mark_safe
class CachedTransactionAdmin(admin.ModelAdmin):
list_display = ("txid", 'crypto', "c... | [
{
"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 | multiexplorer/multiexplorer/admin.py | priestc/MultiExplorer |
import pytest
from kidslanguages import english_to_pig_latin
@pytest.mark.parametrize(
"original,expected_pig_latinized",
[("inside job", "insideway objay"), ("i am groot", "iway amway rootgay")],
)
def test_latinize(original: str, expected_pig_latinized: str):
assert list(english_to_pig_latin(original)) ... | [
{
"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 | test/test_piglatin.py | farooq-teqniqly/py-workout |
# Copyright 2018 HTCondor Team, Computer Sciences Department,
# University of Wisconsin-Madison, WI.
#
# 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/LICE... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
... | 3 | tests/unit/test_wait_for_path_to_exist.py | JoshKarpel/condormap |
# Copyright (c) 2013 Red Hat, 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 writ... | [
{
"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 | zaqar/tests/unit/transport/wsgi/v2_0/test_auth.py | mail2nsrajesh/zaqar |
import torch.nn as nn
from .base import BaseLM
class IpaLM(BaseLM):
name = 'lstm'
def __init__(self, vocab_size, hidden_size, nlayers=1, dropout=0.1, embedding_size=None, **kwargs):
super().__init__(
vocab_size, hidden_size, nlayers=nlayers, dropout=dropout, embedding_size=embedding_size... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inherita... | 3 | learn_pipe/model/lstm.py | tpimentelms/meaning2form |
import itertools
import toposort
from populus.utils.contracts import (
compute_direct_dependency_graph,
compute_recursive_contract_dependencies,
)
def compute_deploy_order(dependency_graph):
"""
Given a dictionary that maps contract to their dependencies,
determine the overall dependency orderin... | [
{
"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 | deploy.py | blockchainhelppro/CelvinRost |
import tensorflow_federated as tff
def download_and_save_stackoverflow():
tff.simulation.datasets.stackoverflow.load_data(cache_dir='./')
def download_and_save_word_counts():
tff.simulation.datasets.stackoverflow.load_word_counts(cache_dir='./')
def download_and_save_tag_counts():
tff.simulation.datas... | [
{
"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 | data/stackoverflow/dataset.py | xuwanwei/FedML |
import pytest
from utils.phone_numbers import fix_number_formatting, validate_phone_number
@pytest.mark.parametrize(
"number, expected_result",
[
("7446123456", "07446123456"), # Test number with missing 0
("07446123456", "07446123456"), # Test number no spaces
("07446 123456", "07... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding sel... | 3 | tests/utils/test_phone_numbers.py | Silvian/attendance-processor |
import torch
import torch.nn as nn
def safe_norm(x, eps=1e-5, dim=-1, keepdim=True):
return torch.sqrt(torch.sum(torch.square(x), dim=dim, keepdim=keepdim) + eps)
class LayerNormTf(nn.Module):
def __init__(self, hidden_size: int, eps: float = 1e-12):
"""Construct a layernorm module in the TF style (... | [
{
"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 | slp/modules/norm.py | PansoK/slp |
"""
Provide a mock switch platform.
Call init before using it in your tests to ensure clean test data.
"""
from homeassistant.const import STATE_ON, STATE_OFF
from tests.common import MockToggleDevice
DEVICES = []
def init(empty=False):
"""Initialize the platform with devices."""
global DEVICES
DEVICE... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"... | 3 | tests/testing_config/custom_components/switch/test.py | don66/home-assistant |
__author__ = 'ziyasal'
from unittest import TestCase
import subprocess
import redis
from emitter import Emitter
class TestEmitter(TestCase):
@classmethod
def setUpClass(cls):
cls.redis_server = subprocess.Popen("redis-server", stdout=subprocess.PIPE, shell=True)
def setUp(self):
self.... | [
{
"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 | test/emitter.test.py | thongdong7/socket.io-python-emitter |
"""
Убраны часовые пояса
Revision ID: aff6badb8f87
Revises: 22d32aac74f7
Create Date: 2021-09-07 01:05:37.881411
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'aff6badb8f87'
down_revision = '22d32aac74f7'
branch_labels = None
depends_on = None
def upgrade()... | [
{
"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 | alembic/versions/20210907_aff6badb8f87.py | CyberDAS-Dev/API |
from computer_players.base_computer_player import BaseComputerPlayer
from dominion_game_engine.hand import has_card_type, select_by_name
class StayAtHomeSon(BaseComputerPlayer):
def buy(self, supply, money, buys):
return self.buy_card(money, 'Cellar')
def play_action_cards(self, hand):
""" ""... | [
{
"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 | computer_players/stay_at_home_son.py | the-gigi/dominion |
import numpy as np
from utils import read_file
file_path = './input/day7.txt'
def parse_file(file_content):
return [int(x) for x in file_content.split(',')]
def fuel(steps):
return steps*(steps+1)/2
data = parse_file(read_file(file_path))
np_data = np.array(data)
median = np.median(np_data)
distance_su... | [
{
"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 | adventcode/day7.py | johnhendrick/adventofcode2021 |
from typing import List
from typing import Optional
from typing import Tuple
from app.main.repository.device_group_repository import DeviceGroupRepository
from app.main.repository.unconfigured_device_repository import UnconfiguredDeviceRepository
from app.main.util.constants import Constants
class UnconfiguredDevice... | [
{
"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 | app/main/service/unconfigured_device_service.py | michalkoziara/IoT-RESTful-Webservice |
"""NDG XACML package
NERC DataGrid
"""
__author__ = "P J Kershaw"
__date__ = "16/03/10"
__copyright__ = "(C) 2010 Science and Technology Facilities Council"
__contact__ = "Philip.Kershaw@stfc.ac.uk"
__license__ = "BSD - see LICENSE file in top-level directory"
__contact__ = "Philip.Kershaw@stfc.ac.uk"
__revision__ = ... | [
{
"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 | ndg/xacml/__init__.py | philipkershaw/ndg_xacml |
# -*- coding: utf-8 -*-
"""
Validate Finn code validator
"""
__author__ = 'Samir Adrik'
__email__ = 'samir.adrik@gmail.com'
from source.util import Assertor, Tracking
from .operation import Operation
from ...scrapers import Finn
class ValidateFinnCode(Operation):
"""
Operation for validating a Finn code
... | [
{
"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 | source/app/processing/engine/validate_finn_code.py | seemir/stressa |
from pathlib import Path
import shutil
from jinja2 import Template
from invoke import task
import jupytext
_TARGET = Path('~', 'dev', 'ploomber').expanduser()
@task
def setup(c, from_lock=False):
"""Create conda environment
"""
if from_lock:
c.run('conda env create --file environment.yml --force... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self... | 3 | tasks.py | edublancas/ploomber-workshop |
import pandas as pd
import numpy as np
from sklearn.preprocessing import StandardScaler, MinMaxScaler
from datetime import datetime
COLUMNS = [
'uid',
'rental_place',
'return_place'
]
nodes_to_remove = [
'.GOTOWE DO REZERWACJI',
'Poza stacją',
'.RELOKACYJNA',
'.RELOKACYJNA A1-4',
'# Ro... | [
{
"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 | processing_helper.py | burnpiro/wod-bike-temporal-network |
import datetime
import re
from rest_framework_jwt.settings import api_settings
from django.contrib.auth.backends import ModelBackend
from .models import User
# def get_user_by_account(account):
# """
# 根据帐号获取user对象
# :param account: 账号,可以是用户名,也可以是手机号
# :return: User对象 或者 None
# """
# try:
# ... | [
{
"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 | longqiao/longqiao/apps/users/utils.py | yktimes/longqiao |
import torch
import torch.nn as nn
from torch.autograd import Variable
import torch.nn.functional as F
import torch.utils.data as Data
import torch.optim as optim
from torch.utils.data import Dataset, DataLoader, WeightedRandomSampler
class MultipleRegression(nn.Module):
def __init__(self, num_features):
s... | [
{
"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 | ArtificialNeuralNetwork/model.py | jiruifu-jerry0219/UpperLimbEstimator |
import pandas as pd
import os
import logging
import yaml
import datetime
def df_to_ontology(params, staging_dir, pass_df=None):
'''
Takes the text file from staging, or the pandas df passed from the merge
app, and converts to an ontology dictionary suitable from the annotation
ontology API add_annotat... | [
{
"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": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/c... | 3 | lib/MergeMetabolicAnnotations/utils/functions.py | cshenry/MergeMetabolicAnnotations-1 |
from services.proto import article_pb2
from services.proto import general_pb2
from utils.articles import md_to_html
class PreviewServicer:
def __init__(self, md_stub, logger):
self._md_stub = md_stub
self._logger = logger
def PreviewArticle(self, req, context):
self._logger.info('Rec... | [
{
"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 | services/article/preview_servicer.py | SailSlick/rabble |
#This code aims to return an "n" result of the Fibonnachi Sequence.
#Below are two fucntions, each of which return the same results by following different algorithms.
def getFibNExt (n):
fibAr = [0, 1, 0]
for i in range(n-1):
fibAr[2] = fibAr[0]
fibAr[0] += fibAr[1]
fibAr[1] = fibAr[2]
... | [
{
"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 | fibonnachiSequence.py | DAM-96/Python-CodeSamples |
from pytest import mark
from pantable.util import convert_texts, convert_texts_fast, eq_panflute_elems
# construct some texts cases
texts_1 = [
'some **markdown** here',
'and ~~some~~ other?'
]
texts_2 = [
'some *very* intersting markdown [example]{#so_fancy}',
'''# Comical
Text
# Totally comical
... | [
{
"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 | tests/util_test.py | panfill/pandoc-tables |
from paystack.models import PayStackCustomer
from .base_api_service import BaseAPIService
class CustomerService(BaseAPIService):
def _create_customer_object(self, user, customer_data, authorization_data):
defaults = {
"user": user,
"email": customer_data["email"],
"aut... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/... | 3 | paystack/services/customer_service.py | Nyior/django-rest-paystack |
import logging
from awsgen.applications.profile import ProfileApp
class ListProfiles(object):
log = logging.getLogger(__name__)
def __init__(self, parser=None):
pass
def action(self, args):
ProfileApp().list()
| [
{
"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 | awsgen/command/listprofiles.py | mvallim/aws-gen-cli |
from dataclasses import dataclass
from typing import Set, List
from extractors.CharacterFactory import Character, CharacterFactory
@dataclass
class Block(object):
name: str
start: int
end: int
characters: List[Character]
class BlockFactory(object):
def __init__(self: 'BlockFactory', character_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_params_annotated",
"question": "Does every function parameter in this file have a ty... | 3 | extractors/BlockFactory.py | eumiro/rofimoji |
from gensim.models import KeyedVectors
import numpy as np
import nltk
# model = KeyedVectors.load_word2vec_format('data/GoogleNews-vectors-negative300.bin',binary=True)
#
# vecab = model.vocab.keys()
# print(len(vecab))
# vector = model.get_vector('This')
# print(type(vector))
# print(vector.shape)
def load_model(f... | [
{
"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/rte_pac/feature_extaction/average_word_embedding.py | UKPLab/conll2019-snopes-experiments |
import unittest
import numpy as np
from op_test import OpTest
class TestFTRLOp(OpTest):
def setUp(self):
self.op_type = "ftrl"
w = np.random.random((102, 105)).astype("float32")
g = np.random.random((102, 105)).astype("float32")
sq_accum = np.full((102, 105), 0.1).astype("float32")... | [
{
"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": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
... | 3 | python/paddle/v2/fluid/tests/test_ftrl_op.py | QingshuChen/Paddle |
# python3
import sys
def fib_slow(n):
'''Dumb (slow) example solution.
'''
if (n <= 1):
return n
return fib_slow(n - 1) + fib_slow(n - 2)
def fib_countup(n):
'''Less-dumb 'count up as you go' solution.
'''
if (n <= 1):
return n
x, y = 0, 1
for i in range(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 | course1/fibonacci.py | ropable/algorithmic_toolbox |
from oslo_log import log as logging
from oslo_config import cfg
from fuel_agent.utils import utils
from fuel_additive.drivers.os.bootstrap import Bootstrap as Driver
LOG = logging.getLogger(__name__)
CONF = cfg.CONF
class Bootstrap(object):
def __init__(self, data):
self.config = utils.get_driver(CONF.d... | [
{
"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 | fuel_additive/api/bootstrap.py | skdong/fuel-additive |
#
# from src/koch.c
#
# void koch(void) to koch
#
from svgplot import svgPlot
from koch import koch
def sampleWriter(path):
plotter = svgPlot(1200, 360)
def sample(fh):
plotter.plotStart(fh)
plotter.move(0, 0)
koch(plotter, 1200, 0, 3)
plotter.plotEnd()
def writer():
... | [
{
"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 | algo-c-to-_/examples/koch_.py | nobi56/aRepo |
from typing import List
from lxml import etree
from cssselect import GenericTranslator
from kloppy.domain import Event, EventType
class CSSPatternMatcher:
def __init__(self, pattern: str):
self.expression = GenericTranslator().css_to_xpath([pattern])
def match(self, events: List[Event]) -> List[Lis... | [
{
"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 | kloppy/domain/services/matchers/css.py | pratikthanki/kloppy |
from __future__ import unicode_literals
from django.shortcuts import redirect
from .. import BasicProvider, RedirectNeeded
from .forms import PaymentForm
class StripeProvider(BasicProvider):
def __init__(self, *args, **kwargs):
self.secret_key = kwargs.pop('secret_key')
self.public_key = kwargs... | [
{
"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 | payments/stripe/__init__.py | pmuilu/django-payments |
class Animal:
def __init__(self, name, gender, age, money_for_care):
self.name = name
self.gender = gender
self.age = age
self.money_for_care = money_for_care
def __repr__(self):
return f"Name: {self.name}, Age: {self.age}, Gender: {self.gender}"
| [
{
"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 | Encapsulation - Exercise/WildCatZoo/animal.py | DiyanKalaydzhiev23/OOP---Python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.