source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
from sklearn.base import BaseEstimator, TransformerMixin # type: ignore
from typing import List, Any
import pandas as pd
class MinZeroTransform(BaseEstimator, TransformerMixin):
"""
Transforms X to X-X.min(), so that the minimum is shifted to 0.
X.min() is learned in the fit.
"""
def transform(self... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": true
}... | 3 | min_zero_transform.py | herwinvw/TabularPlayGroundMay2021 |
"""
********************************************************************************
* Name: form_input_rws.py
* Author: glarsen, mlebaron
* Created On: October 17, 2019
* Copyright: (c) Aquaveo 2019
********************************************************************************
"""
from tethysext.atcore.models.app_us... | [
{
"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 | tethysext/atcore/models/resource_workflow_steps/form_input_rws.py | Aquaveo/tethysext-atcore |
# -*- coding: utf-8 -*-
"""
:copyright: Copyright 2020-2022 Sphinx Confluence Builder Contributors (AUTHORS)
:license: BSD-2-Clause (LICENSE)
"""
from tests.lib.testcase import ConfluenceTestCase
from tests.lib.testcase import setup_builder
import os
class TestConfluenceMetadata(ConfluenceTestCase):
@classmethod... | [
{
"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 | tests/unit-tests/test_confluence_metadata.py | tonybaloney/sphinx-confluencebuilder |
import numpy as np
from mpi4py import MPI
class Kmeans:
def __init__(self, k=3, num_iterations=100, seed=42):
self.k = k
self.num_iterations = num_iterations
self.centorids = None
self.dim = None
self.n = None
np.random.seed(seed)
def train(self, X, parallel=F... | [
{
"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 | src/senjyu/ml/clustering/kmeans.py | Koukyosyumei/Senjyu |
from pathlib import Path
import streamlit as st
from package import utils
from pages import local_page, global_page
from shared import list_explanation_groups
def explanation_group_selectbox():
paths = list_explanation_groups()
path = st.sidebar.selectbox(
label='Select explanation group:',
... | [
{
"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 | sagemaker_studio/containers/dashboard/src/app.py | NihalHarish/sagemaker-explaining-credit-decisions |
import sys
import validation
from major_minor import *
class Command(Major):
def __init__(self, name, defaultHelpOption=True):
super().__init__(name)
self.options = self._minors
def addOption(self, option):
self._addMinor(option)
def addNewOption(self, longname, shortname, valid=... | [
{
"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": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excl... | 3 | clargs.py | dakalamin/Timelapse_cam |
# -*- coding: utf-8 -*-
"""Tests for the Config class."""
from click.testing import CliRunner
from made import cli
import pytest
@pytest.fixture
def runner():
"""TODO."""
return CliRunner()
def test_cli(runner):
"""Tests that the cli can be launched."""
result = runner.invoke(cli.cli)
assert ... | [
{
"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_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
... | 3 | tests/test_cli.py | GuerrillaAnalytics/made-cli |
from .cog import Debug
from . import config
def setup(bot):
bot.add_cog(Debug(bot, name=config.name))
def configure(name="Debug"):
config.name = 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": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answe... | 3 | debug_cog/setup.py | ilovetocode2019/Debug-Cog |
import requests
import pandas as pd
from bs4 import BeautifulSoup
def get_financial_statements(code):
url = "http://companyinfo.stock.naver.com/v1/company/ajax/cF1001.aspx?cmp_cd=%s&fin_typ=0&freq_typ=Y" % (code)
html = requests.get(url).text
html = html.replace('<th class="bg r01c02 endLine line-bottom"c... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"ans... | 3 | ch19/day06/07.py | starcatch1/book |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Date : 2018-11-05 11:30:01
# @Author : Bolun Wang (bolunwang@cs.ucsb.edu)
# @Link : http://cs.ucsb.edu/~bolunwang
import tensorflow as tf
import numpy as np
from keras.preprocessing import image
import h5py
def dump_image(x, filename, format):
img = image... | [
{
"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 | utils_backdoor.py | ByzanTine/backdoor |
import json
class AdFieldObject:
def __init__(self, json_def = None):
if type(json_def) is str:
json_def = json.loads(json_def)
s = json_def
self.pc_display = None if 'pc' not in s else self.pc_display_easy(s['pc'])
self.pc_final = None if 'pc' not in s else self... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cl... | 3 | powernad/Object/Ad/sub/AdFieldObject.py | devkingsejong/python---PowerNad |
from datetime import datetime
import click
from tools import background, nasa_api
from tools.utils import parse_str_to_date
@click.group()
def nasa_background():
pass
@nasa_background.command()
@click.option("--date",
default=None,
help="Enter the date as a single string in YYYYMMD... | [
{
"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": fal... | 3 | nasa_background.py | Thomas9292/nasa-background |
# -*- coding: utf-8 -*-
import gzip
import bz2
import numpy as np
def advanced_open(filepath, *args, **kwargs):
""" Open function interface for files with different extensions.
Parameters
----------
filepath: str
File path with extension.
args: list
Non-key arguments
kwargs: ... | [
{
"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 | libkge/io/base.py | samehkamaleldin/libkge |
from django.db.models import CharField
from django_gcp.models import MyAbstractModel
class Armadillo(MyAbstractModel):
"""
This is how you test abstract classes in your library without adding concrete models: add the concrete model
to your test app. You'll need to make the migrations for the test app:
... | [
{
"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/models.py | octue/django-gcp |
import sys
import pytest
from pre_commit_hooks.loaderon_hooks.tests.util.test_helpers import perform_test_on_file_expecting_result
from pre_commit_hooks.loaderon_hooks.general_hooks.check_location import main
@pytest.fixture(autouse=True)
def clean_sys_argv():
sys.argv = []
# Each line is a directory that ... | [
{
"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 | pre_commit_hooks/loaderon_hooks/tests/general_hooks/check_location_test.py | alvaroscelza/pre-commit-hooks |
import h5py
import numpy as np
import torch.utils.data as data
class ShapeDataset(data.Dataset):
def __init__(self, h5_file, mode, n_points=2048, augment=False):
assert (mode == 'train' or mode == 'val'), 'Mode must be "train" or "val".'
self.mode = mode
self.n_points = n_points
se... | [
{
"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 | data/shape_dataset.py | mremilien/object-deformnet |
from django.contrib.auth import get_user_model
from django.test import TestCase, Client
from django.urls import reverse
class AdminSiteTests(TestCase):
def setUp(self):
"""Creating admin and spare user for testing"""
self.client = Client()
self.admin_user = get_user_model().objects.create... | [
{
"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 | app/core/tests/test_admin.py | LukaszMalucha/Springboard-analytics |
# Copyright 2018 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, ... | [
{
"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 | ci/fireci/fireci/gradle.py | Elke26/firebase-android-sdk |
"""Zoom.us REST API Python Client -- Recording component"""
__author__ = "Tomas Garzon"
__email__ = "tomasgarzonhervas@gmail.com"
from zoomus import util
from zoomus.components import base
class RecordingComponent(base.BaseComponent):
"""Component dealing with all recording related matters"""
def list(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": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": ... | 3 | zoomus/components/recording.py | appfluence/zoomus |
"""
DO NOT MODIFY
This file is used to validate your publish settings.
"""
from __future__ import print_function
import os
import sys
import importlib
components_package = 'yasqe_dcc'
components_lib = importlib.import_module(components_package)
missing_dist_msg = 'Warning {} was not found in `{}.__init__.{}`!!!'
m... | [
{
"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 | _validate_init.py | nruemmele/yasqe_dcc |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
# ************* 3 **********
EtabsAPI illustration: 0.0.1
Autor: Francisco J.Mucho
Date: 25/03/21
Time: satrt 10:10am finish 12:00pm
# ************* 3 **********
'''
import sys
class EtabsAPIcFile:
'''File'''
def __init__(self):
# TODO
... | [
{
"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_Python/EtabsAPIModCLI/coreapi/EAPIFile.py | fjmucho/APIdeEtabsYPython |
import time
import json
import orjson
import rapidjson
import ujson
import simplejson
import hyperjson
import simdjson
num = 10**6
m = {
"timestamp": 1556283673.1523004,
"task_uuid": "0ed1a1c3-050c-4fb9-9426-a7e72d0acfc7",
"task_level": [1, 2, 1],
"action_status": "started",
"action_type": "main",... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside... | 3 | library/json_lib.py | wenbindu/test-collections |
# -*- coding: utf-8 -*-
import os
from django.core.management.base import BaseCommand
from common.access_control.base import AccessSet
from account.repository.auth_models import BmProject
class Command(BaseCommand):
def add_arguments(self, parser):
parser.add_argument('-project_name')
def handle(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": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": fals... | 3 | app/access_control/management/commands/base_button_role.py | 21vcloud/Controller |
import os
import sys
BASE_DIR = os.getcwd()
sys.path.append(BASE_DIR)
from helper import random, diff
import unittest
class TestHelper(unittest.TestCase):
def test_random(self):
for l in [1, 2, 5, 10, 100]:
a = random.randints(0, 1, l)
self.assertEqual(len(a), l, "Not returning co... | [
{
"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 | newcode/tests/test_helper.py | rchatterjee/nocrack |
# -*- coding: utf-8 -*-
__author__ = 'CongRong <tr3jer@gmail.com>'
import difflib
from .utils.compat import bytes_decode, xrange
hashbits = 128
difflib_threshold = 0.95
simhash_threshold = 0.95
def simhash(tokens):
v = [0] * hashbits
for t in [string_hash(x) for x in tokens]:
for i in xrange(hashbits):
bi... | [
{
"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 | wsltools/similar.py | Symbo1/wsltools |
#!/usr/bin/python3
import os
from pathlib import Path
import pytest
from brownie.project.scripts import run
# browniemix is parametrized with every mix repo from https://www.github.com/brownie-mix/
def test_mixes(plugintesterbase, project, tmp_path, rpc, browniemix):
path = Path(project.from_brownie_mix(browni... | [
{
"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/project/test_brownie_mix.py | palkeo/brownie |
with open("data.txt") as f:
polymer = f.read().strip()
def react_polymer(pol):
pol = [ord(c) for c in pol]
i = 0
while i < len(pol) - 1:
if abs(pol[i] - pol[i + 1]) == 32:
del pol[i]
del pol[i]
i -= 1
else:
i += 1
return pol
def p... | [
{
"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 | day-5/main.py | jmolinski/advent-of-code-2018 |
import win32api
import win32con
##from ctypes import windll
import time
import serial
##def m_move(x,y):
## windll.user32.SetCursorPos(x,y)
def l_click(x,y):
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, x, y)
time.sleep(0.05)
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/... | 3 | mm2.py | kapil-iitk/Arduino_bluetooth_mouse |
from fastai.basic_train import Learner, LearnerCallback
from fastai.vision.gan import GANLearner
class GANSaveCallback(LearnerCallback):
"""A `LearnerCallback` that saves history of metrics while training `learn` into CSV `filename`."""
def __init__(
self,
learn: GANLearner,
learn_gen... | [
{
"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 | deoldify/save.py | TaktakTaktouk/DeOldify |
import pytest
from vdirsyncer.storage.dav import _BAD_XML_CHARS
from vdirsyncer.storage.dav import _merge_xml
from vdirsyncer.storage.dav import _parse_xml
def test_xml_utilities():
x = _parse_xml(
b"""<?xml version="1.0" encoding="UTF-8" ?>
<multistatus xmlns="DAV:">
<response>
... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
... | 3 | tests/storage/dav/test_main.py | edvfb9/vdirsyncer |
import requests
import json
APIURL = "https://api.idpay.ir/v1.1/"
# You can get your Token from this url => https://idpay.ir/dashboard/web-services
TOKEN = "Your Token Here"
SANDBOX = str(1) # 1 or 0
Headers = {
"Content-Type": "application/json",
"X-SANDBOX":SANDBOX,
"X-API-KEY":TOKEN
}
... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": fal... | 3 | idpay.py | amirhossein4778/idPay-python |
"""
Copyright (c) 2019 Intel Corporation
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 wri... | [
{
"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 | model-optimizer/mo/ops/deformable_convolution.py | zhoub/dldt |
from zeit.cms.testing import copy_inherited_functions
import zeit.cms.testing
import zeit.cms.content.contentsource
class ContentSourceBase(object):
source = zeit.cms.content.contentsource.CMSContentSource()
expected_types = [
'channel', 'collection', 'file', 'testcontenttype', 'unknown']
def te... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": true
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
... | 3 | core/src/zeit/cms/content/tests/test_contentsource.py | rickdg/vivi |
#!/usr/bin/env python3
UNKNOWN = -1
def read_val():
return int(input())
def read_row():
return list(map(int, input().split()))
def read_grid():
return [read_row() for _ in range(read_val())]
def make_blank_row(i):
return [UNKNOWN] * i
def make_blank_grid(n):
return [make_blank_row(i) for i in ... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
... | 3 | hier/project-euler/euler-067-hackerrank/euler067.py | EliahKagan/old-practice-snapshot |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
class MybankCreditLoanapplyInsturlQueryResponse(AlipayResponse):
def __init__(self):
super(MybankCreditLoanapplyInsturlQueryResponse, self).__init__()
self._target_url = No... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": ... | 3 | alipay/aop/api/response/MybankCreditLoanapplyInsturlQueryResponse.py | snowxmas/alipay-sdk-python-all |
from floodsystem.station import MonitoringStation
#from floodsystem.stationdata import *
##Task 2B
def stations_level_over_threshold(stations, tol):
station_list = []
for station in stations:
if station.relative_water_level() is not None and station.relative_water_level() > tol:
stati... | [
{
"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 | floodsystem/flood.py | amyponter/amy_reve |
import discord
from discord.ext import commands
import platform
token = "ODAyNTM0NTYwMzk4NTczNTk5.YAwojQ.jBDMBpDZ_R50KqWSGnCjToCY8No"
kanal_adi = ""
class Bot(commands.Bot):
def __init__(self):
super().__init__(command_prefix="&", pm_help=None, description=None)
self.bot_version = "1.0.0"
self.bot_nam... | [
{
"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 | Dayyip/main.py | TheDeadStalker/DiscordBot-Dayyip |
#
# Copyright: Japannext Co., Ltd. <https://www.japannext.co.jp/>
# SPDX-License-Identifier: Apache-2.0
#
# TODO: check whether it's faster with BitStream.
from dataclasses import dataclass
ORDER_VERB = {
'00': 'B',
'01': 'S',
'10': 'T',
'11': 'E',
}
STR_TO_BOOL = { # Override non empty strings bei... | [
{
"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_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true... | 3 | jnx_bits/mdrop/bitfields.py | Japannext/jnx_bits |
#!/usr/bin/env python3
from unittest import TestCase, main
from g2p import make_g2p
from g2p.exceptions import InvalidLanguageCode, NoPath
from g2p.transducer import CompositeTransducer, Transducer
class NetworkTest(TestCase):
"""Basic Test for available networks"""
def setUp(self):
pass
def t... | [
{
"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 | g2p/tests/test_network.py | roedoejet/gi2pi |
from TwitterAuthenticater import TwitterAuthenticator
from TwitterListener import TwitterListener
from tweepy import Stream
class TwitterStreamer():
"""
Class for streaming and processing live tweets.
"""
# Constructor
def __init__(self):
self.twitter_autenticator = TwitterAuthenticato... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},... | 3 | src/TwitterStreamer.py | Rafii-Ayoub/Twitter-Advertising-Bot |
"""
Solution to https://adventofcode.com/2020/day/9
"""
def read_input():
with open("./input.txt", mode="r") as file_pointer:
return tuple(int(line.strip()) for line in file_pointer.readlines())
def walk(encrypted_data, preamble=25):
for pos, data_point in enumerate(encrypted_data[preamble:]):
... | [
{
"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 | aoc_2020/day_09/solution.py | janjagusch/advent-of-code |
from django.shortcuts import render
from django.utils import timezone
from django.shortcuts import redirect, render, get_object_or_404
from .models import Post
from .forms import PostForm
# Create your views here.
def post_list(request):
posts = Post.objects.filter(published_date__lte=timezone.now()).order_by('pub... | [
{
"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 | blog/views.py | IvanSotelo/Django |
"""
Copyright [2009-2019] EMBL-European Bioinformatics Institute
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 a... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answ... | 3 | sequence_search/db/tests/test_base.py | RNAcentral/sequence_search |
def evaluate(operand, a, b):
if operand:
return a
else:
return b
def inv_evaluate(operand, a, b):
if operand:
return not a
else:
return not b
class Shield(object):
def __init__(self):
self.s0 = False;
def move(self,i1, i2, i3, o1, o2, o3):
tmp2... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self... | 3 | safelearn__.py | sahabi/opt |
from datetime import date, time, datetime, timedelta
def trabalhando_com_datetime():
data_atual = datetime.now()
print(data_atual)
print(data_atual.strftime('%d/%m/%Y %H:%M:%S'))
print(data_atual.strftime('%c'))
print(data_atual.weekday())
tupla = ('Segunda','Terça','Quarta','Quinta','Sexta','S... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
... | 3 | aula10.py | lucasalcantarap/Exercicios-de-python |
"""
Copyright (c) Contributors to the Open 3D Engine Project.
For complete copyright and license terms please see the LICENSE at the root of this distribution.
SPDX-License-Identifier: Apache-2.0 OR MIT
"""
def PrefabBasicWorkflow_CreateAndReparentPrefab():
CAR_PREFAB_FILE_NAME = 'car_prefab'
WHEEL_PREFAB_FI... | [
{
"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 | AutomatedTesting/Gem/PythonTests/Prefab/tests/PrefabBasicWorkflow_CreateAndReparentPrefab.py | NickR49/o3de |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import simplejson as json
from alipay.aop.api.constant.ParamConstants import *
class AlipayOpenPublicSinglearticleDataBatchqueryModel(object):
def __init__(self):
self._begin_date = None
self._end_date = None
@property
def begin_date(self):
... | [
{
"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 | alipay/aop/api/domain/AlipayOpenPublicSinglearticleDataBatchqueryModel.py | articuly/alipay-sdk-python-all |
from __future__ import print_function
import sys
CLI = False
DEBUG = False
AUTO = False
def eprint(*args, **kwargs):
print(*args, file=sys.stderr, **kwargs)
def setdebug(state):
global DEBUG
DEBUG = state
Debug("Python:")
for p in sys.version.split("\n"):
Debug(p)
def setauto(state)... | [
{
"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 | automatia/main.py | ShadowJonathan/automatia.py |
import os
from flask import Flask, flash, render_template, request
from helpers import *
app = Flask(__name__)
app.secret_key = 'dkjkffksks'
@app.route('/', methods=["GET", "POST"])
def index():
"""Index page"""
if request.method == "POST":
msg = request.form.get("textarea")
img = request.form.get("output_imag... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"... | 3 | app.py | MattJAshworth/UniSecrets |
from flask import Flask
from flask.helpers import send_from_directory
from flask_cors import CORS
from celery import Celery
from redis_manager import get_schedules
from redbeat.decoder import RedBeatJSONEncoder, RedBeatJSONDecoder, to_timestamp
import os
import json
from pprint import pprint as pp
app = Flask(__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": fal... | 3 | app.py | B2Metric-AI/redbeat_manager |
from dnl.IconEasySolver import ICON_scheduling, calculate_energy_from_solver, ICON_scheduling_relaxation
from KnapsackSolving import solveKnapsackProblem, solveKnapsackProblemRelaxation
from dnl.Params import KNAPSACK, ICON_SCHEDULING_EASY
import numpy as np
def get_relax_optimization_objective(Y, weights, opt_params,... | [
{
"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 | dnl/RelaxSolver.py | Patyrn/Divide-and-Learn |
"""
My first application
"""
import toga
from toga.style import Pack
from toga.style.pack import COLUMN, ROW
class HelloWorld(toga.App):
def startup(self):
"""
Construct and show the Toga application.
Usually, you would add your application to a main content box.
We then create 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": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true... | 3 | src/helloworld/app.py | The-Heyman/helloworld |
from ..entity import (
EntitySchema,
SecondaryEntity,
)
from ..fields import (
ListField,
StringField,
EntityField,
)
from ..secondary.related_judgement import RelatedJudgement
from ..validators import validate_string
class JudgementSpecificationSchema(EntitySchema):
"""
https://github.com... | [
{
"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 | bundlebuilder/models/secondary/judgement_specification.py | CiscoSecurity/tr-05-ctim-bundle-builder |
import pandas as pd
def compute_directed_edges(edges_w_features):
"""
Converts the undirected edge information into a directed format, by duplicating each edge and flipping the node
attributes to make it point in the opposite direction. This makes computation from the viewpoint of each node
simpler.
... | [
{
"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 | hw_demo_estimation/data_manipulation.py | kklkodi/empirikushazi |
# Copyright 2011 Nicholas Bray
#
# 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_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 | bin/analysis/ipa/memory/storegraphpolicy.py | ncbray/pystream |
from __future__ import annotations
from typing import (
cast,
Generic,
List,
Tuple,
TypeVar,
)
from entropy.min_heap import MinHeap
K = TypeVar("K")
V = TypeVar("V")
Distribution = List[Tuple[K, V]]
def indent(inp: str, indent: str) -> str:
return "\n".join([indent + l for l in inp.splitli... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstr... | 3 | entropy/huffman.py | davesque/entropy |
# Copyright 2014, Doug Wiegley, A10 Networks.
#
# 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 ... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer"... | 3 | zuul.d/octavia/tests/unit/common/test_config.py | yi-cloud/octavia |
x=int(input("enter the number 1"))
y=int(input("enter the number 2"))
def sumt(n,m):#function with argument no return
print("sum operation \n")
sumt=n+m
print("sum is",sumt)
def subs(n,m):#function with argument with return
print("substraction operation \n")
subs=n-m
print("difference is",subs)... | [
{
"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 | function.py | anmol1455/python |
# Copyright 2015 0xc0170
#
# 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, soft... | [
{
"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 | project_generator/build.py | sg-/project_generator |
"""
The ``transaction`` submodule contains a wrapper class to simplify the usage of transactions::
t = revitron.Transaction()
...
t.close()
"""
# from pyrevit import script
class Transaction:
"""
A transaction helper class.
"""
def __init__(self):
"""
Inits a... | [
{
"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 | revitron/transaction.py | YKato521/revitron-for-RevitPythonShell |
from nanome._internal._util._serializers import _TypeSerializer
class _SliderCallback(_TypeSerializer):
def version(self):
return 1
def name(self):
return "SliderCallback"
def serialize(self, version, value, context):
if (version == 0):
plugin_mask = (context._plugin_... | [
{
"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 | nanome/_internal/_network/_commands/_serialization/_ui/_slider_callback.py | nanome-ai/nanome-plugin-api |
#!/usr/bin/python
from __future__ import print_function
from struct import pack
import random
import unittest
from datachunkpy.datachunk import DataChunk, MessageHandler
class MyMsgHandler(MessageHandler):
def __init__(self):
self.msg_processed = 0
self.bytes_processed = 0
def handle_msg(se... | [
{
"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 | datachunkpy/tests/datachunk_test.py | nipuntalukdar/datachunkpy |
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
# O(n) time | O(Log(n)) space
def maxPathSum(tree):
_, maxSum =findMaxSum(tree)
return maxSum
def findMaxSum(tree):
if tree is None:
return (0, 0)
leftMaxSumAsBranch, leftMax... | [
{
"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 | sri/maxpathsum_in_binary_tree.py | ravichalla/wallbreaker |
# Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT-0
# pylint: skip-file
import os
import boto3
from pytest import fixture, raises
from stubs import stub_step_functions
from mock import Mock
from stepfunctions import StepFunctions
@fixture
def cls():
cls = S... | [
{
"point_num": 1,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"a... | 3 | src/lambda_codebase/initial_commit/bootstrap_repository/adf-build/shared/python/tests/test_step_functions.py | StewartW/aws-deployment-framework |
class Calculator:
def __init__(self):
pass
def add(self, a, b):
return a + b
def divide(self, a, b):
return b / a
# Todo: Add subtract option
# def root(a):
# return math.sqrt()
def greetings(name):
print('Hello ' + name + '!')
def goodbye():
print('Good... | [
{
"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 | Section1/1.5 Python Console/console.py | rneighborsphone/PyCharm-for-Power-Developer-v- |
import pytest
import requests_mock
from app.integrations.clickmeeting import ClickMeetingClient
pytestmark = [pytest.mark.django_db]
@pytest.fixture(autouse=True)
def set_api_key(settings):
settings.CLICKMEETING_API_KEY = 's3c3r37'
@pytest.fixture
def client():
client = ClickMeetingClient()
with requ... | [
{
"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/app/tests/clickmeeting/conftest.py | iNerV/education-backend |
import requests
import json
from datetime import datetime, timezone
from . utils import _extract_videos_necessary_details, _save_video_detils_in_db
from .models import ApiKeys
from . import config
def _get_api_key(): #getting different key w.r.t last used every time cron job starts.(load balanced)
new_key = ApiKe... | [
{
"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 | youtubeDataApi/searchApi/cron.py | aryamaan98/Youtube-Data-API-Integration |
class CopyPixelOperation(Enum,IComparable,IFormattable,IConvertible):
"""
Determines how the source color in a copy pixel operation is combined with the destination color to result in a final color.
enum CopyPixelOperation,values: Blackness (66),CaptureBlt (1073741824),DestinationInvert (5570569),MergeCopy (... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
... | 3 | release/stubs.min/System/Drawing/__init___parts/CopyPixelOperation.py | tranconbv/ironpython-stubs |
"""
Copyright (c) Facebook, Inc. and its affiliates.
"""
from typing import Tuple, Dict, Any, Optional
from droidlet.dialog.dialogue_objects import DialogueObject
from ..interpreter import ReferenceObjectInterpreter, FilterInterpreter, interpret_reference_object
from ..condition_helper import ConditionInterpreter
fro... | [
{
"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 | droidlet/interpreter/craftassist/dummy_interpreter.py | adamlerer/droidlet |
# Cache Timeouts
TIMEOUT_5_MINUTES = 300
TIMEOUT_60_MINUTES = 3600
TIMEOUT_24_HOURS = 86340
TIMEOUT_12_HOURS = 43140
# Cache keys
def FILE_UPLOAD_SIZE(document_guid): return f'document-manager:{document_guid}:file-size'
def FILE_UPLOAD_OFFSET(document_guid): return f'document-manager:{document_guid}:offset'
def FILE_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 | services/document-manager/backend/app/constants.py | parc-jason/mds |
from pathlib import Path
from typing import Any, Mapping
from aioworkers.core.config import ValueExtractor
from aioworkers.storage.http import Storage
BASE = Path(__file__).parent
configs = (BASE / "config.ini",)
class Client(Storage):
_service: Mapping[str, Any]
def set_config(self, config: ValueExtracto... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false... | 3 | aioworkers_consul/__init__.py | aioworkers/aioworkers-consul |
__all__ = ["EvaluatingInferencer"]
from dataclasses import dataclass
from typing import Sequence
import torch
import torch.utils.data as td
import utils
from datasets import BatchData
from .inferencer import Inferencer
from evaluators import FinegrainedEvaluator
@dataclass
class EvaluatingInferencer(Inferencer):
... | [
{
"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 | loopers/inferencer/evaluator.py | kaniblu/vhda |
from uuid import uuid4
from django.contrib.auth.models import (AbstractBaseUser, BaseUserManager,
PermissionsMixin)
from django.core.validators import EmailValidator
from django.db import models
class UserManager(BaseUserManager):
def create_user(self, name, email, passwo... | [
{
"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 | users/models.py | MaryzangelaBessa/ElRoyale |
# -*- coding: utf-8 -*-
"""DrCIF test code."""
import numpy as np
from sklearn.metrics import accuracy_score
from sktime.classification.interval_based import DrCIF
from sktime.datasets import load_unit_test
def test_drcif_train_estimate():
"""Test of DrCIF on unit test data."""
# load unit test data
X_tr... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answ... | 3 | sktime/classification/interval_based/tests/test_drcif.py | biologioholic/sktime |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
from object_detection.tf_utils import label_map_util
class LoadLabelMap():
def __init__(self):
return
def load_label_map(self, cfg):
"""
LOAD LABEL MAP
"""
print('Loading label map')
LABEL_PATH = cfg['la... | [
{
"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 | pilot/perception/object_detection/load_label_map.py | yanbarurobotics/PythonPilot |
import sys
from concurrency.thread.safety import SafeCounter, UnsafeCounter, eval_counter
MAX_THREADS = 5
INC_LIMIT = 100000
sys.setswitchinterval(0.0005)
def test_thread_unsafety():
unsafe_counter = UnsafeCounter(limit=INC_LIMIT)
result = eval_counter(unsafe_counter, n_threads=MAX_THREADS)
assert result... | [
{
"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 | programming/python/concurrency/tests/test_thread_safety.py | ltbringer/learning |
"""Module for test user model"""
import unittest
from auth.models import User
class TestUserModel(unittest.TestCase):
"""Class for user model testing"""
def setUp(self) -> None:
"""Setting up test data and configs"""
self.user = User(password="pass", username="user_name")
self.user2 ... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer":... | 3 | backend/auth/tests/test_models.py | yar-kik/Flask-API-bookshop |
#!/usr/bin/env python3
import os
import re
import subprocess
import sys
def get_project_name(project_dir):
with open(os.path.join(project_dir, 'deploy', 'environments', 'all', 'vars.yml')) as f:
for l in f.readlines():
m = re.match('^project_name: (.*)$', l)
if m:
... | [
{
"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": fal... | 3 | compare.py | trawick/emptyhammock-project-template |
def mensagem():
print('Criando no python')
def tabuada():
n = int(input('Digite um número que deseja ver a tabuada: '))
for x in range (1,11):
print('{} X {:2} = {:2}'.format(n, x, n*x))
mensagem()
tabuada()
| [
{
"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 | conexao.py | gabrielmonzato20/ProjetoCp |
'''
Base class for sqlalchemy
'''
__author__ = 'Elisha Yadgaran'
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, DateTime, func
from sqlalchemy_mixins import AllFeaturesMixin
Base = declarative_base()
class BaseSQLAlchemy(Base, AllFeaturesMixin):
'''
Base class for ... | [
{
"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 | simpleml/persistables/base_sqlalchemy.py | ptoman/SimpleML |
from unittest import TestCase
from pyhocon import ConfigTree
from mist.models import Deployment
class DeploymentTest(TestCase):
def test_create_deployment(self):
Deployment('test', 'Artifact', ConfigTree(), '0.0.1')
def test_get_name(self):
d = Deployment('test', 'Artifact', ConfigTree({
... | [
{
"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 | tests/models/test_deployment.py | Hydrospheredata/mist-cli |
"""Accept a text file and do the fizzbuzz upon it.
Your program should accept a file as its first argument.
The file contains multiple separated lines; each line contains
3 numbers that are space delimited. The first number is the first
divider (X), the second number is the second divider (Y), and the
third number is ... | [
{
"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 | python_solutions/fizz_buzz/codeeval_fizzbuzz.py | joelstanner/codeeval |
from typing import Any, Dict, List, Type, TypeVar, Union
import attr
from ..types import UNSET, Unset
T = TypeVar("T", bound="IndyRevRegDefValuePublicKeysAccumKey")
@attr.s(auto_attribs=True)
class IndyRevRegDefValuePublicKeysAccumKey:
""" """
z: Union[Unset, str] = UNSET
additional_properties: Dict[s... | [
{
"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 | acapy_client/models/indy_rev_reg_def_value_public_keys_accum_key.py | dbluhm/acapy-client |
__all__ = [ 'Interval' ]
class Interval(object):
'''Interval - Arbitrary half-closed interval of the form [start, end)'''
def __init__(self, start, end):
self.start = start
self.end = end
def __call__(self, value):
return (1. - value) * self.start + value * self.end
def __str... | [
{
"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 | handsome/Interval.py | bracket/handsome |
# coding: utf-8
"""
Xero Payroll AU
This is the Xero Payroll API for orgs in Australia region. # noqa: E501
Contact: api@xero.com
Generated by: https://openapi-generator.tech
"""
import re # noqa: F401
from xero_python.models import BaseModel
class Timesheets(BaseModel):
"""NOTE: This clas... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},... | 3 | venv/lib/python3.6/site-packages/xero_python/payrollau/models/timesheets.py | 6enno/FarmXero |
#!/usr/bin/env python
# encoding: utf-8
def build_log_urls(node, path):
url = node.web_url_for(
'addon_view_or_download_file',
path=path,
provider='osfstorage'
)
return {
'view': url,
'download': url + '?action=download'
}
class OsfStorageNodeLogger(object):
... | [
{
"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 | website/addons/osfstorage/logs.py | lbanner/osf.io |
# 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_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 | aliyun-python-sdk-vs/aliyunsdkvs/request/v20181212/ModifyDeviceCaptureRequest.py | jia-jerry/aliyun-openapi-python-sdk |
#!/usr/bin/env python
import datetime
import os
import sys
def extract_datetime_from_line(line, year):
# Expected format: I0210 13:39:22.381027 25210 solver.cpp:204] Iteration 100, lr = 0.00992565
line = line.strip().split()
month = int(line[0][1:3])
day = int(line[0][3:])
timestamp = line[1]
p... | [
{
"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 | caffe/tools/extra/extract_seconds.py | blitzingeagle/DeepEmbeddedClustering |
try:
import unittest2 as unittest
except ImportError:
import unittest
import sys
sys.path.append('..')
from pyrabbit import http
class TestHTTPClient(unittest.TestCase):
"""
Except for the init test, these are largely functional tests that
require a RabbitMQ management API to be available on loc... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},... | 3 | tests/test_httpclient.py | singulret/pyrabbit |
# pylint: disable=unused-argument,unused-variable,expression-not-assigned
import os
from datetime import datetime
import pytest
from expecter import expect
import xlrd
from dwellingplace.models._utils import parse_xlsx_into_dicts, get_value
DATA = os.path.join(os.path.dirname(__file__), "data")
def test_load():
... | [
{
"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 | dwellingplace/tests/test_models_utils.py | dwelling-place/xlsx-merger |
import requests
import datetime
import configparser
import json
import copy
from circuits import Component, handler
from events.JobCompleteEvent import JobCompleteEvent
from events.EntityPreprocessedEvent import EntityPreprocessedEvent
class QuestionJobRunnerComponent(Component):
config = configparser.ConfigParser... | [
{
"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 | components/jobRunner/QuestionJobRunnerComponent.py | AmeyKamat/ProjectJarvis |
import asyncio
from pyrogram.types import Message
from tronx import app
from tronx.helpers import (
gen,
)
app.CMD_HELP.update(
{"spam" : (
"spam",
{
"spam [number] [text]" : "You Know The Use Of This Command.",
"dspam [delay] [count] [msg]" : "Delay spam use it to spam with a delay between spamming m... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than... | 3 | tronx/modules/spam.py | JayPatel1314/Tron |
def for_Z():
for row in range(7):
for col in range(7):
if row==0 or row==6 or row+col==6 :
print("*",end=" ")
else:
print(end=" ")
print()
def while_Z():
i=0
while i<7:
j=0
while j<7:
if i==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_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
... | 3 | Alp/cap_alp/Z.py | Ashokkommi0001/patterns |
from flask import Flask
from optparse import OptionParser
import api
from app import config
def create_app():
app = Flask(__name__, static_folder='static')
app.register_blueprint(
api.bp,
url_prefix='')
app.config['SECRET_KEY'] = config.SECRET_KEY
return app
def new_app(*args, **kw... | [
{
"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/runserver.py | maurapintor/pandavision |
'''
Clase que modela una entidad de recomendación, contiene la informacion de automoviles y perfil
'''
class Recommendation:
def __init__(self, id, arrAutomobiles, profile):
self.__id=id
self.__arrAutomobiles=arrAutomobiles
self.__profile=profile
def get_recommendation(self):
da... | [
{
"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": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excl... | 3 | entities/recommendation.py | bitmarc/Recomendautos_Server |
#coding:utf-8
import requests
from lxml import etree
class Xinlang:
def __init__(self):
self.url = 'http://zst.aicai.com/ssq/openInfo/'
self.headers = {
'User-Agent': '"Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0) ",'
}
def get_data(self, url):
response = 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": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fe... | 3 | Directional_crawler/shuangseqiu_caipiao.py | Zyn0423/crawler- |
import sys
import os
import pandas as pd
import pytest
# Avoid error module path
sys.path.insert(0, os.path.abspath( # noqa: E402 - Avoid flake8 error 402
os.path.join(os.path.dirname(__file__), '..'))
)
from pandasbt import calc_signal
from pandasbt.calc_signal import calc_return
from pandasbt import zscore
@... | [
{
"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 | tests/test_calc_signal.py | Janderson/pandasbt |
# 给定一组非负整数,重新排列它们的顺序使之组成一个最大的整数。
# 示例 1:
# 输入: [10,2]
# 输出: 210
# 示例 2:
# 输入: [3,30,34,5,9]
# 输出: 9534330
# 说明: 输出结果可能非常大,所以你需要返回一个字符串而不是整数。
from typing import List
class Solution:
def largestNumber(self, nums: List[int]) -> str:
nums = self.bubble_sort_mod(nums)
return "".join([str(x) ... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/c... | 3 | leetcode/sort/179.py | 1lch2/PythonExercise |
# coding: utf-8
"""
No descripton provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: 2.1.1+01d50e5
Generated by: https://github.com/swagger-api/swagger-codegen.git
Licensed under the Apache License, Version 2.0 (the "License");
you m... | [
{
"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/test_cluster_stats.py | yumimobi/graylog.py |
def square_of_sum(number):
count = 0
for i in range(1,number + 1):
count += i
c_squared = count**2
return c_squared
def sum_of_squares(number):
total = 0
for i in range(1,number + 1):
total = total + (i**2)
return total
def difference(number):
first = square_of_sum(num... | [
{
"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 | student-work/quinn_zepeda/exercism/python/difference-of-squares/difference_of_squares.py | developerQuinnZ/this_will_work |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.