source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
from setuptools import setup, find_packages
from setuptools.command.install import install
import os
import io
SETUP_DIR = os.path.dirname(os.path.abspath(__file__))
# List all of your Python package dependencies in the
# requirements.txt file
def readfile(filename, split=False):
with io.open(filename, encoding... | [
{
"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 | setup.py | rchristie/mapclientplugins.datatrimmerstep |
from django.db import models
import os
def get_image_path(instance, filename):
return os.path.join('pics', str(instance.id), filename)
# Create your models here.
class Pets(models.Model):
pet_foto = models.ImageField(upload_to=get_image_path, blank=True, null=True)
DOG = 'C'
CAT = 'G'
... | [
{
"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/doghouse/models.py | JuniorGunner/ConcilBackendTest |
#!/usr/bin/env python
# -*- coding: utf-8
from __future__ import unicode_literals
import platform as pf
from . import core
class PlatformCollector(object):
"""Collector for python platform information"""
def __init__(self, registry=core.REGISTRY, platform=None):
self._platform = pf if platform is N... | [
{
"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 | Python/venv/lib/python3.7/site-packages/prometheus_client/platform_collector.py | HenriqueBuzin/TCC |
# -*- coding: utf-8 -*- #
# Copyright 2016 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... | [
{
"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 | lib/surface/compute/networks/peerings/delete.py | kustodian/google-cloud-sdk |
"""Select2 view implementation."""
import json
from dal.views import BaseQuerySetView
from django import http
from django.utils.translation import ugettext as _
class Select2ViewMixin(object):
"""View mixin to render a JSON response for Select2."""
def get_results(self, context):
"""Return data fo... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": fals... | 3 | env/lib/python2.7/site-packages/dal_select2/views.py | NITKOSG/InfoGami |
from second.second import checkLinkedList, linked_list
import pytest
def test_1(list1):
actual = checkLinkedList(list1)
expected = False
assert actual == expected
def test_2(list2):
actual = checkLinkedList(list2)
expected = True
assert actual == expected
@pytest.fixture
def list1():
l... | [
{
"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 | Interviews/second/tests/test_second.py | makkahwi/data-structures-and-algorithms |
#!/usr/bin/env python
#encoding: utf8
import sys, rospy, math
from pimouse_ros.msg import MotorFreqs
from geometry_msgs.msg import Twist
class Motor():
def __init__(self):
if not self.set_power(True): sys.exit(1)
rospy.on_shutdown(self.set_power)
self.sub_raw = rospy.Subscriber('motor_raw'... | [
{
"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 | scripts/motors1.py | aoko5/pimouse_ros |
#
# @lc app=leetcode id=102 lang=python3
#
# [102] Binary Tree Level Order Traversal
#
# @lc code=start
# Definition for a binary tree node.
class TreeNode:
def __init__(self, val=0, left=None, right=None):
self.val = val
self.left = left
self.right = right
from typing import List, Optional... | [
{
"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 | Difficulty/Medium/102.binary-tree-level-order-traversal.py | ryderfang/LeetCode |
import time
import dlib
import cv2
from interface_dummy import Connection
class Main(object):
def __init__(self):
self.camera = cv2.VideoCapture(0)
self.camera.set(cv2.CAP_PROP_FRAME_WIDTH, 1280)
self.camera.set(cv2.CAP_PROP_FRAME_HEIGHT, 720)
self.face_detector_dlib = dlib.get_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": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"... | 3 | facedistance/main.py | imakin/ProsesKiller |
from typing import Union, List, Tuple, Type
from deeprob.spn.structure.leaf import Leaf
from deeprob.spn.structure.node import Node, Sum, Product, bfs
def collect_nodes(root: Node) -> List[Node]:
"""
Get all the nodes in a SPN.
:param root: The root of the SPN.
:return: A list of nodes.
"""
... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return t... | 3 | deeprob/spn/utils/filter.py | fedelux3/deeprob-kit |
import pytest
import sys
import trio
import inspect
import re
import time
pytestmark = pytest.mark.trio
io_test_pattern = re.compile("io_.*")
async def tests(subtests):
def find_io_tests(subtests, ignored_names):
functions = inspect.getmembers(sys.modules[__name__], inspect.isfunction)
for (f_na... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (e... | 3 | tests/base_test.py | ibalagurov/async_api_tests |
class Super(object):
attribute = 3
def func(self):
return 1
class Inner():
pass
class Sub(Super):
#? 13 Sub.attribute
def attribute(self):
pass
#! 8 ['attribute = 3']
def attribute(self):
pass
#! 4 ['def func']
func = 3
#! 12 ['def func']
... | [
{
"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": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answe... | 3 | test/completion/inheritance.py | mrclary/jedi |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""
Steps:
1. Given a CSV export of F_YL_LEARNER
2. Create a unique list of all IBM email addresses
3. Perform a lookup in the Bluepages API
4. Populate MongoDB with this information
5. Then create a DbViz insert file of the Bl... | [
{
"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 | python/databp/scripts/bp_query_via_fyllearner.py | jiportilla/ontology |
from unittest import TestCase
from tests import get_data
from pytezos.michelson.converter import build_schema, decode_micheline, encode_micheline, micheline_to_michelson
class StorageTestKT1HodLKwRxAWonG3jzAdHmVmKvPiNaXbpxV(TestCase):
@classmethod
def setUpClass(cls):
cls.maxDiff = None
cls.... | [
{
"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/storage/cases/test_KT1HodLKwRxAWonG3jzAdHmVmKvPiNaXbpxV.py | juztin/pytezos-1 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
from abc import ABC, abstractmethod
class AbstractLogger(ABC):
"""
Abstract base class for all the logger implementations of this tool
"""
__debug = False
@abstractmethod
def info(self, tag, message):
raise Not... | [
{
"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 | core/interfaces/logger.py | microsoft/Guardinel |
from glob import glob
import config
import errno
import os
def unique_id(msg):
ext = '.txt'
f = glob("*"+ext)[0]
num_trail = int(f.split(".")[0])
newf = "./" + str(num_trail+1) + ext
os.rename(f, newf)
outdir = os.path.join("../weights", config.summary_prefix+"%02d"%num_trail)
mkdir_p(outdi... | [
{
"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 | train/faci_training.py | Dung-Han-Lee/Pointcloud-based-Row-Detection-using-ShellNet-and-PyTorch |
import os
from dotenv import load_dotenv
from helpers import RequestHandler
class Order(RequestHandler):
def place_order(self, isin: str, expires_at: str, quantity: int, side: str):
load_dotenv()
order_details = {
"isin": isin,
"expires_at": expires_at,
"side":... | [
{
"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 | models/Order.py | lemon-markets/content-dollar-cost-average |
import pygame
from random import randint
BLACK = (0,0,0)
import numpy as np
class Ball(pygame.sprite.Sprite):
def __init__(self, color , width ,height, twidth, theight):
super().__init__()
self.image = pygame.Surface([width,height])
self.image.fill(BLACK)
self.image.set_colorkey(... | [
{
"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 | ball.py | hex-plex/Pong-ReinforcementLearning |
import numpy as np
import matplotlib.pyplot as plt
# Part A: Numerical Differentiation Closure
def numerical_diff(f,h):
def inner(x):
return (f(x+h) - f(x))/h
return inner
# Part B:
f = np.log
x = np.linspace(0.2, 0.4, 500)
h = [1e-1, 1e-7, 1e-15]
y_analytical = 1/x
result = {}
for i in h:
y = n... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (e... | 3 | homework/HW4/HW4-final/P1.py | TangJiahui/cs107_system_devlopment |
from typing import List, TypeVar, Sequence, Dict, Tuple
from polyhedral_analysis.coordination_polyhedron import CoordinationPolyhedron
T = TypeVar('T')
"""
Utility functions
"""
def flatten(this_list: Sequence[Sequence[T]]) -> List[T]:
"""Flattens a nested list.
Args:
(list): A list of lists.
... | [
{
"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_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer... | 4 | polyhedral_analysis/utils.py | bjmorgan/polyhedral-analysis |
from rest_framework import serializers
from carts.models import Cart
from merchandises.models import Merchandise
from django.contrib.auth import get_user_model
from rest_framework.validators import UniqueTogetherValidator
from django.db.models import Sum, Avg, Count
class CartSerializer(serializers.ModelSerializer):
... | [
{
"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 | carts/api/serializers.py | it-teaching-abo-akademi/webshop-project-arnelimperial |
# 6. Больше числа п. В программе напишите функцию, которая принимает два
# аргумента: список и число п. Допустим, что список содержит числа. Функция
# должна показать все числа в списке, которые больше п.
import random
def main():
list_num = [random.randint(0, 100) for i in range(20)]
print(list_num)
n = ... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
... | 3 | chapter_07/06_larger_than_n.py | SergeHall/Tony-Gaddis-Python-4th |
from ..utils import Object
class GetLoginUrl(Object):
"""
Returns an HTTP URL which can be used to automatically authorize the user on a website after clicking an inline button of type inlineKeyboardButtonTypeLoginUrl.Use the method getLoginUrlInfo to find whether a prior user confirmation is needed. If an ... | [
{
"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 | pytglib/api/functions/get_login_url.py | iTeam-co/pytglib |
import torch
import torch.nn as nn
class ComplexResGate(nn.Module):
def __init__(self, embedding_size):
super(ComplexResGate, self).__init__()
self.fc1 = nn.Linear(2*embedding_size, 2*embedding_size)
self.fc2 = nn.Linear(2*embedding_size, embedding_size)
self.sigmoid = nn.Sigmoid()... | [
{
"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 | model/complex_res_gate.py | ajyl/MIME |
from django.conf import settings
from storages.backends.s3boto import S3BotoStorage
class S3StaticStorage(S3BotoStorage):
"S3 storage backend that sets the static bucket."
def __init__(self, *args, **kwargs):
super(S3StaticStorage, self).__init__(
bucket=settings.AWS_STATIC_BUCKET_NAME,
... | [
{
"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 | coderdojochi/custom_storages.py | rgroves/weallcode-website |
"""Test the fogfreq script
"""
from unittest.mock import patch
@patch("argparse.ArgumentParser", autospec=True)
def test_get_parser(ap):
import fogtools.analysis.foghist2d
fogtools.analysis.foghist2d.get_parser()
assert ap.return_value.add_argument.call_count == 1
@patch("fogtools.analysis.foghist2d.ge... | [
{
"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_foghist2d.py | gerritholl/fogtools |
import sys
from os.path import join, relpath, dirname
upper_dir = join(dirname(relpath(__file__)), "..")
sys.path.append(upper_dir)
from torch import nn, cat
from base_model import ImageClassificationLightningModule
from typing import Callable
class EfficientNetLightningModuleWithTwoBackbones(ImageClassificationLig... | [
{
"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 | app/image_classification/models_with_two_separate_backbones/efficientnet_with_two_separate_backbones.py | tugot17/RGB-Infrared-Classification |
# -*- coding: utf-8 -*-
"""Contains constants for middleware layer."""
from typing import Tuple, Union
class Text:
"""Contains constants for text parameters."""
@property
def global_font(self) -> str:
"""Used for setting global font for text."""
return "Helvetica"
@property
def... | [
{
"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": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer"... | 3 | PyPDFForm/middleware/constants.py | XinyuLiu5566/PyPDFForm |
"""
Runtime: 6200 ms, faster than 5.01% of Python3 online submissions for Container With Most Water.
Memory Usage: 27.5 MB, less than 57.22% of Python3 online submissions for Container With Most Water.
"""
from typing import List
from typing import Optional
class Solution:
def maxArea(self, height: List[int]) -> i... | [
{
"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 | solutions/11. Container With Most Water.py | JacopoPan/leetcode-top100-liked-questions |
# -*- coding: utf-8 -*-
from flask import request, current_app
from domain.models import Image, Document
from validation.base_validators import ParameterizedValidator
import repo
class CanCreateFacilityValidator(ParameterizedValidator):
def validate(self, f, *args, **kwargs):
user_id = repo.get_user_id_f... | [
{
"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_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
}... | 3 | flod_facilities_backend/validation/credential_validators.py | Trondheim-kommune/Bookingbasen |
from ipynta.sourcing import DirectorySniffer
from ipynta.loaders import PillowLoader
from ipynta.transform import GrayscaleTransform
from os import path
import pytest
SAMPLES_DIR = path.dirname(path.abspath(__file__)) + "/sample_images/grayscale"
@pytest.fixture
def sample_images():
img_list = DirectorySn... | [
{
"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 | src/tests/transform/test_grayscale_transform.py | allanchua101/ipynta |
import math
import requests
def calc_dist(lat1, lon1, lat2, lon2):
lat1 = math.radians(lat1)
lon1 = math.radians(lon1)
lat2 = math.radians(lat2)
lon2 = math.radians(lon2)
h = math.sin( (lat2 - lat1) / 2 ) ** 2 + \
math.cos(lat1) * \
math.cos(lat2) * \
math.sin( (lon2 - lon1) / 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": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding sel... | 3 | meteors/find_meteors.py | Mathman628/find-close-meteorites |
from PySide import QtGui, QtCore
from AttributeWidgetImpl import AttributeWidget
class ScalarWidget(AttributeWidget):
def __init__(self, attribute, parentWidget=None, addNotificationListener = True):
super(ScalarWidget, self).__init__(attribute, parentWidget=parentWidget, addNotificationListener = addNot... | [
{
"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 | Python/kraken/ui/DataTypeWidgets/ScalarWidgetImpl.py | FabricExile/Kraken |
# coding: utf-8
"""
Cisco Intersight
Cisco Intersight is a management platform delivered as a service with embedded analytics for your Cisco and 3rd party IT infrastructure. This platform offers an intelligent level of management that enables IT organizations to analyze, simplify, and automate their environmen... | [
{
"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_inventory_generic_inventory_holder_ref.py | sdnit-se/intersight-python |
from __future__ import absolute_import
from __future__ import unicode_literals
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import copy
# \ref page 4, layers=2, forward + backward, concat[forward_projection, backward_projection]
class LstmbiLm(nn.Module):
de... | [
{
"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 | elmoformanylangs/modules/lstm.py | luomou97/ELMoForManyLangs |
class FtpOutputListQueryParams(object):
def __init__(self, offset=None, limit=None, name=None):
# type: (int, int, string_types) -> None
super(FtpOutputListQueryParams, self).__init__()
self.offset = offset
self.limit = limit
self.name = name
@property
def openapi_t... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than... | 3 | bitmovin_api_sdk/encoding/outputs/ftp/ftp_output_list_query_params.py | jaythecaesarean/bitmovin-api-sdk-python |
import datetime as dt
from flask import current_app
from polylogyx.db.database import db
class ConfigDomain:
def __init__(self, node, remote_addr):
self.node = node
self.remote_addr = remote_addr
def get_config(self):
current_app.logger.info(
"%s - %s checking in to ret... | [
{
"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 | plgx-esp/polylogyx/domain/config_domain.py | eclecticiq/eiq-er-ce |
class Node:
def __init__(self, x):
self.val = x
self.next = None
def __str__(self):
string = "["
node = self
while node:
string += "{} ->".format(node.val)
node = node.next
string += "None]"
return string
def get_nodes(values):
... | [
{
"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 | solutions/problem_177.py | ksvr444/daily-coding-problem |
import pandas as pd
import numpy as np
def replace_outliers(data, columns):
'''
Quantile-based Flooring and Capping
'''
df = data.copy()
for column in columns:
ten_percentile = (df[column].quantile(0.10))
ninety_percentile = (df[column].quantile(0.90))
... | [
{
"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 | src/features/build_features.py | HninPwint/nba-career-prediction |
"""modify migration
Revision ID: d1168fc41a41
Revises: 05fe6c4da706
Create Date: 2022-03-14 08:46:15.711561
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'd1168fc41a41'
down_revision = '05fe6c4da706'
branch_labels = None
depends_on = None
def upgrade():
... | [
{
"point_num": 1,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answe... | 3 | migrations/versions/d1168fc41a41_modify_migration.py | lewis-murgor/Blog |
from models.project import Project
import time
class ProjectHelper:
def __init__(self, app):
self.app = app
def open_projects_page(self):
dw = self.app.dw
if not dw.current_url.endswith("/manage_proj_page.php"):
dw.find_element_by_link_text("Manage").click()
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 | fixture/projects.py | AndreevaAnastasiya/py_training_mantis |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# this is to generate a config file when the --config flag is passed
from configparser import ConfigParser
import logging
from pathlib import Path
from .input_utils import choice, yes_or_no
log = logging.getLogger('pfg.config')
log.addHandler(logging.NullHandler())
hom... | [
{
"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 | pfg/config_utils.py | michaelfreyj/pfg |
# imports - module imports
from pipupgrade import cli
from pipupgrade.table import _sanitize_string, Table
def test__sanitize_string():
assert _sanitize_string(cli.format("foobar", cli.GREEN)) == "foobar"
assert _sanitize_string(cli.format("foobar", cli.BOLD)) == "foobar"
def test_table():
table =... | [
{
"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 | tests/pipupgrade/test_table.py | max-nicholson/pipupgrade |
from unittest import TestCase
from pya import *
import numpy as np
import logging
logging.basicConfig(level=logging.DEBUG)
class TestUgen(TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def test_sine(self):
sine = Ugen().sine(freq=200, amp=0.5, dur=1.0, sr=44100 // 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": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
}... | 3 | tests/test_ugen.py | m---w/pya |
import socket
import os
import time
def do_sleep():
time.sleep(1)
def do_work():
from random import random
iterations = 5_000_000
count = 0
for _ in range(iterations):
x = random()
y = random()
if x*x + y*y <= 1.0:
count = count + 1
pi = 4.0 * count / ite... | [
{
"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 | aws/test_function.py | danielBCN/faas-parallelism-benchmark |
# Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cl... | 3 | client/monitor_.py | tungsten-infra/containerregistry |
from django.test import TestCase, Client
from django.contrib.auth import get_user_model
class ModelTests(TestCase):
def test_create_user_with_email_successful(self):
'''
Test that creating a user with an email is successful
'''
email = 'test@gmail.com'
password = '456@3... | [
{
"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 | backend/user/tests/test_models.py | Ssents/stonewell_tech |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
OpenAPI spec version: v1.14.7
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import unittest
import kube... | [
{
"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 | kubernetes_asyncio/test/test_v1beta1_stateful_set_status.py | aK0nshin/kubernetes_asyncio |
import unittest.mock as mock
import pytest
import requests
from transiter.scheduler import client
@pytest.fixture
def scheduler_post_response(monkeypatch):
response = mock.Mock()
def post(*args, **kwargs):
return response
monkeypatch.setattr(requests, "post", post)
return response
@pytes... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written... | 3 | tests/unit/scheduler/test_client.py | jamespfennell/realtimerail |
import logging
from urllib.parse import urljoin
import requests
from eth_typing import ChecksumAddress
from safe_transaction_service.tokens.clients.exceptions import CannotGetPrice
logger = logging.getLogger(__name__)
class CoingeckoClient:
base_url = 'https://api.coingecko.com/'
def __init__(self):
... | [
{
"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 | safe_transaction_service/tokens/clients/coingecko_client.py | vaporyorg/safe-transaction-service |
# Portfolio
def query_portfolio():
pass
# Positions
def query_open_positions():
pass
def has_open_position(symbol):
pass
def query_open_position_by_symbol(symbol):
pass
# Balances
def query_balance(asset):
pass
def query_balances():
pass
def query_balance_free(asset):
pass
| [
{
"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 | trality_simulator/portfolio.py | ffavero/trality-simulator |
from __future__ import unicode_literals
import swapper
from django.db import models
from accelerator_abstract.models.accelerator_model import AcceleratorModel
class BaseProgramFamilyLocation(AcceleratorModel):
program_family = models.ForeignKey(
swapper.get_model_name(AcceleratorModel.Meta.app_label,
... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
}... | 3 | accelerator_abstract/models/base_program_family_location.py | masschallenge/django-accelerator |
"""Define the common values and functions to run the tests."""
from pathlib import Path
from scrapd.core import constant
TEST_ROOT_DIR = Path(__file__).resolve().parent
TEST_DATA_DIR = TEST_ROOT_DIR / 'data'
TEST_DUMP_DIR = TEST_ROOT_DIR.parent / constant.DUMP_DIR
def load_test_page(page):
"""Load a test page."... | [
{
"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 | tests/test_common.py | scrapd/scrapd |
import pytest
from aiopg.sa.connection import _distill_params
pytest.importorskip("aiopg.sa") # noqa
def test_distill_none():
assert _distill_params(None, None) == []
def test_distill_no_multi_no_param():
assert _distill_params((), {}) == []
def test_distill_dict_multi_none_param():
assert _distill... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer"... | 3 | tests/test_sa_distil.py | dduong42/aiopg |
#!/usr/bin/env python
#
# assa-2020.py
# Search SHODAN for Cisco ASA CVE-2020-3452
#
# Author: random_robbie
import shodan
import sys
import re
import requests
from time import sleep
from requests.packages.urllib3.exceptions import InsecureRequestWarning
requests.packages.urllib3.disable_warnings(InsecureRequestWarnin... | [
{
"point_num": 1,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"a... | 3 | cisco/asa-2020.py | phiberoptick/My-Shodan-Scripts |
import json
import os
from app import app
def invalid_file_error_response(data) -> json:
data = {"detail_error": 'File format not supported only supported are .jpeg and .png but received a' + ' ' + data}
response = app.response_class(
response=json.dumps(data),
status=400,
mimetype='a... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
... | 3 | utils.py | rksingh95/prediction-service |
from load_data import LoadData
from check_solution import CheckSudoku
from brute_force.brute_force import BruteForce
from base_solver.solve_it_like_a_human import SolveItLikeAHuman
from genetic_algorithm.genetic_algorithm import GeneticAlgorithm
import numpy as np
import logging
logger = logging.getLogger('Sudoku Solve... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"ans... | 3 | src/sudoku_solver.py | Mai13/sudoku |
import constants
import frame_subscriber
import frame_receiver
# Income
def create_receiver():
receiver_port = constants.get_meta_frame_server_port()
return frame_receiver.FrameReceiver(port=receiver_port)
def create_subscriber():
subscriber_port = constants.get_meta_frame_server_port()
topic = cons... | [
{
"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 | video_processor/frame_comm.py | zhiyanliu/riverrun |
import pytest
import subprocess
from Browser.assertion_engine import AssertionOperator
@pytest.fixture()
def application_server():
process = subprocess.Popen(
["node", "./node/dynamic-test-app/dist/server.js", "7272"]
)
yield
process.terminate()
@pytest.fixture()
def browser(monkeypatch):
... | [
{
"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 | utest/test_python_usage.py | emanlove/robotframework-browser |
import pytest
from gene_finder.utils import get_neighborhood_ranges
def _build_hit_dictionary(coords):
hits = {}
for coord in coords:
key = "hit_{}_{}".format(coord[0], coord[1])
hits[key] = {}
hits[key]["Query_start-pos"] = coord[0]
hits[key]["Query_end-pos"] = coord[1]
ret... | [
{
"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 | tests/test_gene_finder/test_utils.py | caacree/Opfi |
'''
Created on Oct 29, 2018
@author: riaps
'''
class Origin(object):
'''
RIAPS app origin - 'signature file
url = URL of the repo (or local folder) the app is coming from
host = host IP addares
mac = MAC address of host
sha = SHA of package
home = local source folder (used in remote debugg... | [
{
"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/riaps/utils/origin.py | mbellabah/riaps-pycom |
class Soma:
def __init__(self):
self.numeroDeCartas = list()
def set_numeroDeCartas(self, numero):
if numero == '':
numero = '1'
numero = numero[:]
self.numeroDeCartas.extend(numero)
def get_numeroDeCartas(self):
... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",... | 3 | 14-flashcardsContador/1-versaoTerminal/0-versoesAntigas/flashcardsContador2/Soma.py | jonasht/Python |
from typing import Any, Dict
import httpx
from ...client import Client
from ...models.a_form_data import AFormData
from ...types import Response
def _get_kwargs(
*,
client: Client,
form_data: AFormData,
) -> Dict[str, Any]:
url = "{}/tests/post_form_data".format(client.base_url)
headers: Dict[s... | [
{
"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_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"an... | 3 | end_to_end_tests/golden-record/my_test_api_client/api/tests/post_form_data.py | kmray/openapi-python-client |
from PIL import Image
import numbers
class RandomCrop(object):
def __init__(self, size, v):
if isinstance(size, numbers.Number):
self.size = (int(size), int(size))
else:
self.size = size
self.v = v
def __call__(self, img):
w, h = img.size
th, tw =... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},... | 3 | api/utils/data_utils.py | wtomin/Multitask-Emotion-Recognition-with-Incomplete-Labels |
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See LICENSE in the project root
# for license information.
from __future__ import absolute_import, division, print_function, unicode_literals
import contextlib
import os
@contextlib.contextmanager
def cwd(dirnam... | [
{
"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 | home/vscode/extensions/ms-python.python-2021.12.1559732655/pythonFiles/lib/python/debugpy/_vendored/_util.py | qwertzy-antonio-godinho/dots |
from abc import ABC, abstractmethod
from typing import List
import numpy as np
class Ledger(ABC):
@abstractmethod
def get_next_batch_id(self) -> int:
"""Return next available batch id."""
@abstractmethod
def get_next_transaction_id(self) -> int:
"""Return next available transaction i... | [
{
"point_num": 1,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer"... | 3 | ledger.py | HaeckelK/bookkeeping |
from sqlite3 import connect
cxn = connect("./files/database.db", check_same_thread=False)
cur = cxn.cursor()
def with_commit(func):
def inner(*args, **kwargs):
func(*args, **kwargs)
commit()
return inner
@with_commit
def build():
scriptexec("./files/script.sql")
def commit():
cxn.commit()
def close():
... | [
{
"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 | lib/db.py | sbshrey/twitch-bot-tutorial |
import os
import unittest
from typing import Dict
from kfai_env import Environment
from kfai_sql_chemistry.db.database_config import DatabaseConfig
from kfai_sql_chemistry.db.engines import SQLEngineFactory
def setUpModule():
os.environ['ENV'] = 'TEST'
def tearDownModule():
os.environ['ENV'] = ''
class ... | [
{
"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 | kfai_sql_chemistry/test/test_create_db_connection.py | krishisharma45/sql-chemistry |
import requests
def get_patient_data(patient_id):
res = requests.get(f'http://hapi.fhir.org/baseDstu3/Patient/{patient_id}/_history/1?_pretty=true&_format=json')
return res.json()
def get_data(id,
fhir_base='http://hapi.fhir.org/baseDstu3/',
fhir_resource='Patient/'):
res = requests.get(f'{fhir... | [
{
"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 | _site/lectures/Week 01 - Language basics, Generating Data, Storing Data/inclass-2019-05-23.py | BrianKolowitz/data-focused-python |
"""
Tools for interop with other libraries.
Check if libraries available without importing them which can be slow.
"""
import importlib.util
from typing import Any, Callable
# pylint: disable=import-outside-toplevel
class _LibChecker:
@property
def rasterio(self) -> bool:
return self._check("rasteri... | [
{
"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 | odc/geo/_interop.py | opendatacube/odc-geo |
from django.shortcuts import render, get_object_or_404
from rest_framework.views import APIView
from rest_framework.response import Response
from .models import Post
from .serializers import PostSerializer
class BlogListView(APIView):
def get(self, request, *args, **kwargs):
posts = Post.postobjects.all(... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?... | 3 | backend/blog/views.py | alexandersilvera/django-rest-blog |
# qubit number=4
# total number=44
import pyquil
from pyquil.api import local_forest_runtime, QVMConnection
from pyquil import Program, get_qc
from pyquil.gates import *
import numpy as np
conn = QVMConnection()
def make_circuit()-> Program:
prog = Program() # circuit begin
prog += CNOT(0,3) # number=13
... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 lines?",
"answer": true
... | 3 | benchmark/startPyquil3332.py | UCLA-SEAL/QDiff |
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from ..utils import Calc
def test_Calc_inputs():
input_map = dict(
args=dict(argstr='%s', ),
environ=dict(
nohash=True,
usedefault=True,
),
expr=dict(
argstr='-expr "%s"',
mandator... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 lines?",
"answer": true
... | 3 | nipype/interfaces/afni/tests/test_auto_Calc.py | PAmcconnell/nipype |
from alembic import context
from prettyconf import config
from sqlalchemy import create_engine
from thales import db
DATABASE_URL = config('DATABASE_URL')
METADATA = db.metadata
def run_migrations_offline():
context.configure(url=DATABASE_URL, metadata=METADATA)
with context.begin_transaction():
con... | [
{
"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 | thales/migrations/env.py | cacarrara/thales |
# module for distance computation;
import numpy as np
def dist(arraya, arrayb, mode):
if mode == 0:
dis = np.sum(np.abs(np.subtract(arraya, arrayb)))
elif mode == 1:
dis = np.sqrt(np.sum(np.power(np.subtract(arraya, arrayb), 2)))
else:
dis = 1 - np.dot(arraya, arrayb) / np.sqrt(np.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": "every_function_under_20_lines",
"question": "Is every function in this file shorter than ... | 3 | DCS311 Artificial Intelligence/KNN/lab1_code/M3/dist.py | Lan-Jing/Courses |
from requests import session
from threading import Thread
from re import findall
SERVER = "http://mustard.stt.rnl.tecnico.ulisboa.pt:12202"
s = session()
f = None
def doLogin():
data = {
"username": "admin",
"password": "admin"
}
s.post(SERVER + "/login", data=data)
def doJackpot():
... | [
{
"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 | Labs/6/RaceConditions/RemoteRace/Exploit.py | Opty-MISCE/SS |
import os
import sys
import grammaire
from datalabs.operations.edit.editing import editing
sys.path.append(
os.path.abspath(os.path.join(os.path.dirname(__file__), "../../../../"))
)
def readfile(file):
with open(file, encoding="utf8") as input:
lines = input.readlines()
return lines
def load... | [
{
"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 | datalabs/operations/edit/plugins/general/insert_abbreviation/transformation.py | ExpressAI/DataLab |
from __future__ import unicode_literals
import json
from urllib.parse import quote
import pytest
import sure # noqa
import moto.server as server
from moto import mock_iot
"""
Test the different server responses
"""
@mock_iot
def test_iot_list():
backend = server.create_backend_app("iot")
test_client = ba... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": tru... | 3 | tests/test_iot/test_server.py | oakbramble/moto |
from django.db.models import Count, Manager
class ExampleManager(Manager):
def bulk_create(self, objs, batch_size=None, ignore_conflicts=False):
super().bulk_create(objs, batch_size=batch_size, ignore_conflicts=ignore_conflicts)
uuids = [data.uuid for data in objs]
examples = self.in_bulk... | [
{
"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 | backend/examples/managers.py | daobook/doccano |
#!/bin/python3
# Copyright (C) 2020 Matheus Fernandes Bigolin <mfrdrbigolin@disroot.org>
# SPDX-License-Identifier: MIT
"""Day Thirteen, Shuttle Search."""
from sys import argv
from re import findall
from utils import open_file, arrange, usage_and_exit, product
def solve1(buses, est):
"""Get the earliest bus... | [
{
"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 | src/day13.py | mfrdbigolin/AoC2020 |
import random
NUMBERS = ["1", "2", "3", "4", "5", "6", "7", "8", "9"]
def read_file():
WORDS = []
with open("./archivos/data.txt", "r", encoding="utf-8") as f:
for line in f:
WORDS.append(line.replace("\n", ""))
return WORDS
def random_word(words):
idx = random.randint(0, len(wor... | [
{
"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 | hangman.py | KevinCardenasDev/PythonIntermedio |
import abc
class WriterBase(abc.ABC):
@abc.abstractmethod
def set_pipe(self, pipe):
pass
@abc.abstractmethod
def parallel_write_end_loop(self) -> None:
pass
@abc.abstractmethod
def is_running(self):
pass
@abc.abstractmethod
def is_stopped(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 | process_exec/parallel_pipe_io_base.py | sreramk/dag_process_exec |
from flask import session, redirect, url_for
from functools import wraps
def login_required(f):
@wraps(f)
def decorated_function(*args, **kwargs):
if session.get("_user_id") is None:
return redirect(url_for("auth.login"))
return f(*args, **kwargs)
return decorated_function
| [
{
"point_num": 1,
"id": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 lines?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answe... | 3 | caishen_dashboard/auth/utils.py | Kerem-Sami-Coop/caishen-dashboard-be2 |
# coding: utf-8
# Copyright (c) 2015 Fabian Barkhau <fabian.barkhau@gmail.com>
# License: MIT (see LICENSE file)
from gravur.common.abstractscrollview import AbstractScrollView
from gravur.contacts.contactpreview import ContactPreview
from gravur.utils import load_widget
@load_widget
class ContactScrollView(Abstrac... | [
{
"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 | gravur/contacts/contactscrollview.py | F483/gravur |
from binary_search import binary_search
# import pytest
def test_binary_search_with_valid_input_in_list():
'''
tests array with a valid case of search key being in array
'''
assert binary_search([1,2,3,4,5,6,7], 6) == 5
def test_binary_search_with_valid_but_not_included_input_in_list():
'''
te... | [
{
"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 | challenges/binary-search/test_binary_search.py | tyler-fishbone/data-structures-and-algorithms |
# -*- coding: utf-8 -*-
"""
bilibili user
~~~~~~~~~~~~~
目标网站: www.bilibibli.com
爬虫描述: 爬取 bilibili 用户信息
示例链接: https://space.bilibili.com/33683045/
接口格式:
示例接口:
用户信息 - https://api.bilibili.com/x/space/acc/info?mid=26019347&jsonp=jsonp
收藏夹 - https://api.bilibili.com/medialist/gateway/base/created?pn=1&ps=10&up_mid... | [
{
"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 | dev/bilibili_user.py | lin-zone/crawler-dev |
# coding: utf-8
"""
Seldon Deploy API
API to interact and manage the lifecycle of your machine learning models deployed through Seldon Deploy. # noqa: E501
OpenAPI spec version: v1alpha1
Contact: hello@seldon.io
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future... | [
{
"point_num": 1,
"id": "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 | python/test/test_volume.py | adriangonz/seldon-deploy-sdk |
from .table import Table
from .database import Database
class View(Table):
def __init__(self, db: Database, schema: str, name: str, view_def: str) -> None:
self.viewDefinition = None
super().__init__(db, schema, name)
self.set_view_definition(view_def)
def set_view_definition(self, vi... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inherit... | 3 | dataprep/eda/create_db_report/db_models/view.py | devinllu/dataprep |
from functools import wraps
from typing import Callable, TypeVar
from graphene import ResolveInfo
from typing_extensions import Concatenate, ParamSpec
R_f = TypeVar("R_f")
R_fn = TypeVar("R_fn")
P = ParamSpec("P")
def context(fn: Callable[Concatenate[ResolveInfo, P], R_fn]) -> Callable[P, R_fn]:
"""
Injects... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"a... | 3 | backend/decorators/helpers.py | hovedstyret/indok-web |
from celery.loaders.base import BaseLoader
class AppLoader(BaseLoader):
def on_worker_init(self):
self.import_default_modules()
def read_configuration(self):
return {}
| [
{
"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 | celery/loaders/app.py | frac/celery |
import json, os
from position import Pos
class Loader:
def __init__(self, id):
file_name = str(id) + ".json"
path = os.path.dirname(__file__)
path_json = os.path.join(path, "data", file_name)
file = open(path_json)
dict = json.load(file)
players = dict["players"]
... | [
{
"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/map/loader.py | paoli7612/Elements |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | [
{
"point_num": 1,
"id": "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 | aliyun-python-sdk-faas/aliyunsdkfaas/request/v20170824/UpdateImageAttributeRequest.py | liumihust/aliyun-openapi-python-sdk |
from typing import AbstractSet, Any, Mapping, Optional
def stringify(self_: Any, use: Optional[Mapping[str, Any]] = None, hide: Optional[AbstractSet[str]] = None) -> str:
name = self_.__class__.__name__
state = self_.__dict__
return f'{name}({_stringify_state(state, use or {}, hide or set())})'
def _str... | [
{
"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": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
... | 3 | cmaj/utils/stringify.py | marianwieczorek/cmaj |
import LL1
class Node(LL1.Node):
def delete(self, k):
if(k<0):
return None
node = self
nodeinit = node
if(k==0):
nodeinit = nodeinit.next
else:
i = 1
while(node.next != None):
if(i == k):
nod... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
... | 3 | LL4.py | Am4teur/LinkedList |
# automatically generated by the FlatBuffers compiler, do not modify
# namespace: MNN
import flatbuffers
class Plugin(object):
__slots__ = ['_tab']
@classmethod
def GetRootAsPlugin(cls, buf, offset):
n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
x = Plugin()
... | [
{
"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 | pymnn/pip_package/MNN/tools/mnn_fb/Plugin.py | xhuan28/MNN |
import numpy as np
from .provider import BaseProvider
from pathlib import Path
from torch import is_tensor
class AudioProvider(BaseProvider):
"""Provides the data for the audio modality."""
def __init__(self, *args, **kwargs):
self.modality = 'audio'
super().__init__(*args, **kwargs)
... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answe... | 3 | end2you/data_provider/audio_provider.py | tfyd/myEnd2you |
import sort_utils
def mergeTwoSorted(array1, array2):
len1 = len(array1)
len2 = len(array2)
result = [None for _ in range(len1 + len2)]
i1 = 0
i2 = 0
ir = 0
while i1 < len1 and i2 < len2:
if array1[i1] <= array2[i2]:
result[ir] = array1[i1]
i1 += 1
... | [
{
"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 | tests_sort/05_30/merge_sort.py | pfreese/py_test |
import unittest
from localstack.utils.tagging import TaggingService
class TestTaggingService(unittest.TestCase):
svc = TaggingService()
def test_list_empty(self):
result = self.svc.list_tags_for_resource("test")
self.assertEqual({"Tags": []}, result)
def test_create_tag(self):
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 | tests/unit/test_tagging.py | jorges119/localstack |
import pytest
import numpy as np
import cirq
from cirq.contrib.svg import circuit_to_svg
def test_svg():
a, b, c = cirq.LineQubit.range(3)
svg_text = circuit_to_svg(
cirq.Circuit(
cirq.CNOT(a, b),
cirq.CZ(b, c),
cirq.SWAP(a, c),
cirq.PhasedXPowGate(exp... | [
{
"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 | cirq/contrib/svg/svg_test.py | lilies/Cirq |
class Publisher:
def __init__(self):
self.observers = []
def add(self, observer):
if observer not in self.observers:
self.observers.append(observer)
else:
print('Failed to add: {}'.format(observer))
def remove(self, observer):
try:
self.o... | [
{
"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_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
}... | 3 | Module 3/9324OS_13_code/old/observer.py | real-slim-chadi/Python_Master-the-Art-of-Design-Patterns |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.