source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
import redis
import json
from itertools import zip_longest
from common.config import REDIS_ADDR, REDIS_PORT, REDIS_DB
def batcher(iterable, n):
args = [iter(iterable)] * n
return zip_longest(*args)
def insert2redis(ids, dataList):
# dataList [{"videoId": id, "feat": feat, "name": name}]
r = redis.Re... | [
{
"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 | solutions/video_similarity_search/search-video-demo/search/controller/database.py | kxjko/bootcamp |
#$Id$
class EmailTemplate:
"""This class is used to create object for email templates."""
def __init__(self):
"""Initialize parameters for email templates."""
self.selected = None
self.name = ''
self.email_template_id = ''
def set_selected(self, selected):
"""Set... | [
{
"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 | books/model/EmailTemplate.py | nudglabs/books-python-wrappers |
from pythonwarrior.abilities.base import AbilityBase
class Rest(AbilityBase):
def description(self):
return "Gain 10% of max health back, but do nothing more."
def perform(self):
if self._unit.health < self._unit.max_health:
amount = int(self._unit.max_health * 0.1)
if... | [
{
"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 | pythonwarrior/abilities/rest.py | kuvaszkah/python_warrior |
# -*- coding: utf-8 -*-
# @Time : 2021/8/10 17:00
# @Author : zc
# @Desc : 使用用户永久授权码获取token返回值实体
from chanjet_openapi_python_sdk.chanjet_response import ChanjetResponse
class GetTokenByPermanentCodeResponse(ChanjetResponse):
def __init__(self, data=None):
# 错误码,200为成功,其余均为失败
self.code = ''... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false... | 3 | chanjet_openapi_python_sdk/response/get_token_by_permanent_code_response.py | Chanjet/chanjet-openapi-python-sdk- |
import tvm
@tvm.target.generic_func
def mygeneric(data):
# default generic function
return data + 1
@mygeneric.register(["cuda", "gpu"])
def cuda_func(data):
return data + 2
@mygeneric.register("rocm")
def rocm_func(data):
return data + 3
@mygeneric.register("cpu")
def rocm_func(data):
return da... | [
{
"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/python/unittest/test_lang_target.py | titikid/tvm |
SUBLIST = 0
SUPERLIST = 1
EQUAL = 2
UNEQUAL = 3
def check_lists(l1, l2):
if l1 == l2:
return EQUAL
if contains(l1, l2):
return SUPERLIST
if contains(l2, l1):
return SUBLIST
return UNEQUAL
def contains(l1, l2):
if not l2:
return True
if len(l2) > len(l1):
... | [
{
"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 | exercises/sublist/example.py | wonhyeongseo/python |
#!/usr/bin/python3
import argparse
from http import server
import json
import subprocess
def main():
argp = argparse.ArgumentParser()
argp.add_argument('--host', default='0.0.0.0')
argp.add_argument('--port', default=6969, type=int)
# argp.add_argument('--password')
args = argp.parse_args()
... | [
{
"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 | remote-notify/server.py | JOndra91/siliness |
"""
This file demonstrates writing tests using the unittest module. These will pass
when you run "manage.py test".
Replace this with more appropriate tests for your application.
"""
import unittest
from octogit.core import get_single_issue
class UTF8Support(unittest.TestCase):
def assertNotRaises(self, exceptio... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding se... | 3 | tests/core.py | myusuf3/octogit |
# coding: utf-8
# Copyright (c) Max-Planck-Institut für Eisenforschung GmbH - Computational Materials Design (CM) Department
# Distributed under the terms of "New BSD License", see the LICENSE file.
import pandas
from pysqa.wrapper.slurm import SlurmCommands
__author__ = "Jan Janssen"
__copyright__ = (
"Copyrigh... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true... | 3 | pysqa/wrapper/gent.py | pyiron/pysqa |
import enum
class Mode(enum.IntEnum):
Normal = 0
ArcSource = 1
ArcTarget = 2
Simulation = 100
ModeStrings = {Mode.Normal: 'Editor: Normal',
Mode.ArcSource: 'Editor: Arc source',
Mode.ArcTarget: 'Editor: Arc target',
Mode.Simulation: 'Simulation',
... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false... | 3 | editor/mode.py | ChrnyaevEK/petnetsim |
import dash
import dash_core_components as dcc
import dash_html_components as html
import pandas as pd
from influxdb import InfluxDBClient
from pandas import DataFrame, Series
from pandas.io.json import json_normalize
from influxdb import InfluxDBClient
from datetime import datetime, timedelta
import plotly.graph_obj... | [
{
"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 | Autoupdate/scatterinfluxtemp.py | Yuri-Njathi/Dash_Temperature_Plot |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import asyncio
import sys
from typing import AsyncContextManager, AsyncIterator
from idb.utils.contextlib import asynccontextmanager
from idb.utils.typing import none_throws
READ_CHUNK_SIZE: int = 1024 * 1024 * 4 # 4Mb,... | [
{
"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 | idb/common/gzip.py | sergey-plevako-badoo/FBSimulatorControl |
''' A simple profiler for logging '''
import logging
import time
class Profiler(object):
def __init__(self, name, logger=None, level=logging.INFO):
self.name = name
self.logger = logger
self.level = level
def step(self, name):
""" Returns the duration and stepname since last s... | [
{
"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 | omnidata_annotator/scripts/profiler.py | EPFL-VILAB/omnidata |
import time
import striga.core.prioqueue
###
#TODO: Move scheduler terminology and implementation (when needed) more to following:
#
# class Scheduler
# - method At(rel=) - OneShotAbsTimeJob
# - method At(abs=) - OneShotRelTimeJob
# - method Every(period=) - PeriodicJob, period can be string with ('1d')
#
#This can ... | [
{
"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 | src/striga/server/scheduler.py | ateska/striga |
"""Unit tests for numbers.py."""
import math
import operator
import unittest
from numbers import Complex, Real, Rational, Integral
class TestNumbers(unittest.TestCase):
def test_int(self):
self.assertTrue(issubclass(int, Integral))
# self.assertTrue(issubclass(int, Complex)) # Error in Julia
... | [
{
"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/cases_py/test_abstract_numbers.py | MiguelMarcelino/py2many |
"""Utility functions."""
import h5py
import numpy as np
from torch.utils import data
def save_dict_h5py(data, fname):
"""Save dictionary containing numpy arrays to h5py file."""
with h5py.File(fname, 'w') as hf:
for key in data.keys():
hf.create_dataset(key, data=data[key])
def load_di... | [
{
"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 | utils.py | tkipf/gym-gridworld |
from flask import Flask, request, jsonify, current_app, render_template
from .process_data import *
from .models import *
from .user import user
from .book import book
from .rent import rent
import logging
logging.basicConfig(level=logging.INFO)
def create_app():
app = Flask(__name__)
app.register_blueprint... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"... | 3 | app/app/__init__.py | yongjjang/book-rental-service |
from vnpy.app.cta_strategy import BarData
class CandleEngine:
"""
蜡烛图分析引擎
"""
def recognitionBar(self, bar: BarData):
"""
识别单个bar数据
:param bar:
:return:
"""
candle_chart = CandleChart(bar.open_price, bar.high_price, bar.low_price, bar.close_price)
cla... | [
{
"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_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": ... | 3 | tests/basic/candle_engine.py | CatTiger/vnpy |
import pytest
import nvme as d
import time
import logging
TEST_SCALE = 10 #1, 10
# trim
@pytest.mark.parametrize("repeat", range(TEST_SCALE))
@pytest.mark.parametrize("lba_count", [8, 8*1024, 0]) # 4K, 4M, all
def test_trim_time_one_range(nvme0, nvme0n1, lba_count, repeat, qpair):
buf = d.Buffer(4096)
... | [
{
"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 | scripts/performance/4_nvme_cmd_test.py | catogts/pynvme |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | [
{
"point_num": 1,
"id": "all_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 | aliyun-python-sdk-pvtz/aliyunsdkpvtz/request/v20180101/SetZoneRecordStatusRequest.py | yndu13/aliyun-openapi-python-sdk |
import pandas as pd
from sklearn.model_selection import train_test_split
class DataLoader:
def __init__(self):
self.dataset = None
self.sensor = None
self.target = None
def load(self,file,isTest=False):
if not isTest:
print("loading")
self.dataset = pd.r... | [
{
"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 | dataHandler.py | RJRL12138/Regression-Examples |
import logging
from airflow.hooks.postgres_hook import PostgresHook
from airflow.models import BaseOperator
from airflow.utils.decorators import apply_defaults
class FactsCalculatorOperator(BaseOperator):
facts_sql_template = """
DROP TABLE IF EXISTS {destination_table};
CREATE TABLE {destination_table} ... | [
{
"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 | data_pipelines_w_airflow/03_production_data_pipelines/facts_calculator.py | MonNum5/udacity_data_engineer |
import logging
import sys
import traceback
verbosity_to_logging_level = {
0: logging.CRITICAL,
1: logging.ERROR,
2: logging.WARNING,
3: logging.INFO,
4: logging.DEBUG,
}
def exception_handler(etype, value, tb):
# Report to file
logging.exception(''.join(traceback.format_exception(ety... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding s... | 3 | biclust_comp/logging_utils.py | nichollskc/biclust_comp |
# Copyright (c) OpenMMLab. All rights reserved.
import torch
from torch.autograd import Function
from ..utils import ext_loader
ext_module = ext_loader.load_ext('_ext', ['ball_query_forward'])
class BallQuery(Function):
"""Find nearby points in spherical space."""
@staticmethod
def forward(ctx, min_rad... | [
{
"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 | mmcv/ops/ball_query.py | ngonhi/mmcv |
import boto3, shutil, subprocess, os
from aws_lambda_powertools import Logger, Tracer
# start logger and tracing of function
logger = Logger()
modules_to_be_patched = [ "boto3" ]
tracer = Tracer(patch_modules = modules_to_be_patched)
# connect to S3 bucket using AWS SDK
s3_bucket_conn = boto3.client("s3")
s3_bucket_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_has_docstring",
"question": "Does every function in this file have a docst... | 3 | lambda/app.py | marekq/go-lambda-pipeline |
import numpy
import matplotlib.pyplot as plt
import threading
import multiprocessing
from scipy import stats
class TestHist:
def hist(self, parameter_list):
x = numpy.random.uniform(0.0, 5.0, 100000)
plt.hist(x, 100)
plt.show()
y = numpy.random.normal(0.0, 5.0, 100000)
pl... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
... | 3 | ml.py | congnb/mypython |
"""This module contains exceptions defined for Hermes Audio Server."""
class HermesAudioServerError(Exception):
"""Base class for exceptions raised by Hermes Audio Server code.
By catching this exception type, you catch all exceptions that are
defined by the Hermes Audio Server code."""
class Configura... | [
{
"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 | src/hermes_audio_server/exceptions.py | djvl/hermes-audio-server |
from cefpython3 import cefpython as cef
import platform
import sys
def main():
check_versions()
sys.excepthook = cef.ExceptHook # To shutdown all CEF processes on error
cef.Initialize()
cef.CreateBrowserSync(url="https://fortune.chinanews.com/",
window_title="Hello World!")
... | [
{
"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 | mycef.py | sillyemperor/mypynotebook |
from thriftpy2.thrift import TType
class ThriftError(Exception):
""" Base Exception defined by `aiothrift` """
class ConnectionClosedError(ThriftError):
"""Raised if connection to server was closed."""
class PoolClosedError(ThriftError):
"""Raised when operating on a closed thrift connection pool"""
... | [
{
"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": true
},
{
... | 3 | aiothrift/errors.py | achimnol/aiothrift |
#!/usr/bin/env python
from __future__ import print_function
import sys
import struct
def read():
try:
return sys.stdin.buffer.read()
except AttributeError:
return sys.stdin.read()
def write(out):
try:
sys.stdout.buffer.write(out)
except AttributeError:
sys.stdout.wri... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": fal... | 3 | bootstrap/bootstrap.py | chungy/doom-pwads |
# -*- coding: utf-8 -*-
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
... | [
{
"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 | prestoadmin/topology.py | leniartek/trino-admin |
from flask import Flask
from flask_restful import Resource, Api
#import para ações
from yahoo_fin import stock_info
#import para opções
from lxml import html
import requests
#
#---------------------------------------------
#
app = Flask(__name__)
api = Api(app)
class Home(Resource):
def get(self):
re... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answ... | 3 | app/main.py | thiagopirex/api-finance-lastprice |
from src.Car import Car
from src.CarImpl import CarImpl
from unittest.mock import *
from unittest import TestCase, main
class test_Car(TestCase):
def test_needsfuel_true(self):
car = Car()
car.needsFuel = Mock(name='needsFuel')
car.needsFuel.return_value = True
carImpl = CarImpl(ca... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer":... | 3 | tests/TestCar.py | TestowanieAutomatyczneUG/laboratorium-9-stokwiszadrian |
from django import forms
from models import *
class QuestionForm(forms.ModelForm):
def __init__(self, user = None, *args, **kwargs):
self.user = user
super(QuestionForm, self).__init__(*args, **kwargs)
def save(self):
question = Question(user = self.user, category = self.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": "all_function_names_snake_case",
"question": "Are all function names in this file written... | 3 | answrs/aforms.py | agiliq/django-answrs |
import time
# https://docs.datadoghq.com/integrations/amazon_lambda/#lambda-metrics
DATADOG_METRIC_TYPES = {"count", "gauge", "histogram", "check"}
# https://github.com/DataDog/datadogpy/blob/master/datadog/api/constants.py
# I kept the existing upstream structure to make it easy for future patches.
class CheckStatus... | [
{
"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 | dbsnap_verify/datadog_output.py | isabella232/dbsnap |
from keras.engine import Layer
import tensorflow as tf
class LetterBoxLayer(Layer):
def __init__(self,net_size,**kwargs):
super(LetterBoxLayer, self).__init__(**kwargs)
self.net_size = net_size
# save config to save and load the keras model correctly
def get_config(self):
... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written... | 3 | utils/letterboxlayer.py | Kammerlo/keras-yolo3-serving |
#!/usr/bin/env python
from multicorn import ForeignDataWrapper
import numpy as np
import scipy.stats
class RNGWrapper(ForeignDataWrapper):
def __init__(self, options, columns):
super(RNGWrapper, self).__init__(options, columns)
self.columns = columns
# default to the normal distributio... | [
{
"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 | rng_fdw/__init__.py | yieldsfalsehood/rng_fdw |
# coding: utf-8
"""
OpenAPI Extension x-auth-id-alias
This specification shows how to use x-auth-id-alias extension for API keys. # noqa: E501
The version of the OpenAPI document: 1.0.0
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import unittest
import... | [
{
"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 | samples/openapi3/client/extensions/x-auth-id-alias/python-experimental/test/test_usage_api.py | data-experts/openapi-generator |
from bigcoin import bc_kafka,bc_elasticsearch
import json
import datetime
import signal
def generate_elastic_insert_from_messages(messages):
for message in messages:
json_message = json.loads(message)
#value are in satoshi
yield {
'_index' : 'transaction_idx',
'_type': 'transaction',
'_id': json_messag... | [
{
"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 | kafka_to_elastic/kafka_historique_montants_to_elastic.py | Neemys/BigCoin |
"""
Given an array A[] of N positive integers.
The task is to find the maximum of j - i subjected to the constraint of A[i] <= A[j].
Example 1:
Input:
N = 2
A[] = {1, 10}
Output:
1
Explanation:
A[0]<=A[1] so (j-i) is 1-0 = 1.
Example 2:
Input:
N = 9
A[] = {34, 8, 10, 3, 2, 80, 30, 33, 1}
Output:
6
Explanation:
In t... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
... | 3 | DatastructureAndAlgorithms/4_ArrayAndString/10_maximum_index.py | sabyasachisome/DatastructureAndAlgorithms |
# Copyright 2013-2019 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import re
import os
from itertools import product
from spack.util.executable import which
# Supported archive extensions.... | [
{
"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/spack/spack/util/compression.py | Bidibulke/spack |
import numpy as np
class NeuralNetwork:
def __init__(self, input_shape, neurons, learning_rate):
self.wights = []
self.wights.append(np.random.rand(input_shape, neurons))
self.wights.append(np.random.rand(neurons, 1))
self.baias = np.zeros(neurons)
self.learning_rate = learn... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding se... | 3 | NeuralNetwork/NN.py | CarlosW1998/DeepLearningClass |
from model.authentication import *
from config.options import *
import json
import redis
import time
from pymongo import MongoClient
class RedisSubscribeListener(object):
def __init__(self):
mongo_client = MongoClient(MONGODB_URI)
db = mongo_client[MONGODB_DBNAME]
self.tr_tweets = db.tr_... | [
{
"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 | daemon/turkish_streaming_sub.py | scirag/TwitterAnalyzer |
#
# This example is again a graph coloring problem. In this case, however,
# a stronger object oriented approach is adopted to show how Coopy is
# indeed compatible with such practices.
#
import coopy
import random
class Node:
def __init__(self):
self._color = coopy.symbolic_int('c')
self._neighb... | [
{
"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 | examples/example-5.py | abarreal/coopy |
from fastapi import APIRouter
from shared import bikecalc
router = APIRouter()
@router.get("/calculate/gear_ratios")
async def calculate_gear_ratios(
min_chainring: int = 36,
max_chainring: int = 50,
min_cog: int = 14,
max_cog: int = 28):
"""Calculates a hierarchy of gear ratios f... | [
{
"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 | src/views/calculate.py | cmrust/rando |
from federatedscope.core.monitors.monitor import Monitor
class Worker(object):
"""
The base worker class.
"""
def __init__(self, ID=-1, state=0, config=None, model=None, strategy=None):
self._ID = ID
self._state = state
self._model = model
self._cfg = config
sel... | [
{
"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 | federatedscope/core/worker/base_worker.py | alibaba/FederatedScope |
import pandas as pd
import numpy as np
import os
import matplotlib.pyplot as plt
import sys
plt.rcParams['figure.figsize'] = (19.2, 8.7)
index = 0
def show_accuracy(df):
global index
df.plot(kind='line')
plt.xlabel('iterations')
plt.ylabel('accuracy')
plt.savefig(str(index) + '.png', bbox_inches='tight')
pr... | [
{
"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 | analyzer/federated_visualize.py | Davide-DD/distributed-machine-learning-architectures |
# -*- coding: utf-8 -*-
import unittest
from andip import AnDiP
from andip.provider import FileProvider
class PolishTest(unittest.TestCase):
def setUp(self):
self.ad = AnDiP(FileProvider('../data/english'))
def testGetWordVerb(self):
self.assertEqual(u'am', self.ad.get_word(('verb', 'be', {'number': 'singular... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false... | 3 | tests/english.py | kamilpp/andip |
from twisted.internet import defer
from ldaptor import numberalloc
from ldaptor.protocols.ldap import ldapsyntax, autofill
class Autofill_posix: # TODO baseclass
def __init__(self, baseDN, freeNumberGetter=numberalloc.getFreeNumber):
self.baseDN = baseDN
self.freeNumberGetter = freeNumberGetter
... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false... | 3 | ldaptor/protocols/ldap/autofill/posixAccount.py | scottcarr/ldaptor |
from datetime import datetime, timedelta
from pymongo.mongo_client import MongoClient
from secrets import MONGO
class BasicMongo:
@staticmethod
def get_last(db):
return db.logs.aggregate(
[
{'$sort': {'mac': 1, 'timestamp': 1}},
{
'$gro... | [
{
"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 | basic_mongo.py | Andre0512/HeizungsLogger |
import copy
import random
class Hat:
def __init__(self, **kwarg):
contents = []
for key in kwarg.keys():
for n in range(kwarg[key]):
contents.append(key)
self.contents = contents
def draw(self, number):
contents = self.contents
if number >= ... | [
{
"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 | Probability Calculator/prob_calculator.py | lorenzotsouza/Python |
from django import forms
from .models import Order
class OrderForm(forms.ModelForm):
class Meta:
model = Order
fields = ('user_full_name', 'email', 'phone_number', 'street_address1', 'street_address2',
'town_or_city', 'postcode', 'country',
'county' )
def ... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{... | 3 | checkout/forms.py | alissatroiano/Hue |
#!/usr/bin/python3
import sys
import os
import unittest
from pprint import pprint
from udpbrcst import PyLayerUDPb
# FOR TESTING:
my_command = ""
my_params = []
my_udpb = PyLayerUDPb()
# UNITTEST:
class PyLayerUDPbTest(unittest.TestCase):
_testMethodName = ''
def __init__(self, in_name):
global _log_mo... | [
{
"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 | testing/udpbrcst-test.py | Markatrafik/PyIRCIoT |
class OrderedList:
def __init__(self, unique=False):
self.list = []
self.__unique = unique
def add(self, value):
i = 0
while (i < len(self.list)) and (self.list[i] < value):
i += 1
if self.__unique:
if len(self.list) == i or self.list[i] != va... | [
{
"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/client_py/olist.py | epmcj/nextflix |
import os
from setuptools import setup, find_packages
def read(fname):
path = os.path.join(os.path.dirname(__file__), fname)
try:
file = open(path, encoding='utf-8')
except TypeError:
file = open(path)
return file.read()
def get_install_requires():
install_requires = [
't... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"... | 3 | setup.py | kingemma0430/jet-bridge |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import simplejson as json
from alipay.aop.api.constant.ParamConstants import *
class KoubeiRetailItemQueryModel(object):
def __init__(self):
self._city_id = None
self._item_id = None
@property
def city_id(self):
return self._city_id
... | [
{
"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_multiple_inheritance",
"question": "Does any class in this file use multiple inherit... | 3 | alipay/aop/api/domain/KoubeiRetailItemQueryModel.py | articuly/alipay-sdk-python-all |
#!/usr/bin/env python
# Copyright (c) 2009 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
import sys
import subprocess
PY3 = bytes != str
# Below IsCygwin() function copied from pylib/gyp/common.py
def IsCygwin():
tr... | [
{
"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 | node_modules/_npm@6.14.9@npm/node_modules/node-gyp/gyp/gyp_main.py | TT555666/cms-server |
from bot_messenger import messenger
from bs4 import BeautifulSoup
from firebase.firebase import db_firebase
#driver=messenger.driver
class scrapy:
def extract():#driver):
#print('realizando extraçao')
#elemento = driver.find_element_by_xpath('/html/body/div/div[1]/div[1]/div[4]/div[1]/div[... | [
{
"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 | python/bot/bot_scrapy.py | Douglasbm040/BOT.PRE-NATAL |
import time
class MetricBase(object):
def __init__(self, listeners, name):
"""Create a new metric object
:param metricslib.listeners.Listeners: the listeners to use
:param str name: the metric name
"""
self._listeners = listeners
self._name = name
class Counter(M... | [
{
"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 | metricslib/metrics.py | pmatigakis/metricslib |
# -*- coding: utf-8 -*-
#
# Copyright (c) 2017 - 2019 Karlsruhe Institute of Technology - Steinbuch Centre for Computing
# This code is distributed under the MIT License
# Please, see the LICENSE file
#
"""
Created on Sat Aug 10 08:47:51 2019
@author: vykozlov
"""
import unittest
import semseg_vaihingen.models.deepaas... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer":... | 3 | semseg_vaihingen/tests/test_unit_model.py | SilkeDH/semseg_vaihingen |
from typing import Dict
from exaslct_src.lib.export_container_task import ExportContainerTask
from exaslct_src.lib.data.required_task_info import RequiredTaskInfo
from exaslct_src.lib.docker.docker_create_image_task import DockerCreateImageTask
class ExportContainerTasksCreator():
def __init__(self, export_path... | [
{
"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 | exaslct_src/lib/export_container_tasks_creator.py | mace84/script-languages |
#!/usr/bin/python
# multitonePygameSampler.py
# this enables you to press the buttoins on PiPiano like a piano, and will play the sounds out of the Pi's audio output like a proper keyboard
# Author : Zachary Igielman
# to run:
# sudo python multitonePygameSampler.py
# to change volume:
# amixer cset numid=1 -- 80%
#... | [
{
"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 | examples/multitonePygameSampler.py | ZacharyIgielman/PiPiano |
from unittest import TestCase, skip
from unittest.mock import Mock, patch
import json
import sqlalchemy
from rq import get_current_job
from rq_settings import prefix, callback_queue_name
from app_settings.app_settings import AppSettings
from callback import job
def my_get_current_job():
class Result:
id... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{... | 3 | tests/test_callback.py | unfoldingWord-dev/door43-job-handler |
import torch
from transformers import BertTokenizer, BertModel
from wiki_search.dataset import Document
torch.set_grad_enabled(False)
MODEL_NAME = 'bert-base-cased'
class BertRanking(object):
def __init__(self, device: str = 'cuda:0'):
self.device = torch.device(device)
self.model = BertModel.fr... | [
{
"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 | wiki_search/core/bert_ranking.py | WikiMegrez/wikisearch |
import pytest
from mimesis_stats.providers.distribution import Distribution
@pytest.mark.parametrize(
"population, weights, return_value",
[
(["A", "B"], [0, 1], "B"),
([1, 2, 3], [1, 0, 0], 1),
],
)
def test_discrete_distribution_fixed(population, weights, return_value):
"""Test does... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside... | 3 | tests/providers/test_distribution.py | jonathonmellor/mimesis-stats |
from __future__ import unicode_literals
import tornado.ioloop
import tornado.web
import tornado.websocket
import logging
from leapcast.apps.default import *
from leapcast.services.rest import *
from leapcast.services.websocket import *
class LEAPserver(object):
def start(self):
logging.info('Starting LE... | [
{
"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_multiple_inheritance",
"question": "Does any class in this file use multiple inherit... | 3 | leapcast/services/leap.py | tibnor/leapcast |
# Timing functionality from Python's built-in module
from time import perf_counter
from functools import lru_cache
def timer(fn):
def inner(*args):
start = perf_counter()
result = fn(*args)
end = perf_counter()
elapsed = end - start
print(result)
print('elapsed', el... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answ... | 3 | lesson3-functional_programming/timing.py | zubrik13/udacity_inter_py |
# Copyright (c) 2012-2018 SoftBank Robotics. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the COPYING file.
""" List the contents of a package """
import zipfile
import os
import tabulate
from qisys import ui
import qisys.parsers
def configure_parser(parse... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (e... | 3 | python/qipkg/actions/ls_package.py | vbarbaresi/qibuild |
import unittest
from SDWLE.agents.trade.possible_play import PossiblePlays
from SDWLE.cards import Wisp, WarGolem, BloodfenRaptor, RiverCrocolisk, AbusiveSergeant, ArgentSquire
from testsSDW.agents.trade.test_helpers import TestHelpers
from testsSDW.agents.trade.test_case_mixin import TestCaseMixin
class TestTradeAge... | [
{
"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 | testsSDW__copy/agents/trade_agent_tests.py | jomyhuang/sdwle |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside... | 3 | src/managementgroups/azext_managementgroups/_client_factory.py | mayank88mahajan/azure-cli-extensions |
# project/tasks/sample_tasks.py
import time
from celery import shared_task
@shared_task
def send_email(email_id, message):
time.sleep(10)
print(f"Email is sent to {email_id}. Message sent was - {message}")
@shared_task
def get_micro_app_status(app):
print(f"La micro app {app}. est UP")
@shared_task
... | [
{
"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 | project/tasks/sample_tasks.py | idjemaoune/django-celery |
import sys
import logging
import argparse
import numpy as np
from quilted.h5blockstore import H5BlockStore
def main():
logger = logging.getLogger('quilted.h5blockstore')
logger.setLevel(logging.INFO)
logger.addHandler(logging.StreamHandler(sys.stdout))
parser = argparse.ArgumentParser()
parser.add... | [
{
"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 | bin/export-to-hdf5.py | stuarteberg/quilted |
import datetime
import sys
from collections import OrderedDict
class DiskEntry:
"""A disk entry."""
def __init__(self, read_in_kb, write_in_kb, timestamp):
"""Initialize a DiskEntry."""
self._read_in_kb = read_in_kb
self._write_in_kb = write_in_kb
self._timestamp = timestamp
... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false... | 3 | parsers/disk.py | jazevedo620/wise-kubernetes |
import pathlib
from fpdf import FPDF
root_path = pathlib.Path(__file__).parent.absolute()
# trade by trade
# prepayment
# bi-weekly
# monthly
def trade_by_trade(self):
path = root_path / "contract-templates/cht/逐筆結.txt"
with open(path, 'rb') as f:
txt = f.read().decode('UTF-8')
self.set_text_c... | [
{
"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 | pdf.py | yesiah/contract-generator |
# automatically generated by the FlatBuffers compiler, do not modify
# namespace: tflite
import flatbuffers
from flatbuffers.compat import import_numpy
np = import_numpy()
class ArgMinOptions(object):
__slots__ = ['_tab']
@classmethod
def GetRootAsArgMinOptions(cls, buf, offset):
n = flatbuffers... | [
{
"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 | tflite-onnx/onnx_tflite/tflite/ArgMinOptions.py | jwj04ok/ONNX_Convertor |
import asyncio
import uvloop
from secret_sdk.client.localsecret import AsyncLocalSecret
async def with_sem(aw, sem):
async with sem:
print(sem)
return await aw
async def main():
async with AsyncLocalSecret(chain_id="pulsar-2") as secret:
validators = await secret.staking.validators... | [
{
"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 | integration_tests/async_parallel.py | abduramann/secret-sdk-python |
import sympy as smp
from sympy import *
def prgrm_iter():
x, k, n, h = smp.symbols ('x k n h')
f = smp.sin(x)
print (" ")
print ("This program comes from the GitHub repository")
print ("AndreiMurashev/pos.int_diff_formula")
print (" ")
print ("The purpose of this program is to check if the... | [
{
"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 | formula-verif-case.py | AndreiMurashev/pos.int_diff_formula |
from datetime import datetime
from urllib.parse import urlparse
from transformer.request import HttpMethod, Header, Request
from transformer.task import Task2
from .sanitize_headers import plugin
def test_its_name_is_resolvable():
from transformer.plugins import resolve
assert list(resolve("transformer.plug... | [
{
"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 | transformer/plugins/test_sanitize_headers.py | jsabak/Transformer |
from tests import create_rand
def prepare_database_with_table(name: str, rows: list):
from peewee import IntegerField, Proxy, CharField, Model
from playhouse.sqlite_ext import CSqliteExtDatabase
db = Proxy()
db.initialize(CSqliteExtDatabase(':memory:', bloomfilter=True))
NameModel = type(name, (M... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": tru... | 3 | tests/test_ds.py | kororo/rand |
import common.database as db
import common.util.urlFuncs as urlFuncs
import logging
import os.path
import settings
class Clean(object):
def __init__(self):
print("Clean __init__()")
self.log = logging.getLogger("Main.Cleaner")
super().__init__()
def clean_files(self):
with db.session_context() as sess:
... | [
{
"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 | Misc/Cleaner/Clean.py | awesome-archive/ReadableWebProxy |
from flask import Flask, current_app, request
from flask import render_template
app = Flask(__name__)
@app.route('/')
def hello_world():
return render_template('index.html')
@app.route('/favicon.ico')
def get_fav():
print(__name__)
return current_app.send_static_file('img/favicon.ico')
@app.route('/e... | [
{
"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.py | BlueRhino/crazytools |
from os.path import join
from ...utils import get_test_data_path
from pliers.extractors import ClarifaiAPIExtractor
from pliers.stimuli import ImageStim
from pliers.extractors.base import merge_results
import numpy as np
import pytest
@pytest.mark.skipif("'CLARIFAI_API_KEY' not in os.environ")
def test_clarifai_api_e... | [
{
"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 | pliers/tests/extractors/api/test_clarifai_extractors.py | adelavega/pliers |
# Copyright 2018 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import json
import unittest
from pants.testutil.subsystem.util import init_subsystem
from pants.contrib.python.checks.checker.common import CheckstylePlugin
from pants.contrib.python.che... | [
{
"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 | contrib/python/tests/python/pants_test/contrib/python/checks/tasks/checkstyle/test_plugin_subsystem_base.py | revl/pants |
import datetime
from context_manager.db_context_manager import DBContextManager
from util.constants import QUERIES
def export_results(data, controller_name, trajectory_name, database_path):
def get_table_name(controller, trajectory, date_time):
return '_'.join([controller,
trajec... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding s... | 3 | src/util/results.py | lmiguelvargasf/trajectory_tracking |
# Time: O(n)
# Space: O(1)
# 1018
# Given an array A of 0s and 1s, consider N_i: the i-th subarray from A[0] to A[i] interpreted
# as a binary number (from most-significant-bit to least-significant-bit.)
#
# Return a list of booleans answer, where answer[i] is true if and only if N_i is divisible by 5.
# Input: [0,1... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},... | 3 | Python/binary-prefix-divisible-by-5.py | RideGreg/LeetCode |
from flask import jsonify, g
from app import db
from app.api import bp
from app.api.auth import basic_auth
@bp.route('/tokens', methods=['POST'])
@basic_auth.login_required
def get_token():
token = g.current_user.get_token()
db.session.commit()
return jsonify({'token': token})
def revoke_token():
... | [
{
"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 | YTReviewsAPI/app/api/tokens.py | porterehunley/OneReview_Data_Collection |
import os
pluginName = os.path.abspath(__file__).split(os.path.sep)[-2]
pluginNameFriendly = (pluginName[0].upper()+pluginName[1:]).replace('_',' ')
from corpusslayer.hooks import getAnalysisOptionsEmptyContainer
from corpusslayer.bootstrap_constants import COLOR
from django.utils.translation import ugettext_lazy as _
... | [
{
"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 | plugins/base/hooks.py | adlerosn/corpusslayer |
"""Модуль со вспомогательными функциями."""
from argparse import ArgumentTypeError
from random import choice
from string import ascii_letters
from typing import Optional, Tuple, Union
from graphql_relay import from_global_id
def gid2int(gid: Union[str, int]) -> Optional[int]:
try:
return int(gid)
ex... | [
{
"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 | devind_helpers/utils.py | devind-team/devind-django-helpers |
import os
import sys
import zipfile
import pytest
from mountequist import installers
from mountequist.util import get_root_mountebank_path
from tests.defaults import DEFAULT_TEST_PATH
windows_only = pytest.mark.skipif(sys.platform != "win32", reason="Windows Only")
@windows_only
def test_windows_can_download(mark_... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding se... | 3 | tests/installers/test_web.py | ginjeni1/mountequist |
import torch
import nucls_model.torchvision_detection_utils.transforms as tvdt
ISCUDA = torch.cuda.is_available()
def tensor_isin(arr1, arr2):
r""" Compares a tensor element-wise with a list of possible values.
See :func:`torch.isin`
Source: https://github.com/pytorch/pytorch/pull/26144
"""
res... | [
{
"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 | TorchUtils.py | CancerDataScience/NuCLS |
# -*- coding: utf-8 -*-
__author__ = 'sandlbn'
from django import template
from datetime import datetime
from time import mktime
from jsmin import jsmin
def timestamp_to_datetime(timestamp):
"""
Converts string timestamp to datetime
with json fix
"""
if isinstance(timestamp, (str, unicode)):
... | [
{
"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 | django_bootstrap_calendar/utils.py | urtzai/django-bootstrap-calendar |
from api import app
from json import dumps
from flask import request
from flask import render_template
from flask_restful import Resource
from flask.ext.jsonpify import jsonify
from api.models.inflacpy.scrap.scrap import Scrap
scrap = Scrap()
@app.route('/')
def home():
"""Método para retorno da página inicial... | [
{
"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 | api/controllers/routes.py | M3nin0/inflacpy-api |
from pygame import *
class Blocker(sprite.Sprite):
def __init__(self, size, color, row, column):
sprite.Sprite.__init__(self)
self.height = size
self.width = size
self.color = color
self.image = Surface((self.width, self.height))
self.image.fill(self.color)
... | [
{
"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_multiple_inheritance",
"question": "Does any class in this file use multiple inherit... | 3 | sprites/blocker.py | ErezOr18/pygame-space-invaders |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.13.4
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
i... | [
{
"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 | kubernetes/test/test_v1beta1_self_subject_rules_review.py | iamneha/python |
"""Implementation of scaled KNX DPT_1_Ucount Values."""
from xknx.exceptions import ConversionError
from .dpt import DPTBase
class DPTScaling(DPTBase):
"""
Abstraction for KNX 1 Octet Percent.
DPT 5.001
"""
value_min = 0
value_max = 100
resolution = 100/255
unit = "%"
payload_le... | [
{
"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 | xknx/dpt/dpt_scaling.py | cyberjunky/xknx |
#STP header feilds
#list, fields containing following keys
#dict, head containing key, value pairs
#1. source port #
#2. dest port #
#3. seq_nb
#4. ack_nb
#5. ACK
#6. SYN
#7. FIN
#8. RST
#example ['1234', '1234', '100000', '4294967295', '4294967295', '0', '1', '1', '1']
#max len of header = 46 bytes
#b'1234+1234+10000... | [
{
"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 | ass1/rsc/stp_header.py | suryaavala/network |
import unittest
import numpy as np
import torch
from rl_safety_algorithms.common.online_mean_std import OnlineMeanStd
import rl_safety_algorithms.common.mpi_tools as mpi_tools
class TestOnlineMeanStd(unittest.TestCase):
""" Testing the non-MPI version.
"""
@staticmethod
def perform_single_pass(rms, i... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding s... | 3 | tests/test_mean_std.py | liuzuxin/RL-Safety-Algorithms |
from typing import Union
class int(float):
def __init__(self, arg: int): pass
# def __add__(self, other: float) -> float: pass
# def __add__(self, other: complex) -> complex: pass
def __add__(self, other: int) -> int: pass
# def __sub__(self, other: float) -> float: pass
# def __sub__(self, o... | [
{
"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 | src/check/resource/primitive/int.py | JSAbrahams/mamba |
'''
Date Time Utility
'''
from datetime import datetime
class DateTimeUtil(object):
def getDate(self):
date = datetime.now().strftime('%b %d %y')
return date
def getTime(self):
time = datetime.now().strftime('%H:%M:%S')
return time
| [
{
"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 | wifi_radio/date_time_util.py | thomasvamos/wifi_radio |
##############################################################################
#
# Copyright (c) 2003 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOF... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},... | 3 | ThirdParty/ZopeInterface/zope/interface/tests/advisory_testing.py | jasper-yeh/VtkDotNet |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.