source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
import logging
import json
import os
import argparse
import tensorflow as tf
import numpy as np
from contextlib import contextmanager
import fcntl
logger = logging.getLogger(__name__)
def save_to_json(data, f_name):
with tf.io.gfile.GFile(f_name, 'w') as writer:
writer.write(json.dumps(data, cls=JSONEnco... | [
{
"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 | utils/misc.py | francoispichard/covid_twitter_bert_imbalanced |
# Tweepy
# Copyright 2009-2010 Joshua Roesslein
# See LICENSE for details.
from __future__ import print_function
import six
class TweepError(Exception):
"""Tweepy exception"""
def __init__(self, reason, response=None, api_code=None):
self.reason = six.text_type(reason)
self.response = respon... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?... | 3 | tweepy/error.py | Wolfofcryptos/tweepy |
import json
def respond(err, res=None):
return {
'statusCode': 400 if err else 200,
'body': 'Python error' if err else json.dumps(res),
'message': 'Python error' if err else res.get('message'),
'headers': {
'Content-Type': 'application/json'
}
}
def parse_pa... | [
{
"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 | src/python_lambdas/hello_world.py | jonwhittlestone/lambda-api-boto3 |
#!/usr/bin/env python3
import sys
import os
import argparse
def read_params(args):
parser = argparse.ArgumentParser(description='Convert LEfSe output to '
'Circlader input')
parser.add_argument( 'inp_f', metavar='INPUT_FILE', nargs='?',
default=None, typ... | [
{
"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 | lefse2circlader.py | bvaisvil/lefse |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author: Benjamin Vial
# License: MIT
import pytest
from gyptis.utils.parallel import *
def f(x, y, a=1, b="b"):
print(f"f called with {x} {y} {a} {b}")
y = x ** 2
print(f"output y = {x}^2 = {y}")
return y
@parloop(n_jobs=4)
def fpar(x, *args, **kwar... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",... | 3 | tests/test_parallel.py | benvial/gyptis |
# python3
# Copyright 2018 DeepMind Technologies Limited. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless re... | [
{
"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 | acme/jax/networks/rescaling.py | ostap-viniavskyi/acme |
import os
import zlib
import uuid
import re
def get_image(repository, name):
"""Get the full image name by integrating repository and image name.
:param repository: The name of repository
:param name: The short image name
:returns: str: Full image name, format: repo/name.
"""
return "{repo}/{... | [
{
"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 | kubeflow/fairing/utils.py | suomitekai/fairing |
# -*- coding: utf-8 -*-
from scrapy.linkextractors import LinkExtractor
from scrapy.spiders import CrawlSpider, Rule
from tasksmanager.models import SpiderTask
class DefaultCrawlerSpider(CrawlSpider):
name = 'defaultcrawler'
def __init__(self, *args, **kwargs):
self.domain = kwargs.get('domain')
... | [
{
"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 | scrapyapp/scrapyapp/spiders/DefaultCrawler.py | sharawy/genie_crawler |
from werkzeug.security import generate_password_hash, check_password_hash
from shopyoapi.init import db
from flask_login import UserMixin
from modules.course.models import Course
from modules.lightcourse.models import LightCourse
from modules.course.models import QuizHistory
course_subs = db.Table('course_subs',
... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": ... | 3 | modules/auth/models.py | Maurilearn/learnings |
# This example requires the 'members' privileged intents
import diskord
class MyClient(diskord.Client):
async def on_ready(self):
print(f'Logged in as {self.user} (ID: {self.user.id})')
print('------')
async def on_member_join(self, member):
guild = member.guild
if guild.syste... | [
{
"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 | examples/new_member.py | Hype3808/diskord |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
This is rumdom run node.
subscribe No topcs.
Publish 'cmd_vel' topic.
mainly use for simple sample program
by Takuya Yamaguhi.
'''
import rospy
import random
from geometry_msgs.msg import Twist
class RandomBot():
def __init__(self, bot_name="NoName"):
... | [
{
"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 | burger_war_dev/scripts/randomRun.py | shendongqiang/burger_war_dev |
"""initial database
Revision ID: 4be2799e102a
Revises:
Create Date: 2018-11-28 20:39:45.470767
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '4be2799e102a'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto g... | [
{
"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 | RESTBasic/migrations/versions/4be2799e102a_initial_database.py | vgeorgo/courses-python-udemy-create-websites-using-flask |
import os
import posixpath
from enum import Enum
from fastapi import Path, HTTPException
from utils import security
class UploadPath(str, Enum):
default = "default"
UPLOAD_PATH_DICT = {
UploadPath.default: "default/"
}
def get_upload(upload_key: UploadPath = Path(..., description="上传文件块位置")):
"""
... | [
{
"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 | app/file/config/__init__.py | SystemLight/T-fastapi |
"""empty message
Revision ID: 0076_add_intl_flag_to_provider
Revises: 0075_create_rates_table
Create Date: 2017-04-25 09:44:13.194164
"""
# revision identifiers, used by Alembic.
revision = "0076_add_intl_flag_to_provider"
down_revision = "0075_create_rates_table"
import sqlalchemy as sa
from alembic import op
de... | [
{
"point_num": 1,
"id": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 lines?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
}... | 3 | migrations/versions/0076_add_intl_flag_to_provider.py | cds-snc/notifier-api |
"""
Migration script to create tables for tracking workflow invocations.
"""
from __future__ import print_function
import datetime
import logging
from sqlalchemy import (
Column,
DateTime,
ForeignKey,
Integer,
MetaData,
Table
)
from galaxy.model.migrate.versions.util import (
create_table... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": fals... | 3 | lib/galaxy/model/migrate/versions/0041_workflow_invocation.py | lawrence14701/galaxy |
import coffeewhale
import time
def main():
test_func()
@coffeewhale.on_except
def test_func():
print('start sleeping')
time.sleep(1)
print('after sleep')
raise Exception()
# coffeewhale.notify(url="https://hooks.slack.com/services/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",
# result='... | [
{
"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 | main.py | hongkunyoo/coffeewhale |
from abc import ABC, abstractmethod
from typing import List, Literal
class StorageProvider(ABC):
@abstractmethod
def __init__(self, allow_db_create=False, if_table_exists: Literal['ignore', 'recreate'] = 'ignore'):
pass
### MAIN INTERFACE ###
# Function args are the split parts of a typical db... | [
{
"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 | authlib/repo/provider/base_provider.py | jmrafael/Streamlit-Authentication |
import RPi.GPIO as GPIO
import logging
log = logging.getLogger("gc.b")
# Note choose a pin that has pull down on by default to avoid opening the door on reboot.
DOORPIN = 17
ECHOPIN = 27
TRIGGERPIN = 22
REEDPIN = 23
def init():
""" Initializes GPIOS """
log.info("Setup GPIO")
GPIO.setmode(GPIO.BCM)
G... | [
{
"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 | raspberry/src/board.py | mnordlund/GarageController |
"""
Example file on how to display a networkx graph on a browser
"""
import json
import networkx as nx
from networkx.readwrite import json_graph
import http_server
import random
# https://www.alanzucconi.com/2015/11/03/recreational-maths-python/
# Converts a number in the list of its digits
def int_to_list(n):
#... | [
{
"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 | program.py | dborbor/InteractiveGraph |
try:
from . import BASE, SESSION
except ImportError:
raise AttributeError
from sqlalchemy import BigInteger, Column, Numeric, String, UnicodeText
class Welcome(BASE):
__tablename__ = "codwelcome"
chat_id = Column(String(14), primary_key=True)
previous_welcome = Column(BigInteger)
... | [
{
"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 | usercodex/sql_helper/welcome_sql.py | ipindanger/Codex-z |
import os
import pytest
import time
from linenotipy import Line
@pytest.fixture(scope="module", autouse=True)
def scope_module():
token = os.environ["line_notify_token"]
yield Line(token=token)
@pytest.fixture(scope="function", autouse=True)
def line(scope_module):
time.sleep(1)
yield scope_module
... | [
{
"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_linenotipy.py | 10mohi6/line-notify-python |
from pyramid_layout.layout import layout_config
@layout_config(template='h:templates/base.pt')
class BaseLayout(object):
csp = None
inline_webfont = True
requirements = (('app', None),)
def __init__(self, context, request):
self.context = context
self.request = request
self.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": false
}... | 3 | h/layouts.py | gnott/h |
import ray
from copy import deepcopy
from leaderboard.leaderboard_evaluator import LeaderboardEvaluator
from leaderboard.utils.statistics_manager import StatisticsManager
@ray.remote(num_cpus=1./8, num_gpus=1./4, max_restarts=100, max_task_retries=-1)
class ScenarioRunner():
def __init__(self, args, scenario_class... | [
{
"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 | runners/scenario_runner.py | cgeller/WorldOnRails |
#
# softmax paddle model generator
#
import numpy as np
import sys
from save_model import saveModel
def softmax(name: str, x, axis):
import paddle as pdpd
pdpd.enable_static()
node_x = pdpd.static.data(name='x', shape=x.shape, dtype='float32')
out = pdpd.nn.functional.softmax(x=node_x, axis=axis)
... | [
{
"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 | src/core/tests/frontend/paddlepaddle/test_models/gen_scripts/generate_softmax.py | ytorzuk-altran/openvino |
#!/usr/bin/env python3
from typing import Dict
from iometrics.example import usage
from iometrics.pytorch_lightning.callbacks import LOG_KEY_DISK_UTIL
from iometrics.pytorch_lightning.callbacks import NetworkAndDiskStatsMonitor
def test_all_metrics() -> None:
last_row = usage(1)
assert "0.0" in last_row
de... | [
{
"point_num": 1,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"an... | 3 | tests/test_iometrics.py | moritazy/iometrics |
# 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": "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 | aliyun-python-sdk-edas/aliyunsdkedas/request/v20170801/ListDegradeControlsRequest.py | sdk-team/aliyun-openapi-python-sdk |
'''
SIGNUS V1 post API
'''
from flask import g
from app.api.signus_v1 import signus_v1 as api
from app.api.decorators import timer, login_required, login_optional
from app.controllers.post import (post_like,
post_unlike,
post_view)
@api.route("/post/... | [
{
"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 | SIGNUS/app/api/signus_v1/post.py | 837477/SIGNUS |
#! /Users/gabriel.hernandez/.virtualenvs/better/bin/python
from lifxlan import LifxLAN
import time
aqua = (180, 94.31, 100)
orag = (37, 100, 100)
pink = (308, 81.18, 100)
max_range = 65535
hue_range = 360
sat_bri_r = 100
FPS = 60
# dt is the time delta in seconds (float).
class LaserCatTheme():
def __init_... | [
{
"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 | laser-cat.py | webspinner/lifxlan-themes |
from pairs.ir.block import pairs_block
from pairs.ir.variables import VarDecl
from pairs.sim.lowerable import Lowerable
class VariablesDecl(Lowerable):
def __init__(self, sim):
super().__init__(sim)
@pairs_block
def lower(self):
for v in self.sim.vars.all():
VarDecl(self.sim, ... | [
{
"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 | src/pairs/sim/variables.py | rafaelravedutti/pairs |
from abc import ABC, abstractmethod
from status import Status
class State(ABC):
def __init__(self, turret_controls, body_controls, status: Status):
self.turret_controls = turret_controls
self.body_controls = body_controls
self.status = status
@abstractmethod
def perform(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": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excludi... | 3 | src/states/state.py | Iain530/do-you-have-the-guts2018 |
from numba.cuda.testing import unittest, SerialMixin, skip_on_cudasim
from numba import cuda
from numba.core import config
class MyError(Exception):
pass
regex_pattern = (
r'In function [\'"]test_exc[\'"], file [\:\.\/\\\-a-zA-Z_0-9]+, line \d+'
)
class TestUserExc(SerialMixin, unittest.TestCase):
de... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answe... | 3 | numba/cuda/tests/cudapy/test_userexc.py | ARF1/numba |
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license.
import unittest
import ast
from textwrap import dedent
import inspect
from typing import List, Tuple
from pyis.onnx.transpiler.passes.type_infer import TypeInfer
from pyis.onnx.transpiler.ast_printer import pformat_ast
class... | [
{
"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 | py/pyis-onnx/tests/test_transpiler/test_resolve_function.py | microsoft/python-inference-script |
import logging
class BaseResponseHandler:
def on_execution(self, event):
logging.debug(event)
return event
def on_exception(self, ex):
logging.exception(str(ex))
raise
def on_response(self, response):
logging.debug(response)
return response
| [
{
"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 | lambda_utils/response_handlers/__init__.py | Christoph-Schabert/lambda-utils |
"""Helper definitions to glob .aar and .jar targets"""
def create_aar_targets(aarfiles):
for aarfile in aarfiles:
name = "aars__" + aarfile[aarfile.rindex("/") + 1:aarfile.rindex(".aar")]
lib_deps.append(":" + name)
android_prebuilt_aar(
name = name,
aar = aarfile,
... | [
{
"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 | Examples/ReactNativeKakaoExample/android/app/build_defs.bzl | namdq97/react-native-kakao-login |
import seaborn as sns
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
class BoxPlot:
def __init__(
self,
title,
x_label,
y_label,
):
self.title = title
self.x_label = x_label
self.y_label = y_label
self.data = pd.DataFrame()... | [
{
"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 | boxplot.py | guodashun/training-curve-vis |
# pylint: disable=useless-super-delegation
import json
from concurrent.futures import ThreadPoolExecutor, Future
import boto3
from oautom import get_logger
from oautom.execution.execution import Execution
class LambdaExecution(Execution):
def __init__(self, name: str, flow: 'Flow', lambda_function: str, payloa... | [
{
"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 | oautom/execution/lambda_execution.py | FabienArcellier/oautom |
from collections import Counter
import numpy as np
from sklearn.metrics import accuracy_score, confusion_matrix
def __majority(arr):
counter = Counter(arr)
value, _ = counter.most_common(1)[0]
return value
def clustering_accuracy(y_true, y_clustering):
clustering_labels = list(set(y_clustering))
... | [
{
"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 | util/metric.py | smartdolphin/variational-autoencoder |
from sparknlp.annotator import *
class BertSentence:
@staticmethod
def get_default_model():
return BertSentenceEmbeddings.pretrained() \
.setInputCols("sentence") \
.setOutputCol("sentence_embeddings")
@staticmethod
def get_pretrained_model(name, language, bucket=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_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
... | 3 | nlu/components/embeddings/sentence_bert/BertSentenceEmbedding.py | milyiyo/nlu |
from decimal import Decimal, ROUND_HALF_UP
from django.test import TestCase
from .utils import create_test_expenses
from ..models import Expense
from ..reports import summary_overall
class ReportsTestCase(TestCase):
"""Test reports utilities for the expenses"""
def setUp(self) -> None:
"""Set up fo... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},... | 3 | project/expenses/tests/test_reports.py | MaciejChoromanski/parleto-recruitment-task |
# -*- coding: utf-8 -*-
from bs4 import BeautifulSoup
import pandas as pd
# Likely coming from
# https://www.google.com/maps/d/viewer?mid=151Itl_57S7UlpC7P-TdfvT2Pz7Y
class KMLConverter(object):
def __init__(self, filepath):
self.filepath = filepath
self.postes = []
self.parse()
def ... | [
{
"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 | collecte/postes_plage_snsm/convert.py | entrepreneur-interet-general/predisauvetage |
import numpy as np
import cv2
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import pickle
class Line():
def __init__(self,n):
self.n=n
self.detected =False
#Polynomial coefficients of the lines
self.A=[]
self.B=[]
self.C=[]
#Running average of coefficients
sel... | [
{
"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": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
... | 3 | line.py | kavach-feature/Advanced_lane_finding |
from keras.models import load_model
from glob import glob
from metrics import auc, precision, recall, f1
def save_json(model, path):
model_json = model.to_json()
with open(path, "w") as json_file:
json_file.write(model_json)
def save_weights(model, path):
model.save_weights(path)
def resave_mo... | [
{
"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 | learning/model/keras_model_resave.py | eugene-vasilev/Automatic-Tool-Annotation-for-CATARACT-Surgery |
"""
Nonlinearities
"""
# sigmoid
from theano.tensor.nnet import sigmoid
# softmax (row-wise)
from theano.tensor.nnet import softmax
# tanh
from theano.tensor import tanh
# rectify
# The following is faster than lambda x: T.maximum(0, x)
# Thanks to @SnippyHolloW for pointing this out.
# See: https://github.com/Sni... | [
{
"point_num": 1,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?... | 3 | lasagne/nonlinearities.py | dimatura/nntools |
# 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": "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 | aliyun-python-sdk-cdn/aliyunsdkcdn/request/v20141111/DescribeDomainsBySourceRequest.py | sdk-team/aliyun-openapi-python-sdk |
#!/usr/bin/env python3
#import chardet
import sys
def readline_safe():
line = None
while line == None:
try:
line = sys.stdin.readline()
except:
pass
return line
def main():
line = readline_safe()
while line:
if not line.startswith('CVE-') or line.sp... | [
{
"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 | training_data/old/cve/cve_parser.py | rbenic-fer/security-report-generation |
import pytest
from pytest_mock import mocker
from hamcrest import *
import numpy as np
from src.objects.quantum_system import SystemType
from src.objects.qudit import Qudit
from src.dirac_notation.constants import *
@pytest.mark.parametrize('input', [
(
comp_ket_x(0, 4)
)
])
def test_init(input):
... | [
{
"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/src/objects/test_qudit.py | KaroliShp/Quantumformatics |
#
# @lc app=leetcode id=349 lang=python3
#
# [349] Intersection of Two Arrays
#
# @lc code=start
class Solution:
def binarySearch(self, nums: List[int], target: int) -> int:
left = 0
right = len(nums) - 1
while left <= right:
middle = (left + right) // 2
if nums[midd... | [
{
"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 | leetcode/349.intersection-of-two-arrays.py | zhongqi1112/Hulk |
"""
Routines to join all pdb files into one pdb file
These routines were developed by:
Rodrigo Antonio Faccioli - rodrigo.faccioli@usp.br / rodrigo.faccioli@gmail.com
Leandro Oliveira Bortot - leandro.bortot@usp.br / leandro.obt@gmail.com
"""
import os
import sys
""" This function obtains all pd... | [
{
"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 | scripts/analysis/join_pdbs_one_pdb.py | michelleduarte/2pg_cartesian |
import sys
import numpy as np
from scipy.stats import multivariate_normal
sys.path.append('./../../')
from src.HMC.hmcparameter import HMCParameter
class VelParam(HMCParameter):
def __init__(self, init_val):
super().__init__(np.array(init_val))
dim = np.array(init_val).shape
self.mu = np.... | [
{
"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 | src/LocalChoiceModel/vel_param.py | noashin/local_global_attention_model |
__author__ = 'Pavel Ageyev'
class Groups:
def __init__(self, name , header, footer):
self.name=name
self.header=header
self.footer=footer
class Formfields:
def __init__(self, firstName, lastName, companyName, email, mobile):
self.firstName=firstName
self.lastName=lastNa... | [
{
"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 | groupproperties.py | rolef/PyHomework |
import logging
import os
import boto3
from lib.cleanup_resource_handler import CleanupResourceHandler
from lib.queue_handler import QueueHandler
logging.getLogger().setLevel(logging.INFO)
def queue_handler(event, context):
"""
Handler for the event queue lambda trigger
"""
ec2_client = boto3.clien... | [
{
"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": true... | 3 | packages/@aws-cdk-containers/ecs-service-extensions/lib/extensions/assign-public-ip/lambda/index.py | RichiCoder1/aws-cdk |
from base import BaseTest
import os
import stat
import unittest
import sys
INTEGRATION_TESTS = os.environ.get('INTEGRATION_TESTS', False)
class TestUmask(BaseTest):
"""
Test default umask
"""
DEFAULT_UMASK = 0o027
def setUp(self):
super(BaseTest, self).setUp()
... | [
{
"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 | vendor/github.com/elastic/beats/libbeat/tests/system/test_umask.py | lstyles/nsgflowlogsbeat |
class Model(object):
"""Base class for classification models."""
def __init__(self, path, **kwargs):
self.path = path
self.data = kwargs.get("data", [])
self.labels = kwargs.get("labels", [])
self.tokens = kwargs.get("tokens", [])
self.predicted = kwargs.get("predi... | [
{
"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 | Scripts/classification/model.py | lasigeBioTM/ULISBOA-at-SemEval-2017 |
def preto():
return '\0331;30m'
def vermelho():
return '\033[1;31m'
def verde():
return '\033[1;32m'
def amarelo():
return '\033[1;33m'
def azul():
return '\033[1;34m'
def magenta():
return '\033[1;35m'
def ciano():
return '\033[1;36m'
def cinzaclaro():
return '\033[1;37m'
def ci... | [
{
"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 | GDT/ferramentas/cores/__init__.py | GustavoHenriqueSchmitz/GDT |
# -*- coding: utf-8 -*-
"""Test human2bytes function."""
import pytest
from pcof import bytesconv
@pytest.mark.parametrize(
"size, unit, result",
[
(1, "KB", "1024.00"),
(1, "MB", "1048576.00"),
(1, "GB", "1073741824.00"),
(1, "TB", "1099511627776.00"),
(1, "PB", "1125... | [
{
"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_bytesconv_human2bytes.py | thobiast/pcof |
"""
Main part of nuqql.
"""
import logging
import os
import signal
import nuqql.backend
import nuqql.config
import nuqql.ui
logger = logging.getLogger(__name__)
# main loop of nuqql
def main_loop() -> str:
"""
Main loop of nuqql.
"""
logger.debug("entering main loop")
try:
# init and s... | [
{
"point_num": 1,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer... | 3 | nuqql/main.py | hwipl/nuqql |
import ipaddress
from dataclasses import dataclass
from typing import Optional, Union
from caldera.util.ints import uint16, uint64
from caldera.util.streamable import Streamable, streamable
@dataclass(frozen=True)
@streamable
class PeerInfo(Streamable):
host: str
port: uint16
def is_valid(self, allow_pr... | [
{
"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": fals... | 3 | caldera/types/peer_info.py | wolfrage76/caldera-blockchain |
"""
Couette Flow
"""
import numpy as np
from lettuce.unit import UnitConversion
from lettuce.boundary import BounceBackBoundary, EquilibriumBoundaryPU
class CouetteFlow2D(object):
def __init__(self, resolution, reynolds_number, mach_number, lattice):
self.resolution = resolution
self.units = Uni... | [
{
"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 | lettuce/flows/couette.py | MartinKliemank/lettuce |
"""
Created on Fri Oct 29 18:54:18 2021
@author: Krishna Nuthalapati
"""
import numpy as np
def iou(boxA, boxB):
# determine the (x, y)-coordinates of the intersection rectangle
xA = max(boxA[0], boxB[0])
yA = max(boxA[1], boxB[1])
xB = min(boxA[2], boxB[2])
yB = min(boxA[3], boxB[3])
# compute the area of int... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding... | 3 | Object detection and depth estimation/catkin_ws/src/f110-fall2018-skeltons/labs/wall_following/scripts/utils/other.py | UF-f1tenth/F1tenth-UFL |
import json
import numpy as np
from PIL import Image
def load_json(f):
with open(f, 'r') as fp:
return json.load(fp)
def save_json(obj, f, ensure_ascii=True, indent=None):
with open(f, 'w') as fp:
json.dump(obj, fp, ensure_ascii=ensure_ascii, indent=indent)
def load_image(f, mode='RGB'):
... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (... | 3 | labelmeutils/utils/io.py | narumiruna/labelme-utils |
from unittest import TestCase
from collective.solr.parser import SolrFlare
from collective.solr.flare import PloneFlare
class FlareTests(TestCase):
def testRelevanceFormatting(self):
def score(**kw):
return PloneFlare(SolrFlare(**kw)).data_record_normalized_score_
self.assertEqual(sc... | [
{
"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 | src/collective/solr/tests/test_flare.py | IMIO/collective.solr |
"""
The Hamming distance between two integers is the number of positions at which the corresponding bits are different.
Now your job is to find the total Hamming distance between all pairs of the given numbers.
Example:
Input: 4, 14, 2
Output: 6
Explanation: In binary representation, the 4 is 0100, 14 is 1110,... | [
{
"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 | questions/total-hamming-distance/Solution.py | marcus-aurelianus/leetcode-solutions |
import os
import pytest
from . import run
from .conditions import has_http
def test_unit(cmake, unittest):
cwd = cmake(
["sentry_test_unit"], {"SENTRY_BACKEND": "none", "SENTRY_TRANSPORT": "none"}
)
env = dict(os.environ)
run(cwd, "sentry_test_unit", ["--no-summary", unittest], check=True, env... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than ... | 3 | tests/test_unit.py | lmdsp/sentry-native |
from typing import Any, BinaryIO
from kale.util.struct_stream import StructStream
class int8(StructStream):
PACK = "!b"
class uint8(StructStream):
PACK = "!B"
class int16(StructStream):
PACK = "!h"
class uint16(StructStream):
PACK = "!H"
class int32(StructStream):
PACK = "!l"
class uint... | [
{
"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 | kale/util/ints.py | inan0812/kale-blockchain |
"""
To understand why this file is here, please read:
http://cookiecutter-django.readthedocs.io/en/latest/faq.html#why-is-there-a-django-contrib-sites-directory-in-cookiecutter-django
"""
from django.conf import settings
from django.db import migrations
def update_site_forward(apps, schema_editor):
"""Set site d... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/... | 3 | instagram_clone/contrib/sites/migrations/0003_set_site_domain_and_name.py | eugene94/IG_clone |
import pytest
import json
class TestRbdMirrors(object):
@pytest.mark.no_docker
def test_rbd_mirror_is_installed(self, node, host):
assert host.package("rbd-mirror").is_installed
def test_rbd_mirror_service_enabled_and_running(self, node, host):
service_name = "ceph-rbd-mirror@rbd-mirror.... | [
{
"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 | tests/functional/tests/rbd-mirror/test_rbd_mirror.py | u-kosmonaft-u/ceph-ansible |
#!/usr/local/bin/python
# Code Fights Efficient Comparison Problem
import time
def main():
x, y, L, R = 9, 9, 1, 10000
print("Procedure 1")
t1 = time.clock()
procedure1(x, y, L, R)
print(time.clock() - t1)
print("Procedure 2")
t2 = time.clock()
procedure2(x, y, L, R)
print(time.c... | [
{
"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 | CodeFights/efficientComparison.py | HKuz/Test_Code |
#! /usr/bin/env
from .pkt_dispatch import PacketDispatcher
from scapy.all import rdpcap
class PacketFileDispatcher(PacketDispatcher):
'''Definition of PacketDispatcher for files of packets.
Args:
pkt_src: str - network interface (wlan0, eth0, lo, ...)
filtr: str - tcpdump-like filters (BPF)
... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",... | 3 | dispatch/pkt_file_dispatch.py | grn-bogo/net_eye |
import os
import sys
from flask_migrate import Migrate, MigrateCommand
from flask_script import Manager
base_dir = os.path.dirname(os.path.abspath(__file__))
def main():
command = sys.argv[1]
if command == "db":
from client.database import db
from client.factory import create_app
a... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
... | 3 | manage.py | meko0019/Stellar-SMS |
import math_helpers
from problems.problem import Problem
class Problem021(Problem):
def __init__(self):
super().__init__()
self._cache = {}
def calculate_answer(self) -> int:
answer = 0
n = 10000
primes = math_helpers.primes_below(n)
for i in range(2, n):
sum_1 = self.sum_proper_di... | [
{
"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 | ProjectEulerPython/problems/problem_021.py | geo-desic/project-euler |
import pandas as pd
import re
data = pd.read_csv("BIPMetadata_current.csv")
def format_date(date_column):
# formatting the date data to display as yyyy-mm-dd
new_dates = []
for date in date_column:
month = date[0:date.find('/')]
date = date[date.find('/')+1:]
day = date[0:date.find... | [
{
"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 | server/db/Data/data_cleaner.py | katekaseth/Project_One |
"""
AStar search
author: Ashwin Bose (@atb033)
"""
class AStar():
def __init__(self, env):
self.agent_dict = env.agent_dict
self.admissible_heuristic = env.admissible_heuristic
self.is_at_goal = env.is_at_goal
self.get_neighbors = env.get_neighbors
def reconstruct_path(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 | centralized/cbs/a_star.py | KSHITIJBITHEL/multi_agent_path_planning |
import json
import socket
def is_jsonable(obj):
try:
json.dumps(obj)
return True
except (TypeError, OverflowError, ValueError):
return False
def sanitize_meta(meta):
keys_to_sanitize = []
for key, value in meta.items():
if not is_jsonable(value):
keys_to_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": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"... | 3 | logdna/utils.py | nimbinatus/python |
"""Test DeltaPySimulator functionality pre-execution."""
import unittest
import deltalanguage as dl
from deltalanguage.test._graph_lib import (getg_const_chain,
getg_optional_queues)
class DeltaQueueCreationTest(unittest.TestCase):
"""Test that the simulator creates q... | [
{
"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 | deltalanguage/test/runtime/test_runtime.py | riverlane/deltalanguage |
import debile.master.utils as utils
import unittest
import mock
class MasterUtilsTestCase(unittest.TestCase):
def test_init_config(self):
config = utils._init_config('tests/resources/master.yaml')
self.assertEquals(config['database'], 'sqlite:////srv/debile/debile.db')
self.assertIsNotNo... | [
{
"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 | tests/test_master_utils.py | tcc-unb-fga/debile |
"""
domonic.webapi.dragndrop
====================================
https://developer.mozilla.org/en-US/docs/Web/API/HTML_Drag_and_Drop_API
"""
from domonic.events import DragEvent
class DataTransfer:
def __init__(self):
self.data = {}
self.types = []
self.files = []
se... | [
{
"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 | domonic/webapi/dragndrop.py | byteface/domonic |
from ..model import Model
from . import loadDefaultParams as dp
from . import timeIntegration as ti
class ThalamicMassModel(Model):
"""
Two population thalamic model
Reference:
Costa, M. S., Weigenand, A., Ngo, H. V. V., Marshall, L., Born, J.,
Martinetz, T., & Claussen, J. C. (2016). A thala... | [
{
"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 | neurolib/models/thalamus/model.py | Ronjaa95/neurolib |
#boggle matrix analysis main app
def find_adjacent_nodes(row_index, col_index):
adjacent_nodes = []
temp_num_pair = []
count = 0
while count < 9:
if count == 0:
temp_num_pair = [row_index-1, col_index-1]
elif count == 1:
temp_num_pair = [row_index-1, col_index]
... | [
{
"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 | app.py | chalvors/boggle_matrix_analysis |
#!/usr/bin/env python3
# Copyright (c) 2017-2019 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test the RPC call related to the uptime command.
Test corresponds to code in rpc/server.cpp.
"""
impo... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer"... | 3 | test/functional/rpc_uptime.py | adymoloca/flocoin |
import os
from typing import (
Any,
Sequence, List
)
def ensure_list(value: Any) -> List:
# if isinstance(value, Sequence) and not isinstance(value, str):
if hasattr(value, '__iter__') and not isinstance(value, str):
return list(value)
else:
return [value]
def files_exist(files: ... | [
{
"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 | tsl/utils/python_utils.py | TorchSpatiotemporal/tsl |
import time
import numpy as np
import torch
def to_tensor(tensor):
if isinstance(tensor, np.ndarray):
tensor = torch.from_numpy(tensor)
if torch.cuda.is_available():
return torch.autograd.Variable(tensor).cuda()
return torch.autograd.Variable(tensor)
def set_default_device_cuda():
"... | [
{
"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 | running_modes/utils/general.py | lilleswing/Reinvent-1 |
# -*- coding: utf-8 -*-
"""
This code is auto generated from troposphere_mate.code_generator.__init__.py scripts.
"""
import sys
if sys.version_info.major >= 3 and sys.version_info.minor >= 5: # pragma: no cover
from typing import Union, List, Any
import troposphere.detective
from troposphere import Template,... | [
{
"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_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
... | 3 | troposphere_mate/detective.py | tsuttsu305/troposphere_mate-project |
from brownie import SimpleStorage, accounts
def test_deploy():
# Arrange
account = accounts[0]
# Act
simple_storage = SimpleStorage.deploy({"from": account})
starting_value = simple_storage.retrieve()
expected = 0
# Assert
assert starting_value == expected
def testupdating_storage(... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": fals... | 3 | tests/test_simple_storage.py | jayantpatil/brownie-simple-storage |
# -*- coding: utf-8 -*-
"""Family module for Wikivoyage."""
from __future__ import absolute_import, unicode_literals
__version__ = '$Id: f762c76d91e13629122c6ee944de08a2221cd193 $'
# The new wikivoyage family that is hosted at wikimedia
from pywikibot import family
class Family(family.SubdomainFamily, family.Wikim... | [
{
"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 | pywikibot/families/wikivoyage_family.py | metakgp/pywikibot |
# Copyright (C) 2010 Ion Torrent Systems, Inc. All Rights Reserved
import sys
def parseLog(logText):
metrics = {}
# Get Headings for beadfind
for line in logText:
if "=" in line:
name = line.strip().split("=")
key = name[0].strip()
value = name[1].strip()
... | [
{
"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 | pipeline/python/ion/reports/parseBeadfind.py | konradotto/TS |
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**6)
def input():
return sys.stdin.readline().strip()
import math
import collections
from collections import deque, Counter, defaultdict
from bisect import bisect_left, bisect
from copy import deepcopy
import itertools
from heapq import heappush, heapp... | [
{
"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/data/40.py | NULLCT/LOMC |
import time
import pca9685
from utility import *
class DCMotors:
def __init__(self, i2c, address=0x40, freq=50):
self.pca9685 = pca9685.PCA9685(i2c, address)
self.pca9685.freq(freq)
self.m1_speed = 0
self.m2_speed = 0
def _pin(self, pin, value=None):
if value is None:
... | [
{
"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 | ports/esp32/modules/motor.py | AITT-VN/micropython |
import factory
from django.contrib.auth.hashers import check_password
from django.urls import reverse
from faker import Faker
from rest_framework import status
from rest_framework.test import APITestCase
from src.users.models import User
from tests.users.factories import UserFactory
fake = Faker()
class TestUserList... | [
{
"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/users/test_views.py | SerhatTeker/django-rest-todo |
def foo():
a = 5
return 10 + a
def bar():
a = 1e6
return a / 5.0
def tests():
assert foo() == 15
assert bar() == 2e5
tests()
if hasattr(foo, "__jit__"):
print("Has jit")
foo.__jit__()
tests()
| [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"ans... | 3 | tests/snippets/jit.py | BasixKOR/RustPython |
from charms.reactive import Endpoint, when, set_flag, clear_flag
import charmhelpers.core.hookenv as hookenv
from charmhelpers.core.hookenv import log
class GearmanRequires(Endpoint):
@when('endpoint.{endpoint_name}.joined')
def joined(self):
# if any(unit.received['port'] for unit in self.all_joined_... | [
{
"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 | interfaces/gearman/requires.py | centauri-charmers/charm-zuul-executor |
from kivy.uix.splitter import Splitter, SplitterStrip
from kivy.lang import Builder
from kivy.core.window import Window
from kivy.properties import BooleanProperty
from kivystudio.behaviors import HoverBehavior
Builder.load_string('''
#: import Factory kivy.factory.Factory
<StudioSplitter>:
strip_cls: Factory.St... | [
{
"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 | kivystudio/widgets/splitter.py | hashfx/kivystudio |
from .activation_checkpoint import checkpoint
from .common import print_rank_0, sync_model_param_in_dp, is_dp_rank_0, is_tp_rank_0, is_no_pp_or_last_stage
from .cuda import get_current_device, synchronize, empty_cache, set_to_cuda
from .memory import report_memory_usage
from .timer import MultiTimer, Timer
_GLOBAL_MUL... | [
{
"point_num": 1,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?... | 3 | colossalai/utils/__init__.py | rahulgupta9202/ColossalAI |
import cocotb
from cocotb.clock import Clock
from cocotb.triggers import RisingEdge, FallingEdge, ClockCycles
import random
async def reset(dut):
dut.RESET_N <= 0
await ClockCycles(dut.EXTERNAL_CLK, 20)
dut.RESET_N <= 1
await ClockCycles(dut.EXTERNAL_CLK, 1)
@cocotb.test()
async def spi_v... | [
{
"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 | test/fpga/spi_video_ram_test/spi_video_ram_test.py | mbalestrini/hack_soc |
"""Figures management command to run course MAU metrics for all courses, all Sites.
"""
from __future__ import print_function
from __future__ import absolute_import
from textwrap import dedent
from django.core.management.base import BaseCommand
from figures.tasks import (
populate_all_mau
)
class Command(Bas... | [
{
"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 | figures/management/commands/run_figures_mau_metrics.py | Groove-eLearning/figures |
import os
import resources_portal.models # noqa
from flask import Flask
from flask_migrate import Migrate
from flask_restful import Api
from resources_portal.db import db
from resources_portal.views import user
migrate = Migrate()
def initialize_routes(api: Api):
api.add_resource(user.UsersApi, "/users")
a... | [
{
"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 | resources_portal/__init__.py | AlexsLemonade/python-flask-demo |
# -*- coding: utf-8 -*-
#
# 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
#... | [
{
"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 | airflow/utils/weight_rule.py | shrutimantri/airflow |
# Petit exercice utilisant la bibliothèque graphique tkinter
from tkinter import *
from random import randrange
# --- définition des fonctions gestionnaires d'événements : ---
def drawline():
"Tracé d'une ligne dans le canevas can1"
global x1, y1, x2, y2, coul
can1.create_line(x1,y1,x2,y2,width=2,fil... | [
{
"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 | Exemples cours 6/TK_Line.py | geocot/coursPython |
import tkinter as tk
from tkinter.ttk import *
def f():
frame=tk.Tk()
frame.geometry('1500x1500')
c=tk.Canvas(frame,bg="white",height=1300,width=1200)
return c,frame
def circle():
c,e=f()
c.create_oval(20,20,200,200,outline="red")
c.pack()
e.mainloop()
def rect():
c,e=f()
c.creat... | [
{
"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 | guimodulecanvas.py | anmol1455/python |
import unittest
from logging import Logger, getLogger
from numpy import ndarray, power, allclose
from numpy.random import randn
from freq_used.logging_utils import set_logging_basic_config
from optmlstat.functions.function_base import FunctionBase
from optmlstat.functions.example_functions import get_sum_of_square_fu... | [
{
"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 | optmlstat/test/test_basic_functions.py | sungheeyun/optmlstat |
from typing import Any
from fastapi import APIRouter
from fastapi import Depends
from fastapi import status
from sitreps_server import crud
from sitreps_server import schemas
from sqlalchemy.orm import Session
from .deps import get_db
router = APIRouter()
@router.get("/")
def read_code_coverage(
db: Session = ... | [
{
"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_return_types_annotated",
"question": "Does every function in this file have a return... | 3 | sitreps_server/api/v1/code_coverage.py | digitronik/sitreps-server |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.