source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
from __future__ import unicode_literals
import unittest
import os
from pymatgen.util.testing import PymatgenTest
from monty.serialization import loadfn
test_dir = os.path.join(os.path.dirname(__file__), "..", "..", "..",
'test_files')
class IRDielectricTensorTest(PymatgenTest):
def set... | [
{
"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 | pymatgen/phonon/tests/test_ir_spectra.py | dynikon/pymatgen |
"""Add post class for blog posts
Revision ID: 4dfdaa23de0
Revises: 48eb772b7a93
Create Date: 2017-08-17 14:02:27.133734
"""
# revision identifiers, used by Alembic.
revision = '4dfdaa23de0'
down_revision = '48eb772b7a93'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"... | 3 | migrations/versions/4dfdaa23de0_add_post_class_for_blog_posts.py | havanhuy1997/pmg-cms-2 |
from crits.core.crits_mongoengine import CritsDocument, CritsSchemaDocument
from mongoengine import DynamicDocument, ListField, ObjectIdField, StringField, DictField, IntField, BooleanField
class SavedSearch(CritsDocument, CritsSchemaDocument, DynamicDocument):
"""
savedSearch class
"""
meta = {
... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": true
},... | 3 | crits/dashboards/dashboard.py | puhley/crits |
"""Unittests for the deepblink.augment module."""
# pylint: disable=missing-function-docstring
from hypothesis import given
from hypothesis.extra.numpy import arrays
import numpy as np
import pytest
from deepblink.augment import augment_batch_baseline
from deepblink.augment import flip
from deepblink.augment import g... | [
{
"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 | tests/test_augment.py | BioinfoTongLI/deepBlink |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for `mcc` package."""
import unittest
from click.testing import CliRunner
from mcc import mcc
from mcc import split
class TestMcc(unittest.TestCase):
"""Tests for `mcc` package."""
def setUp(self):
"""Set up test fixtures, if any."""
def... | [
{
"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/test_mcc.py | IamkkQi/mcc |
import unittest
from ..src import arraylist
# import arraylist
class TestArrayList(unittest.TestCase):
def setUp(self):
self.array = arraylist.ArrayList()
pass
def test_append(self):
array_test = []
for i in range(0,10):
self.array.append(2*i)
array_tes... | [
{
"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 | python/Data Structures/ArrayList/test_arraylist.py | aarodrigues/algorithms |
import json
import time
from bottle import Bottle, request
from engine.app import app
api_server = Bottle()
# CAREFUL: Do NOT perform any computation-related tasks inside these methods, nor inside functions called from them!
# Otherwise your app does not respond to calls made by the FeatureCloud system quickly eno... | [
{
"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 | api/http_ctrl.py | Mohammad-Bakhtiari/app-template |
from os import path
import pytest
import autofit as af
import autolens as al
directory = path.dirname(path.realpath(__file__))
class MockClass:
pass
@pytest.fixture(name="label_config")
def make_label_config(config):
return config["notation"]["label"]
class TestLabel:
def test_b... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{... | 3 | test_autolens/unit/test_config.py | rakaar/PyAutoLens |
#!/usr/bin/env python3
import argparse
import os
import subprocess
def naive_config_read(cfg):
for line in cfg:
key, val = line.strip().split(':')
if key == 'pipe':
return val.strip()
else:
print("Input pipe not found in config")
exit(0)
def main(config_file):
... | [
{
"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 | input.py | aragaer/pa-client |
import copy
import pathlib
import sys
import helpers
import numpy
import pytest
import meshio
@pytest.mark.parametrize(
"mesh, binary, data",
[
(helpers.tet_mesh, False, []),
(helpers.hex_mesh, False, []),
(helpers.tet_mesh, False, [1, 2]),
(helpers.tet_mesh, True, []),
... | [
{
"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 | test/test_flac3d.py | ffilotto/meshio |
import unittest
import sys
sys.path.append('bin')
from umdinst import wrap
class TestIsSourceFile(unittest.TestCase):
def testHasExtension(self):
self.failUnless(wrap.hasextension('foo.c'))
self.failIf(wrap.hasextension('bar'))
def testIsSourceFile(self):
self.failUnless(wrap... | [
{
"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 | test/testissourcefile.py | julianmi/umdinst |
import sys
sys.path.append('..')
import unittest
import jamon
'''
Tests to be run from the command line:
from root directory:
..\JamOn $ python -m unittest tests.name_test
However,
# sys.path.append('..')
makes it so you don't have to run from root
'''
class TestStringMethods(unittest.TestCase):
def te... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
... | 3 | tests/example_test.py | jrburga/JamOn |
from epidemic_simulation.simulation import SimulationManager
import pytest
@pytest.fixture
def test_data():
test_calc=SimulationManager([],{'infection_r':100,'infection_p':0.99,'sickness_duration':6})
return test_calc
def test_infection_prob_between_0_1(test_data):
"""
infection_prob must be between 0... | [
{
"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 | testing/test_is_infected.py | GalBenZvi/EpidemicSimulation |
from typing import Iterable, Callable
import numpy as np
from examples.synthetic_sounds.util import (
seeds_to_wfs,
seed_to_wf_chk,
DFLT_SEEDS,
DFLT_CHUNKER,
chk_tag_gen,
frame_annots_to_chk_annots,
)
from sklearn.decomposition import PCA
from sklearn.svm import SVC
def make_frequency_groups(s... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"ans... | 3 | synthetic_sounds/classification_problems.py | i2mint/examples |
from charmhelpers.core.hookenv import (
config,
status_set,
log,
)
import common_utils
import docker_utils
config = config()
MODULE = "kubernetes-node"
BASE_CONFIGS_PATH = "/etc/contrail"
CONFIGS_PATH = BASE_CONFIGS_PATH + "/contrail-kubernetes-node"
IMAGES = [
"contrail-kubernetes-cni-init",
]
de... | [
{
"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 | contrail-kubernetes-node/hooks/contrail_kubernetes_node_utils.py | progmaticlab/tf-charms |
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# Copyright 2011 Justin Santa Barbara
# Copyright 2014 Steve Huang
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this... | [
{
"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 | common/log.py | stevehuang/TimeLapse |
from django.conf import settings
from django.db import models
# Create your models here.
from django.urls import reverse, NoReverseMatch
from django.utils.safestring import mark_safe
from users.models import Achievement
class Redirect(models.Model):
source = models.CharField(max_length=50)
sink = models.Cha... | [
{
"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 | redirect/models.py | ashbc/tgrsite |
from rest_framework import serializers
from django.contrib.auth.models import User
from django.contrib.auth import authenticate
# user serializer
class userSerializer(serializers.ModelSerializer):
class Meta:
model = User
fields = ('id','username','email')
# register serializer
class registerSe... | [
{
"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 | users/serializers.py | bhagwanZaki/floran_todo_api |
import random
KILLERS = {
"Michael Myers": 7,
"Jason Vorhees": 6,
"Freddy Krueger": 8,
"Jigsaw": 2,
"Pinhead": 9,
"Leatherface": 5,
"Ghostface": 3,
"Hannibal Lecter": 4,
}
def get_killer():
return random.choice(list(KILLERS.keys()))
def killer_battle(k1, k2):
if k1 not in KI... | [
{
"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 | Python/halloween_special/my_app/helpers.py | JacobCallahan/Understanding |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import unittest
from lxml import etree
from os import path
from parse_xml_torah import XmlTorahParser
from torah_model import Perek, TextFragment
from torah_model import Sefer, PasukStart
class XmlTorahParserTest(unittest.TestCase):
def _xml_to_string(self, xml_elt):
""... | [
{
"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 | source/test/parse_xml_test.py | flamholz/kavlar |
class BriefmetricsException(Exception):
pass
class APIException(BriefmetricsException):
def __init__(self, message, code=400, response=None):
self.message = message
self.code = 400
self.response = response
def __repr__(self):
return '%s("%s", code=%d)' % (self.__class__.__... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"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 | briefmetrics/lib/exceptions.py | shazow/briefmetrics |
#!/usr/bin/env python
"""
This module defines some useful design patterns.
"""
from __future__ import division
__author__ = "Shyue Ping Ong"
__copyright__ = "Copyright 2011, The Materials Project"
__version__ = "1.0"
__maintainer__ = "Shyue Ping Ong"
__email__ = "shyuep@gmail.com"
__status__ = "Production"
__date__ ... | [
{
"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 | pymatgen/core/design_patterns.py | NadezhdaBzhilyanskaya/pymatgen |
#!/usr/bin/python
import subprocess as sb
import sys
import os
import stegall as stg
prog = 'hexcurse'
def launch(arg2):
if os.path.isfile(arg2):
os.system(prog +' ' +arg2)
else:
stg.io_error()
exit()
def hedit(arg2):
try :
launch(arg2)
except OSError as e:
if e.errno == os.errno.ENOENT:
stg.p... | [
{
"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 | tools/hexedit.py | mrT4ntr4/Stegall |
# This file is part of Indico.
# Copyright (C) 2002 - 2021 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from __future__ import unicode_literals
from sqlalchemy.ext.declarative import declared_attr
from indico... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": ... | 3 | indico/core/settings/models/settings.py | UNOG-Indico/UNOG-Indico-v2 |
from lunespy.client.transactions.burn import BurnAsset
from lunespy.client.wallet import Account
def test_without_asset_id_ready_failed_successful():
"""
without a asset_id parameter:
- should be return False for BurnAsset.ready
- else should be return True
"""
# Failed
... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": fals... | 3 | test/client/burn/test_burn_asset.py | xonfps/lunespy |
import scrapy
from os import path
INDEX_PATH = './resources/index'
RECORD_PATH = './resources/record'
class NewsSpider(scrapy.Spider):
name = "index"
start_urls = ['http://fund.10jqka.com.cn/smxw_list/index_1.shtml']
def parse_record(self, response):
filename: str = response.url.split('/')[-1]
... | [
{
"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 | data_ai/comp3035/finews/spiders/news_spider.py | lonelyhentai/workspace |
import threading
from logging import getLogger
from time import sleep
from threading import Thread, currentThread
from jsdc.sensor import Sensor
lock = threading.Lock()
class Gatherer:
"""Sensor data gatherer"""
def __init__(self, sensor: Sensor):
self.sensor = sensor
self.gatherer = Thread(... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": ... | 3 | jsdc/gatherer.py | Jacfal/SensorDataCollector |
#!/usr/bin/env python
class FilterModule(object):
def filters(self):
return {'json_env_map': self.json_env_map}
def json_env_map(self, env):
return [{'name': k, 'value': str(v)} for k,v in env.items()]
| [
{
"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 | filter_plugins/env_json_map.py | paulrbr-fl/ansible-clever |
# -*- coding: utf-8 -*-
from util import WebHelpersTestCase
import unittest
from nose.tools import eq_
from webhelpers.text import *
class TestTextHelper(WebHelpersTestCase):
def test_excerpt(self):
self.assertEqual("...lo my wo...",
excerpt("hello my world", "my", 3))
... | [
{
"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/test_text.py | ankurRakuten/WebHelper |
import textwrap
import aiohttp
from aiostripe import error
def new_default_http_client(*args, **kwargs):
return AsyncioClient(*args, **kwargs)
class HTTPClient(object):
def __init__(self, verify_ssl_certs=True):
self._verify_ssl_certs = verify_ssl_certs
def request(self, method, url, headers,... | [
{
"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_class_has_docstring",
"question": "Does every class in this file have a docstring?"... | 3 | aiostripe/http_client.py | cypreess/aiostripe |
import os
import logging
from zope.dottedname.resolve import resolve
from pkg_resources import resource_exists
from pkg_resources import get_provider
from pkg_resources import get_distribution
from z3c.autoinclude.utils import DistributionManager
from z3c.autoinclude.utils import ZCMLInfo
class DependencyFinder(Distri... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self... | 3 | src/z3c/autoinclude/dependency.py | datakurre/z3c.autoinclude |
from functools import wraps
from webob import Request
def robot(adapterModule, **kwargs):
def wrapper(func):
assert hasattr(adapterModule, 'Adapter')
bot = adapterModule.Adapter(func, **kwargs)
return wraps(func)(bot)
return wrapper
| [
{
"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 | src/pengbot/decorators.py | mariocesar/pengbot |
"""An augmentation to randomly rotate an image."""
import random
from discolight.params.params import Params
from .augmentation.types import Augmentation, NumericalRange
from .rotate import Rotate
from .decorators.accepts_probs import accepts_probs
@accepts_probs
class RandomRotate(Augmentation):
"""Randomly rot... | [
{
"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 | src/discolight/augmentations/randomrotate.py | datature/discolight |
import numpy as np
from flask import Flask, request, jsonify, render_template
import pickle
import requests
app = Flask(__name__)
# model = pickle.load(open('model.pkl', 'rb'))
@app.route('/')
def home():
return render_template('index.html')
@app.route('/predict',methods=['POST'])
def predict():
'''
For ... | [
{
"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 | FrontEnd/app.py | SouvikRishi/GetTheFakeOut-GTFO |
# Copyright 2015 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# https://aws.amazon.com/apache2.0/
#
# or in the "license" file accomp... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"... | 3 | tests/functional/test_utils.py | kellertk/boto3 |
"""Demo of how to pop up plots asynchronously using separate processes."""
from __future__ import print_function
# https://gist.github.com/dwf/1222883
from multiprocessing import Process
import time
import sys
import matplotlib.pyplot as plt
import numpy as np
def demo():
i = 0
processes = []
while 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_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"... | 3 | tests/GUI_tests/Ex_pyplot2.py | davtoh/RRTools |
import os
import pytest
import requests_mock
import CTRegisterMicroserviceFlask
from CTRegisterMicroserviceFlask.errors import NotFound
@pytest.fixture
def validate_env():
if not os.getenv('CT_URL'):
raise Exception('CT_URL needs to be set')
if not os.getenv('CT_TOKEN'):
raise Exception('CT_... | [
{
"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 | CTRegisterMicroserviceFlask/tests/call_endpoint_tests.py | Skydipper/ct-register-microservice-python-flask |
import unittest
from unittest.mock import MagicMock
from tests.test_base import TestBase
from timerecorder import timerecord
from timerecorder.receiver import Receiver
from timerecorder.statsProcessor import StatsProcessor
class TestTimeRecord(TestBase):
def __init__(self, methodName):
TestBase.__init__(s... | [
{
"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 | tests/test_timerecord.py | maxbechtold/dirt-rally-time-recorder |
# coding=utf8
# Copyright 2018 JDCLOUD.COM
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed ... | [
{
"point_num": 1,
"id": "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 | jdcloud_sdk/services/jdccs/apis/DescribeIdcOverviewRequest.py | Tanc009/jdcloud-sdk-python |
import tcod
def initialize_fov(game_map):
fov_map = tcod.map_new(game_map.width, game_map.height)
for y in range(game_map.height):
for x in range(game_map.width):
tcod.map_set_properties(
fov_map,
x,
y,
not game_map.tiles[x][... | [
{
"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 | roguelike/fov_functions.py | clamytoe/roguelike |
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from __future__ import unicode_literals
from ..featuredetection import DistanceMaps
def test_DistanceMaps_inputs():
input_map = dict(
args=dict(argstr='%s', ),
environ=dict(
nohash=True,
usedefault=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": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": fal... | 3 | nipype/interfaces/semtools/filtering/tests/test_auto_DistanceMaps.py | abelalez/nipype |
"""Linked nodes in both direction"""
class DoublyLinkedNode:
"""Represents doubly linked list of nodes from a doubly linked list"""
def __init__(self,
list_in,
next_node=None,
previous_node=None,
value=None):
self.next_node = next_no... | [
{
"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 | pyformlang/finite_automaton/doubly_linked_node.py | IlyaEp/pyformlang |
from unittest.mock import patch
from django.core.management import call_command
from django.db.utils import OperationalError
from django.test import TestCase
class CommandTests(TestCase):
# we will use this function to mock the behavior of getitem
def test_wait_for_db_ready(self):
"""Test waiting fo... | [
{
"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": true
},... | 3 | app/core/tests/test_commands.py | enpifa-travelperk/recipe-app-api |
import json
from phc.base_client import BaseClient
from phc.easy.auth import Auth
from phc.easy.ocr.options.ocr_config_types import Config as OcrConfig
class Config:
@staticmethod
def create(config: OcrConfig, auth_args: Auth = Auth.shared()):
auth = Auth(auth_args)
client = BaseClient(auth.s... | [
{
"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 | phc/easy/ocr/config.py | lifeomic/phc-sdk-py |
from deepdab.ai import *
class TDZeroPolicy(TabularPolicy):
def __init__(self, board_size, learning_rate=0.0, gamma=0.0, epsilon=0.0, initial_state_value=0.0, table_file_path=None):
super(TDZeroPolicy, self).__init__(board_size=board_size, epsilon=epsilon,
initia... | [
{
"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 | deepdab/ai/td0_policy.py | lantunes/deepdab |
import os
import pytest
from app.file_storage import clean_up
class MockFs:
@staticmethod
def listdir():
return ["1.txt", "2.txt", "3.txt"]
@staticmethod
def remove():
return
@pytest.fixture
def mock_setting(monkeypatch):
monkeypatch.setenv("FILE_STORAGE", "tmp")
monkeypat... | [
{
"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 | tests/test_file_storage.py | dasdachs/media-api |
# Copyright Contributors to the Packit project.
# SPDX-License-Identifier: MIT
from os import getenv
from celery import Celery
from lazy_object_proxy import Proxy
from packit_service.models import get_pg_url
from packit_service.sentry_integration import configure_sentry
class Celerizer:
def __init__(self):
... | [
{
"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 | packit_service/celerizer.py | jpopelka/packit-service |
from . import textakel
FUNCTIONS = {
"alphabetical": textakel.alphabetical,
"capitalize": textakel.capitalize,
"casefold": textakel.casefold,
"count_multiples": textakel.count_multiples,
"lower": textakel.lower,
"remove-consonant": textakel.remove_consonant,
"remove-digit": textakel.remove_... | [
{
"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 | textakel/api.py | alexbennik/textakel |
import re
def list_cite(tex):
r"""
List all citation keys in::
\cite{...}
\citet{...}
\citep{...}
"""
# extract keys from "cite"
def extract(s):
try:
return list(
re.split(r"([pt])?(\[.*\]\[.*\])?(\{[a-zA-Z0-9\,\-\ ]*\})", s)[3][1:-1].s... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
... | 3 | GooseBib/tex.py | tdegeus/GooseBib |
# --------------------------------------------------------
# Written by: Romuald FOTSO
# Licensed: MIT License
# Copyright (c) 2017
# Based on 'dandxy89' github repository:
# https://github.com/dandxy89/ImageModels/blob/master/KerasLayers/Custom_layers.py
# --------------------------------------------------------
from ... | [
{
"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 | libs/cnn/customlayers.py | franckfotso/kr_cnn_models |
class Account:
# Constructor untuk akun
def __init__(self, initial_balance):
self._initial_balance = initial_balance
if self._initial_balance < 0:
raise ValueError("Saldo awal harus lebih besar atau sama dengan 0")
# Getter untuk akun
@property
def initial_balance(self):
return self._initial_ba... | [
{
"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 | Tugas 0/Account/Account.py | hafidh561/Pemrograman-Berorientasi-Objek |
"""
@author: krakowiakpawel9@gmail.com
@site: e-smartdata.org
"""
from mrjob.job import MRJob
from mrjob.step import MRStep
class MRFlight(MRJob):
def steps(self):
return [
MRStep(mapper=self.mapper,
reducer=self.reducer)
]
def mapper(self, _, line):
(... | [
{
"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 | 04_airports/04_average_departue_arrival_delay_by_month.py | krakowiakpawel9/big-data-hadoop-map-reduce-course |
import argparse
from .iterator import BedEntryIterator
from lhc.io.bed.tools import depth, sort, filter
from lhc.io.txt.tools import compress
def iter_bed(fname):
it = BedEntryIterator(fname)
for entry in it:
yield entry
it.close()
def main():
args = get_parser().parse_args()
args.func(... | [
{
"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 | lhc/io/bed/__main__.py | EnjoyLifeFund/macHighSierra-py36-pkgs |
from boa.blockchain.vm.Neo.Blockchain import GetHeight, GetHeader
from boa.blockchain.vm.Neo.Header import GetTimestamp, GetConsensusData
from boa.blockchain.vm.Neo.Runtime import Log
from boa.code.builtins import concat, list, range, take, substr
def blockTimeStamp():
current_height = GetHeight()
c... | [
{
"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 | cashflow/utils.py | wg-git/cashflow-contract |
from math import ceil, floor
from pathlib import Path
import cv2
import numpy as np
from util import load, save
def pad_square(img):
h, w, c = img.shape
size = max(h, w)
pad_h = size - h
pad_w = size - w
img = np.pad(img, ((floor(pad_h / 2), ceil(pad_h / 2)),
(floor(pad_... | [
{
"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 | imgs/make_table.py | RElbers/strotss-pytorch |
import time
from tests.common.nebula_test_suite import NebulaTestSuite
class TestBugUpdate(NebulaTestSuite):
@classmethod
def prepare(self):
resp = self.execute(
'CREATE SPACE IF NOT EXISTS issue1827_update(partition_num={partition_num}, replica_factor={replica_factor})'
.forma... | [
{
"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/query/bugs/fixed_update_issue1827.py | wenhaocs/nebula |
# -----------------------------------------------------------------------------
#
# Copyright (C) 2021 CERN & Newcastle University for the benefit of the
# BioDynaMo collaboration. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance w... | [
{
"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 | cli/print_command.py | nicogno/biodynamo |
from ..utils.core import concatenate
class StreamList(list):
"""Class to replace a basic list for streamed products
"""
def __init__(self, product):
if isinstance(product, list):
super(StreamList, self).__init__(product)
else:
super(StreamList, self).__init__([prod... | [
{
"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 | geeksw/framework/stream.py | guitargeek/geeksw |
from polyphony import testbench
def fib(n):
if n <= 0: return 0
if n == 1: return 1
r0 = 0
r1 = 1
for i in range(n-1):
prev_r1 = r1
r1 = r0 + r1
r0 = prev_r1
return r1
@testbench
def test():
expect = [0,1,1,2,3,5,8,13,21,34,55,89,144,233,377,610]
for i in range(... | [
{
"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 | Tutorial_2/fib.py | ryos36/polyphony-tutorial |
class AttrDict(dict):
IMMUTABLE = '__immutable__'
def __init__(self, *args, **kwargs):
super(AttrDict, self).__init__(*args, **kwargs)
self.__dict__[AttrDict.IMMUTABLE] = False
def __getattr__(self, name):
if name in self.__dict__:
return self.__dict__[name]
el... | [
{
"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 | thirdparty/collections.py | HongLabTHU/dual-mVEPs |
class TrieNode:
def __init__(self):
self.children = {}
self.isWord = False
class Trie:
def __init__(self):
self.root = TrieNode()
def put(self, word):
current = self.root
for i in range(0, len(word)):
child = word[i]
tmp = None
... | [
{
"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 | Python/DataStructures/Trie.py | AndrewMcShane/DevMakingSource |
def genFile(name):
return open(name, "w+")
def writeFile(f , content):
f.write(content)
| [
{
"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 | genFile.py | Joshua-amare/Word-Analyzer |
# write python function to compute:
# volume of a box (input | length, width, height)
# volume of a sphere (Given radius, Height)
# volume of pyramid (Given length, width, height)
# volume of a cylinder (Given radius, height)
# Print volume
import math
def volume_box(length, width, height):
volume = length * wid... | [
{
"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 | CS-190/Labs/Lab8.py | lividsubset3/College-CS |
import pytest
from api2ch import Api2chAsync, Api2chError
@pytest.mark.asyncio
class TestApiAsync:
async def test_thread(self, api_async: Api2chAsync):
await api_async.thread('api', 1)
with pytest.raises(Api2chError):
await api_async.thread('b', 1)
async def test_threads(self, a... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
... | 3 | tests/test_api_async.py | uburuntu/api2ch |
# author: gorquan <gorquanwu@gmail.com>
# date: 2019.7.21
import json
class RequestMsg():
def __init__(self, comment, flag):
self.comment = comment
self.flag = flag
def accept(self):
replyMessage = {"action": "set_friend_add_request",
"params": {
... | [
{
"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 | wsMiddle/requestMsg.py | gorquan/tangdou |
from io import BytesIO
import torch
from ts.torch_handler.base_handler import BaseHandler
class NetHandler(BaseHandler):
def preprocess(self, data):
# TODO: temporarily set the model in training mode,
# instead of eval mode until model is fixed.
self.model.train()
return torch.lo... | [
{
"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 | model-server/net_handler.py | Practicum-Team-2/DeepLIIF |
from config.SourceUrl import getUrl
from ip.Ip2Db import insert
import threading
import requests
from Log import log
header = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36'
}
def acquireIp():
aUrl = getUrl()
log.info('获... | [
{
"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 | IPAddressPool/IPAddressPool/ip/IpAcquire.py | ruxuezhuimeng/spider |
from threading import Thread
from flask import current_app, render_template
from flask_mail import Message
from pili.app import celery, mail
def send_email(to, subject, template, **kwargs):
"""Send email using either Celery, or Thread.
Selection depends on CELERY_INSTEAD_THREADING config variable.
"""
... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding sel... | 3 | pili/email.py | pilosus/pili |
# -*- coding: utf-8 -*-
"""
@author: alex
"""
import numpy as np
def main():
"""Main program execution."""
n,h1,h2,h3 = generate_ammonia_sites()
nList = [[1,2,3],[0],[0],[0]]
return [n,h1,h2,h3], nList
def generate_ammonia_sites():
"""Generate the locations for the atoms in the amm... | [
{
"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 | kappa/lattice/ammonia.py | ajkerr0/kappa |
import jwt
import os
from sparrow_cloud.utils.get_cm_value import get_env_value
from sparrow_cloud.utils.get_settings_value import get_settings_value
def get_jwt_secret():
return get_env_value("JWT_SECRET") or get_settings_value("JWT_MIDDLEWARE").get("JWT_SECRET")
# def decode_jwt(token):
# secret = get_jwt... | [
{
"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_under_20_lines",
"question": "Is every function in this file shorter than 2... | 3 | sparrow_cloud/utils/decode_jwt.py | waro163/sparrow_cloud |
class Frame:
def __init__(self, rtsp_address, fps, img_id, img, time, gray_scale_flag):
self.__rtsp_address = rtsp_address
self.__fps = fps
# Frame
self.__img_id = img_id
self.__img = img
self.__time = time
self.__img_shape = img.shape
self.__gray_scale_flag = gray_scale_flag
def get_img_id(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": false
... | 3 | RTSP_python_multi_threading/frame.py | qbxlvnf11/Python-RTSP-Real-Time-Streaming-Protocol- |
from argparse import ArgumentParser
from matplotlib import pyplot as plt
from greengraph.Graph import Graph
'''
This class implements the command line interface.
'''
def runModule():
parser = ArgumentParser(description='Generates a graph that displays the number of green pixels per step between two geographical l... | [
{
"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 | greengraph/cmd.py | stiebels/MPHYG001_assignment-1 |
from unittest.mock import mock_open, patch
from y_2020.day5 import Day
with patch("builtins.open", mock_open(read_data=":")):
day = Day()
def test_preprocess_input():
day._input_data = ["FBFBBFFRLR"]
day._preprocess_input()
assert day._Day__decoded_seats == [357]
day._input_data = ["BFFFBBFRRR"... | [
{
"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/y_2020/test_2020_day5.py | Stegallo/adventofcode |
import os
import matplotlib.pyplot as plt
import numpy as np
from PIL import Image
def make_trainable(net, val):
net.trainable = val
for layer in net.layers:
layer.trainable = val
def plot_loss(losses):
plt.figure(figsize=(10, 8))
plt.plot(losses['g'], label='generative loss')
plt.plot(... | [
{
"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 | src/util.py | lukamaletin/multi-gan |
# -*- coding: utf-8 -*-
"""
weatherapi
This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ).
"""
import weatherapi.models.forecastday
class Forecast(object):
"""Implementation of the 'Forecast' model.
TODO: type model description here.
Attributes:
forecastday... | [
{
"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": true
}... | 3 | weatherapi/models/forecast.py | VaibhavBhujade/Weather-or-not |
from __future__ import unicode_literals
from django.db import models
from django import forms
from django.template.defaultfilters import slugify
from django.contrib.auth.models import User
from django.utils import timezone
class Category(models.Model):
name = models.CharField(max_length=128, unique=True)
vie... | [
{
"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 | rango/models.py | StandeBoerIsle/tango_with_django_project |
# coding: utf-8
"""
Url2Src APIs
Url to Image src urls.<BR />[Endpoint] https://api.apitore.com/api/15 # noqa: E501
OpenAPI spec version: 0.0.1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import swagger_client
f... | [
{
"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 | 15/test/test_link_response_entity.py | apitore/apitore-sdk-python |
class FluidsObs(object):
"""
The base FLUIDS observation interface
"""
def __init__(self):
pass
def get_array(self):
"""
Returns a numpy array representation of the observation
Returns
-------
np.array
"""
raise NotImplementedError
| [
{
"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 | fluids/obs/obs.py | kargarisaac/Urban_Driving_Simulator |
# -*- coding: utf-8 -*-
"""
@date: 2021/8/29 下午2:36
@file: custom_basicblock.py
@author: zj
@description:
"""
from torch import Tensor
import torch.nn as nn
from torchvision.models.resnet import BasicBlock
class CustomBasicBlock(nn.Module):
def __init__(self, basicblock):
super().__init__()
as... | [
{
"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 | rfd/model/resnet/custom_basicblock.py | ZJCV/KnowledgeReview |
import speech_recognition as sr
import pyttsx3
listener = sr.Recognizer()
engine = pyttsx3.init()
def speak(phrase):
engine.say(phrase)
engine.runAndWait()
def set_voice():
"""
Set voice to English by default.
Can modify the chosen_voice variable to set a different default voice.
:return... | [
{
"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/__init__.py | TrialAndErrror/TnE_Assistant |
import unittest
from typing import Any, List, Tuple
from unittest.mock import MagicMock, patch
from io import StringIO
from nixpkgs_review.cli import main
from .cli_mocks import (
CliTestCase,
build_cmds,
Mock,
IgnoreArgument,
MockCompletedProcess,
read_asset,
)
def wip_command_cmds() -> L... | [
{
"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 | nixpkgs_review/tests/test_wip.py | jonringer/nixpkgs-review |
import os
import shutil
import time
from mklib import Task
from mklib.common import relpath
class foo(Task):
default = True
results = ["foo.txt"]
deps = ["bar.txt"]
def make(self):
src = self.deps[0].path
dst = self.results[0].path
self.log.info("cp %s %s", relpath(src), relpat... | [
{
"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_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false... | 3 | test/data/outofdate/Makefile.py | ActiveState/mk |
import unittest
from old import module0_formula_and_identifier_retrieval
import pandas as pd
# Python Tutorial: Unit Testing Your Code with the unittest Module:
#https://www.youtube.com/watch?v=6tNS--WetLI
# Retrieve sample QIDs
sample_IDs_filepath = r'evaluation\sample_IDs.csv'
QIDs_column_name = 'QID'
def get_sa... | [
{
"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 | module_unit_tests.py | NYC00kie/PhysWikiQuiz |
from kulka import Kulka
import time
ADDR = 'XX:XX:XX:XX:XX:XX'
STEPS = 10
SPEED = 0x30
SLEEP_TIME = 0.3
def make_a_step(kulka, current_angle):
kulka.roll(SPEED, current_angle)
time.sleep(SLEEP_TIME)
kulka.roll(0, current_angle)
def make_a_circle(kulka, steps):
rotate_by = 360 ... | [
{
"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 | bb8/kulka_testing_.py | CoderAryanAnand/fun_projects |
from typing import List
from . import AccessRequest, FileID, PartSpec, PartsGenerator
class NonCorrelatedSchemesGenerator(object):
def __init__(self, number: int, fraction: float) -> None:
self._number: int = number
self._fraction: float = fraction
self._parts_number: int = 2 ** number
@property
def number... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"a... | 3 | src/simulator/workload/schemes.py | pskopnik/htc-cache-simulator |
import logging
import random
import string
import sys
import time
import unittest
import apiritif
def setup():
target = apiritif.http.target('http://localhost:8000/')
target.keep_alive(True)
target.auto_assert_ok(True)
target.use_cookies(True)
target.allow_redirects(True)
vars = {
... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
... | 3 | tests/resources/apiritif/test_vars.py | adrianantonypillai/taurus |
class Solution(object):
def uniquePaths(self, m, n):
def factorial(n):
ans = 1
for i in xrange(1, n+1):
ans *= i
return ans
return factorial((m-1)+(n-1))/(factorial(n-1)*factorial(m-1)) | [
{
"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 | problems/unique-paths.py | sailikhithk/tech-interview-prep |
# coding=utf-8
'''
Created: 2021/3/12
@author: Slyviacassell@github.com
'''
import torch
import torch.nn as nn
from memonger import SublinearSequential
class Stage(nn.Module):
def __init__(self, out_channels, layers):
super(Stage, self).__init__()
if isinstance(layers, (nn.Sequential, Sublinear... | [
{
"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 | modules/Stage.py | slyviacassell/Multi-taks-UNITE |
import torch
# Gradient Reversal Layer
class GRLayer(torch.autograd.Function):
@staticmethod
def forward(ctx, x, lmbd=0.01):
ctx.lmbd = torch.tensor(lmbd)
return x.reshape_as(x)
@staticmethod
# 输入为forward输出的梯度
def backward(ctx, grad_output):
grad_input = grad_output.clone(... | [
{
"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 | modules/grl.py | LindgeW/AT4MTL |
'''
Module: utility
Author: David Frye
Description: Contains a variety of helper Classes.
'''
import enum
import random
class Direction(enum.Enum):
'''
Enum: Direction
Description: Represents the four primary cardinal directions (North, East, South, and West)
'''
NORTH = 0
EAST = 1
SOUTH = 2
WEST = 3
def ge... | [
{
"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 | utility.py | DFrye333/DynamicMaze |
# coding: utf-8
"""
Engine api
Engine APIs # noqa: E501
The version of the OpenAPI document: 1.0.4
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import unittest
import vtpl_api
from vtpl_api.models.meta_no_seat_belt_event import MetaNoSeatBeltEvent # no... | [
{
"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 | test/test_meta_no_seat_belt_event.py | vtpl1/vtpl_api |
from filebeat import BaseTest
import os
"""
Contains tests for filtering.
"""
class Test(BaseTest):
def test_dropfields(self):
"""
Check drop_fields filtering action
"""
self.render_config_template(
path=os.path.abspath(self.working_dir) + "/test.log",
filt... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false... | 3 | vendor/github.com/elastic/beats/filebeat/tests/system/test_filtering.py | ykyuen/dockerbeat |
"""Implements sauce lab login abstraction."""
from selenium.webdriver.remote.webdriver import WebDriver
from module_06.src.elements.base_page_element import BasePageElement
from module_06.src.locators.login import LoginPageLoc
from module_06.src.pages.base_page import BasePage
from module_06.src.pages.inventory import ... | [
{
"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 | module_06/src/pages/login.py | IvanJL/2021_python_selenium |
#
# MAKEPLOTS--A library for making plots for demaniacs
#
#
#
from pylab import *
import numpy
def plotframe(data):
"""Plot the entire data array
returns a figure
"""
nimg = 10
ywidth = 0.08
xlen = len(data[0]) / nimg
for i in range(nimg):
yax = 0.90 - ywidth * 1.1 * i
... | [
{
"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 | PySpectrograph/Utilities/makeplots.py | crawfordsm/pyspectrograph |
'''
Created on 11 Aug 2017
String rotation: Assume you have a method isSubstring which checks if one word is a substring
of another. Given two strings, s1 and s2, write code to check if s2 is a rotation of s1 using only one
call to isSubstring (e.g. "waterbottle" is rotation of "erbottlewat)
@author: igoroya
'''
def ... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding sel... | 3 | crackingcointsolutions/chapter1/excersisenine.py | igoroya/igor-oya-solutions-cracking-coding-interview |
from django.shortcuts import render, get_object_or_404
# Create your views here.
from django.views.generic import TemplateView
from example.simple_cms_app.models import SimpleModel
class SimpleView(TemplateView):
template_name = 'simple_cms_app/detail.html'
def get_context_data(self, **kwargs):
kwa... | [
{
"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 | example/simple_cms_app/views.py | bmcmurray/djangocms-workflows |
from cms.extensions.toolbar import ExtensionToolbar
from cms.toolbar_pool import toolbar_pool
from cms.utils import get_language_list
from django.utils.translation import get_language, ugettext_lazy as _
from . import models
@toolbar_pool.register
class ImageExtensionToolbar(ExtensionToolbar):
model = models.Im... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
... | 3 | djangocms_page_image/cms_toolbars.py | nburlett/djangocms-page-image |
import re
from .base import CodingSequence
from ...helpers.files import read_and_parse_fasta_seqio
class GCContentSecondPosition(CodingSequence):
def __init__(self, args) -> None:
super().__init__(**self.process_args(args))
def run(self):
# create biopython object of sequences
record... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": ... | 3 | biokit/services/coding_sequences/gc_content_second_position.py | JLSteenwyk/BioKIT |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2018 damian <damian@C-DZ-E5500>
#
# Distributed under terms of the MIT license.
"""
"""
import subprocess
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
import yaml
def read_file(filename):
with open(f... | [
{
"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 | bandit/insecureCode.py | mir-dhaka/coding_playground |
from django.conf.urls import url, include, handler404
from django.http import HttpResponse, HttpResponseNotFound
from django.template import Template, Context
from django.contrib import admin
import treenav.urls
from ..admin import MenuItemAdmin
from ..models import MenuItem
admin.autodiscover()
# create a second Ad... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding sel... | 3 | treenav/tests/urls.py | itsdkey/django-treenav |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.