source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
# encoding: utf-8
from __future__ import absolute_import
from __future__ import unicode_literals
from docker.utils.json_stream import json_splitter, stream_as_text, json_stream
class TestJsonSplitter(object):
def test_json_splitter_no_object(self):
data = '{"foo": "bar'
assert json_splitter(data... | [
{
"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 | tests/unit/utils_json_stream_test.py | jbn/docker-py |
"""Shared test fixtures."""
import pytest
from multipackage import Repository
pytest_plugins = ['mock_travis', 'mock_pypi', 'mock_slack']
@pytest.fixture(scope="function")
def bare_repo(tmpdir):
"""Return a repository pointed at a bare repo."""
folder = str(tmpdir.mkdir("bare_repo"))
return Repository... | [
{
"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 | test/conftest.py | iotile/multipackage |
class ALU():
def __init__(self):
self.Rs = None
self.Rt = None
self.Rd = None
def alu(self, opcode):
if (opcode == 0):
self.Rd = self.Rs + self.Rt
return self.Rd
elif (opcode == 1):
self.Rd = self.Rs - self.Rt
return 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 | alu.py | jhonatheberson/MIPS-architecture |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2010-2016 PPMessage.
# Guijin Ding, dingguijin@gmail.com
#
#
from .basehandler import BaseHandler
from ppmessage.api.error import API_ERR
from ppmessage.core.constant import API_LEVEL
from ppmessage.db.models import PredefinedScript
import json
import logging
class PPMovePr... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer":... | 3 | ppmessage/api/handlers/ppmovepredefinedscriptintogroup.py | x-debug/ppmessage_fork |
import os
PLOTLY_DIR = os.environ.get("PLOTLY_DIR",
os.path.join(os.path.expanduser("~"), ".plotly"))
TEST_FILE = os.path.join(PLOTLY_DIR, ".permission_test")
def _permissions():
try:
if not os.path.exists(PLOTLY_DIR):
try:
os.mkdir(PLOTLY_DIR)
... | [
{
"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 | _plotly_utils/files.py | piyush1301/plotly.py |
from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
from compas_rhino.geometry import RhinoPoint
class RhinoPoint(RhinoPoint):
@property
def xyz(self):
return self.geometry.X, self.geometry.Y, self.geometry.Z
def closest_point(self, *args... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"ans... | 3 | src/compas_rv2/singular/rhino/geometry/point.py | selinabitting/compas-RV2 |
## A recursive implementation of merge sort.
## Author: AJ
## test case 1 45 849 904 79 48942 7
class sorting:
def __init__(self):
self.arr = []
def get_data(self):
self.arr = list(map(int, input().split()))
return self.arr
def merge_sort(self, array):
if len(array) == 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 | sorting/merge-sort-recursive.py | thehimalayanleo/Algorithm-Practice |
from collections import defaultdict
from dataclasses import dataclass
@dataclass
class Utterance:
speaker_id: str
message_id: int
speaker_name: str
speaker_language: str
text: str
timestamp: float
class TranscriptList:
"""Holds transcripts"""
def __init__(self):
self.transcr... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class 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": true... | 3 | backend/src/services/transcript.py | didi/MeetDot |
#-*- coding:utf-8 -*-
import os
import time
import pprint
import tensorflow as tf
from six.moves import range
from logging import getLogger
logger = getLogger(__name__)
pp = pprint.PrettyPrinter().pprint
def get_model_dir(config, exceptions=None):
"""根据设置的参数生成一个路径.
这个路径将会作为存放训练数据的目录地址,所以不同的参数的训练数据必须保证路径唯一。
"""... | [
{
"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 | utils.py | bluepc2013/deep-rl-tensorflow-master |
# Copyright 2014 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ag... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer... | 3 | google-cloud-sdk/lib/surface/dns/managed_zones/list.py | KaranToor/MA450 |
# -*- coding: utf-8 -*-
import functools
import logging
import sys
import time
import grpc
from grpc._channel import _Rendezvous
NUMBER_OF_RETRIES = 5
# Initial delay in seconds before an attempt to retry
INITIAL_DELAY = 0.3
def retry_wrapper(function, *args):
delay = INITIAL_DELAY
for i in range(NUMBER_OF_... | [
{
"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 | casperlabs_client/decorators.py | CasperLabs/client-py |
from ixnetwork_restpy.base import Base
from ixnetwork_restpy.files import Files
class FC_RNN_ID(Base):
__slots__ = ()
_SDM_NAME = 'FCRNNID'
_SDM_ATT_MAP = {
'FC Header': 'fCRNNID.header.fcHeader',
'FC_CT': 'fCRNNID.header.fcCT',
'dNS': 'fCRNNID.header.dNS',
'FC CRC': 'fCRNN... | [
{
"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_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer"... | 3 | ixnetwork_restpy/testplatform/sessions/ixnetwork/traffic/trafficitem/configelement/stack/FCRNNID_template.py | Vibaswan/ixnetwork_restpy |
import asyncio
import signal
import logging
try:
import uvloop
except ImportError:
uvloop = None
from src.introducer import Introducer
from src.server.outbound_message import NodeType
from src.server.server import ChiaServer
from src.util.config import load_config_cli, load_config
from src.util.default_root i... | [
{
"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 | src/server/start_introducer.py | cryptonoob42/chia-blockchain |
from transformers import AlbertTokenizerFast, RobertaTokenizerFast, DistilBertTokenizerFast
from piqa.model.tokenizers_base import BaseTokenizerPIQA
class PIQATokenizer(object):
tokenizer_mapping = dict()
@classmethod
def register(cls, *args):
def decorator(fn):
for arg in args:
... | [
{
"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 | piqa/model/tokenizers.py | AndrzejGretkowski/masters-piqa |
from collections import defaultdict
class Graph:
def __init__(self, numberOfNodes):
self.numberOfNodes = numberOfNodes+1
self.graph = [[0 for x in range(numberOfNodes+1)]
for y in range(numberOfNodes+1)]
def withInBounds(self, v1, v2):
return (v1 >= 0 and v1 <= s... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inherit... | 3 | Graphs/graphs creation/directed graph/adjacency matrix/index.py | PawanRamaMali/LeetCode |
# -*- coding: utf-8 -*-
# © 2017-2019, ETH Zurich, Institut für Theoretische Physik
# Author: Dominik Gresch <greschd@gmx.ch>
"""
Tests with a nodal line.
"""
import numpy as np
import pytest
from nodefinder.search import run
from nodefinder.search.refinement_stencil import get_mesh_stencil
@pytest.fixture
def nod... | [
{
"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 | tests/search/test_nodal_surface.py | zx-sdu/NodeFinder |
def test_config_arg():
from argdeco import CommandDecorator, arg
from argdeco.config import config_factory
command = CommandDecorator(compiler_factory=config_factory())
@command('foo', arg('--first'), arg('--second', default=1, config_name="foo.bar"))
def cmd_foo(config):
assert config['fo... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"... | 3 | tests/test_command_decorator.py | klorenz/python-argdeco |
import os
from werkzeug.security import generate_password_hash
from flask_script import Manager, Shell, Command, Option
from flask_migrate import Migrate, MigrateCommand
from app import db
from app import create_app
from app.models import User
app = create_app(os.getenv('FLASK_CONFIG') or 'default')
manager = Manage... | [
{
"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 | manage.py | Tianny/incepiton_mysql |
from package import package
parent_path = '.scanners'
config_path = 'scanner.yml'
class Scanner(package.Package):
def __init__(self, url, name, auther):
super().__init__(url, name, auther)
self.parent_path = parent_path
self.config_path = config_path
class ScannerFactory(package.PackageF... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/... | 3 | src/package/scanner.py | buckler-project/armoury |
#Python program to search for an element in a linked list using recursion
class Node:
def __init__(self, data):
self.data = data
self.next = None
class LinkedList:
def __init__(self):
self.head = None
self.last_node = None
def append(self, data):
if self.last_node ... | [
{
"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 | out/production/Hacktoberfest1/Python/LinkedList.py | Nandini2901/Hacktoberfest-1 |
import os
from os.path import isfile, join
import adal
from settings import settings
from office365.graph_client import GraphClient
def get_token():
"""Acquire token via client credential flow
"""
authority_url = 'https://login.microsoftonline.com/{0}'.format(settings['tenant'])
auth_ctx = adal.Auth... | [
{
"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 | examples/onedrive/import_files.py | andreas-j-hauser/Office365-REST-Python-Client |
from typing import List
from ....source_shared.base import Base
from ....utilities.byte_io_mdl import ByteIO
class MaterialReplacementList(Base):
def __init__(self):
self.replacements = [] # type: List[MaterialReplacement]
def read(self, reader: ByteIO):
entry = reader.tell()
repl... | [
{
"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 | source1/vtx/structs/material_replacement_list.py | half5life/SourceIO |
# -*- coding: utf-8 -*-
# Copyright (c) 2018, Frappe Technologies and Contributors
# See license.txt
from __future__ import unicode_literals
import frappe
import unittest
class TestViewLog(unittest.TestCase):
def tearDown(self):
frappe.set_user('Administrator')
def test_if_user_is_added(self):
ev = frappe.get_... | [
{
"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 | frappe/core/doctype/view_log/test_view_log.py | vigneshbarani/frappe |
import pandas as pd
from sklearn.metrics import mean_squared_error, mean_absolute_error
class Metrics:
def __init__(self):
pass
def calculate_regression(self, y_true, y_pred):
'''
Calculate the metrics from a regression problem
:param y_true: Numpy.ndarray or Pandas... | [
{
"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 | class-week-07/projeto padrao/src/metrics.py | flavio92ux/aceleracao-DataScience |
from flask import Flask, render_template, url_for, request, redirect
from flask_sqlalchemy import SQLAlchemy
from datetime import datetime
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///test.db'
db = SQLAlchemy(app)
class Todo(db.Model):
id = db.Column(db.Integer, primary_key=True)
... | [
{
"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 | app.py | cop1fab/Tasky |
import random
import time
class Athlete():
name = ""
health = 100
def __init__(self, newName):
self.name = newName
print("На ринге появляется новый боец, его имя - ", self.name )
print()
def punch(self, other):
time.sleep(1)
print(self.name, "наносит удар бойцу ", other.name)
other.health -= 20
... | [
{
"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 | Python/Fighters.py | chernyshov-dev/ideal-octo-waffle |
import unittest
import inspect
from pyvalidator.utils.to_string import to_string, obj_str
from . import print_test_ok
class TestIsUuid(unittest.TestCase):
def test_input_str(self):
self.assertEqual(to_string("x"), "x")
print_test_ok()
def test_input_int(self):
self.assertEqual(to_st... | [
{
"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 | test/test_utils_to_string.py | theteladras/py.validator |
import re
from videos_id.platform import Platform
class Vimeo(Platform):
def __init__(self):
self.platform = "Vimeo"
def check_url(self, url):
pattern = r'https?:\/\/(?:www\.|player\.)?vimeo.com\/(?:channels\/(?:\w+\/)?|groups\/(?:[^\/]*)\/videos\/|album\/(?:\d+)\/video\/|video\/|)(\d+)(?:$|\... | [
{
"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 | videos_id/provider/vimeo.py | RentFreeMedia/python-video-ids |
from django.conf.urls import url
from django.contrib import admin
from mixpanel_django_graphos.views import ReportActivityView
admin.site.index_template = 'admin/index.html'
admin.autodiscover()
def get_admin_urls(urls):
"""
Extend admin to include additional urls
"""
def get_urls():
my_url... | [
{
"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 | mixpanel_django_graphos/urls.py | sayonetech/mixpanel-django-graphos |
#!/usr/bin/env python3.7
import sys
import asyncio
import aiohttp
from bs4 import BeautifulSoup
name = "Fakku"
async def get_manga_by_author(author):
results = list()
page = 1
async with aiohttp.ClientSession() as session:
status, text = await fetch_page(session, author, page)
# It is noteworthy that FAKKU ... | [
{
"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 | site_Fakku.py | Plurmp/license-checker |
# Copyright 2020 Kochat. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | [
{
"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 | kochat/app/scenario_manager.py | Kochat-framework/kochat-core |
# ============================================================================
# FILE: lsp/document_symbols.py
# AUTHOR: Takahiro Shirasaka <tk.shirasaka@gmail.com>
# License: MIT license
# ============================================================================
import os
import sys
sys.path.insert(1, os.path.dir... | [
{
"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 | rplugin/python3/denite/source/lsp/document_symbols.py | tk-shirasaka/denite-utils |
# Copyright 2021 Splunk 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 applicable law or agreed to in writing, soft... | [
{
"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 | splunk_connect_for_snmp_poller/manager/data/event_builder.py | splunk/splunk-connect-for-snmp-poller |
from typing import Any
import tensorflow as tf
from .tf_util import scope_name as get_scope_name
def absolute_scope_name(relative_scope_name):
"""Appends parent scope name to `relative_scope_name`"""
base = get_scope_name()
if len(base) > 0:
base += '/'
return base + relative_scope_name
def _infer_scope_nam... | [
{
"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_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": ... | 3 | sandblox/util/scope.py | reubenjohn/sandblox |
import math
class Scheduler:
def __init__(self, n_epoch):
self.n_epoch = n_epoch
class ExponentialScheduler(Scheduler):
def __init__(self, x_init: float, x_final: float, n_epoch: int):
Scheduler.__init__(self, n_epoch)
self.step_factor = math.exp(math.log(x_final / x_init) / n_epoch)... | [
{
"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 | utils/schedulers.py | gmatt/Simplex |
# -*- coding : utf-8 -*-
import datetime
from tornado.log import app_log
from models.posts import Post
from models.groups import Group
from handlers import BaseHandler
from decorators import authenticated
class GroupHandler(BaseHandler):
def get(self, tag):
group = Group.objects(tag=tag)[0]
post... | [
{
"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 | handlers/group/group_handler.py | yunlzheng/PDFLabs |
from __future__ import unicode_literals
from flask import Flask,render_template,url_for,request
from text_summarization import text_summarizer
import time
import spacy
nlp = spacy.load('en_core_web_sm')
app = Flask(__name__)
# Web Scraping Pkg
from bs4 import BeautifulSoup
# from urllib.request import urlo... | [
{
"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 | Automatic extractive Text Summarization using RoBERTa/Deploy Flask app/app.py | ramachandra742/Text-Summarization-projects |
"""
1556. Thousand Separator
Given an integer n, add a dot (".") as the thousands separator and return it in string format.
Example 1:
Input: n = 987
Output: "987"
Example 2:
Input: n = 1234
Output: "1.234"
Example 3:
Input: n = 123456789
Output: "123.456.789"
Example 4:
Input: n = 0
Output: "0"
Constraints:
0 <... | [
{
"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 | Algorithms_medium/1556. Thousand Separator.py | VinceW0/Leetcode_Python_solutions |
from django.shortcuts import render, get_object_or_404, redirect
from django.http import HttpResponseRedirect
from django.urls import reverse
from django.views import generic
from .models import Requirement#, CreateRequirement
from django.forms.models import model_to_dict
# Create your views here.
class RequirementIn... | [
{
"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 | set/requirements/views.py | Protocomms/SysEng-Tools |
# -*- coding: utf8 -*-
from explicates.model.annotation import Annotation
from . import BaseFactory, factory, repo
class AnnotationFactory(BaseFactory):
class Meta:
model = Annotation
@classmethod
def _create(cls, model_class, *args, **kwargs):
annotation = model_class(*args, **kwargs)
... | [
{
"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/factories/annotation.py | alexandermendes/libanno |
# https://en.wikipedia.org/wiki/Observer_pattern
class Observable:
def __init__(self):
self.__observers = []
def register_observer(self, observer):
self.__observers.append(observer)
def notify_observers(self, *args, **kwargs):
for observer in self.__observers:
observe... | [
{
"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 | language/patterns/observer.py | aliaksandr-klimovich/sandbox |
# !/usr/bin/python3
# -*- coding: utf-8 -*-
# @Time : 2021/7/5 下午5:29
# @Author : Latent
# @Email : latentsky@gmail.com
# @File : sequence_nick.py
# @Software: PyCharm
# @class : 清晰店铺的相关信息
"""
字段说明:
1.nick_id ---->数据库自增
2.nick_name
3.nick
4.brand
5.company_name
6.platform
"""
from tools_class import Tools_Class
cla... | [
{
"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 | api/clean/sequence_nick.py | Latent-Lxx/dazhou-dw |
import pytest
from loris import constants
class TestImageRequest:
def test_valid_filenames(self):
self._assert_valid('/123.jpg/full/full/0/default.jpg')
@pytest.mark.parametrize('path', [
'/a*b/full/full/0/default.jpg',
'/a:b/full/full/0/default.jpg',
'/a-b/full/full/0/defaul... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
... | 3 | tests/constants_t.py | jamieparkinson/loris |
import unittest
import roomai.kuhn
import roomai.common
class KuhnTester(unittest.TestCase):
"""
"""
def testKuhn(self):
"""
"""
for i in range(1000):
players = [roomai.kuhn.Example_KuhnPokerAlwaysBetPlayer() for i in range(2)] + [roomai.kuhn.KuhnPokerChancePlayer()]
... | [
{
"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 | tests/testKuhn.py | 1696012928/RoomAI |
"""
Data processing routines
Deepak Baby, UGent, June 2018
deepak.baby@ugent.be
"""
import numpy as np
def reconstruct_wav(wavmat, stride_factor=0.5):
"""
Reconstructs the audiofile from sliced matrix wavmat
"""
window_length = wavmat.shape[1]
window_stride = int(stride_factor * window_length)
wav_length ... | [
{
"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 | data_ops.py | samiulshuvo/se_relativisticgan |
from django.shortcuts import render
# Create your views here.
import folium
def home(request):
mf = folium.Map([35.3369, 127.7306], zoom_start=10)
mf = mf._repr_html_()
first ='juna'
result ={'mapfolium': mf, 'fo1':first}
return render(request, template_name='maps/home.html', context=result)
de... | [
{
"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 | maps/views.py | junanote/test_django |
import networkx as nx
from networkx.algorithms import bfs_tree
import sys
from scopes import utils
from .tasks import Spout
import pdb
G = nx.DiGraph()
def build(tasks):
""" Build graph from a list of tasks. """
for t in tasks:
G.add_node(t)
for t in tasks:
deps_found = 0
f... | [
{
"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 | scopes/graph.py | leg100/scopes |
# Definition for singly-linked list.
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
class Solution:
def removeDuplicateNodes(self, head: ListNode) -> ListNode:
if not head or not head.next:
return head
f = [False for i in range(20001)]
... | [
{
"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": false
}... | 3 | interview 02.01. Remove Duplicate Node LCCI/Solution.py | furutuki/LeetCodeSolution |
# Copyright (c) 2018 European Organization for Nuclear Research.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LIC... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (... | 3 | aardvark/conf/placement_conf.py | ttsiouts/aardvark |
from util import read_puzzle_input
def _parse_instruction(instruction_line):
operation, argument = instruction_line.split()
return (
operation,
int(argument[1:]) if argument[0] == "+" else -1 * int(argument[1:]),
)
def _parse_input(puzzle_input):
return [_parse_instruction(line) for ... | [
{
"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 | year_2020/day08/handheld_halting.py | mjalkio/advent-of-code |
"""empty message
Revision ID: 7b0843b4944f
Revises: a83fe752a741
Create Date: 2016-08-08 23:12:27.138166
"""
# revision identifiers, used by Alembic.
revision = '7b0843b4944f'
down_revision = 'a83fe752a741'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - ... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": fal... | 3 | src/migrations/versions/7b0843b4944f_.py | colinnewell/Adventure-Insecure |
from cuor.organizations.api import OrganizationRecord
import traceback
def remove_nulls(d):
return {k: v for k, v in d.items() if v is not None}
def _assing_if_exist(data, record, field):
if field in record:
data[field] = record[field]
def insert_in_cuor(data, inst):
# try:
OrganizationReco... | [
{
"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 | cuor/harvester/general.py | tocororo/cuor |
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from __future__ import unicode_literals
from ..histogrammatching import HistogramMatching
def test_HistogramMatching_inputs():
input_map = dict(
args=dict(argstr='%s', ),
environ=dict(
nohash=True,
usedefault=True,
... | [
{
"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 | nipype/interfaces/slicer/filtering/tests/test_auto_HistogramMatching.py | abelalez/nipype |
"""A module as test dummy for flake8-assertAlmostEqual."""
import unittest
class TestSelfAssertEqualDetection(unittest.TestCase):
"""Dummy for flake8-assertAlmostEqual."""
def setUp(self):
"""Set up."""
self.my_result = 5.0473
def test_detection(self):
"""Detect flake8-assertAlm... | [
{
"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": true... | 3 | flake8-AAE-tests.py | MarkusPiotrowski/flake8-assertAlmostEqual |
from abc import ABC, abstractmethod
import copy
import numpy as np
from typing import Dict
DEFAULT_META = {
"name": None,
"detector_type": None, # online or offline
"data_type": None # tabular, image or time-series
} # type: Dict
def outlier_prediction_dict():
data = {
'instance_score': No... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?"... | 3 | alibi_detect/base.py | Clusks/alibi-detect |
from disco.test import TestCase, TestJob
from disco.compat import bytes_to_str
class SimpleJob(TestJob):
@staticmethod
def map(e, params):
yield int(e), (bytes_to_str(e)).strip()
@staticmethod
def reduce(iter, out, params):
for k, v in sorted(iter):
out.add(k, v)
class Sim... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class 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 self/cls)... | 3 | tests/test_simple.py | pooya/disco |
import csv
import calendar
import datetime
from django.core.management.base import BaseCommand, CommandError
from api_mihai.models import CollectedData
class Command(BaseCommand):
help = 'Imports the CSV file from the collected data to the database'
def add_arguments(self, parser):
parser.add_argument('file_nam... | [
{
"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 | api_mihai/management/commands/london_data_importer.py | MihaiVisu/hons-backend |
# coding: utf-8
def g():
pass
def f():
d1 = {42: 100}
d2 = {'abc': 'fob'}
d3 = {1e1000: d1}
s = set([frozenset([2,3,4])])
class C(object):
abc = 42
def f(self): pass
cinst = C()
class C2(object):
abc = 42
def __init__(self):
self.oar = 100... | [
{
"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 | Python/Tests/TestData/DebuggerProject/PrevFrameEnumChildTestV3.py | techkey/PTVS |
# Copyright 2014 Cisco Systems, Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... | [
{
"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 | neutron/db/migration/alembic_migrations/versions/24c7ea5160d7_cisco_csr_vpnaas.py | SnabbCo/neutron |
# Space - O(1) ; Time - O(n logn)
class Solution:
def maxOperations(self, nums: List[int], k: int) -> int:
nums.sort()
i = 0
j = len(nums)-1
op = 0
while i<j:
val = nums[i] + nums[j]
if val == k:
op += 1
i += 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": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},... | 3 | 1679. Max Number of K-Sum Pairs.py | Dharaneeshwar/Leetcode |
#!/usr/bin/env python3
"""Replace all vowels in s string with "oodle".
Title:
Voodlewoodlel
Description:
Boodleb wanted to see how his friend's name would look
if he changed every vowel to "oodle".
But he has no idea what vowels are, or how to chage them.
Help him realize his life's goal.
The user inputs n lines, wit... | [
{
"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 | Text/Voodlewoodlel/voodlewoodlel.py | fossabot/IdeaBag2-Solutions |
import datetime
def DateTimeNow():
return datetime.date.today()
def DateTime1WeekAgo():
return DateTimeNow() - datetime.timedelta(7+1)
def DateTime2WeekAgo():
return DateTimeNow() - datetime.timedelta(14+1)
def DateTime4WeekAgo():
return DateTimeNow() - datetime.timedelta(28+1)
def DateTime26W... | [
{
"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 | Common/Measures/TradingDateTimes/PyDateTimes.py | enriqueescobar-askida/Kinito.Finance |
import warnings
from torchvision.datasets import *
from .base import *
from .coco import COCOSegmentation
from .ade20k import ADE20KSegmentation
from .pascal_voc import VOCSegmentation
from .pascal_aug import VOCAugSegmentation
from .pcontext import ContextSegmentation
from .cityscapes import CitySegmentation
from .ima... | [
{
"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 | encoding/datasets/__init__.py | A201124253/PyTorch-Encoding |
import time
import psycopg2
def get_conn(conn_string):
conn = psycopg2.connect(conn_string)
conn.set_isolation_level(psycopg2.extensions.ISOLATION_LEVEL_AUTOCOMMIT)
return conn
def get_conn_string(username, password, hostname, db_name, port='5432'):
return 'postgresql://{username}:{password}@{hostn... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answ... | 3 | python_modules/libraries/dagster-postgres/dagster_postgres/utils.py | shahvineet98/dagster |
# coding=utf8
"""
md2pdf.renderer
~~~~~~~~~~~~~~~
Usage::
>>> from md2pdf.renderer import renderer
>>> renderer(**kwargs)
"""
from jinja2 import Environment, FileSystemLoader
from . import template
from .utils import path_to
class Renderer(object):
def __init__(self, pdf_template... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
... | 3 | md2pdf/renderer.py | billweasley/md2pdf |
# !/usr/bin/python3
# -*- coding:utf-8 -*-
# Author:WeiFeng Liu
# @Time: 2021/11/9 下午4:57
import torchvision
import torch.nn as nn
class my_densenet(nn.Module):
def __init__(self):
super(my_densenet, self).__init__()
self.backbone = torchvision.models.densenet121(pretrained=False)
self.f... | [
{
"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 | Densenet_COVID/densenet.py | SPECTRELWF/pytorch-cnn-study |
import sys
from PySide2 import QtGui
from PySide2.QtWidgets import QApplication, QWidget, QFileDialog
class Ui_Load(QWidget):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(640, 480)
file = self.openFileNameDialog()
icon = QtGui.QIcon()
... | [
{
"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 | GUI/code/GUI_load_config.py | jlhitt1993/pytentiostat |
def auto_str(cls):
def __str__(self):
return '%s(%s)' % (
type(self).__name__,
', '.join('%s=%s' % item for item in vars(self).items())
)
cls.__str__ = __str__
return cls | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"... | 3 | base/utils/auto_str_decorator.py | PeterStuck/teacher-app |
# Testing module network_performance.high
import pytest
import ec2_compare.internal.network_performance.high
def test_get_internal_data_network_performance_high_get_instances_list():
assert len(ec2_compare.internal.network_performance.high.get_instances_list()) > 0
def test_get_internal_data_network_performance_hig... | [
{
"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 | tests/internal/network_performance/test_network_performance_high_auto.py | frolovv/aws.ec2.compare |
from peewee import SqliteDatabase, Model, CharField, TextField
db = SqliteDatabase('comments.db')
class Comment(Model):
title = CharField()
content = TextField()
class Meta:
database = db
db.connect()
if not Comment.table_exists():
Comment.create_table()
def create_comment(title, content... | [
{
"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 | db.py | ismtabo/hoc2017uva-python3 |
#!/usr/bin/env python
import webapp2
from google.appengine.api import app_identity
from google.appengine.api import mail
from conference import ConferenceApi
class SetAnnouncementHandler(webapp2.RequestHandler):
def get(self):
"""Set Announcement in Memcache."""
header = self.request.headers.get('... | [
{
"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 | solutions/REF_11_main.py | ManoloBrn/gcloudtraining17 |
import re
import os
import io
def webdelay(urlpart, minseconds, maxseconds):
def inner(func):
def result(url):
if (urlpart in url):
waitfor = random.randrange(minseconds, maxseconds)
time.sleep(waitfor)
return func(url)
return resul... | [
{
"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 | source/webanalyzer.py | hrbolek/func2pipe |
__author__ = "JJ.sven"
import json
'''
users = {
user_account: {
pwd: pwd
name: name
}
}
'''
users_file_name = 'users.txt'
name_key = 'user'
pwd_key = 'pwd'
users = {}
user_file = open(users_file_name, 'r')
users = json.load(user_file)
user_file.close()
def checkAccount(account, pwd):
u... | [
{
"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_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer"... | 3 | python_base/HomeWork/Shopping/core/login.py | sven820/python |
#!/usr/bin/env python
#
# Copyright 2019 Google Inc.
#
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
import subprocess
import sys
INFRA_GO = 'go.skia.org/infra'
WHICH = 'where' if sys.platform == 'win32' else 'which'
def check():
'''Verify that g... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding sel... | 3 | src/third_party/skia/tools/infra/go.py | rhencke/engine |
#-*- coding: utf-8 -*-
from django.shortcuts import render, redirect, get_object_or_404
from django.contrib.auth import get_user_model
from django.contrib import messages
from django.utils.translation import ugettext as _
from spirit.utils.decorators import administrator_required
from spirit.forms.admin import UserE... | [
{
"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 | spirit/views/admin/user.py | benmurden/Spirit |
from pettingzoo import AECEnv
from pettingzoo.utils.agent_selector import agent_selector
from gym import spaces
import rlcard
import random
from rlcard.games.uno.card import UnoCard
import numpy as np
from pettingzoo.utils import wrappers
from .rlcard_base import RLCardBase
def env(**kwargs):
env = raw_env(**kwar... | [
{
"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 | pettingzoo/classic/rlcard_envs/uno.py | dkkim93/PettingZoo |
from pyrogram import Client, filters
import asyncio
import os
from pytube import YouTube
from pyrogram.types import InlineKeyboardMarkup
from pyrogram.types import InlineKeyboardButton
from youtubesearchpython import VideosSearch
from blissbot.basi_mon import ignore_blacklisted_users, get_arg
from blissbot import app, ... | [
{
"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 | blissbot/modules/lucido.py | ah3653070/bliss |
class Battery:
def __init__(self, evaluator):
raise NotImplementedError
def get_action(self, current_state):
raise NotImplementedError
| [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},... | 3 | src/battery/battery.py | BigOz/flourish |
from subprocess import run
import pytest
def pytest_addoption(parser):
"""By default run tests in clustered mode, but allow dev mode with --single-node"""
parser.addoption('--single-node', action='store_true',
help='non-clustered version')
def pytest_configure(config):
compose_flags... | [
{
"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 | tests/conftest.py | OSC-JYU/oscari-ES |
'''
This is active only when deployed via UWSGI
'''
import logging, time, shutil, subprocess
from django.core import management
from biostar.utils.decorators import spool, timer
import time
logger = logging.getLogger("engine")
@timer(250)
def send_emails(*args ,**kwargs):
"""
Sends queued emails
"""
... | [
{
"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 | biostar/recipes/tasks.py | Oribyne/biostar-central-fork |
from typing import Any, Dict, Tuple
from django.core.exceptions import ValidationError
from django.db import models
from django.utils.translation import ugettext as _
from .intset import IntegerSetSpecifier
class IntegerSetSpecifierField(models.CharField): # type: ignore
def __init__(
self, *, value_ra... | [
{
"point_num": 1,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
... | 3 | batchrun/fields.py | suutari-ai/mvj |
# 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 use ... | [
{
"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 | runtime/python/test/test_clownfish.py | dgreatwood/lucy-clownfish |
from itertools import cycle
from common.intcode import IntCode, ProgramTerminatedError
def max_thruster_single_mode(program, phase_settings):
output = 0
for phase in phase_settings:
computer = IntCode(program)
computer.queue_input(phase)
computer.queue_input(output)
output = 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 | day_7/day7.py | mickeelm/aoc2019 |
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
import unittest
import torch
import onnxruntime_pybind11_state as torch_ort
import os
class OrtEPTests(unittest.TestCase):
def get_test_execution_provider_path(self):
return os.path.join('.', 'libtest_execution_provi... | [
{
"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 | orttraining/orttraining/eager/test/ort_eps_test.py | CoderHam/onnxruntime |
# -*- test-case-name: twisted.pair.test.test_rawudp -*-
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
#
"""Implementation of raw packet interfaces for UDP"""
import struct
from twisted.internet import protocol
from twisted.pair import raw
from zope.interface import implements
class UDPHea... | [
{
"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": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheri... | 3 | twisted/pair/rawudp.py | Laharah/twisted |
from pytest import fixture
from novel_tools.common import NovelData, Type
from novel_tools.processors.transformers.pattern_transformer import PatternTransformer
@fixture
def pattern_transformer():
return PatternTransformer({
'units': [
{
'filter': {
'type': ... | [
{
"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 | tests/processors/transformers/test_pattern_transformer.py | ALMSIVI/novel_tools |
import twl
wolf = twl.Wolf()
def split(wolf, end=7):
return [wolf.len(n)() for n in range(2, end+1)]
def spell(ltrs, wild=0):
return split(wolf.wild(ltrs, wild), len(ltrs)+wild)
def _munge(func, fix, ltrs, wild=0):
return split(func(fix).wild(fix+ltrs, wild), len(fix+ltrs)+wild)
def starts(fix, ltr... | [
{
"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 | use.py | esoterik0/scrabble-comp |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from parlai.core.worlds import World
# ----- Baseline overworld that simply defers to the default world ----- #
class ... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fe... | 3 | parlai/chat_service/services/messenger/worlds.py | takatoy/ParlAI |
import matplotlib.pyplot as plt
import numpy as np
from mpl_toolkits.mplot3d import Axes3D
from pedrec.models.constants.skeleton_pedrec import SKELETON_PEDREC, SKELETON_PEDREC_JOINT_COLORS, SKELETON_PEDREC_LIMB_COLORS
from pedrec.visualizers.visualization_helper_3d import draw_origin_3d, draw_grid_3d
def add_skeleto... | [
{
"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": "all_function_names_snake_case",
"question": "Are all function names in this file written i... | 3 | pedrec/visualizers/skeleton_3d_visualizer.py | noboevbo/PedRec |
# functions/add.py
import torch
from torch.autograd import Function
from _ext import forward_utils
if torch.cuda.is_available():
from _ext import forward_utils_cuda
class OccupancyToTopology(Function):
""" Convert the occupancy probability to topology probability
see ../src/occupancy_to_topology.c
... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": fals... | 3 | marching_cube/model/cffi/functions/occupancy_to_topology.py | YiyiLiao/deep_marching_cubes |
from app.models import User
from flask_restful import Resource, reqparse
from sqlalchemy.orm.exc import NoResultFound
from flask import request, jsonify, make_response
def identity(payload):
username = payload['identity']
return User.query.filter_by(id = username).first()
def authenticate(username, password):... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"ans... | 3 | app/auth/auth.py | faithngetich/Buckectlist |
from vocoder.models.fatchord_version import WaveRNN
from vocoder import hparams as hp
import torch
_model = None # type: WaveRNN
def load_model(weights_fpath, verbose=True):
global _model
if verbose:
print("Building Wave-RNN")
_model = WaveRNN(
rnn_dims=hp.voc_rnn_dims... | [
{
"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": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (ex... | 3 | vocoder/inference_wavrnn.py | freenowill/autoVC-WavRNN |
from urllib.parse import urlparse
from requests import post
def Shortner(big_url: str) -> str:
"""
Function short the big urls to short
"""
return post(f"https://is.gd/create.php?format=json&url={big_url}").json()[
"shorturl"
]
def MaskUrl(target_url: str, mask_domain: str, keyword: str... | [
{
"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 | app/utils/mask_url.py | yogeshwaran01/Projects |
from __future__ import annotations
from spark_auto_mapper_fhir.fhir_types.uri import FhirUri
from spark_auto_mapper_fhir.value_sets.generic_type import GenericTypeCode
from spark_auto_mapper.type_definitions.defined_types import AutoMapperTextInputType
# This file is auto-generated by generate_classes so do not edi... | [
{
"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 | spark_auto_mapper_fhir/value_sets/contract_resource_asset_availiability_codes.py | imranq2/SparkAutoMapper.FHIR |
# coding: utf-8
"""
Gitea API.
This documentation describes the Gitea API. # noqa: E501
OpenAPI spec version: 1.16.7
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import gitea_api
from gitea_api.models.edit_hook_op... | [
{
"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 | test/test_edit_hook_option.py | r7l/python-gitea-api |
'''
Sorting Examples for showcasing and developing Jungle features
'''
import inspect
from jungle import JungleExperiment, JungleProfiler
import numpy as np
print('Finished Loading Modules')
class Sorting_Prototype:
print('\n---Test Sort N---')
@JungleExperiment(reps=1, n=[100, 500])
def test_sort_n(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": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?... | 3 | jungle/code/sorting.py | nate-russell/Jungle |
import logging
class HeterogeneousClient:
def __init__(self, client_idx, local_training_data, local_test_data, local_sample_number, args, device,
model_trainer):
self.client_idx = client_idx
self.local_training_data = local_training_data
self.local_test_data = local_test_... | [
{
"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 | heterogeneous_client.py | samiul272/fed_ml_proj |
# Copyright (C) 2008 Valmantas Paliksa <walmis at balticum-tv dot lt>
# Copyright (C) 2008 Tadas Dailyda <tadas at dailyda dot com>
#
# Licensed under the GNU General Public License Version 3
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License ... | [
{
"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 | linux/lib/python2.7/dist-packages/blueman/main/Mechanism.py | nmercier/linux-cross-gcc |
# import necessary libraries
from flask import Flask, render_template, jsonify, redirect
from flask_pymongo import PyMongo
import scrape_mars
# create instance of Flask app
app = Flask(__name__)
app.config["MONGO_URI"] = "mongodb://localhost:27017/mars_app"
mongo = PyMongo(app)
# create route that renders index.ht... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": fals... | 3 | app.py | JoeDReynolds/HW_13 |
#######################################################
#
# ConnectHandler.py
# Python implementation of the Class ConnectHandler
# Generated by Enterprise Architect
# Created on: 29-Dec-2020 8:10:45 AM
# Original author: natha
#
#######################################################
from Catalog.Data.Federatio... | [
{
"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 | FreeTAKServer/controllers/services/federation/ConnectHandler.py | logikal/FreeTakServer |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.