source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
from common.parameter_store import get_parameter
class Settings:
_mobile_commons_username = None
_mobile_commons_password = None
_actblue_webhook_username = None
_actblue_webhook_password = None
def mobile_commons_username(self):
if not self._mobile_commons_username:
self._mob... | [
{
"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 | common/settings.py | lbozarth/exercise-toes |
"""
Copyright 2020 The OneFlow Authors. 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 agr... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answ... | 3 | oneflow/python/test/ops/test_all_reduce_group.py | wanghongsheng01/framework_enflame |
# Class contains auxiliary methods
from numpy import array
from numpy.linalg import det
from .Intersection import Intersection
def isValidPos(oPos, sl):
if oPos < 0 or oPos >= len(sl):
return False
return True
# credit to Dr. Sheehy for provinding orientation class code
def orientation(*points):
d = array(... | [
{
"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 | linesegmentintersections/helper.py | LiahNikol/line-segment-intersections |
from ..parser.syntax import *
class Visitor:
def visit_program(self, program: Program):
pass
def visit_function_call(self, function_call: FunctionCall):
pass
def visit_assignment(self, assignment: Assignment):
pass
def visit_block(self, block: Block):
pass
def v... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excludi... | 3 | src/interpreter/visitor.py | piotrfratczak/image-processing-language |
class intSet(object):
"""An intSet is a set of integers
The value is represented by a list of ints, self.vals.
Each int in the set occurs in self.vals exactly once."""
def __init__(self):
"""Create an empty set of integers"""
self.vals = []
def insert(self, e):
"""Assumes e... | [
{
"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 | Week5/intSet.py | Sid2697/MIT-6.00.1x |
#!/usr/bin/env python
from spt3g import core
import time, sys
# File to disk
n = 0
def addinfo(fr):
global n
if fr.type != core.G3FrameType.Timepoint:
return
fr['time'] = core.G3Time(int(time.time()*core.G3Units.s))
fr['count'] = n
n += 1
m = 0
def checkinfo(fr):
global m
if fr.type != core.G3FrameType.Timep... | [
{
"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 | core/tests/multiproc.py | tskisner/spt3g_software |
from sanic import Sanic
from sanic import response
app = Sanic(__name__)
@app.route('/')
def handle_request(request):
return response.redirect('/redirect')
@app.route('/redirect')
async def test(request):
return response.json({"Redirected": True})
if __name__ == '__main__':
app.run(host="0.0.0.0"... | [
{
"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 | examples/redirect_example.py | Varriount/sanic |
from django.db import models
# Create your models here.
class BaseView(models.Model):
title = models.CharField(max_length=256)
def __unicode__(self):
return self.title
class port1View(models.Model):
def __unicode__(self):
return self.title
class port2View(models.Model):
title = models.CharField(max_length=... | [
{
"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 | mainsite/models.py | nandosarracino/mymainsite |
import numpy as np
import pandas as pd
import pandas.util.testing as tm
import pytest
from dask.dataframe.hashing import hash_pandas_object
from dask.dataframe.utils import assert_eq
@pytest.mark.parametrize('obj', [
pd.Series([1, 2, 3]),
pd.Series([1.0, 1.5, 3.2]),
pd.Series([1.0, 1.5, 3.2], index=[1.5... | [
{
"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 | dask/dataframe/tests/test_hashing.py | abhinavralhan/dask |
"""Rinse SOAP library: XML Schema Definition (XSD) functions."""
from lxml import etree
from rinse.util import element_as_tree
NS_XSD = 'http://www.w3.org/2001/XMLSchema'
NS = {
'xsd': NS_XSD,
}
class XSDValidator(object):
"""XSD Schema Validation."""
_parser = None
def __init__(self, schema_root)... | [
{
"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 | rinse/xsd.py | tysonclugg/rinse |
import os
import sys
import argparse
import numpy as np
from PIL import Image
import matplotlib.pyplot as plt
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.optim import Adam
from torch.utils.data import Dataset
import torchvision.transforms as transforms
import pickle
de... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter tha... | 3 | CNN/code/filter_visualiton.py | Zeng-WH/ML2020 |
"""Support for Overkiz lock."""
from homeassistant.components.lock import DOMAIN as LOCK, LockEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import STATE_LOCKED
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from ... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"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 | custom_components/tahoma/lock.py | iMicknl/ha-tahoma |
import time
from functools import wraps
"""
包装器, 计时
"""
# 计时
def timethis(func):
@wraps(func)
def wrapper(*args, **kwargs):
start = time.time()
result = func(*args, **kwargs)
end = time.time()
print(func.__name__, end-start)
return result
return wrapper
@timethis... | [
{
"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 | python_cookbook/c09/p01_wrap_function.py | AtlantisFox/Green-Point-Challenge |
import unittest
from pymath.primes.prime_factors import prime_factors
class PrimeFactorsTest(unittest.TestCase):
def test_1(self):
self.assertEqual([], prime_factors(1))
def test_2(self):
self.assertEqual([2], prime_factors(2))
def test_3(self):
self.assertEqual([3], prime_facto... | [
{
"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 | tests/pymath/primes/test_prime_factors.py | BrianLusina/PyCharm |
class Solution:
def minSteps(self, n: int) -> int:
dp = [i for i in range(1 + n)]
dp[1] = 0
for i in range(2, 1 + n):
for j in range(1, i // 2 + 1):
if i % j == 0:
dp[i] = min(dp[i], dp[j] + i // j)
return dp[-1]
class Solution2:
d... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
... | 3 | 0601-0700/0650-2 Keys Keyboard/0650-2 Keys Keyboard.py | jiadaizhao/LeetCode |
from django.core.urlresolvers import reverse
from core.mixins import JSONView, JSONListView
from .mixins import UserListMixin, UserDetailMixin
def get_item(db_user, request):
href_relative_uri = reverse('api:users:user',
kwargs={'username': db_user.username,
... | [
{
"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": true
},
... | 3 | lotube/users/views_api_json.py | zurfyx/lotube |
# -*- coding: utf-8 -*-
from spaceone.core.manager import BaseManager
from spaceone.secret.connector.identity_connector import IdentityConnector
class IdentityManager(BaseManager):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.identity_conn: IdentityConnector = 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_params_annotated",
"question": "Does every function parameter in this file have a type annotation (ex... | 3 | src/spaceone/secret/manager/identity_manager.py | ku524/secret |
from nose.tools import eq_
from ddtrace.contrib.util import func_name
from functools import partial
class SomethingCallable(object):
"""
A dummy class that implements __call__().
"""
value = 42
def __call__(self):
return 'something'
def me(self):
return self
@staticmetho... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class 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/cls)?",... | 3 | tests/contrib/test_utils.py | lucien2k/dd-trace-py |
import polygnomeObject
import pureTensor
import tensor
import abstractPolynomial
class tensorAlgebra(polygnomeObject.polygnomeObject):
"""
File: tensorAlgebra.py
Author: Chris Campbell
Email: c (dot) j (dot) campbell (at) ed (dot) ac (dot) uk
Github: https://github.com/campbellC
Description: Th... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding... | 3 | tensorAlgebra.py | chriscampbell19/polygnome |
# 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": "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/python/unittest/test_pass_basic.py | yongfeng-nv/incubator-tvm |
#!/usr/bin/env python3
"""
Copyright (C) 2021 Intel Corporation
SPDX-License-Identifier: BSD-3-Clause
"""
from tts_openvino.synthesizer import Synthesizer
class tacotron_tts:
def __init__(self):
duration_model = "/model/text-to-speech-en-0001-duration-prediction.xml"
regression_model = "/model/... | [
{
"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 | tts/src/test_tts.py | shivdeep-singh/conversational-ai-chatbot |
import urllib.request
import json
import requests
from data.config import *
def youtube_get_information(channel_id):
api_key = YOUTUBE_API_KEY
base_search_url = "https://www.googleapis.com/youtube/v3/search?"
base_video_link = "https://www.youtube.com/watch?v="
first_url = base_search_url + f"key={api... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
... | 3 | utils/parser/parser.py | reeegry/youtube-parser-bot |
try:
from maya import cmds
except ImportError:
pass
from menus import typeIDs as nem_typeids, base as nem_base
import logging
logging.basicConfig()
logger = logging.getLogger(__name__)
def createOutputJnts(*args):
## Create outputs for the selected hermite nodes
exitB = "Exit"
doitB = "doIt"
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": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
... | 3 | menus/nodes/hermite.py | fsanges/neMenuManager |
from QiuBaiSpider.pymysqldb_manager import DbManager
from QiuBaiSpider.page_items import PageItems
from QiuBaiSpider.tools import Tools
'''
爬取糗事百科笑话剔除正文DOM标签然后将爬取数据存入MySQL数据库
Extra module:
PyMySQL
'''
class Main(object):
def __init__(self, max_page=1):
self.max_page = max_page
self.db_manager = Db... | [
{
"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 | QiuBaiSpider/spider_main.py | lidenghong1/SmallReptileTraining |
import torch
from torch import nn
from torchsparse.nn.functional import spcrop
__all__ = ['SparseCrop']
class SparseCrop(nn.Module):
def __init__(self, loc_min, loc_max):
super().__init__()
self.loc_min = torch.cuda.IntTensor([list(loc_min)])
self.loc_max = torch.cuda.IntTensor([list(loc_... | [
{
"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 | torchsparse/nn/modules/crop.py | f-sky/torchsparse |
import functools
def log_info(func):
@functools.wraps(func)
def wrapper(*args, **kwargs):
print("Wywołuję funkcję...")
result = func(*args, **kwargs)
print("Już po wszystkim :)")
return result
return wrapper
@log_info
def calculate_sum(a, b):
return a + b
def run_... | [
{
"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 | example_8.py | mikolevy/webinar-function-examples |
import tensorflow as tf
from tensorflow.keras.callbacks import ModelCheckpoint
import os
class TensorBoardFix(tf.keras.callbacks.TensorBoard):
"""
This fixes incorrect step values when using the TensorBoard callback with custom summary ops
https://stackoverflow.com/questions/64642944/steps-of-tf-summar... | [
{
"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 | convRFF/utils/utils.py | aguirrejuan/ConvRFF |
from typing import Any
class ASTNode:
def __init__(self, name: str, children: list) -> None:
self.name = name
self.children = children
def __getitem__(self, key: int) -> Any:
return self.children[key]
def __len__(self) -> int:
return len(self.children)
| [
{
"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 | latte/front/parser/ast_node.py | latte-c/latte |
#!/usr/bin/env python
import os
import tempfile
import unittest
from ct.client import state
from ct.proto import client_pb2
class StateKeeperTest(unittest.TestCase):
_DEFAULT_STATE = client_pb2.MonitorState()
# fill with some data
_DEFAULT_STATE.verified_sth.timestamp = 1234
_DEFAULT_STATE.pending_st... | [
{
"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/ct/client/state_test.py | jmhodges/certificate-transparency |
# qubit number=4
# total number=43
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 += H(3) # number=40
prog... | [
{
"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": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 lines?",
"answer":... | 3 | benchmark/startPyquil3062.py | UCLA-SEAL/QDiff |
import scipy.stats
import unifit
class TestFit:
data = scipy.stats.cauchy.rvs(size=256)
def test_basic(self):
unifit.fit(self.data)
def test_unnamed(self):
unifit.fit(
self.data,
distributions=unifit.distributions.values()
)
| [
{
"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 | test/test_fit.py | malyvsen/unifit |
import numpy as np
# try to import numba
# or define dummy decorator
try:
from numba import autojit
except:
def autojit(func):
return func
# util functions for network simulation
def smooth_trace(trace, scale):
scale = int(scale)
if scale == 1 or scale == 0:
return trace
slen = int(... | [
{
"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 | models/brian2/utils_net.py | caglorithm/stimulus_neural_populations |
from typing import List, Any
from deliverable_model.batch_like_dict import BatchLikeDict
class Response(BatchLikeDict):
def __init__(self, data: List[Any]):
self.data_history = []
self["data"] = data
@classmethod
def from_dict(cls, data) -> "Response":
self = cls(None)
fo... | [
{
"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 | deliverable_model/response.py | lanSeFangZhou/deliverable_model |
# Copyright 2018 Yegor Bitensky
# 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": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?... | 3 | tests/utils.py | YegorDB/phnl |
from atlasclient.client import Atlas
class TestClient():
def test_atlas_client(self):
client = Atlas('localhost', port=21000, username='admin', password='admin')
assert client.base_url == 'http://localhost:21000'
assert 'headers' in client.client.request_params.keys()
assert 'X-R... | [
{
"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_client.py | andrewmccall/atlasclient |
# 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": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer":... | 3 | aliyun-python-sdk-ros/aliyunsdkros/request/v20190910/ContinueCreateStackRequest.py | liumihust/aliyun-openapi-python-sdk |
class Node:
def __init__(self, key):
self.key, self.left, self.right = key, None, None
def bfs(node):
if not node:
return
q = []
q.append(node)
while len(q):
temp = q.pop(0)
if temp.left:
q.append(temp.left)
if temp.right:
q.append(... | [
{
"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 | data-structures/tree/bfs.py | AlaminMahamud/python-cheatsheet |
class Buffer:
def __init__(self, buffer_size):
self.buffer = [None]*buffer_size
def push(self, element):
# Add element at zero position and remove last element (maintain fixed size)
if None in self.buffer:
self.buffer.insert(0,element)
self.buffer = sel... | [
{
"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 | utilities/buffer.py | Veinar/cp2k77HackingAssistant |
def n_primos(n):
def éPrimo(k):
divisores = 0
for i in range(1,k):
if k % i == 0:
divisores += 1
if divisores >= 2:
return False
else:
return True
conta_primos = 0
for i in range(2, n+1):
if éPrimo(i) == True:
... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answ... | 3 | Coursera/CICCP1/conta_primos.py | marcelomiky/python_code |
#!/usr/bin/python3
#coding=utf-8
#author: cody
def create_reader(byte_arr, offset):
f = offset
b_arr = byte_arr
def read(count):
nonlocal f
nonlocal b_arr
b = b_arr[f:f + count]
f = f + count
return b
return read
def bytes_to_int(b):
return int.from_bytes(b,... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined insid... | 3 | ManifestEditor/Util.py | CodyGit/ManifestEditor |
from __future__ import annotations
from dataclasses import dataclass
from anytree import NodeMixin
from typing import Optional
from slugify import slugify
pattern_ltree_compatible = "[^-a-z0-9_]+"
def identifier_from_string(a_string: str) -> str:
return slugify(a_string, regex_pattern=pattern_ltree_compatible, se... | [
{
"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 | src/clean/domain/model.py | evoludigit/clean_architecture_fastapi |
from qstrader.data.backtest_data_handler import DataHandler
from qstrader.asset.universe.universe import Universe
from qstrader.alpha_model.alpha_model import AlphaModel
class FixedSignalsAlphaModel(AlphaModel):
"""
A simple AlphaModel that provides a single scalar forecast
value for each Asset in the Uni... | [
{
"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 | qstrader/alpha_model/fixed_signals.py | Dynami/qstrader-1 |
"Load and download data for use in other modules"
import sqlite3
import geopandas as gpd
import pandas as pd
import requests
import sqlalchemy as sa
from bs4 import BeautifulSoup
from xlrd import XLRDError
from powergenome.params import IPM_GEOJSON_PATH
def load_ipm_plant_region_map(pudl_engine):
"""Load the t... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": fals... | 3 | powergenome/load_data.py | josiahjohnston/PowerGenome |
import sys
def freeze(obj):
if isinstance(obj, dict):
return frozenset(map(freeze, obj.items()))
if isinstance(obj, (list, tuple)):
return tuple(map(freeze, obj))
if isinstance(obj, set):
return frozenset(obj)
else:
return obj
def memorized(func):
map = {}
de... | [
{
"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 | youtube_podcast_gateway/util.py | Feuermurmel/youtube-podcast-gateway |
# Test for one implementation of the interface
from lexicon.providers.dnspod import Provider
from integration_tests import IntegrationTests
from unittest import TestCase
import pytest
# Hook into testing framework by inheriting unittest.TestCase and reuse
# the tests which *each and every* implementation of the interf... | [
{
"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 | tests/providers/test_dnspod.py | chibiegg/lexicon |
#!/usr/bin/python
'''
ST Micro Node Server for Polyglot
by Einstein.42(James Milne)
milne.james@gmail.com
'''
import sys
from polyglot.nodeserver_api import SimpleNodeServer, PolyglotConnector
from st_types import STControl
VERSION = "0.0.1"
class STNodeServer(SimpleNodeServer):
''' ST Micro Node Server '... | [
{
"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 | st_nodeserver.py | Einstein42/st-nodeserver |
from PIL import Image as im
import numpy as np
from io import BytesIO
import csv
class outputResponse():
def __init__(self,reponse):
self.response = reponse
def retrieveResult(response, returntype):
if (returntype == "image/png" or returntype == "image/jpeg"):
img_arr = np.array(i... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than cla... | 3 | Output.py | itsayeshanaeem/WCPSAccess |
# -*- coding: utf-8 -*-
"""
Neighbor Articles Plugin for Pelican
====================================
This plugin adds ``next_article`` (newer) and ``prev_article`` (older)
variables to the article's context
"""
from pelican import signals
def iter3(seq):
it = iter(seq)
nxt = None
cur = next(it)
for... | [
{
"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 | website/plugins/neighbors/neighbors.py | brandonjflannery/data-analysis-template |
from pdb import set_trace as br
SEP = '_'
def behavior_label(name):
return name + SEP + 'Behavior'
def cclass_label(name):
return name + SEP + 'CompiledClass'
def class_label(name):
return name # + SEP + "Class"
def cfun_label(owner_name, name):
return owner_name + SEP + name + SEP + 'CompiledFunct... | [
{
"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 | stuff/py/pycore/utils.py | clarete/memetalk |
#!/usr/bin/python
################################################################################
# 211b0e3a-5cc5-11e4-af55-00155d01fe08
#
# Justin Dierking
# justindierking@hardbitsolutions.com
# phnomcobra@gmail.com
#
# 10/24/2014 Original Construction
################################################################... | [
{
"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 | pcat2py/class/211b0e3a-5cc5-11e4-af55-00155d01fe08.py | phnomcobra/PCAT2PY |
from docxtpl import DocxTemplate
import csv
import json
import random
#случайный авто
with open('Car_info.txt') as file:
car_rand = []
reader = csv.reader(file)
for row in file:
car_rand.append(row)
report_car = car_rand[random.randint(0, len(car_rand)-1)]
car_info = report_car.split()
#О авто
def g... | [
{
"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 | 7.py | Nikolas-01/Lesson_7 |
"""Override module for the mass lapse risk calculation
The formulas in this module overrides cells related to lapse in
:mod:`projection <solvency2.projection>` module.
"""
def BenefitSurr(t):
"""Surrender benefits"""
return SizeBenefitSurr(t) * (PolsSurr(t) + PolsSurrMass(t))
def PolsSurrMass(t):
"""Num... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding se... | 3 | lifelib/projects/solvency2/override/lapse_mass.py | rahmanifard/lifelib |
import argparse
import sys
from setuptools import find_packages, setup
def get_version(name):
version = {}
with open('dagster_cron/version.py') as fp:
exec(fp.read(), version) # pylint: disable=W0122
if name == 'dagster-cron':
return version['__version__']
elif name == 'dagster-cron... | [
{
"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_modules/libraries/dagster-cron/setup.py | joeyfreund/dagster |
# -*- coding: utf-8 -*-
from pyparsing import Optional, Group, Literal, CaselessKeyword, And, OneOrMore
from .primitives import SimpleWord, Field, PartialString, QuotedString, Integer, IntegerRange, concatenate
class TermFactory(object):
@staticmethod
def build_term(field, values, parse_method=None):
... | [
{
"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 | plyse/expressions/terms.py | arcodergh/plyse |
from __future__ import annotations
import pytest
from dials.algorithms.indexing.basis_vector_search import (
FFT1D,
FFT3D,
RealSpaceGridSearch,
)
class TestStrategies:
def check_results(self, unit_cell, basis_vectors):
# check we have found a basis vector corresponding to each unit cell para... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true... | 3 | tests/algorithms/indexing/basis_vector_search/test_strategies.py | dials-src/dials |
"""
Customized Mixin2to3 support:
- adds support for converting doctests
This module raises an ImportError on Python 2.
"""
from distutils.util import Mixin2to3 as _Mixin2to3
from distutils import log
from lib2to3.refactor import RefactoringTool, get_fixers_from_package
import setuptools
class DistutilsRefactori... | [
{
"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 | python3.4Smartforest/lib/python3.4/site-packages/setuptools/lib2to3_ex.py | letouriste001/SmartForest_2.0 |
from datetime import datetime
class App_Logger:
def __init__(self):
pass
def log(self, file_object, log_message):
self.now = datetime.now()
self.date = self.now.date()
self.current_time = self.now.strftime("%H:%M:%S")
file_object.write(str(self.date) + "/" + str(self.c... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},... | 3 | application_logging/logger.py | ThakurSneha/ThyroidDetection |
"""
Test suite for the short (<= 8 bytes) input case.
"""
from hypothesis import given
import hypothesis.strategies as st
from umash import C, FFI
from umash_reference import vec_to_u64, umash, UmashKey
U64S = st.integers(min_value=0, max_value=2 ** 64 - 1)
@given(data=st.binary(min_size=0, max_size=8),)
def test_v... | [
{
"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 | t/test_umash_short.py | rurban/umash |
# -*- coding: utf-8 -*-
"""
filename - tessellation.py
author - MyMindPalace
Description
A Tessellation (or Tiling) is the act of covering a surface with a pattern of flat shapes so that there are no overlaps or gaps.
Tessellations express fascinating geometric and symmetric properties as art,
and famously... | [
{
"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 | tessellation/tessellation.py | My-MindPalace/Tessellation |
from typing import List
def join_numbers(
integers: List[str],
separator: str = ','
) -> int:
return sum(
[
int(hex_number, 16)
for hex_number in integers
]
)
def join_numbers_using_mapfilter(
integers: List[str],
separator: str = ','
) -> int:
ret... | [
{
"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 | Python/pyworkout/comprehensions/ex28_mod2.py | honchardev/Fun |
from abc import ABC, abstractmethod
from typing import Generic, TypeVar
T = TypeVar("T")
class Factory(ABC, Generic[T]):
"""Provides methods for creating, validating and releasing `T` objects and managed resources"""
@abstractmethod
def create(self) -> T:
"""Create a new `T` object and allocates... | [
{
"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 | generic_pool/factory.py | gfmio/generic-pool |
import pytest
import core.config
import modules.contrib.kernel
@pytest.fixture
def some_kernel():
return "this-is-my-kernel"
@pytest.fixture
def kernel_module():
return modules.contrib.kernel.Module(config=core.config.Config([]), theme=None)
def test_full_text(mocker, kernel_module):
platform = mocke... | [
{
"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/modules/contrib/test_kernel.py | spxtr/bumblebee-status |
"""Threading utilities."""
from inspect import isclass
import threading
# python2 workaround
_EventClass = threading.Event if isclass(threading.Event) else threading._Event #pylint:disable=protected-access,invalid-name
class EventGroup(object):
"""EventGroup that can be waited with an OR condition."""
cla... | [
{
"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": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},... | 3 | splitio/util/threadutil.py | cfogg/python-client |
from scipy.signal import savgol_filter
import numpy as np
import matplotlib.pyplot as plt
def normalize_by_baseline(timeseries, baseline_length=4):
baseline = timeseries.iloc[:baseline_length].mean(axis=0)
normalized_timeseries = np.log2(timeseries / baseline)
normalized_timeseries = normalized_timeseries... | [
{
"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 | modules/dynamics.py | sebastianbernasek/dataincubator |
from discord.ext import commands
from mods.cog import Cog
class PlaceHolder(Cog):
@commands.group()
@commands.cooldown(2, 3, commands.BucketType.guild)
async def phone(self, ctx):
if ctx.guild and ctx.guild.get_member(336961510276595722):
return
await ctx.send("\N{WARNING SIGN} NotSoPhone is not here!\n" \... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer"... | 3 | mods/PlaceHolder.py | NotSoPrivate/NotSoBot |
class addition:
def __init__(self):
self.a=10
self.b=20
def add(self):
self.c=self.a+self.b
print('addition ;',self.c)
a1=addition()
a1.add()
| [
{
"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 | Advance_Python/Class_&_Objects/default_constructor.py | siddharth-143/Python |
from datetime import datetime, date
from marqeta.response_models.avs_information import AvsInformation
from marqeta.response_models.avs_information import AvsInformation
from marqeta.response_models.response import Response
from marqeta.response_models import datetime_object
import json
import re
class AddressVerifica... | [
{
"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 | marqeta/response_models/address_verification_model.py | marqeta/marqeta-python |
from flask import render_template
from app.errors import bp
@bp.app_errorhandler(404)
def not_found_error(error):
return render_template('404.html'), 404
@bp.app_errorhandler(500)
def internal_error(error):
return render_template('500.html'), 500 | [
{
"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 | web/app/errors/controllers.py | mcodegeeks/containerized_webapp |
"""empty message
Revision ID: 44b4fd37b54e
Revises: 293c6eae1bb7
Create Date: 2015-12-01 09:12:21.569936
"""
# revision identifiers, used by Alembic.
revision = '44b4fd37b54e'
down_revision = '293c6eae1bb7'
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql
def upgrade():
### ... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": tru... | 3 | migrations/versions/44b4fd37b54e_.py | tuanquanghpvn/flask-intro |
import unittest
from typing import List
from is_valid_binary_search_tree import Solution, TreeNode
class TestSolution(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def test_isValidBST_when_tree_has_single_node_should_return_true(self):
... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer":... | 3 | test_is_valid_binary_search_tree.py | kannanParamasivam/practice |
from flask import Flask, render_template, request
import model
from model import get_headlines
app = Flask(__name__)
@app.route('/', methods=['GET', 'POST'])
def index():
if request.method == 'POST':
url = request.form['url']
predict = model.predict(url)
value = predict[1]
clickbait = pr... | [
{
"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 | app.py | asaxena2019/FakeNewsify-Article-Credibility-Checker |
from .results import Result
class K4AException(Exception):
pass
class K4ATimeoutException(K4AException):
pass
def _verify_error(res: int):
"""
Validate k4a_module result
"""
res = Result(res)
if res == Result.Failed:
raise K4AException()
elif res == Result.Timeout:
... | [
{
"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 | pyk4a/errors.py | animuku/pyk4a |
from flask_sqlalchemy import SQLAlchemy
db = SQLAlchemy()
class Agent(db.Model):
id = db.Column(db.Integer, primary_key=True)
type = db.Column(db.Integer, nullable=False)
name = db.Column(db.Integer, unique=True, nullable=False)
port = db.Column(db.Integer, unique=True, nullable=False)
def __re... | [
{
"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 | dream/server/models.py | icyblade/dream |
from unittest import mock
import freezegun
import freezegun.config
def setup_function():
freezegun.config.reset_config()
def teardown_function():
freezegun.config.reset_config()
def test_default_ignore_list_is_overridden():
freezegun.configure(default_ignore_list=['threading', 'tensorflow'])
with... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",... | 3 | tests/test_configure.py | tirkarthi/freezegun |
import os
from algorithms.sorting.wordle_solver import _read_file, get_best_guess, get_most_common
def test_get_most_common():
file_data = _read_file(os.path.join('algorithms', 'assets', 'wordle_answer_list.json'))
most_common_start, most_common_letters, possible_words = get_most_common(file_data)
asser... | [
{
"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 | test/unit/sorting/test_wordle_solver.py | bestpersonyes2/algorithms |
import torch
import mxnet as mx
import numpy as np
from gluon2pytorch import gluon2pytorch
class SoftmaxTest(mx.gluon.nn.HybridSequential):
def __init__(self):
super(SoftmaxTest, self).__init__()
from mxnet.gluon import nn
with self.name_scope():
self.conv1 = nn.Conv2D(3, 32)
... | [
{
"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/convert_softmax.py | juanCastrillo/gluon2pytorch |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.7.1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
im... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer":... | 3 | kubernetes/test/test_v1_projected_volume_source.py | jraby/kubernetes-client-python |
def first_letter_of_word(current_word):
digits = []
new_current_word = []
for letter in current_word:
if letter.isdigit():
digits.append(letter)
elif letter.isalpha():
new_current_word.append(letter)
first_letter = chr(int("".join(digits)))
new_current_word.in... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": tru... | 3 | Python Fundamentals/Lists Advanced/Exercise/Task08_2.py | DonikaChervenkova/SoftUni |
from leapp.utils.meta import with_metaclass
from leapp.workflows.flags import Flags
from leapp.workflows.policies import Policies
class PhaseMeta(type):
classes = []
def __new__(mcs, name, bases, attrs):
klass = super(PhaseMeta, mcs).__new__(mcs, name, bases, attrs)
PhaseMeta.classes.append(k... | [
{
"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 | leapp/workflows/phases.py | asilveir/leapp |
#!/usr/bin/env python
import rospy
from sensor_msgs.msg import MagneticField
from geometry_msgs.msg import Vector3Stamped
class Relay:
def __init__(self):
rospy.init_node("imu_time")
self._mag_pub = rospy.Publisher("imu/mag_fixed", MagneticField, queue_size=10)
self._mag_sub = rospy.Subscri... | [
{
"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 | mag_cal/scripts/imu_time.py | MichaelSalah/Apollo |
from typing import List
import urllib.request as http
import json, os, requests
from guet.steps.action import Action
class SetGithub(Action):
token = os.getenv('GITHUB_TOKEN', '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')
owner = "AbhishekMashetty"
repo = "assign-git"
query_url = f"https://api.github.co... | [
{
"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 | guet/commands/github/_setGithub.py | AbhishekMashetty/pairprogrammingmasetty |
from django.contrib import admin
from imagekit.admin import AdminThumbnail
from mptt.admin import DraggableMPTTAdmin
from ad.models import City, \
Category, AdvertisementImage, Advertisement
class SubCategoryInline(admin.TabularInline):
model = Category
extra = 14
exclude = ('icon', 'slug')
class ... | [
{
"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 | src/ad/admin.py | mio-eldar/ads-board |
import logging
from . import FileChecker
l = logging.getLogger(__name__)
class CheckPackageMetadata(FileChecker):
def check(self):
if self.sub_path("package-metadata.json").is_file():
self.fail("'package-metadata.json' is supposed to be automatically generated "
"by Pa... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
... | 3 | st_package_reviewer/check/file/check_redundant_files.py | Thom1729/st_package_reviewer |
# coding: utf-8
"""
OpenSilex API
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: INSTANCE-SNAPSHOT
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_imp... | [
{
"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 | test/test_entity_creation_dto.py | OpenSILEX/opensilexClientToolsPython |
# external imports
import unittest
# local imports
import nautilus.models as models
from nautilus.contrib.graphene_peewee import PeeweeObjectType
from ...util import MockModel
class TestUtil(unittest.TestCase):
def setUp(self):
# the base model to test
TestModel = MockModel()
# the objec... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{... | 3 | tests/contrib/graphene_peewee/test_objecttype.py | AlecAivazis/python |
'''
Given the root of a binary tree, return its maximum depth.
A binary tree's maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.
'''
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# se... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer":... | 3 | recursion/104. Maximum Depth of Binary Tree_easy.py | JunzhongLin/leetcode_practice |
# Copyright 2015 Open Source Robotics Foundation, 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 ... | [
{
"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 | ros2_batch_job/batch_job.py | taewoong0627/ci |
from django.db import models
from django.contrib.auth.models import User
from talk.models import Challenger
class Article(models.Model):
author = models.ForeignKey(User)
title = models.CharField(max_length=128)
content = models.TextField(blank=True)
date_post = models.DateTimeField(auto_now_add=True)
... | [
{
"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 | blog/models.py | piratos/ctfbulletin |
from unittest import TestCase
from unittest import mock
from med2img.med2img import Med2img
class Med2imgTests(TestCase):
"""
Test Med2img.
"""
def setUp(self):
self.app = Med2img()
def test_run(self):
"""
Test the run code.
"""
args = []
if self.a... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": fals... | 3 | med2img/tests/test_med2img.py | mohitchandarana/pl-med2img |
from flask import Flask
from . import csrf
import ishuhui.data as data
import env
from flask_assets import Environment, Bundle
def create_app(config, should_register_blueprints=True):
app = Flask(__name__,static_folder = env.ASSETS,static_url_path='/assets')
assets = Environment(app)
js = Bundle('ap... | [
{
"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 | ishuhui/__init__.py | lawnight/flask_ishuhui |
import os
import json
from cas import CASClient
from urllib.parse import urlunparse
SSO_UI_URL = "https://sso.ui.ac.id/cas2/"
SSO_UI_FORCE_SERVICE_HTTPS = False
def normalize_username(username):
return username.lower()
def get_protocol(request):
if request.is_secure or SSO_UI_FORCE_SERVICE_HTTPS:
re... | [
{
"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 | flask_sso_ui/utils.py | DhanarSantika/flask-sso-ui |
###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013-2020, John McNamara, jmcnamara@cpan.org
#
from ..excel_comparsion_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompareXLSXFiles(ExcelComparisonTest):
"""... | [
{
"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 | xlsxwriter/test/comparison/test_default_row03.py | timgates42/XlsxWriter |
from errors import HypnoError
class Env:
def __init__(self, values=None, parent=None):
self.values = values or {}
self.parent = parent
if parent is None:
self.base_env = self
else:
self.base_env = parent.base_env
def __getitem__(self, name):
scop... | [
{
"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 | env.py | alehander42/hypno |
from config.Resources import UnitTypes
from Utils import dist
class Controller:
def do(self, unit, all_units):
pass
def find_nearest_obj(self, unit, units, set_of_types=None):
found = []
if set_of_types is None:
found = units
else:
for obj in units:
... | [
{
"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 | controllers/Controller.py | Ctalk3r/NotTowerDefence |
from PIL import ImageChops, Image as PILImage
from http.client import HTTPConnection
from time import sleep
from traceback import format_stack, print_exc
def Tint(image, color):
return ImageChops.blend(image, PILImage.new('RGB', image.size, color), 0.36)
def GetStatusCode(host, path="/"):
""" This function r... | [
{
"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 | commands/utils.py | j4p/JeBB |
import unittest
from botlang import BotlangSystem, BotlangErrorException
class StackTraceTestCase(unittest.TestCase):
def test_stack_trace(self):
code = """
(begin
(define f
(fun (n)
(fun (x) (n x))
)
... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 lines?",
"answer": true
},
... | 3 | tests/test_stack_trace.py | PostCenter/botlang |
import numpy as np
import os
import pickle
import unittest
import wkb_raster
class TestWKBRasterWrite(unittest.TestCase):
def setUp(self):
self.data_dir = os.path.abspath(
os.path.join(
os.path.dirname(__file__),
'data'
)
)
self.so... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true... | 3 | tests/test_write.py | dustymugs/wkb-raster |
from queue import Queue
from threading import Thread
from time import sleep
from bripy.bllb.logging import logger, DBG
def unloadq(q, stop, limit=2000, rest=.1, check=100):
i = limit
loops = 0
results = []
while True and ((i and not stop()) or q.qsize()):
loops += 1
if loops % check ==... | [
{
"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 | src/bripy/bllb/q.py | brl0/bripy |
'''
累加数
累加数是一个字符串,组成它的数字可以形成累加序列。
一个有效的累加序列必须至少包含 3 个数。除了最开始的两个数以外,字符串中的其他数都等于它之前两个数相加的和。
给定一个只包含数字 '0'-'9' 的字符串,编写一个算法来判断给定输入是否是累加数。
说明: 累加序列里的数不会以 0 开头,所以不会出现 1, 2, 03 或者 1, 02, 3 的情况。
示例 1:
输入: "112358"
输出: true
解释: 累加序列为: 1, 1, 2, 3, 5, 8 。1 + 1 = 2, 1 + 2 = 3, 2 + 3 = 5, 3 + 5 = 8
示例 2:
输入: "199100199"
输出: 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": "has_nested_function_def",
"question": "Does this file contain any function defined insid... | 3 | medium/306-additive-number.py | wanglongjiang/leetcode |
import scrapy
import json
class RussianAlphabetSpider(scrapy.Spider):
name = "quotes"
start_urls = [
'https://www.russianforeveryone.com/',
]
def parse(self, response):
alphabets_urls = response.xpath('//a[contains(.,"alphabet")]')
yield from response.follow_all(alphabets_urls... | [
{
"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 | banana_crawler/spiders/russian_alphabet.py | robsonzagrejr/banana-crawler |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.