source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
import logging
import opentracing
from jaeger_client import Config
def init_tracer(service):
logging.getLogger('').handlers = []
logging.basicConfig(format='%(message)s', level=logging.DEBUG)
config = Config(
config={
'sampler': {
'type': 'const',
'para... | [
{
"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 | garden_scorer/src/tracing.py | emilybache/BeeFriendly |
from pyramid.response import Response
from pyramid.view import view_config
from pyramid.renderers import render
@view_config(route_name='wer-kann-mitmachen')
def wer_kann_mitmachen_view(request):
set_language(request)
lan = get_language(request)
result = render('templates/' + str(lan) + '/mitmachen/wer-ka... | [
{
"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 | WebPortal/gbol_portal/viewsMitmachen.py | ZFMK/GermanBarcodeofLife |
from django.shortcuts import render,redirect, render_to_response
from django.template import RequestContext
from django.http import HttpResponse, HttpResponseRedirect
from forms import URLForm
from django.contrib.auth import logout as auth_logout
import json
import urllib2
import sys
import os
from subscribe.models i... | [
{
"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 | rssplus/views.py | Davidhw/infocatch |
# https://leetcode.com/problems/count-number-of-pairs-with-absolute-difference-k/
from collections import Counter
class Solution(object):
# Brute Force Approach
# TC : O(N
# SC : O(N)
def countKDifference(self, nums, k):
"""
:type nums: List[int]
:type k: int
... | [
{
"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 | arrays/countNumberOfPairsWithAbsoluteDifferenceK.py | kushvr7/High-On-DSA |
from pytest import mark # type: ignore
from messages import show_count
@mark.parametrize('qty, expected', [
(1, '1 part'),
(2, '2 parts'),
(0, 'no part'),
])
def test_show_count(qty, expected):
got = show_count(qty, 'part')
assert got == expected
# tag::TEST_IRREGULAR[]
@mark.parametrize('qty,... | [
{
"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 | 08-def-type-hints/messages/hints_2/messages_test.py | eumiro/example-code-2e |
import sys
import unittest
from sdl2 import ext as sdl2ext
class SDL2ExtGUITest(unittest.TestCase):
__tags__ = ["sdl", "sdl2ext"]
@classmethod
def setUpClass(cls):
try:
sdl2ext.init()
except sdl2ext.SDLError:
raise unittest.SkipTest('Video subsystem not supported')... | [
{
"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_nested_function_def",
"question": "Does this file contain any function defined inside another function?",... | 3 | sdl2/test/sdl2ext_gui_test.py | zmarvel/py-sdl2 |
from krgram.tl.core_types.native import TL_string
from krgram.tl.base import *
class getConfig(TLFunction):
ID = 0xc4f9186b
TLRegister.register(getConfig)
class getNearestDc(TLFunction):
ID = 0x1fb33026
TLRegister.register(getNearestDc)
class getAppUpdate(TLFunction):
ID = 0xc812ac7e
def get_structure(se... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{... | 3 | krgram/tl/api/functions/help.py | krow89/krgram |
import time
import redis
from flask import Flask
app = Flask(__name__)
cache = redis.Redis(host='redis', port=6379)
def get_hit_count():
retries = 5
while True:
try:
return cache.incr('hits')
except redis.exceptions.ConnectionError as exc:
if retries == 0... | [
{
"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 | app.py | benjohns1/docker-compose-sample |
from django.db import models
from django.contrib.auth.models import AbstractBaseUser, BaseUserManager, \
PermissionsMixin
# Create your models here.
class UserManager(BaseUserManager):
def create_user(self, email, password=None, **extra_fields):
"""... | [
{
"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_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/c... | 3 | app/core/models.py | dipankar-js/Python-Django-TDD |
from lxml import etree
from fmi_api import WeatherPoint
class HtmlWeatherTable:
def __init__(self):
self.root = etree.Element("html")
self.table_body = self._create_table()
def _create_table(self) -> etree.Element:
head = etree.SubElement(self.root, "head")
style = etree.S... | [
{
"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 | email_handler/html_builder.py | JuhaniTakkunen/weather_alarm |
from jackal.settings import jackal_settings
from jackal.structures import JackalBaseStructure, BaseQueryFunction
def structure_loader(key):
ret_data = dict()
stru = getattr(jackal_settings, key, None)
if stru is None:
stru = jackal_settings.CUSTOM_STRUCTURES.get(key)
if stru is None:
... | [
{
"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 | jackal/loaders.py | joyongjin/Jackal |
from app.dao.Produto_dao import Produto_dao
class Produto_service(object):
def salvar(self, produto):
p = self.filter_nome(produto.nome)
if p == None:
produto.salvar()
return {'mensagem':'Produto cadastrado com sucesso'}
else:
return {'mensag... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": ... | 3 | app/service/Produto_service.py | amandapersampa/FastFrango |
def TC_idx(T):
"""
Returns TC Reordering indices.
When channels are ordered like (1R 1G 1B 2R 2G 2B 3R 3G 3B 4R ...),
Returns indices to make it (1R 2R 3R 2G 3G 4G 3B 4B 5B 4R 5R 6R ...).
"""
assert T >= 3
idx_3frame = [0, 3, 6, 4, 7, 10, 8, 11, 14] # (1R 2R 3R) (2G 3G 4G) (3B 4B 5B)
rep... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (exc... | 3 | ops/tc_reordering.py | kiyoon/TDN |
import socket
from time import ctime
import threading
sADDR = ('127.0.0.1', 45002)
buff = 1024
cliSock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
cliSock.connect(sADDR)
def receive():
while True:
rMessage = cliSock.recv(buff)
if not rMessage:
print("Ending conne... | [
{
"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 | fd_chat/fd_2_client.py | devangi2000/Computer-Networking |
from aiogram import Bot, Dispatcher, executor, types
from aiogram.utils.exceptions import CantParseEntities
from dotenv import load_dotenv, find_dotenv
from signal import signal, SIGINT
from tqdm import tqdm
from os import getenv
import sys
import fire
import uvloop
import redis
load_dotenv(find_dotenv('.telegram'))
u... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written ... | 3 | step6_orchestration/telegram_publisher/publisher.py | osmya/pydatanlp |
# Copyright 2019-2020 Axis Communications AB.
#
# For a full list of individual contributors, please see the commit history.
#
# 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... | [
{
"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 | src/eiffel_graphql_api/graphql/schemas/links/iut.py | fredjn/eiffel-graphql-api |
"""create account loginsource column for user table
Revision ID: 5659632c7b2a
Revises: ea64b4d55bfb
Create Date: 2020-07-20 07:33:13.584759
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = '5659632c7b2a'
down_revision = 'ea64b4d55bfb'
branch_labels = None
depend... | [
{
"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 | auth-api/migrations/versions/5659632c7b2a_create_account_loginsource_column_for_.py | karthik-aot/sbc-auth |
# Copyright 2016 Google 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 writing, ... | [
{
"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 | appengine/standard/users/main.py | baditaflorin/python-docs-samples |
# $Id$
#
# Copyright (C) 2003 Rational Discovery LLC
# All Rights Reserved
#
from rdkit import six
from rdkit.VLib.Node import VLibNode
class SupplyNode(VLibNode):
""" base class for nodes which supply things
Assumptions:
1) no parents
Usage Example:
>>> supplier = SupplyNode(contents=[1,2,3])
... | [
{
"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 | rdkit/VLib/Supply.py | docking-org/rdk |
# -*- coding: utf-8 -*-
import xml.etree.ElementTree as ET
import unittest
from context import xml_bibs as xb
class TestGetSubjectFields(unittest.TestCase):
"""Tests parsing of subjects from marcxml"""
def setUp(self):
tree = ET.parse("sample_marcxml.xml")
self.data1 = tree.getroot()
... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
... | 3 | tests/test_xml_bibs.py | Mfgloger/overload |
"""
A sensor platform which detects underruns and capped status from the official Raspberry Pi Kernel.
Minimal Kernel needed is 4.14+
"""
import logging
from rpi_bad_power import UnderVoltage, new_under_voltage
from homeassistant.components.binary_sensor import (
BinarySensorDeviceClass,
BinarySensorEntity,
... | [
{
"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 | homeassistant/components/rpi_power/binary_sensor.py | MrDelik/core |
"""SynologyChat platform for notify component."""
import json
import logging
import requests
import voluptuous as vol
from homeassistant.components.notify import (
ATTR_DATA,
PLATFORM_SCHEMA,
BaseNotificationService,
)
from homeassistant.const import CONF_RESOURCE, CONF_VERIFY_SSL, HTTP_CREATED, HTTP_OK
i... | [
{
"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_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"ans... | 3 | homeassistant/components/synology_chat/notify.py | basicpail/core |
# 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
class Solution:
def isSubtree(self, root: Optional[TreeNode], subRoot: Optional[TreeNode]) -> bool:
if not root or n... | [
{
"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 | code/572.Subtree-of-Another-Tree-v2.py | Aden-Q/leetcode |
import sys
import typing
import numba as nb
import numpy as np
@nb.njit(
(nb.i8[:], ),
cache=True,
)
def solve(
s: np.ndarray,
) -> typing.NoReturn:
mod = 10 ** 9 + 7
n = s.size
dp = np.zeros(n + 2, np.int64)
dp[0] = 1
for i in range(n):
j = i - 1
while j >= 0:
if s... | [
{
"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 | jp.atcoder/abc214/abc214_f/25543460.py | kagemeka/atcoder-submissions |
#!/usr/bin/env python3
# coding: utf-8
"""A simple python3 script template.
"""
import random
import sys
class Solution(object):
def __init__(self, nums):
"""
:type nums: List[int]
"""
self.orig = nums[:]
self.nums = nums[:]
self.seed = 1
random.seed(self.... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answ... | 3 | p384_shuffle_an_array.py | feigaochn/leetcode |
from django.db import models
# Create your models here.
class Category(models.Model):
class Meta:
verbose_name_plural = 'Categories'
name = models.CharField(max_length=254)
display_name = models.CharField(max_length=254)
# note: did not add null=True and blank=True params to these
# as ... | [
{
"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 | quotations/models.py | billdavisjr/wbd_fsd_project4 |
from ..utils import Object
class SearchSecretMessages(Object):
"""
Searches for messages in secret chats. Returns the results in reverse chronological order. For optimal performance the number of returned messages is chosen by the library
Attributes:
ID (:obj:`str`): ``SearchSecretMessages``
... | [
{
"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 | pytglib/api/functions/search_secret_messages.py | iTeam-co/pytglib |
from django.core.exceptions import ValidationError
import magic
class MimetypeValidator(object):
def __init__(self, mimetypes):
self.mimetypes = mimetypes
def __call__(self, value):
try:
mime = magic.from_buffer(value.read(1024), mime=True)
if not mime in self.mimetypes:
raise ValidationError('%s is... | [
{
"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 | etd_drop_app/validators.py | MetaArchive/etd-drop |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a ty... | 3 | aliyun-python-sdk-live/aliyunsdklive/request/v20161101/DescribeUpBpsPeakDataRequest.py | sdk-team/aliyun-openapi-python-sdk |
import os
import asyncio
import logging
import uuid
from datetime import datetime
from websockets import ConnectionClosed
from sanic import Sanic
from sanic.log import access_logger
from sanic.response import file, redirect
class PingFilter(logging.Filter):
def filter(self, record):
return not (record.r... | [
{
"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 | server.py | ministryofjustice/analytics-platform-websocket-status |
from ..utils import sortkey, capitalize_first
FIGURE_TEX_TEMPLATE = r'\hwgraphic{{{path}}}{{{headword}}}{{{attribution}}}'
# change to {filename} if you want to specify full paths.
FIGURE_PATH_TEMPLATE = r'figures/ill-{filename}'
class Image(object):
type = 'img'
def sk(self):
return sortkey(self.hw... | [
{
"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 | sfm2latex/dictionary/Image.py | redmer/sfm2latex |
import math
class Citizen:
def __init__(self, economicPosition, socialPosition):
self.economicPosition = economicPosition
self.socialPosition = socialPosition
def vote(self, politicians):
vote = (0, None)
for politician in politicians:
score = self._score(politician... | [
{
"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 | citizen.py | thesquaregroot/election-simulation |
import cv2 as cv
import numpy as np
import os
def preprocess(labels_path, sep_labels_path):
# list all files on labels_path
labels_filenames = os.listdir(labels_path)
count = 0
for label_filename in labels_filenames:
label_path = os.path.join(labels_path, label_filename)
print(f'segme... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding s... | 3 | preprocessing/main.py | jrobertojunior/face-parsing.PyTorch |
# SPDX-FileCopyrightText: 2020 Splunk Inc.
#
# SPDX-License-Identifier: Apache-2.0
from builtins import object
import os.path as op
import traceback
from splunktalib.common import log
class FileMonitor(object):
def __init__(self, callback, files):
"""
:files: files to be monidtored with full pat... | [
{
"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": false... | 3 | TA-linode/bin/ta_linode/aob_py3/splunktalib/file_monitor.py | jriddle-linode/splunk-addon-linode |
# Pylint doesn't play well with fixtures and dependency injection from pytest
# pylint: disable=redefined-outer-name
import os
import pytest
from buildstream import _yaml
from buildstream.testing import cli_integration as cli # pylint: disable=unused-import
from buildstream.testing.integration import walk_dir
pyt... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"ans... | 3 | tests/integration/import.py | doraskayo/buildstream |
from flask import Blueprint
from werkzeug.exceptions import NotFound, InternalServerError, TooManyRequests
from mldictionary_api.const import API_PREFIX
from mldictionary_api.resources.response import ResponseAPI
from mldictionary_api.resources.const import (
ENGLISH_REPR,
ENGLISH_TO_PORTUGUESE_REPR,
PORTU... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written ... | 3 | mldictionary_api/routes/api.py | PabloEmidio/MLDictionaryAPI |
# Write a function to find the longest common prefix string amongst an array of strings.
# If there is no common prefix, return an empty string "".
#
# Example 1:
# Input: strs = ["flower","flow","flight"]
# Output: "fl"
#
# Example 2:
# Input: strs = ["dog","racecar","car"]
# Output: ""
# Explanation: There is no comm... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},... | 3 | problems/LongestCommonPrefix.py | strambake/data-structures-and-algorithms |
from .predict import predict
import argparse
import sys, multiprocessing
import torch
def _parse_args():
parser=argparse.ArgumentParser(description="Run SolTranNet aqueous solubility predictor")
parser.add_argument('input',nargs='?',type=argparse.FileType('r'),default=sys.stdin,help='PATH to the file containi... | [
{
"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 | soltrannet/__init__.py | hengwei-chan/molecular_attention_transformer |
from flask import Flask, render_template, request, jsonify
from urlparse import urljoin
from werkzeug.contrib.atom import AtomFeed
import os
from bs4 import BeautifulSoup
import os
import datetime
import html2text
app = Flask(__name__)
app.debug=True
def make_external(url):
return urljoin(request.url_root, url)
... | [
{
"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 | __init__.py | infosec-au/websec-weekly |
# -*- coding: utf-8 -*-
import asyncio
import pytest
from poke_env.player.random_player import RandomPlayer
from poke_env.player.utils import cross_evaluate
from poke_env.player_configuration import PlayerConfiguration
from poke_env.server_configuration import LocalhostServerConfiguration
async def simple_cross_eval... | [
{
"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 | integration_tests/test_double_battles.py | suminzu/poke-env |
import datetime
from simple_blog.models.meta import Base
from sqlalchemy import Column
from sqlalchemy import Integer
from sqlalchemy import Unicode
from sqlalchemy import UnicodeText
from sqlalchemy import DateTime
from passlib.apps import custom_app_context as blogger_pwd_context
class User(Base):
__tablename__ = ... | [
{
"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 | simple_blog/models/user.py | ImaduddinAMajid/simple_blog |
from array import array
from random import randint
import sys
@profile
def create_data():
return array('i', [randint(1, 10000000) for i in range(100000)])
def proc():
cnt = 0
data = create_data()
for i in range(100000):
if randint(1, 10000000) in data:
cnt += 1
if __name__ == '_... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": tru... | 3 | append_to_array_with_comp.py | tsuyukimakoto/chore_python_sequence_performance |
from unittest import TestCase
from unittest import mock
from dcm_tagExtract.dcm_tagExtract import Dcm_tagExtract
class Dcm_tagExtractTests(TestCase):
"""
Test Dcm_tagExtract.
"""
def setUp(self):
self.app = Dcm_tagExtract()
def test_run(self):
"""
Test the run code.
... | [
{
"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 | dcm_tagExtract/tests/test_dcm_tagExtract.py | Sandip117/pl-pfdicom_tagExtract |
import time
from threading import Thread
def timestamp_datetime(value):
format = '%Y-%m-%d %H:%M:%S'
value = time.localtime(value)
dt = time.strftime(format, value)
return dt
def log(s):
print("[",timestamp_datetime(time.time()),"]",s)
| [
{
"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 | pyterminator/util.py | tokenchain/fomo3d |
"""Code for reading and writing scansion text-format protocol buffers."""
from google.protobuf import text_format # type: ignore
from . import scansion_pb2 # type: ignore
# TODO(kbg): Add read and write functions for Verse messages, if needed.
def read_document(path: str) -> scansion_pb2.Document:
"""Reads... | [
{
"point_num": 1,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer... | 3 | latin_scansion/textproto.py | jillianchang/LatinScansion |
import re
VALID_EMAIL_RE = re.compile(r"^[a-z0-9._+-]+[@][a-z0-9-]+(\.[a-z0-9-]+)+$")
def validate_clean_email_string(string):
return VALID_EMAIL_RE.match(string) is not None
def clean_email_string(string):
return string.lower().strip()
# For DB models
def validate_email_field_in_db(self, key, value):
... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written ... | 3 | app/helpers/validation.py | MTES-MCT/mobilic-api |
#!/usr/bin/env python3.4
import os
import sys
from subprocess import call
from flask_script import Manager
from flask_migrate import MigrateCommand
from config import config
from app import app_factory, db
app = app_factory('development') # TODO implement env variables
manager = Manager(app)
# The migrate comand
m... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"ans... | 3 | backend/manage.py | dasdachs/flask-blog |
BRAND_A = ["jablka", "hrusky"]
BRAND_B = ["jablka", "banany"]
BRAND_C = ["banany"]
def search_a(item):
if item in BRAND_A:
return True
else:
return False
def search_b(item):
if item in BRAND_B:
return True
else:
return False
def search_c(item):
if item in BRAND_... | [
{
"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 | janca/jablka_hrusky_banany.py | zdenek-nemec/sandbox |
import lightbulb
import hikari
import datetime
ping_plugin = lightbulb.Plugin("ping")
@ping_plugin.command()
@lightbulb.command("ping", "measure the ping of the bot", auto_defer=True, aliases=["pong"])
@lightbulb.implements(lightbulb.PrefixCommand)
async def ping(ctx: lightbulb.Context) -> None:
heartbeat = ctx.b... | [
{
"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_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"ans... | 3 | extensions/utilities/ping.py | kamfretoz/XJ9 |
# Number Of Boomerangs
from collections import defaultdict
class Solution:
def choose(self, n, r):
res = 1
for ri in range(r):
res = res * (n - ri) // (ri + 1)
return res
def numberOfBoomerangs(self, points):
if len(points) <= 2:
return 0
dists... | [
{
"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": false... | 3 | solutions/447.py | pacokwon/leetcode |
from gensim.models.keyedvectors import KeyedVectors
import os
dir = os.path.dirname(__file__)
DIMENSIONS = 300
GLOVE_PATH = '../../data/glove.6B/glove.6B.%sd.txt' % DIMENSIONS
word_vectors = KeyedVectors.load_word2vec_format(os.path.join(dir, GLOVE_PATH), binary=False)
def similarity(tokens, includes=[], excludes=[... | [
{
"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 | backend/src/analysis/topics.py | micimize/guided-topic-models |
class car:
__topspeed = 0
__name=""
def __init__(self):
self.__topspeed=250
self.name="SAM"
def drive(self):
print("Drive Top Speed=" +str(self.__topspeed))
def setTopSpeed(self,speed):
self.__topspeed=speed
volvo=car()
volvo.drive()
volvo.setTopSpeed(380)
volvo.dr... | [
{
"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 | p_var.py | PacktPublishing/Packt |
import numpy as np
import matplotlib.pyplot as plt
# Plot a spiral dataset
def generateArm(rotation, step):
theta = np.random.rand(500) * step
r = np.exp(theta) - 1
x = r * np.cos(theta) + (np.random.rand(500) - 0.5) / 7
y = r * np.sin(theta) + (np.random.rand(500) - 0.5) / 7
x, y = x * np.cos(r... | [
{
"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 | src/prereq/exercise8.py | kradical/cluster-analysis-udemy |
import re
from django.utils.text import compress_string
from django.utils.cache import patch_vary_headers
from django import http
try:
import settings
XS_SHARING_ALLOWED_ORIGINS = settings.XS_SHARING_ALLOWED_ORIGINS
XS_SHARING_ALLOWED_METHODS = settings.XS_SHARING_ALLOWED_METHODS
except:
XS_SHARING_AL... | [
{
"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 | obj_sys/middleware.py | weijia/obj_sys |
from collections import namedtuple
from sqlalchemy.orm import class_mapper, ColumnProperty
from painless_sqlalchemy.core.Model import Model
class AbstractExtendedTest():
@staticmethod
def get(list_, key_, value_):
"""
Find first dict/object in list_ where dict/object[key_] == value_
... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docs... | 3 | painless_sqlalchemy/util/testing/AbstractExtendedTest.py | GetintheLoop/painless-sqlalchemy |
"""Add state, city, and county name to PublishedAwardFinancialAssistance table
Revision ID: 0bf2ed508f33
Revises: 2c2b9b1ff0e5
Create Date: 2017-07-21 13:05:06.714431
"""
# revision identifiers, used by Alembic.
revision = '0bf2ed508f33'
down_revision = '2c2b9b1ff0e5'
branch_labels = None
depends_on = None
from ale... | [
{
"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 | dataactcore/migrations/versions/0bf2ed508f33_add_state_city_and_county_name_to_.py | brianherman/data-act-broker-backend |
import time
def timeit(method):
def timed(*args, **kw):
ts = time.time()
result = method(*args, **kw)
te = time.time()
if 'log_time' in kw:
name = kw.get('log_name', method.__name__.upper())
kw['log_time'][name] = int((te - ts) * 1000)
else:
... | [
{
"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 | util/log.py | icyda17/MNT |
import os,sys
sys.path.append('../')
import os
import numpy as np
import pandas as pd
import lightgbm as lgb
from src.model import Model
from src.util import Util
from sklearn.metrics import log_loss, accuracy_score, f1_score, classification_report
class ModelLGB(Model):
def __init__(self, run_fold_name, **par... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than clas... | 3 | classifier/src/model_lgb.py | banboooo044/natural-language-sentiment-anaysis |
class Node:
def __init__(self, value):
self.value = value;
self.next = None;
class Queue:
def __init__(self):
self.head = None;
self.tail = None;
self.num_element = 0;
def enqueue(self, value):
if self.head is None:
self.head = Node(value);
self.tail = self.head;
self... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answ... | 3 | data-structure/stack-queue/12-queue-linked-list.py | metanitesh/Data-Structure-Algorithm-Python |
import numpy as np
from cell_place_gym.native.acp_placement import *
class acp_placement_state (object):
def __init__ (self, place):
self.place = place
self.design = place.design
l_inst_count = len (self.design.instances)
# Non-Placed Nets Matrix
self.c_matrix = np.z... | [
{
"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 | envs/cell_place_gym/native/acp_state.py | Yvette1993/spinningup |
import re
from model.contact import Contact
def test_firstname_on_home_page(app, check_ui):
contact_from_home_page = app.contact.get_contact_list()[0]
contact_from_edit_page = app.contact.get_contact_info_from_edit_page(0)
assert contact_from_home_page.firstname == merge_firstname_like_on_home_page(contac... | [
{
"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 | test/test_name.py | 200312/python_training |
import unittest
from blockchain.merkle_tree import *
class TestMerkle(unittest.TestCase):
def setUp(self) -> None:
self.merkle = MerkleTree(['a', 'b', 'c', 'd'])
self.level = ['a', 'b', 'c', 'd']
def test_merkle_root(self):
self.assertEqual(self.merkle.get_root(), '20c12afdb2ce90da74... | [
{
"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 | test/test_merkle.py | dujiajun/Blockchain |
"""Create table checksum_and_logs
Revision ID: c84467455016
Revises:
Create Date: 2020-02-14 20:31:39.065035
"""
import sqlalchemy as sa
from alembic import op
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = "000000000000"
down_revision = None
branch_labels = None
depend... | [
{
"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/000000000000_create_table_checksum_and_logs.py | brighthive/data-resource-api |
from sklearn.ensemble import RandomForestClassifier
from configs import CORE_COUNT, SEED
from ml.models.base import SupervisedMLRefactoringModel
class RandomForestRefactoringModel(SupervisedMLRefactoringModel):
def feature_reduction(self) -> bool:
return False
def params_to_tune(self):
retur... | [
{
"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 | ml/models/random_forest.py | refactoring-ai/Machine-Learning |
import aiosqlite
import discord
from discord.ext import commands
import discordSuperUtils
class reactionrole(commands.Cog,discordSuperUtils.CogManager.Cog):
def __init__(self, bot:commands.Bot):
super().__init__()
self.bot = bot
self.ReactionManager = discordSuperUtils.ReactionManager(bot)
... | [
{
"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 | cogs/reactionrole.py | popop098/harin |
from app.db import with_session
from logic.admin import get_query_metastore_by_id
def get_metastore_loader_class_by_name(name: str):
from .loaders import ALL_METASTORE_LOADERS
for loader in ALL_METASTORE_LOADERS:
if loader.__name__ == name:
return loader
raise ValueError(f"Unknown lo... | [
{
"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 | querybook/server/lib/metastore/__init__.py | shivammmmm/querybook |
import pygame
import os
class GameMode:
""" This is the GameMode class where other more specialized
classes have to be derived from """
def __init__(self, screen, game, message, fps = 60):
self.name = None
self.game = game
# screen properties
self.screen = screen
s... | [
{
"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 | code/gamemode.py | prake71/streetchase |
# -*- coding: utf-8 -*-
from django import forms
from django.db.models import get_model
from django.forms.models import inlineformset_factory, fields_for_model
WishList = get_model('wishlists', 'WishList')
Line = get_model('wishlists', 'Line')
class WishListForm(forms.ModelForm):
def __init__(self, user, *args,... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{... | 3 | oscar/apps/wishlists/forms.py | makielab/django-oscar |
import pytest
from pbpstats.client import Client
from pbpstats.data_loader.stats_nba.boxscore.file import StatsNbaBoxscoreFileLoader
from pbpstats.data_loader.stats_nba.boxscore.loader import StatsNbaBoxscoreLoader
from pbpstats.resources.boxscore.boxscore import Boxscore
def test_client_sets_object_attrs():
set... | [
{
"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/test_client.py | bahalbach/pbpstats |
"""The tests for the demo stt component."""
import pytest
from homeassistant.components import stt
from homeassistant.setup import async_setup_component
@pytest.fixture(autouse=True)
async def setup_comp(hass):
"""Set up demo component."""
assert await async_setup_component(hass, stt.DOMAIN, {"stt": {"platfo... | [
{
"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 | tests/components/demo/test_stt.py | domwillcode/home-assistant |
"""test Bit operations"""
import pytest
from aiomysql.bit import Bit
@pytest.mark.parametrize(
'length, value, expected', (
(10, None, ValueError),
(10, 1, 1),
(10, '123', TypeError),
(10, '0', 0),
(10, '1', 1),
(10, '010', 2),
(10, '1010', 10),
(10... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docs... | 3 | tests/test_bit.py | robertchase/aiomysql |
import dpkt
from parsers.utils import *
name = 'ip_parser'
def parseFunc(ts, eth):
if getMACString(eth.dst) == 'FF:FF:FF:FF:FF:FF':
return None
if isinstance(eth.data, dpkt.ip.IP):
return parseIPPacket(ts, eth)
def parseIPPacket(ts, eth):
ip = eth.data
tpa = getIPString(ip.dst)
t... | [
{
"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 | center/app/playback/parsers/ip_parser.py | netSensTeam/netSens |
"""
Copyright (C) 2016 Garry Lachman garry@lachman.co under GNU LGPL
https://github.com/garrylachman/PyProxyToolkit
https://rev.proxies.online
This library is free software; you can redistribute it and/or modify it under the terms of the
GNU Lesser General Public License version 2.1, as published by the Free Software ... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"ans... | 3 | tests/ConsoleUnitest.py | maxpalpal/permanrkee |
class Article:
def __init__(self, title, views, reactions, comments, url, creation_time=None, tags=None):
self.title = title
self.views = views
self.reactions = reactions
self.comments = comments
self.url = url
self.creation_time = creation_time
self.tags = 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_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true... | 3 | models/article.py | sandordargo/dev-analytics-backend |
import collections
Set = set
KEY, PREV, NEXT = range(3)
class OrderedSet(collections.MutableSet):
"""
From: http://code.activestate.com/recipes/576694/
"""
def __init__(self, iterable=None):
self.end = end = []
end += [None, end, end] # sentinel node for doubly linked list
self.map = {} ... | [
{
"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 | fastv8/doc/_extensions/backports.py | gantech/fastv8DriverProgram |
def rename_groups(
adata, key_added, restrict_key, restrict_categories, restrict_indices, groups
):
key_added = restrict_key + '_R' if key_added is None else key_added
all_groups = adata.obs[restrict_key].astype('U')
prefix = '-'.join(restrict_categories) + ','
new_groups = [prefix + g for g in grou... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a t... | 3 | scanpy/tools/_utils_clustering.py | alexcwsmith/scanpy |
from typing import List
from guacamol.distribution_matching_generator import DistributionMatchingGenerator
class MockGenerator(DistributionMatchingGenerator):
"""
Mock generator that returns pre-defined molecules,
possibly split in several calls
"""
def __init__(self, molecules: List[str]) -> No... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer... | 3 | tests/mock_generator.py | jcheminform/guacamol |
from sqlalchemy.dialects.postgresql import UUID
from sqlalchemy.schema import FetchedValue
from sqlalchemy.ext.associationproxy import association_proxy
from sqlalchemy.ext.hybrid import hybrid_property
from app.api.utils.models_mixins import Base
from app.extensions import db
from app.api.now_applications.models.act... | [
{
"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 | services/core-api/app/api/now_applications/models/activity_summary/cut_lines_polarization_survey.py | bcgov/mds |
from python_framework import SqlAlchemyProxy as sap
from ModelAssociation import QUEUE, SUBSCRIPTION, MODEL
from util import ModelUtil
class QueueModel(MODEL):
__tablename__ = QUEUE
id = sap.Column(sap.Integer(), sap.Sequence(f'{__tablename__}{sap.ID}{sap.SEQ}'), primary_key=True)
key = sap.Column(sap.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": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inherita... | 3 | api/src/model/QueueModel.py | SamuelJansen/queue-manager-api |
from django.db import models
from cms.models import CMSPlugin
from cms.models.fields import PlaceholderField
from cms.utils.copy_plugins import copy_plugins_to
class PlaceholderReference(CMSPlugin):
cmsplugin_ptr = models.OneToOneField(
CMSPlugin,
on_delete=models.CASCADE,
related_name='c... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answ... | 3 | cms/models/placeholderpluginmodel.py | Mario-Kart-Felix/django-cms |
# This is an example of a very basic discord bot in python
import discord
from discord.ext import commands
bot = commands.Bot(command_prefix=".", description="A basic discord bot")
@bot.event
async def on_ready():
print("I'm online!")
@commands.command(name="ping")
async def _ping(ctx):
latency = bot.late... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": fals... | 3 | python/discord.py/example-bot.py | martian17/Community-Bin |
# Copyright 2020 Google LLC
#
# 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, s... | [
{
"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 | samples/snippets/import_data_video_classification_sample_test.py | anooshrees/python-aiplatform |
from suds.client import Client
from suds import WebFault
class SoapHelper:
def __init__(self, app):
self.app = app
def can_login(self, username, password):
client = Client("http://localhost/mantisbt-1.2.20/api/soap/mantisconnect.php?wsdl")
try:
client.service.mc_login(use... | [
{
"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 | fixture/soap.py | kasiazubielik/python_training_mantis |
# coding=utf8
# Copyright 2018 JDCLOUD.COM
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed ... | [
{
"point_num": 1,
"id": "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 | python_code/vnev/Lib/site-packages/jdcloud_sdk/services/live/apis/DeleteLiveStreamAppTranscodeRequest.py | Ureimu/weather-robot |
class UUID(object):
value: str
def __init__(self, value: str):
self.value = value
def __eq__(self, other):
return self.value == other.value
def __repr__(self):
return {'value': self.value}
@staticmethod
def random_uuid() -> 'UUID':
import uuid
return U... | [
{
"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 | gaia-sdk-python/gaia_sdk/graphql/GaiaScalars.py | leftshiftone/gaia-sdk |
import re
from typing import List
import numpy as np
# pylint: disable=too-few-public-methods
ID_SEP = re.compile(r"[-:]")
class WordAlignmentPreprocessor(object):
"""A preprocessor for word alignments in a text format.
One of the following formats is expected:
s1-t1 s2-t2 ...
s1:1/w1 s2... | [
{
"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 | neuralmonkey/processors/alignment.py | Simon-Will/neuralmonkey |
import os
from io import StringIO
import ho.pisa as pisa
from django.conf import settings
from django.http import HttpResponse
from django.utils.html import escape
class PDFMixin(object):
"""
Mixin that will change a class based view to render as PDF
Dependencies:
- reportlab
- html5lib
... | [
{
"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 | smartmin/pdf.py | nickhargreaves/smartmin |
#!/usr/bin/env python
from csvitself import csv2csv
from fixed import fixed2csv
from js import json2csv
from xls import xls2csv
SUPPORTED_FORMATS = ['fixed', 'xls', 'csv']
def convert(f, format, schema=None, key=None, **kwargs):
"""
Convert a file of a specified format to CSV.
"""
if not f:
r... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than ... | 3 | csvkit/convert/__init__.py | tthibo/csvkit |
"""Changes tablename blog to blogs
Revision ID: 763b085736ad
Revises: 5a8e4632f6d1
Create Date: 2020-05-09 22:10:15.992648
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '763b085736ad'
down_revision = '5a8e4632f6d1'
branch_labels = None
depends_on = None
def... | [
{
"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 | migrations/versions/763b085736ad_changes_tablename_blog_to_blogs.py | shemian/blogs |
"""Various utils and formatters for log rendering control."""
from typing import Optional, Sequence
import structlog
from structlog.types import Processor
TIMESTAMPER = structlog.processors.TimeStamper(fmt="iso")
LEVELED_TIMESTAMPED_PRE_CHAIN = frozenset(
(
# Add the log level and a timestamp to the eve... | [
{
"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/meltano/core/logging/formatters.py | Mu-L/meltano |
import os
from glob import glob
import imageio
from batchlib.preprocessing import Preprocess
# TODO make it more general
def get_barrel_corrector(folder):
barrel_corrector_path1 = '../misc/barrel_corrector.h5'
barrel_corrector_path2 = '../misc/barrel_corrector_1024x1024.h5'
in_path = glob(os.path.join(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_function_names_snake_case",
"question": "Are all function names in this file written... | 3 | antibodies/preprocess_all.py | hci-unihd/batchlib |
from rest_framework import generics, authentication, permissions
from rest_framework.authtoken.views import ObtainAuthToken
from rest_framework.settings import api_settings
from user.serializers import UserSerializer, AuthTokenSerializer
class CreateUserView(generics.CreateAPIView):
"""Create a new user in the s... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": true
},
{
... | 3 | app/user/views.py | IdaEdgeware/image-labelling-app-api |
from ._abstract import AbstractScraper
from ._utils import get_minutes, normalize_string, get_yields
class SimplyQuinoa(AbstractScraper):
@classmethod
def host(self):
return 'simplyquinoa.com'
def title(self):
return self.soup.find(
'h2',
{'class': 'wprm-recipe-na... | [
{
"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 | recipe_scrapers/simplyquinoa.py | hotfix/recipe-scrapers |
import os.path
import argparse
import json
class CmbLauncher:
def __init__(self):
pass
def run(self, token=None):
# local imports
from cmb import log, logex, CmbBot, CmbBotCommands
from disco.bot import BotConfig
from disco.client import ClientConfig, Client
#... | [
{
"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 | cmblauncher.py | Emzi0767/Discord-Breencast-Bot |
from random import randint
from time import sleep
def sorteio(lista):
print('-=' * 30)
print('Sorteando 5 valores da lista: ', end='')
for i in range(0, 5):
lista.append(randint(1, 10))
print(f'{lista[i]} ', end='', flush=True)
sleep(0.3)
print('PRONTO!')
def somaPar(lista):
... | [
{
"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 | ex100.py | juniorpedroso/Exercicios-CEV-Python |
from modules.countdown.entities.E_InputVoice import E_InputVoice
from speech_recognition import UnknownValueError, RequestError
import speech_recognition as sr
class S_Listener:
def __init__(self,eInput):
self.eInput=eInput
def process(self):
m = sr.Microphone()
try:
... | [
{
"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/modules/countdown/services/S_Listener.py | CoderandGymnast/The-Colosseum |
from typing import final
from project.libs.user.domain.properties import UserEmail
from project.libs.user.domain.repositories import UserNotifier, UserRepository
@final
class UserPasswordForgetService:
__slots__ = ('_user_repository', '_user_notifier')
def __init__(self, user_repository: UserRepository, use... | [
{
"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_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"an... | 3 | project/libs/user/application/password_forget_service.py | ticdenis/python-skeleton |
import copy
#
# Prototype Class
#
class Cookie:
def __init__(self, name):
self.name = name
def clone(self):
return copy.deepcopy(self)
#
# Concrete Prototypes to clone
#
class CoconutCookie(Cookie):
def __init__(self):
Cookie.__init__(self, 'Coconut')
#
# Client Class
#
class... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
... | 3 | test/python/LIM2Metrics/py3/base/common/Prototype/Prototype.py | sagodiz/SonarQube-plug-in |
from mqttplotter import MQTTPlotter
from mqttclient import MQTTClient
from math import sin, cos, exp, pi
mqtt = MQTTClient("iot.eclipse.org")
mp = MQTTPlotter(mqtt)
SERIES = "sinusoid"
mp.new_series(SERIES, 'time', 'cos', 'sin', 'sin*cos')
def f1(t): return cos(2 * pi * t) * exp(-t)
def f2(t): return sin(2 * pi * t)... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written ... | 3 | boards/esp32/libraries/legacy/projects/mqtt_plotter/03_mqtt_plotter_demo.py | iot49/IoT49 |
import os
"""
Load data from a dataset of simply-formatted data
from A to B
from B to A
from A to B
from B to A
from A to B
===
from C to D
from D to C
from C to D
from D to C
from C to D
from D to C
...
`===` lines just separate linear conversations between 2 people.
"""
class LightweightData:
"""
"""
... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"ans... | 3 | dragonfire/deepconv/corpus/lightweightdata.py | ismlkrkmz/Dragonfire |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.