source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
import pickle
from main import clf
from sklearn.pipeline import Pipeline
from sklearn.preprocessing import StandardScaler
def test_accuracy():
# Load test data
with open("data/test_data.pkl", "rb") as file:
test_data = pickle.load(file)
# Unpack the tuple
X_test, y_test = test_data
# Co... | [
{
"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 | course4/week3-ungraded-labs/C4_W3_Lab_4_Github_Actions/app/test_clf.py | atsiatmas/machine-learning-engineering-for-production-public |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import simplejson as json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
from alipay.aop.api.domain.InsPolicy import InsPolicy
class AlipayInsUnderwriteUserPolicyQueryResponse(AlipayResponse):
def __init__(self):
super(AlipayInsUnderwriteU... | [
{
"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 | alipay/aop/api/response/AlipayInsUnderwriteUserPolicyQueryResponse.py | articuly/alipay-sdk-python-all |
class ColorTester:
def __init__(self, on_canvas, name, height=None):
self.name = name
self.height = height
self.position_to_color_expected = {}
self.on_canvas = on_canvas
self.position_to_color_found = {}
def add_check(self, x, y, color_list_expected):
yadj ... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (exclu... | 3 | notebooks/notebook_tests/canvas_test_helpers.py | lingruiluo/jp_doodle |
import os
import inspect
from lib.apirequest import ApiRequest
class ApiCotoha():
def __init__(self, clientId, clientSecret):
self.__clientId = clientId
self.__clientSecret = clientSecret
def __access(self):
at = ApiRequest('https://api.ce-cotoha.com/v1/oauth/accesstokens', 'POST')
... | [
{
"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 | lib/apicotoha.py | ofbear/analysis_narou |
"""
Module: 'urandom' on micropython-v1.18-esp8266
"""
# MCU: {'ver': 'v1.18', 'port': 'esp8266', 'arch': 'xtensa', 'sysname': 'esp8266', 'release': '1.18', 'name': 'micropython', 'mpy': 9733, 'version': '1.18', 'machine': 'ESP module with ESP8266', 'build': '', 'nodename': 'esp8266', 'platform': 'esp8266', 'family': '... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answe... | 3 | stubs/micropython-v1_18-esp8266/urandom.py | mattytrentini/micropython-stubs |
# noqa
from typing import Any, BinaryIO
class CustomSerializer:
"""Custom serializer implementation to test the injection of different serialization strategies to an input."""
@property
def extension(self) -> str: # noqa
return "ext"
def serialize(self, value: Any, writer: BinaryIO): # noq... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (exclu... | 3 | tests/input/custom_serializer.py | larribas/dagger |
# -*- coding: utf8 -*-
from abc import ABC, abstractmethod
from datetime import datetime, timedelta
from typing import Optional, Set, Union
from fledgling.app.entity.plan import IPlanRepository, Plan
class IParams(ABC):
@abstractmethod
def get_duration(self) -> Union[None, int]:
pass
@abstractme... | [
{
"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 | fledgling/app/use_case/create_plan.py | PracticalCleanArchitecture/fledgling |
#!/usr/bin/env python3
"""Support for Tuya switches."""
from __future__ import annotations
import logging
from typing import Any
from tuya_iot import TuyaHomeManager
from homeassistant.components.remote import RemoteEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssist... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written... | 3 | custom_components/tuya_v2/remote.py | tbratfisch/tuya-home-assistant |
import sys
from asyncio import AbstractEventLoop, get_event_loop_policy
from unittest.mock import MagicMock
if sys.version_info >= (3, 8):
from unittest.mock import AsyncMock
else:
class AsyncMock(MagicMock):
async def __call__(self, *args, **kwargs):
return super(AsyncMock, self).__call__... | [
{
"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/conftest.py | Yasti4/python-aioddd |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Sep 13 11:30:06 2021
@author: bloisejuli
"""
# informe_funciones
#%%
# Ejercicio 6.11:
# Modificá este programa informe_funciones.py del Ejercicio 6.5 de modo que todo el procesamiento de archivos de entrada de datos se
# haga usando funciones del m... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding sel... | 3 | Unidad_6/informe_funciones.py | bloisejuli/curso_python_UNSAM |
from __future__ import absolute_import
from django.template.utils import get_app_template_dirs
from django.template.loaders.filesystem import Loader as FilesystemLoader
from django.core.exceptions import SuspiciousFileOperation
from django.utils._os import safe_join
try:
from django.template import Origin # Djang... | [
{
"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 | djsqltemplate/loaders/app_directories.py | marcinn/django-sqltemplate |
import torch
import torch.nn.functional
from e3nn.o3 import Irreps
from e3nn.util.jit import compile_mode
from nequip.data import AtomicDataDict
from .._graph_mixin import GraphModuleMixin
@compile_mode("script")
class OneHotAtomEncoding(GraphModuleMixin, torch.nn.Module):
num_types: int
set_features: bool
... | [
{
"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 | nequip/nn/embedding/_one_hot.py | mir-group/nequip |
""" Jeffreys divergences """
import torch
def jeffreys_normal(mu1, lv1, mu2, lv2):
mu1, lv1 = mu1.view(mu1.shape[0], -1), lv1.view(lv1.shape[0], -1)
mu2, lv2 = mu2.view(mu2.shape[0], -1), lv2.view(lv2.shape[0], -1)
return (0.25*((-lv1).exp() + (-lv2).exp())*(mu1-mu2)**2 + 0.25*((lv1-lv2).exp() + (lv2-lv1)... | [
{
"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 | mapping/model/jeffreys.py | syanga/model-augmented-mutual-information |
#!/usr/bin/python
import math, sys
from subprocess import Popen, PIPE
sys.path.append('scripts')
import hypermapper
def branin_function_two_objectives(X):
"""
Compute the branin function and also a fake energy (in Joules) function to demonstrate a two-objective optimization example.
:param x1: the first in... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"ans... | 3 | example_scenarios/synthetic/multiobjective_branin/multiobjective_branin.py | matthias-mayr/hypermapper |
# -*- coding: utf-8 -*-
# Copyright (c) 2020. Distributed under the terms of the MIT License.
from pymatgen.io.vasp import Vasprun, Outcar
from vise.analyzer.dielectric_function import make_shifted_diele_func
from vise.analyzer.vasp.band_edge_properties import VaspBandEdgeProperties
from vise.analyzer.vasp.make_diele_... | [
{
"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 | vise/tests/analyzer/vasp/test_make_diele_func.py | kumagai-group/vise |
from dbnd._core.errors import DatabandRuntimeError
def failed_to_submit_qubole_job(nested_exception):
return DatabandRuntimeError(
"Qubole submit request failed with code %s." % nested_exception.status_code,
show_exc_info=False,
nested_exceptions=nested_exception,
help_msg="Check y... | [
{
"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 | plugins/dbnd-qubole/src/dbnd_qubole/errors.py | ipattarapong/dbnd |
#!/bin/python3
__author__ = "Adam Karl"
"""Find the sum of all primes less than or equal to N"""
#https://projecteuler.net/problem=10
from math import sqrt
isPrime = []
def sieve(n):
"""fills isPrime array with booleans for whether the number at isPrime[i] is prime or not"""
"""uses a process known as the s... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer"... | 3 | 10/euler10.py | adamkkarl/ProjectEuler |
from __future__ import unicode_literals
from django.test import TestCase
from django.test.utils import override_settings
from paypal.standard.forms import PayPalPaymentsForm
class PaymentsFormTest(TestCase):
def test_form_render(self):
f = PayPalPaymentsForm(initial={'business': 'me@mybusiness.com',
... | [
{
"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 | paypal/standard/ipn/tests/test_forms.py | famous0123/django-paypal |
import shutil
import pytest
def pytest_addoption(parser):
parser.addoption("--database", action="store", help="Path to CheckV's database")
parser.addoption(
"--threads", default=1, type=int, action="store", help="Threads to use"
)
@pytest.fixture
def database(request):
return request.config... | [
{
"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 | test/conftest.py | wolfQK/CheckV-fork |
# Find the right command to use for a program.
import os, sys, subprocess
from subprocess import DEVNULL
from typing import List
_COMPARE_CMD = None
def compare_cmd(print_cmds: bool) -> List[str]:
"""Find the command to use for ImageMagick compare."""
global _COMPARE_CMD
if _COMPARE_CMD != None:
... | [
{
"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": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 lines?",
"answer": true
... | 3 | diff_pdf_visually/external_programs.py | adrien-berchet/diff-pdf-visually |
#!/usr/bin/env python
"""
Copyright (c) 2006-2013 sqlmap developers (http://sqlmap.org/)
See the file 'doc/COPYING' for copying permission
"""
from plugins.generic.syntax import Syntax as GenericSyntax
class Syntax(GenericSyntax):
def __init__(self):
GenericSyntax.__init__(self)
@staticmethod
de... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excludi... | 3 | Dangerous/Golismero/tools/sqlmap/plugins/dbms/postgresql/syntax.py | JeyZeta/Dangerous- |
class Car:
def __init__(self, name: str, model: str, engine: str):
self.name = name
self.model = model
self.engine = engine
def get_info(self):
return f"This is {self.name} {self.model} with engine {self.engine}"
car = Car("Kia", "Rio", "1.3L B3 I4")
print(car.get_info())
| [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or few... | 3 | 01-Defining_classes_exercises/01-Car.py | Beshkov/OOP |
# -*- coding: utf-8 -*-
"""Linked List Nth to Last Node .ipynb.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1cr1A4QVH-0fzpToybYwX4udKRlzkGqF-
"""
# Write a function that takes a head node and an integer value n and then returns the nth to last... | [
{
"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 | Linked List/linked_list_nth_to_last_node_ipynb.py | Dannark/Data-Structure-and-Algorithms |
class ClusterNode:
def perform_maintainance(self):
pass
def checkpoint(self):
pass
def receive_big_data(self):
pass
def request_data_processing(self):
pass
def visualize(self):
pass
def offload(self):
pass
node = ClusterNode()
node.perform_m... | [
{
"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 | examples/invalid_node_maintainance.py | dkarageo/lovpy |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
from alipay.aop.api.domain.SettlementbillOpenApiDTO import SettlementbillOpenApiDTO
class AlipayBossFncSettleSettlementbillCreateResponse(AlipayResponse):
def __init__(self):
super... | [
{
"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 | alipay/aop/api/response/AlipayBossFncSettleSettlementbillCreateResponse.py | antopen/alipay-sdk-python-all |
"""empty message
Revision ID: 07f6e404201c
Revises: 90c05db34e87
Create Date: 2019-04-02 14:16:58.606184
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '07f6e404201c'
down_revision = '90c05db34e87'
branch_labels = None
depends_on = None
def upgrade():
# ... | [
{
"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 | migrations/versions/07f6e404201c_.py | tomasfarias/fariasweb |
from main import count_positives_sum_negatives,count_positives_sum_negatives1
def test1(benchmark):
assert benchmark(count_positives_sum_negatives1,[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, -11, -12, -13, -14, -15]) == [10, -65]
def test(benchmark):
assert benchmark(count_positives_sum_negatives, [1, 2, 3, 4, 5, ... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answe... | 3 | codewars/6kyu/amrlotfy77/Ultimate Array Reverser/test_bench.py | ictcubeMENA/Training_one |
#!/usr/bin/env python
"""Class and context manager for writing KbartRecord class to csv file."""
# coding: utf-8
from __future__ import (absolute_import, division,
print_function, unicode_literals)
import contextlib
import six
import unicodecsv as csv
# TODO: make a better way to write the ... | [
{
"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 | pykbart/writer.py | pybrarian/pykbart |
# coding=utf-8
"""
debug.py - Sopel Debugging Module
Copyright 2013, Dimitri "Tyrope" Molenaars, Tyrope.nl
Licensed under the Eiffel Forum License 2.
http://sopel.chat
"""
from sopel.module import commands, example
@commands('privs')
@example('.privs', '.privs #channel')
def privileges(bot, trigger):
"""Print th... | [
{
"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 | debug.py | dgw/willie-extras |
import pickle
from typing import Any, Union
from datetime import datetime
class DataStorage:
_DataStorageObj = None
def __new__(cls, *args, **kwargs):
if cls._DataStorageObj is None:
cls._DataStorageObj = super().__new__(cls)
return cls._DataStorageObj
def __init__(self):
... | [
{
"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 | src/DataStorage.py | QuantumStatic/wordle |
from __future__ import annotations
import os
import sys
from google.protobuf import text_format
from cyberbrain.generated import communication_pb2, communication_pb2_grpc
python_version = {(3, 7): "py37", (3, 8): "py38"}[sys.version_info[:2]]
def get_value(value_dict: dict[str, any]):
"""Accept an argument li... | [
{
"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": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (exclud... | 3 | test/utils.py | testinggg-art/Cyberbrain |
import os
import pickle
import string
import time
import logging
import numpy as np
def get_logger(name=__file__, level=logging.INFO):
logger = logging.getLogger(name)
if getattr(logger, "_init_done__", None):
logger.setLevel(level)
return logger
logger._init_done__ = True
logger.pr... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"ans... | 3 | src/ClusterTrellis/utils.py | lbg251/ClusterTrellis |
import json, os
# 디렉토리 안의 모든 파일에 대한 absolute path return
def diriter(path):
for p, d, f in os.walk(path):
for ff in f:
yield "/".join([p, ff])
def readfile(path):
with open(path, encoding="utf-8") as f:
for line in f.readlines():
yield line.strip()
# 파일 이름으로 json 로드(... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (exclu... | 3 | knowledge_graph/utils/macro.py | ihaeyong/drama-graph |
"""
Module: 'flowlib.m5mqtt' on M5 FlowUI v1.4.0-beta
"""
# MCU: (sysname='esp32', nodename='esp32', release='1.11.0', version='v1.11-284-g5d8e1c867 on 2019-08-30', machine='ESP32 module with ESP32')
# Stubber: 1.3.1 - updated
from typing import Any
class M5mqtt:
""""""
def _daemonTask(self, *argv) -> Any:
... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
... | 3 | stubs/m5stack_flowui-v1_4_0-beta/flowlib/m5mqtt.py | mattytrentini/micropython-stubs |
#
# Copyright 2013 Apache Software Foundation
#
# 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 agree... | [
{
"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/test/python/apache/thermos/common/test_pathspec.py | wickman/incubator-aurora |
from .iotNode import IotNode
from .iotRGB import RGB
class IotRGBLed(IotNode):
""" the base class for RGB LED
Note: 0 is off otherwise on
"""
def __init__(self, name, parent):
""" construct a IotRGBLed
name: the name of the node
parent: parent IotNode object. None for root node.... | [
{
"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 | IotLib/iotRGBLed.py | rphuang/IotDevicesPy |
#!/usr/bin/env python
import rospy
import numpy as np
import cv2, cv_bridge
from sensor_msgs.msg import Image
class drone_camera:
def __init__(self, drone_N):
assert int(drone_N) in {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
rospy.init_node("drone{}_kinect_vision".format(drone_N), anonymous=False)
se... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": ... | 3 | multi-robot/src/multi-robot/src/drone_kinect.py | YanCHEN-fr/DGA_Challenge_Multi_Robot_Control |
from .utils import get_store
class StoreMiddleware(object):
def __init__(self, get_response):
self.get_response = get_response
def __call__(self, request):
request.store = get_store(request)
response = self.get_response(request)
return response
| [
{
"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 | wagtailcommerce/stores/middleware.py | theplusagency/wagtail-commerce |
#-*- coding: utf-8 -*-
""" Crashlog module (without vendor lock-in) """
# std
import json
import os
import platform
import socket
# 3rd party
import requests
# local
from voiceplay import __version__
from voiceplay.logger import logger
from .piphelper import PIP
def exc2encode(exc_info, fname):
"""
Excepti... | [
{
"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 | voiceplay/utils/crashlog.py | tb0hdan/voiceplay |
#!/usr/bin/env python
# -*- coding: utf8 -*-
import gevent
from gevent import getcurrent
from gevent.pool import Group
group = Group()
def hello_from(n):
print('Size of group %s' % len(group))
print('Hello from Greenlet %s' % id(getcurrent()))
group.map(hello_from, xrange(3))
def intensive(n):
gev... | [
{
"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 | gevent/gevent-group_pool.py | all3g/pieces |
from twx.botapi import TelegramBot
class Bot(TelegramBot):
def __init__(self, token):
TelegramBot.__init__(self, token)
self.listening = False
self.offset = None
# TODO: parametrize in settings
self.timeout = 1
def listen(self, on_message):
self.li... | [
{
"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 | listenclosely_telegram/bot.py | jlmadurga/listenclosely-telegram |
from getpass import getpass
from gmusicapi import Mobileclient
from playlist_kreator.providers.base import BaseProvider
class GMusicProvider(BaseProvider):
def get_artist_id(self, artist_name):
search = self.gmusic_api.search(artist_name)
if len(search["artist_hits"]) == 0:
return N... | [
{
"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 | playlist_kreator/providers/gmusic.py | epayet/playlist-kreator |
import ssl
from notifly import tf_notifier
import tensorflow as tf
from dotenv import load_dotenv
import os
load_dotenv()
ssl._create_default_https_context = ssl._create_unverified_context
token = os.getenv('TOKEN')
notifier = tf_notifier.TfNotifier(token=token, platform='discord')
class TestCallback(tf.keras.call... | [
{
"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 | temp.py | rexdivakar/Telegram-Notify |
import tensorflow as tf
class InverseDecay(tf.optimizers.schedules.LearningRateSchedule):
def __init__(self, initial_learning_rate, decay_rate):
super(InverseDecay, self).__init__()
self.initial_learning_rate = initial_learning_rate
self.decay_rate = decay_rate
def __call__... | [
{
"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 | adain/learning_rate_schedule.py | srihari-humbarwadi/adain-tensorflow2.x |
from django.test import TestCase, Client
from django.contrib.auth import get_user_model
from django.urls import reverse
class AdminSiteTests(TestCase):
"""A funcion that executes before all tests"""
def setUp(self):
self.client = Client()
self.admin_user = get_user_model().objects.create_supe... | [
{
"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 | app/core/tests/test_admin.py | tarcisioLima/recipe-app-api |
from contacts.Group import DGroup
from common import pref
from logging import getLogger; log = getLogger('blistsort'); info = log.info
def grouping():
s = pref('buddylist.sortby', 'none none').startswith
return s('*status') or s('*service')
class SpecialGroup(DGroup):
_renderer = 'DGroup'
def groupk... | [
{
"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 | digsby/src/contacts/buddylistsort.py | ifwe/digsby |
"""
This Module handles all the CyberCaptain exceptions.
"""
import logging
logger = logging.getLogger("CyberCaptain")
class Error(Exception):
"""
Base class for exceptions in this module.
**Parameters**:
message : str
The message why it did not validate.
"""
def __init__(self... | [
{
"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 | src/main/python/cybercaptain/utils/exceptions.py | FHNW-CyberCaptain/CyberCaptain |
import time
import yaml
import numpy as np
from paddlehub.common.logger import logger
from slda_news.config import ModelType
def load_prototxt(config_file, config):
"""
Args:
config_file: model configuration file.
config: ModelConfig class
"""
logger.info("Loading SLDA config.")
... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
... | 3 | hub_module/modules/text/semantic_model/slda_news/util.py | 18621579069/PaddleHub-yu |
# coding: utf8
from __future__ import unicode_literals
from .tokenizer_exceptions import TOKENIZER_EXCEPTIONS
from .stop_words import STOP_WORDS
from .lex_attrs import LEX_ATTRS
from .tag_map import TAG_MAP
from .morph_rules import MORPH_RULES
from ..tokenizer_exceptions import BASE_EXCEPTIONS
from ..norm_exceptions ... | [
{
"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": false
}... | 3 | spacy/lang/lt/__init__.py | monujee/spaCy |
import datetime
from pydantic import BaseModel, Field, validator
class DateTimeModelMixin(BaseModel):
created_at: datetime.datetime = None
updated_at: datetime.datetime = None
@validator('created_at', 'updated_at', pre=True)
def default_datetime(
cls,
value: datetime.datetime... | [
{
"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 | app/models/common.py | ilya-goldin/kanban-board-app |
# -*- coding: utf-8 -*-
# Copyright 2018-2019 Streamlit Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | [
{
"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 | lib/streamlit/elements/lib/ChartComponent.py | Camilo-Mendoza/streamlit-ML |
#!/usr/bin/env python3
# I use python 2.7 grammer
import psutil
import os
import sys
#subprcess.call ('ls -al', shell=True)
def find_ibofos_coredump_and_renaming():
core_dir_path="/etc/ibofos/core"
file_list = os.listdir(core_dir_path)
for path in file_list:
filename=os.path.basename(path)
... | [
{
"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 | tool/dump/ps_lib.py | mjlee34/poseidonos |
# -*- coding:utf-8 -*-
class BaseModel(object):
_all_dic = None
''' Base Model '''
def __init__(self, uid, dic):
''' initializer '''
self.uid = uid
# keep all values in dic
for key in dic.keys():
setattr(self, key, dic.get(key, None))
@classmethod
def... | [
{
"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 | byecha/src/byecha/basemodel.py | nothink/ByeCha |
from django_filters import rest_framework as filters
from apis.models import Api
class ApiFilter(filters.FilterSet):
def __init__(self, *args, author=None, **kwargs):
super().__init__(*args, **kwargs)
name = filters.CharFilter(field_name='name', lookup_expr='contains')
username = filters.CharFilt... | [
{
"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 | apis/filters.py | ale180192/openapi-viewer-back |
from instruction import Instruction
from program import Program
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from span import Span
op_set = set(['+', '-', '<', '>', '[', ']', '.', ','])
class Op(Instruction):
def __init__(self, op: str, span: 'Span'):
assert op in op_set, 'Invalid operation ' ... | [
{
"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 | engine/op.py | wmww/bfstack |
import torch
from toolz import curry
@curry
def weighted_loss(weight, x, y):
# return torch.mean(torch.pow(x - y, 2).mul(weight.float()))
return torch.mean(torch.abs(x - y).mul(weight.float()))
@curry
def dynamic_loss(truth, pred, weights=None):
x = truth['prognostic']
y = pred['prognostic']
to... | [
{
"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 | lib/torch/loss.py | nbren12/nn_atmos_param |
#!/usr/bin/env python
#-*- coding:utf-8 -*-
"""
layout in form
Tested environment:
Mac OS X 10.6.8
"""
import sys
try:
from PySide import QtCore
from PySide import QtGui
except ImportError:
from PyQt4 import QtCore
from PyQt4 import QtGui
class Demo(QtGui.QWidget):
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": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},... | 3 | layout/layout_in_form.py | thanhkaist/Qt-Python-Binding-Examples |
# Copyright (c) 2012-2013, Mark Peek <mark@peek.org>
# All rights reserved.
#
# See LICENSE file for full license.
from aws import Action as BaseAction
from aws import BaseARN
service_name = 'Amazon Kinesis Analytics'
prefix = 'kinesisanalytics'
class Action(BaseAction):
def __init__(self, action=None):
... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{... | 3 | awacs/kinesisanalytics.py | calebmarcus/awacs |
# coding: utf-8
"""
convertapi
Convert API lets you effortlessly convert file formats and types. # noqa: E501
OpenAPI spec version: v1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import cloudmersive_convert_api_... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"ans... | 3 | test/test_html_hyperlink.py | Cloudmersive/Cloudmersive.APIClient.Python.Convert |
import numpy as np
from .transform import sph2vec, vec2sph
def angle_between(ang1, ang2, sign=True):
d = (ang1 - ang2 + np.pi) % (2 * np.pi) - np.pi
if not sign:
d = np.abs(d)
return d
def angdist(v1, v2, zenith=True):
if v1.shape[0] == 2:
v1 = sph2vec(v1, zenith=zenith)
if v2.sh... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (exclu... | 3 | sphere/distance.py | jannsta1/insectvision |
from abc import ABCMeta, abstractmethod
from ..utils.activations import *
class NetworkBase(metaclass=ABCMeta):
def __init__(self, sizes, activation, last_layer, **kwargs):
self.sizes = sizes
self.num_layers = len(sizes)
if activation.lower() == "sigmoid":
self.activation = Sigm... | [
{
"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 | model/Base.py | massquantity/DNN-implementation |
from django.db import models
from django.contrib.auth.models import AbstractBaseUser, BaseUserManager, \
PermissionsMixin
class UserManager(BaseUserManager):
def create_user(self, email, password=None, **extra_fields):
"""Creates and saves a new user"""
if not email:
raise ValueEr... | [
{
"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": false
}... | 3 | app/core/models.py | fakorede-bolu/python-recipe-rest-api |
# -- encoding: UTF-8 --
from io import BytesIO
import pytest
from babel.messages import extract
def test_django_translate():
buf = BytesIO(br"""
{% translate "foo" %}
""")
messages = list(extract.extract('django', buf,
extract.DEFAULT_KEYWORDS, [], {}))
assert messages[0... | [
{
"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/messages/test_django_extract.py | kolonialno/babel |
from django import forms
from django.db.models import fields
from .models import ContactUs, Spaces
class ContactUsForm(forms.ModelForm):
class Meta:
model = ContactUs
fields = '__all__'
class RegisterSpaceForm(forms.ModelForm):
class Meta:
model = Spaces
fields = ('name', 'description', 'cap... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
}... | 3 | spaces/forms.py | TeeblaQ1/Spaces.ng |
# -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import sys
if sys.version_info[0] == 3:
xrange = range
import warnings
class TimeSuite:
sample_time = 0.1
... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{... | 3 | test/benchmark/time_examples.py | jni/asv |
import itertools
from multiprocessing import Manager
from pyaugmecon.options import Options
class Flag(object):
def __init__(self, opts: Options):
self.opts = opts
if self.opts.shared_flag:
self.flag = Manager().dict()
else:
self.flag = {}
def set(self, flag_r... | [
{
"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 | pyaugmecon/flag.py | vishalbelsare/pyaugmecon |
from django.db import models
from django.contrib.auth.models import User
from django.urls import reverse, reverse_lazy
from django.contrib.auth import get_user_model
from s3direct.fields import S3DirectField
class Post(models.Model):
title = models.CharField(max_length=255)
author = models.ForeignKey(User, o... | [
{
"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 | NovelBlog/models.py | Novel-Public-Health/Novel-Public-Health |
from DNAGroup import DNAGroup
from dna.base.DNAPacker import *
class DNANode(DNAGroup):
COMPONENT_CODE = 3
def __init__(self, name):
DNAGroup.__init__(self, name)
self.pos = (0, 0, 0)
self.hpr = (0, 0, 0)
self.scale = (1, 1, 1)
def setPos(self, pos):
self.pos = po... | [
{
"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 | compiler/dna/components/DNANode.py | AnonymousDeveloper65535/libpandadna |
import pytest
ACTIVE_PROJECT = 'project1'
pytestmark = pytest.mark.usefixtures('reset_projects_dir', 'set_active_project')
def test_get_collections(api):
c = api.get_collections()
assert len(list(c)) == 3
def test_new_collection(api):
c = api.new_collection('test1')
assert len(list(api.get_collect... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (exclu... | 3 | test/test_collections.py | sdc50/quest |
import subprocess
from thefuck.specific.apt import apt_available
from thefuck.specific.sudo import sudo_support
from thefuck.utils import for_app, eager, replace_command
enabled_by_default = apt_available
@for_app('apt', 'apt-get', 'apt-cache')
@sudo_support
def match(command):
return 'E: Invalid operation' in 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_under_20_lines",
"question": "Is every function in this file shorter than... | 3 | thefuck/rules/apt_invalid_operation.py | juzim/thefuck |
from abc import ABC, abstractmethod
import ctypes
# Constatns
STARTBYTE = 0xFF
ENDBYTE = 0x3F
ESCCHAR = 0x2F
class Message(ABC):
def __init__(self, addr_CAN, addr_telem, emulator=None):
self.addr_CAN = addr_CAN
self.addr_telem = addr_telem
self.emulator = emulator
@abstractmeth... | [
{
"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 | Mocks/Message.py | Solar-Gators/emulators |
''' Docker + python 3.6.3 and Elasticsearch 6.0.1 '''
from flask import Flask, jsonify
from elasticsearch import Elasticsearch
from datetime import datetime
import os
es_host = os.environ['ELASTICSEARCH_HOST'] # 127.0.0.1
es_port = os.environ['ELASTICSEARCH_PORT'] # 9200
# IF ENV DONT WORK TRY THIS.
# es_host = 'el... | [
{
"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 | Server/api.py | George35mk/Docker-NGINX-NG5-Flask-Elastic |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
import os
from shutil import rmtree
from tempfile import mkdtemp
from nipype.testing import (example_data)
import numpy as np
def test_overlap():
from ... | [
{
"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/algorithms/tests/test_overlap.py | Conxz/nipype |
from os import environ
def get_program(environment_variable: str, backup: str) -> str:
return environ.get(environment_variable, default=backup)
def get_terminal_program(program: str) -> str:
return f"{PROGRAMS['terminal']} -e {program}"
def get_site(url: str) -> str:
return f'{PROGRAMS["browser"]} {ur... | [
{
"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 | .config/qtile/my_modules/programs.py | Rolv-Apneseth/my-configs |
# coding: utf-8
"""
Talend Management Console Public API
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: 2.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import abs... | [
{
"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 | pytmcapi/test/test_promotion_executable_details.py | mverrilli/tmc-api-clients |
from typing import Union
from pandas import Series
from datatypes.AbstractAttribute import AbstractAttribute
from datatypes.utils.DataType import DataType
class IntegerAttribute(AbstractAttribute):
def __init__(self, name: str, is_candidate_key, is_categorical, histogram_size: Union[int, str], data: Series):
... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docst... | 3 | DataSynthesizer/datatypes/IntegerAttribute.py | crangelsmith/synthetic-data-tutorial |
import numpy as np
import pytest
from sklearn.tree._reingold_tilford import buchheim, Tree
simple_tree = Tree("", 0,
Tree("", 1),
Tree("", 2))
bigger_tree = Tree("", 0,
Tree("", 1,
Tree("", 3),
Tree("",... | [
{
"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 | venv/Lib/site-packages/sklearn/tree/tests/test_reingold_tilford.py | Jos33y/student-performance-knn |
"""empty message
Revision ID: ee248674f637
Revises: ebf728dc4d0d
Create Date: 2017-05-31 15:07:32.715000
"""
# revision identifiers, used by Alembic.
revision = 'ee248674f637'
down_revision = 'ebf728dc4d0d'
from alembic import op
import sqlalchemy as sa
def upgrade():
# ### commands auto generated by Alembic ... | [
{
"point_num": 1,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answe... | 3 | migrations/versions/ee248674f637_.py | halonotes/personal_blog |
from seleniumbase import BaseCase
from werkzeug.security import generate_password_hash
from qa327_test.conftest import base_url
from qa327.models import User, Ticket
# Mock a sample user
TEST_USER = User(
email='test_frontend@test.com',
name='test_frontend',
password=generate_password_hash('test_frontend')... | [
{
"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 | qa327_test/frontend/geek_base.py | nicoleooi/cmpe327 |
import os
print("You need to have Python3 or higher and pip installed for this to work")
def linuxSetup():
pkgs = ["sudo apt install python3-pip", "pip install discord.py", "pip install discord.py[voice]", "pip install requests", "pip install times", "pip install youtube_dl", "sudo apt install ffmpeg"]
for pk... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"ans... | 3 | BotSetup.py | DaanSelen/POC_DiscordBot |
# -*- coding: utf-8 -*-
# Define here the models for your spider middleware
#
# See documentation in:
# http://doc.scrapy.org/en/latest/topics/spider-middleware.html
from scrapy import signals
class ScrapyDoubanSpiderMiddleware(object):
# Not all methods need to be defined. If a method is not defined,
# scr... | [
{
"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 | src/com/scrapy_douban/scrapy_douban/middlewares.py | WonderBo/PythonLearningDemo |
# -*- coding: utf-8 -*-
"""
Created on Wed Apr 10 15:11:54 2019
@author: Nate
"""
import numpy as np
import matplotlib.pyplot as plt
N1 = int(1e4)
x10, x20 = 1.1, 2.2
tau = np.arange(1, 10.1, .5)
r_max = 2
def G2(x1, x2, dt):
return np.exp(-(x1-x2)**2/(2*dt)-dt/4*(x1*x1+x2*x2)) / np.sqrt(2*np.pi*dt)
def P1(x... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file writte... | 3 | HW10/problem1 copied.py | nherbert25/Computational-Physics |
from typing import Optional
from db.scaffold import Scaffold
from telegram import models as tg_models
from pyrogram import types
class GetUpdatedDialog(Scaffold):
def get_updated_dialog(
self,
*,
raw_chat: "types.Chat",
db_account: "tg_models.TelegramAccount",
... | [
{
"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": "more_functions_than_classes",
"question": "Does this file define more functions than class... | 3 | backend/telegram/methods/chats/get_updated_dialog.py | appheap/social-media-analyzer |
# 901. Online Stock Span
# brute force: TLE
class StockSpanner2:
def __init__(self):
self.arr = []
def next(self, price):
self.arr.append(price)
i = len(self.arr) - 1
while i >= 0 and self.arr[i] <= price:
i -= 1
if i < 0: return len(self.arr)
return... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/c... | 3 | leetcode/0-250/225-901. Online Stock Span.py | palash24/algorithms-and-data-structures |
from sympy import Rational as frac
from ..helpers import book
from ._helpers import QuadrilateralScheme, concat, symm_s, symm_s_t
citation = book(
authors=["Joseph Oscar Irwin"],
title="On quadrature and cubature",
publisher="Cambridge University Press",
year="1923",
url="https://books.google.de/b... | [
{
"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 | quadpy/quadrilateral/_irwin.py | whzup/quadpy |
import os
import codecs
import pandas as pd
from pathlib import Path
from glob import glob
from ekorpkit.utils.func import ordinal
class ESGReport:
def __init__(self, name, output_dir, output_file, input_path, txt_info, **kwargs):
self.name = name
self.input_path = input_path
self.txt_inf... | [
{
"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 | ekorpkit/io/fetch/loader/esgreport.py | entelecheia/eKorpKit |
# Based Plugins
# Ported For Lord-Userbot By liualvinas/Alvin
# If You Kang It Don't Delete / Warning!! Jangan Hapus Ini!!!
from userbot import CMD_HANDLER as cmd
from userbot import CMD_HELP, bot
from userbot.events import poci_cmd
@bot.on(poci_cmd(outgoing=True, pattern=r"xogame(?: |$)(.*)"))
async def _(event):
... | [
{
"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 | userbot/modules/justfun.py | kikoyaja69/PocongUserbot |
from src.dataToCode.languages.classToCode import ClassToCode
from src.dataToCode.dataClasses.classData import ClassData
from src.dataToCode.dataClasses.modifier import Modifier
from src.dataToCode.languages.ToJava.methodToJava import MethodToJava
from src.dataToCode.languages.ToJava.interfaceToJava import InterfaceToJa... | [
{
"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 | src/dataToCode/languages/ToJava/classToJava.py | CoffeeOverflow/drawtocode |
import cmd
import subprocess
class CLI(cmd.Cmd):
def __init__(self):
cmd.Cmd.__init__(self)
self.prompt = 'zhangll test>'
def do_shell(self,arg):
"run a shell command"
print(">>>",arg)
sub_cmd = subprocess.Popen(arg, shell=True, stdout=subprocess.PIPE)
print(sub... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": ... | 3 | build/lib/test/module1/__init__.py | a524631266/pypi_test |
"""
test outputs
"""
from nose.tools import ok_, eq_
from carousel.core.outputs import Output
from carousel.tests import PROJ_PATH
import os
def test_outputs_metaclass():
"""
Test Output Sources
"""
class OutputTest1(Output):
class Meta:
outputs_file = 'pvpower.json'
... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{... | 3 | carousel/tests/test_outputs.py | mikofski/FlyingCircus |
from collections import deque
# Time Complexity: O(N * K).
# The outer loop runs n-k+1 times and the inner loop runs k times for every iteration of outer loop.
# So time complexity is O((n-k+1)*k) which can also be written as O(N * K).
# Space Complexity: O(1).
# No extra space is required.
def max_val_sub_arrays(arr... | [
{
"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 | problem_18/problem_18.py | oltionzefi/daily-coding-problem |
"""
SimpleMonitor alerts via pushbullet
"""
from typing import cast
import requests
import requests.auth
from ..Monitors.monitor import Monitor
from .alerter import Alerter, AlertLength, AlertType, register
@register
class PushbulletAlerter(Alerter):
"""Send push notification via Pushbullet."""
alerter_ty... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written... | 3 | simplemonitor/Alerters/pushbullet.py | cgroschupp/simplemonitor |
# coding: utf-8
"""
Accounting API
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
OpenAPI spec version: 2.4.0
Contact: api@xero.com
Generated by: https://openapi-generator.tech
"""
import re # noqa: F401
from xero_pytho... | [
{
"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 | xero_python/accounting/models/report_with_rows.py | parasharrk/xero-python |
from app import app
from flask import render_template
import forms
# Basic route
@app.route('/')
@app.route('/index')
def index():
return render_template('index.html', current_title= 'Custom Title')
@app.route('/about', methods=['GET','POST'])
def about():
form = forms.AddTaskForm()
return render_templat... | [
{
"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 | .history/routes_20200723125644.py | rkustas/taskmanager |
from typing import Any
from copy import deepcopy
class Model:
def __init__(self, name: str, model, freq: str):
self.name = name
self.model = model
self.freq = freq
self.train = None
self.test = None
self.prediction = None
self.pred_col = "prediction"
... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answ... | 3 | interpolML/interpolML/model/model.py | MiguelMque/interpolML |
import requests
import json
import time
import random
from . import conf, data, lang
from inukit.timestamp import natural_date, natural_time, timestamp_now
def is_same_day(ts1, ts2) -> bool:
def d(ts):
return natural_date(ts, '%Y-%m-%d')
return d(ts1) == d(ts2)
def handle_morning(qq):
last_morning... | [
{
"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 | src/plugins/sign/req.py | inuEbisu/inuBot |
"""
A recursive function adding commas to integers.
These functions show the why the choice of division at the recursive step matters.
Author: Walker M. White (wmw2)
Date: October 10, 2018
"""
import sys
# Allow us to go really deep
#sys.setrecursionlimit(999999999)
# COMMAFY FUNCTIONS
def commafy(s):
"""
... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/c... | 3 | docs/cornell CS class/lesson 17. Recursion/demos/com.py | LizzieDeng/kalman_fliter_analysis |
"""
Elementy w liście są uporządkowane według wartości klucza. Proszę napisać funkcję usuwającą z listy
elementy o nieunikalnym kluczu. Do funkcji przekazujemy wskazanie na pierwszy element listy,
funkcja powinna zwrócić liczbę usuniętych elementów.
"""
class Node:
def __init__(self, value):
self.value = ... | [
{
"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 | Section_7/Exercise_19.py | Szymon-Budziak/WDI_exercises_solutions |
""" Loss as a Metrics to be used in research pipelines added with `run=True` """
import numpy as np
from .base import Metrics
class Loss(Metrics):
"""
This is a helper class to aggregate losses from pipelines
that are used in Research objects with `run=True`,
like test pipelines
Parameters
... | [
{
"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 | batchflow/models/metrics/loss.py | bestetc/batchflow |
#!/usr/bin/env python3
# Copyright (c) 2018 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Check that it's not possible to start a second muskcoind instance using the same datadir or wallet."""
impor... | [
{
"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 | test/functional/feature_filelock.py | caffeine239/bitcoin |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.