source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
import itertools
from .base import Package
class FedEx(Package):
shipper = 'FedEx'
class FedExExpress(FedEx):
barcode_pattern = r'^\d{34}$'
@property
def tracking_number(self):
return self.barcode[20:22].lstrip('0') + self.barcode[22:]
@property
def valid_checksum(self):
c... | [
{
"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 | drogher/package/fedex.py | thisisnotmyuserid/drogher |
from nose import with_setup
from pygears import Intf, clear
from pygears.typing import Queue, Uint
from utils import svgen_check
@with_setup(clear)
@svgen_check(['sieve_0v2_7_8v10.sv'])
def test_uint():
iout = Intf(Uint[10])[:2, 7, 8:]
assert iout.dtype == Uint[5]
@with_setup(clear)
@svgen_check(['sieve_0... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"ans... | 3 | tests/svgen/test_sieve.py | Risto97/pygears |
# Copyright 2020 Google LLC
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, sof... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",... | 3 | tools/validators/instance_validator/tests/generate_universe_test.py | ljulliar/digitalbuildings |
import json
import os
import sys
from ..functional_test import TestCase
class LuaTest(TestCase):
def test_satisfy_from_source(self):
with open(os.path.join(self.path(), 'needs.json'), 'w') as needs_file:
needs_file.write(json.dumps({
'libraries': {
'lua': {... | [
{
"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 | tests/functional/libraries/test_lua.py | carlbrown/needy |
from appenlight_client.utils import import_module, deco_func_or_method
from appenlight_client.timing import time_trace
ignore_set = frozenset(['remote', 'nosql'])
def add_timing(min_duration=3):
module = import_module('urllib3')
if not module:
return
def gather_args_url(r, m, url, *args, **kwarg... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
... | 3 | appenlight_client/timing/timing_urllib3.py | atomekk/appenlight-client-python |
global messageDict
messageDict={}
def send_Message(messageName, index=None, *args,**kwargs):
'''
tells functions that are listening to this message to run with whatever args are specified
You can also specify and index if there are multiple function in that list.
usage:
send_Message("Default... | [
{
"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 | src/GameTools/Tools/Messaging.py | spidertyler2005/GameTools |
#!/usr/bin/env python3
# https://leetcode.com/problems/factorial-trailing-zeroes/
import unittest
class Solution:
def trailingZeroes(self, n: int) -> int:
step = 5
count = 0
while step <= n:
count += n // step
step = step * 5
return count
class TestCode(u... | [
{
"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 | algorithms/code/leetcode/lc172_factorial_trailing_zeroes/lc172_factorial_trailing_zeroes.py | altermarkive/training |
import unittest
class MarkovFieldTest(unittest.TestCase):
def setUp(self):
print('In setUp()')
self.fixture = range(1, 10)
def tearDown(self):
print('In tearDown()')
del self.fixture
def test(self):
self.assertEqual(fun(3), 4)
mkf = MarkovField()
s... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
... | 3 | markovfieldTest.py | pieteradejong/temp |
# -*- coding: utf-8 -*-
from starlette.applications import Starlette
from starlette.responses import JSONResponse
from starlette.routing import Route, WebSocketRoute
import math_func
import scheduled_tasks
async def homepage(request):
result: dict = {
"status": "hello world",
"method": request.me... | [
{
"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 | app/main.py | devsetgo/apscheduler_example |
# -*- coding: utf-8 -*-
from __future__ import print_function, division, absolute_import
from scipy.misc import lena
from numpy import ones
import numpy
from numba.decorators import jit
from numba import int32, int64
# Original approach will be slower for now due to the object mode failback
# for numpy.zero_like
#
#... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a ty... | 3 | examples/example.py | meawoppl/numba |
import segment as seg
import snakeconfig as config
class Player(object):
def __init__(self):
self.dir_x = 1
self.dir_y = 0
self.length = 4
self.segments = list()
def initializePlayer(self, start_x, start_y):
self.length = 4
self.segments.clear()
... | [
{
"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 | snakeplayer.py | colejagdtiger/RL-snake |
import os, sys
from flask import request, jsonify
from flask_httpauth import HTTPBasicAuth
sys.path.append(os.path.abspath(os.getcwd()))
from utils.gets import set_user, get_user
from utils.login_manager import LoginManager
from enviroment.enviroment import db
auth = HTTPBasicAuth()
def get_token():
return reques... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": true
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?"... | 3 | routes/auth.py | RobertoRosa7/api-organizese |
def Lps(p):
n = len(p)
table = [0] * n
k = 0
for i in range(1, n):
while k > 0 and p[i] != p[k]:
k = table[k - 1]
if p[i] == p[k]:
k += 1
table[i] = k
return table
def Find(s, p):
k = 0
c = 0
table = Lps(p)
for i in range(len(s)):
... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (... | 3 | tests/c2.py | developerHaneum/ft |
from __future__ import absolute_import
import pytest
from changes.expanders.commands import CommandsExpander
from changes.testutils import TestCase
class CommandsExpanderTest(TestCase):
def setUp(self):
super(CommandsExpanderTest, self).setUp()
self.project = self.create_project()
def get_e... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
... | 3 | tests/changes/expanders/test_commands.py | vault-the/changes |
# -*- coding: utf-8 -*-
from typing import Tuple
from recc.rule.naming_base import merge_naming, split_naming
from recc.variables.naming import (
PREFIX_RECC,
NAME_DELIMITER,
NAME_CONTAINER,
NAME_VOLUME,
NAME_NETWORK,
)
def naming_task(group: str, project: str, task: str) -> str:
return merge... | [
{
"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 | core/recc/rule/naming_task.py | bogonets/answer |
# -*- coding: utf-8 -*-
"""
Created on Sun Dec 15 10:58:44 2019
@author: DELL
"""
from __future__ import print_function, division
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
def d(u, v):
diff = u - v
return diff.dot(diff)
def get_data(limit=None):
prin... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a ty... | 3 | MNISTT.py | ankit9437/MNIST |
from django.http import HttpResponse
from rest_framework.views import APIView
from rest_framework.response import Response
from rest_framework import status
import numpy as np
from PIL import Image
import io
# Create your views here.
def index(request):
return HttpResponse(request, "hi there")
class SendImage(A... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than... | 3 | restApi/views.py | santhtadi/rest_api_in_django |
import importlib
from collections import OrderedDict
from django.conf import settings
class ProviderRegistry(object):
def __init__(self):
self.provider_map = OrderedDict()
self.loaded = False
def get_list(self, request=None):
self.load()
return [provider_cls(request) for prov... | [
{
"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 | djangox/lib/python3.8/site-packages/allauth/socialaccount/providers/__init__.py | DemarcusL/django_wiki_lab |
def divide_by_zero_check(func):
"""
Decorator for checking division by zero from user input
"""
def inner(value):
if value.value == 0:
raise ValueError('Cannot divide by zero!')
return func(value)
return inner
| [
{
"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 | weight_converter/utils.py | adamriaz/weight-converter |
import torch
import torch.nn as nn
import torch.nn.functional as F
from starter_code.modules.networks import MLP, MinigridCNN
from mnist.embedded_mnist import MNIST_CNN
class SimpleValueFn(nn.Module):
def __init__(self, state_dim, hdim):
super(SimpleValueFn, self).__init__()
self.value_net = MLP(d... | [
{
"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 | starter_code/modules/value_function.py | mbchang/societal-decision-making |
# -*- coding: utf-8 -*-
from hearthstone.entities import Entity
from entity.spell_entity import SpellEntity
class LETL_040P7(SpellEntity):
"""
虚空吞噬者5
<b>嘲讽</b>。在你施放一个暗影技能后,获得+3/+5。
"""
def __init__(self, entity: Entity):
super().__init__(entity)
self.damage = 0
def p... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
}... | 3 | entity/cards/LETL_040H/LETL_040P7.py | wenhr/lushi_script |
def flatten_dict(dictionary: dict, separator: str = '/',
parent_key: str = '') -> dict:
flattened = {}
for key, value in dictionary.items():
new_key = parent_key + separator + key if parent_key else key
if isinstance(value, dict):
flattened.update(
fl... | [
{
"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 | toolkit/utils/functional.py | Phimos/toolkit |
from django.db import models
from django.contrib.auth.models import User
# Create your models here.
class Acervo(models.Model):
tipoObra = models.CharField(max_length=11)
tituloObra = models.CharField(max_length=20)
description = models.TextField()
begin_date = models.DateField(auto_now_add=True)
a... | [
{
"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 | proj/models.py | lucasviei/Projeto-Estagio |
import argparse
import logging
from logging.handlers import RotatingFileHandler
from dquant.datafeed import Datafeed
class EntryPoint:
datafeed = None
def exec_command(self, args ):
logging.debug('exec_command:%s' % args)
if "feed" in args.command:
self.datafeed = Datafeed()
... | [
{
"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 | Arbitrage_Spot/dquant/entrypoint.py | ronaldzgithub/CryptoArbitrage |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
import logging
import unittest
from ml.rl.models.example_sequence_model import ExampleSequenceModel
from ml.rl.test.models.test_utils import check_save_load
logger = logging.getLogger(__name__)
class TestExampleSequence... | [
{
"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 | ml/rl/test/models/test_sequence_model.py | joshrose/Horizon |
import os
import io
import time
import base64
import functools
from PIL import Image
import numpy as np
import tensorflow as tf
import tensorflow_hub as hub
from helpers import *
os.environ["TFHUB_DOWNLOAD_PROGRESS"] = "True"
class PythonPredictor:
def __init__(self, config):
# Import TF-Hub module
... | [
{
"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 | tensorflow/super_resolution/syndicai.py | muchemwal/models |
# coding: utf-8
from collections import namedtuple
from supervisely_lib.api.module_api import ApiField, ModuleApi
from supervisely_lib._utils import camel_to_snake
class PluginApi(ModuleApi):
_info_sequence = [ApiField.ID,
ApiField.NAME,
ApiField.DESCRIPTION,
... | [
{
"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 | superviselySDK/supervisely_lib/api/plugin_api.py | nicehuster/mmdetection-supervisely-person-datasets |
from cloudshell.recorder.model.base_snmp_parameters import BaseSnmpParameters, config
class SnmpV2Parameters(BaseSnmpParameters):
def __init__(self, ip, snmp_community, snmp_version="2", port=161, is_ipv6=False, timeout=2000, retry_count=2,
get_bulk_flag=False,
continue_on_errors... | [
{
"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 | cloudshell/recorder/model/snmp_v2_parameters.py | QualiSystems/cloudshell-recorder |
from slacker.commands.command import Command
from slacker.commands.argument_parser import ArgumentParser
class ChatPostEphemeralCommand(Command):
def name(self):
return "chat.postephemeral"
def description(self):
return "Post ephemeral message to a channel on Slack that is only visible to assigned user."
... | [
{
"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 | slacker/commands/chat/chat_postephemeral_command.py | netromdk/slacker |
#!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import importlib
import importlib.resources
import json
import sys
from jinja2 import Environment, BaseLoader, Templ... | [
{
"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 | antlir/render_template.py | facebookincubator/fs_image |
# coding: utf-8
"""
Cisco Intersight
Cisco Intersight is a management platform delivered as a service with embedded analytics for your Cisco and 3rd party IT infrastructure. This platform offers an intelligent level of management that enables IT organizations to analyze, simplify, and automate their environmen... | [
{
"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 | test/test_adapter_port_channel_settings_ref.py | sdnit-se/intersight-python |
from .constant import (
Const,
Constant,
ConstantFactory,
ConstantValueProviderFunction,
TypedConstantFactory,
ConstantValueProvider,
)
from .lazy import lazy, LazyWrappedFunction
from ..._internal import API
__all__ = [
"ConstantFactory",
"TypedConstantFactory",
"ConstantValueProv... | [
{
"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 | src/antidote/lib/lazy/__init__.py | Finistere/dependency_manager |
from sqlalchemy import MetaData, Table, Column, Boolean
meta = MetaData()
def upgrade(migrate_engine):
meta = MetaData(bind=migrate_engine)
batch = Table("batch", meta, autoload=True)
deleted = Column("deleted", Boolean())
deleted.create(batch)
def downgrade(migrate_engine):
meta = MetaData(bi... | [
{
"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 | migrations/versions/008_Add_deleted_flag_to_batch.py | LCBRU/batch_demographics |
#
# General-purpose Photovoltaic Device Model - a drift diffusion base/Shockley-Read-Hall
# model for 1st, 2nd and 3rd generation solar cells.
# Copyright (C) 2008-2022 Roderick C. I. MacKenzie r.c.i.mackenzie at googlemail.com
#
# https://www.gpvdm.com
#
# This program is free software; you can redist... | [
{
"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 | gpvdm_gui/gui/gui_enable.py | roderickmackenzie/gpvdm |
import json
def loadConfig():
with open('./config.json', 'r') as f:
content = json.load(f)
return content
def filtFileName(rawName, kind='JSON'):
'''
A util function just used for make objname.json to objname. Default file type is json
'''
l = len(kind) + 1
return rawNa... | [
{
"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 | util.py | AlexFxw/AutoID-server |
#!/usr/bin/env python
""" generated source for module ExecutionFilter """
#
# Original file copyright original author(s).
# This file copyright Troy Melhase, troy@gci.net.
#
# WARNING: all changes to this file will be lost.
from ib.lib.overloading import overloaded
#
# * ExecutionFilter.java
# *
#
# package: com.... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file writte... | 3 | ib/ext/ExecutionFilter.py | LewisW/IbPy |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.12.1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
i... | [
{
"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 | kubernetes/test/test_v1_daemon_endpoint.py | anemerovsky-essextec/python |
import numpy as np
from math import sqrt
class KNN():
""" K Nearest Neighbors classifier.
Parameters:
-----------
k: int
The number of closest neighbors that will determine the class of the
sample that we wish to predict.
"""
def __init__(self, k=5):
self.k = k
def... | [
{
"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 | kNN/kNN.py | divyanshugit/Machine-Learning-Lab-EC792B |
# Stubs for os.path
# Ron Murawski <ron@horizonchess.com>
# based on http://docs.python.org/3.2/library/os.path.html
from typing import Any, List, Tuple, IO, overload
# ----- os.path variables -----
supports_unicode_filenames = False
# ----- os.path function stubs -----
def abspath(path: str) -> str: pass
def basen... | [
{
"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": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (exc... | 3 | stubs/3.2/posixpath.py | TimSimpsonR/mypy |
from django.core.files.uploadedfile import SimpleUploadedFile
from easy_tenants import set_current_tenant
from easy_tenants.storage import TenantFileSystemStorage
def test_default_storage(tenant_ctx, settings):
tenant_id = str(tenant_ctx.id)
s = TenantFileSystemStorage()
file = SimpleUploadedFile('test.t... | [
{
"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 | tests/test_storages.py | eliasfank/django-easy-tenants |
import can
from threading import Thread
import asyncio
import settings
class ThreadModuleAbstract:
thread = None
bus: can.ThreadSafeBus = None
loop: asyncio.AbstractEventLoop = None
_can_filters: [] = None
def __init__(self):
self.bus = self._can = can.ThreadSafeBus(
channel=s... | [
{
"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 | module/ThreadModuleAbstract.py | Exus1/alfa-blue-me |
from rest_framework import permissions, serializers, viewsets
from ....models import FailedToParseScheduleException, Schedule, parse_schedule_trigger
from .shared import ADMIN_RENDERER_CLASSES
class ScheduleSerializer(serializers.HyperlinkedModelSerializer):
plugin_id = serializers.IntegerField()
kwargs = se... | [
{
"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 | unplugged/services/admin/views/scheduler.py | fakegit/unplugged |
# Copyright 2016 The Emscripten Authors. All rights reserved.
# Emscripten is available under two separate licenses, the MIT license and the
# University of Illinois/NCSA Open Source License. Both these licenses can be
# found in the LICENSE file.
import os
import logging
TAG = 'version_2'
HASH = '317b22ad9b6b2f7b4... | [
{
"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 | tools/ports/sdl2_net.py | talrasha/emscripten |
import pytest
from ctypes import *
unsigned_types = [c_ubyte, c_ushort, c_uint, c_ulong]
signed_types = [c_byte, c_short, c_int, c_long, c_longlong]
float_types = [c_double, c_float, c_longdouble]
try:
c_ulonglong
c_longlong
except NameError:
pass
else:
unsigned_types.append(c_ulonglong)
signed_t... | [
{
"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 | extra_tests/ctypes_tests/test_numbers.py | nanjekyejoannah/pypy |
import torch
import torch.nn as nn
import torchvision
class ResNeXtBlock(nn.Module):
def __init__(self,in_places,places, stride=1,downsampling=False, expansion = 2, cardinality=32):
super(ResNeXtBlock,self).__init__()
self.expansion = expansion
self.downsampling = downsampling
sel... | [
{
"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 | python_developer_tools/cv/classes/ResNeXt.py | carlsummer/python_developer_tools |
import asyncio
import logging
import yaml
from discord.ext.commands import Bot
from ulfenkarn.dices.cog import Dices
logger = logging.getLogger(__name__)
async def start_bot(config):
bot = Bot(command_prefix="!", description="Warhammer Quest: Cursed City Helper")
bot.add_cog(Dices(bot))
await bot.start... | [
{
"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 | ulfenkarn/app.py | zer0tonin/Ulfenkarn |
class UndergroundSystem:
def __init__(self):
#checkins[id]={startSation,time}
self.checkins={}
#trips[start+end]={totalduration,count}
self.trips={}
def checkIn(self, id: int, stationName: str, t: int) -> None:
self.checkins[id]=(stationName,t)
def... | [
{
"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 | solutions/1396.py | tanvimoharir/leetcodeproblems |
"""
This module enables log functionality inside the CLI
"""
from termcolor import colored
import datetime
from prompt_toolkit.document import Document
from core.Event import Event
from prompt_toolkit import print_formatted_text
from filelock import Timeout, FileLock
class Log:
"""
Define simple info, debug ... | [
{
"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 | P4-Implementation/host_cli/core/Log.py | qcz994/p4-bier |
from __future__ import division
import numpy as np
# Non-monotonic Sobol G Function (8 parameters)
# First-order indices:
# x1: 0.7165
# x2: 0.1791
# x3: 0.0237
# x4: 0.0072
# x5-x8: 0.0001
def evaluate(values, a=None):
if type(values) != np.ndarray:
raise TypeError("The argument `values` m... | [
{
"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/SALib/test_functions/Sobol_G.py | cmutel/SALib |
"""
Plot a spectrum from a data file of color codes
"""
__author__ = "prOttonicFusion"
__version__ = "0.1.0"
__license__ = "MIT"
import numpy as np
import argparse
from math import pi
from bokeh.io import output_file, export_png, show
from bokeh.plotting import figure
def main(color_data_file, html='', png='', titl... | [
{
"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 | linearSpectrum.py | prOttonicFusion/spectrograph |
# Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""The `depot_tools` module provides safe functions to access paths within
the depot_tools repo."""
import contextlib
from recipe_engine import recipe_api
... | [
{
"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 | recipes/recipe_modules/depot_tools/api.py | xiayongtao/depot_tools |
import hashlib
import json
# The default hashing algorithm used by tplbuild.
HASHER = hashlib.sha256
class HashWriter:
"""
File-like writable object that passed all writes through to the supplied
hasher. It will automatically encode str data using the supplied encoding.
"""
def __init__(self, hs... | [
{
"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 | tplbuild/hashing.py | msg555/tplbuild |
#!/usr/bin/env python
# Copyright (c) 2017, the R8 project authors. Please see the AUTHORS file
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
try:
import gi
from gi.repository import Notify
Notify.init("R8 build tools")
... | [
{
"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 | tools/notify.py | yongjhih/r8 |
import string
from _collections import defaultdict
import csv
def get_word_count(input_filename):
'''
Takes a text file as input and returns
the word count as Python Dictionary
'''
with open(input_filename) as f_input:
lines = f_input.readlines()
word_dict = defaultdict(int)
... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/... | 3 | Section_7/word_count_repo/src/project_utils.py | PacktPublishing/Software-Engineering-with-Python-3.x |
#
# The Python Imaging Library.
# $Id$
#
# standard mode descriptors
#
# History:
# 2006-03-20 fl Added
#
# Copyright (c) 2006 by Secret Labs AB.
# Copyright (c) 2006 by Fredrik Lundh.
#
# See the README file for information on usage and redistribution.
#
# mode descriptor cache
_modes = {}
class ModeDescriptor(ob... | [
{
"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": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answ... | 3 | Lib/site-packages/PIL/ImageMode.py | Kronos3/pyexec |
import grpc
from tiktorch.proto import inference_pb2, inference_pb2_grpc
class FlightControlServicer(inference_pb2_grpc.FlightControlServicer):
def __init__(self, *, done_evt=None) -> None:
self.__done_evt = done_evt
def Ping(self, request: inference_pb2.Empty, context) -> inference_pb2.Empty:
... | [
{
"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 | tiktorch/server/grpc/flight_control_servicer.py | m-novikov/tiktorch |
# coding: utf-8
from django.test import TestCase
rst_markup = """
Sample Header
===============
Blah blah blah
Lower Header
-------------
Blah blah blah
"""
class TestAddForm(TestCase):
fixtures = ["test_tasks.json"]
urls = "tasks.tests.tasks_urls"
def setUp(self):
self.client.login(us... | [
{
"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 | pinax/apps/tasks/tests/test_client.py | peiwei/pinax |
import numpy as np
import unittest
import os
from recommender_pkg.metrics import dcg_score
from recommender_pkg.metrics import ndcg_score
from recommender_pkg.metrics import perform_groupwise_evaluation
class TestMetrics(unittest.TestCase):
def test_dcg_score(self):
self.assertAlmostEqual(dcg_score([1, 2,... | [
{
"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/metrics.py | mianuddin/csc492_recommender_pkg |
# coding: utf-8
from bs4 import BeautifulSoup
from pathlib import Path
from datetime import datetime
import urllib, requests
import socket
import time, pickle
from metspy.config import Config
from metspy.initializer import Urlinit, Urloader
class Spyder(Config):
"""
Create a new spider
"""
def __init__(self, obj_p... | [
{
"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 | spyder.py | soonyenju/metSpy |
import re
def remove_html_tag(texte):
"""
This function only returns the text content inside an HTML tag.
:param texte: str. The full HTML tag.
:return: The text content of a HTML tag.
"""
texte = str(texte)
if rep := re.match('(.*?)(<.*?>)(.*?)', texte):
texte = texte.replace(rep... | [
{
"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 | usefulScrapeFuncs.py | TomPlanche/usefulScrapeFunctions |
# coding=utf8
import socket
import time
import math
url = 'xkcd.com'
def log_time(func):
def wrapper(*args, **kw):
start_time = time.time()
func(*args, **kw)
print(time.time() - start_time)
return wrapper
def blocking_way():
sock = socket.socket()
sock.connect((url, 80))
... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
... | 3 | A_Web_Crawler_With_asyncio_Coroutines/blocking.py | czs0x55aa/500lines_homework |
import tempfile
import webbrowser
import time
import os
import pygtk
import gtk
try:
from StringIO import StringIO
except ImportError:
from io import StringIO
from grab import Grab
from .base import CaptchaBackend
pygtk.require('2.0')
class CaptchaWindow(object):
def __init__(self, path, solution):
... | [
{
"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_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"ans... | 3 | grab/captcha/backend/gui.py | brabadu/grab |
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.models import User
from profiles.models import Developer, Provider
class DeveloperInline(admin.StackedInline):
model = Developer
can_delete = False
verbose_name_plural = 'Developer'
fk_name = 'use... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
}... | 3 | ServerlessController/profiles/admin.py | pacslab/ChainFaaS |
# 在python中复制操作重新赋一个标识符,所以可以直接赋值
class Solution():
def removeElement(self, nums: list, val: int) -> int:
lst=[]
for i in range(len(nums)):
if nums[i]!=val:
lst.append(nums[i])
nums[:]=lst
return len(lst)
#python计数与删除操作
class Solution2:
def removeE... | [
{
"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 | easy/27.removeElement.py | nanfeng-dada/leetcode- |
from django.test import TestCase
from django.test import TestCase
from catalog.models import Author
class AuthorModelTest(TestCase):
@classmethod
def setUpTestData(cls):
# Set up non-modified objects used by all test methods
Author.objects.create(first_name='Big', last_name='Bob')
def t... | [
{
"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 | catalog/tests/test_models.py | sahiljoster32/django_scripts |
"""Added Macros table
Revision ID: b7ab14de6d0f
Revises: 183d3f0348eb
Create Date: 2017-11-28 11:54:23.897000
"""
# revision identifiers, used by Alembic.
revision = 'b7ab14de6d0f'
down_revision = '183d3f0348eb'
from alembic import op
import sqlalchemy as sa
def upgrade():
# ### commands auto... | [
{
"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 | migrations/versions/b7ab14de6d0f_added_macros_table.py | ukblumf/randomise-it |
# Evaluate DAP participation using Chrome headless.
# Can also be run in Lambda.
lambda_support = True
# Signal that this is a JS-based scan using headless Chrome.
# The scan method will be defined in third_parties.js instead.
scan_headless = True
# make sure we have the domain/url stuff set up properly
def init_do... | [
{
"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 | scanners/dap.py | cablej/domain-scan |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
OpenAPI spec version: v1.13.5
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import unittest
import kube... | [
{
"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 | kubernetes_asyncio/test/test_v1_node_status.py | PidgeyBE/kubernetes_asyncio |
'''
This module shows some parametrization demos
'''
import pytest
@pytest.mark.parametrize('value', range(5))
def test_is_above_3(value):
'checks that ``value`` is above 3'
assert value > 3
@pytest.mark.parametrize('value', [
1,
2,
... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/... | 3 | demo/test_parametrisation.py | AnandJyrm/allure-pytest |
''' A module for the various different errors that can be raised. '''
class AbortError(Exception):
''' An exception for aborting computations with.
This is thrown by clicking 'cancel' on a progress box. '''
def __init__(self, message=None):
super().__init__()
self.message = messa... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?"... | 3 | flipper/kernel/error.py | MarkCBell/flipper |
#!/usr/bin/env python
# -*- cpy-indent-level: 4; indent-tabs-mode: nil -*-
# ex: set expandtab softtabstop=4 shiftwidth=4:
#
# Copyright (C) 2008,2009,2010,2012,2013,2014,2015,2016 Contributor
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the ... | [
{
"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 | tests/broker/test_del_share.py | ned21/aquilon |
from xosresource import XOSResource
from core.models import User, Deployment, Flavor
class XOSFlavor(XOSResource):
provides = "tosca.nodes.Flavor"
xos_model = Flavor
copyin_props = ["flavor"]
def get_xos_args(self):
args = super(XOSFlavor, self).get_xos_args()
# Support the default wh... | [
{
"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 | xos/tosca/resources/flavor.py | pan2za/xos |
import random
import statistics
import time
def _generate_gene(length,geneset):
genes = []
while len(genes) < length:
sample = min(length - len(genes), len(geneset))
genes.extend(random.sample(geneset,sample))
return ''.join(genes)
def _mutate(parent,geneset):
childgene = list(parent)
index = random.randran... | [
{
"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 | phrase_guess/genetic.py | chauhanjatin10/Genetic_alogs |
"""
Remove super classes from the train dataset and keep it only in the validation dataset.
Example command: python create_rcv1_heldout_split.py --train_fraction 0.75 --seed 42
"""
import argparse
import jsonlines
from collections import Counter
import numpy as np
import random
import copy
import os
import json
def... | [
{
"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 | run_rcv1/preprocessing/create_rcv1_superclass_split.py | princeton-nlp/semsup |
import unittest
from dbt.adapters.spark import SparkColumn
class TestSparkColumn(unittest.TestCase):
def test_convert_table_stats_with_no_statistics(self):
self.assertDictEqual(
SparkColumn.convert_table_stats(None),
{}
)
def test_convert_table_stats_with_bytes(self)... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true... | 3 | test/unit/test_column.py | mv1742/dbt-spark |
import torch, numpy as np, scipy.sparse as sp
from torch.nn import functional as F
from tqdm import tqdm
def adjacency(H):
"""
construct adjacency for recursive hypergraph
arguments:
H: recursive hypergraph
"""
A = np.eye(H['n'])
E = H['D0']
for k in tqdm(E):
e = list(E[k... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer":... | 3 | MPNNR/model/utils.py | naganandy/G-MPNN-R |
# -*- coding: utf8 -*-
from __future__ import absolute_import
from __future__ import division, print_function, unicode_literals
from collections import namedtuple
from operator import attrgetter
from ..utils import ItemsCount
from .._compat import to_unicode
from ..nlp.stemmers import null_stemmer
from nltk import w... | [
{
"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 | baselines/baseline2/summarize/sumy/summarizers/_summarizer.py | PKULiuHui/LiveBlogSum |
from exaqute.ExaquteParameter import *
class ExaquteTask(object):
def __init__(self, *args, **kwargs):
raise Exception(
"Exaqute task decorator not implemented in the current scheduler")
def __call__(self, f):
raise Exception(
"Exaqute task call code not implemented i... | [
{
"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 | applications/MultilevelMonteCarloApplication/external_libraries/PyCOMPSs/exaqute/ExaquteTask.py | SADPR/Kratos |
import os
import sys
import pwiki.err as err
def add_path(path, check_existence=True):
if check_existence and not os.path.isdir(os.path.abspath(path)):
raise err.FileError('Not a directory: %s' % path)
sys.path.append(os.path.abspath(path))
def find_dump():
for path in ('dump.xml.bz2', 'dump.xml')... | [
{
"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 | pwiki/util.py | lethosor/df-pwiki |
from abaqusConstants import *
class Crack:
"""The Crack object is the abstract base type for ContourIntegral and future crack objects.
Attributes
----------
name: str
A String specifying the repository key.
suppressed: Boolean
A Boolean specifying whether the crack is suppressed o... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},... | 3 | src/abaqus/EngineeringFeature/Crack.py | Haiiliin/PyAbaqus |
import random
import numpy as np
import pytest
from xicor.xicor import Xi
"""
From Wikipedia:
Anscombe's quartet comprises four data sets that have nearly
identical simple descriptive statistics, yet have very different distributions
and appear very different when graphed. Each dataset consists of eleven
(x,y) points... | [
{
"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 | tests/xi_test.py | bbstats/xicor |
import structlog
from pathlib import Path
from typing import Any, Dict, Generator, Iterable, Optional, Tuple
from normality import normalize, WS
from followthemoney.schema import Schema
from followthemoney.types import registry
from opensanctions import settings
from nomenklatura.loader import Loader
from nomenklatura.... | [
{
"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_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"an... | 3 | opensanctions/core/index.py | quantumchips/opensanctions |
from __future__ import unicode_literals
from pygubu.builder.builderobject import *
from pygubu.widgets.tkscrolledframe import TkScrolledFrame
class TKScrolledFrameBO(BuilderObject):
class_ = TkScrolledFrame
container = True
# maxchildren = 1
# allowed_children = ('tk.Frame', 'ttk.Frame' )
OPTIONS_S... | [
{
"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 | Server/ChatBot/venv/Lib/site-packages/pygubu/builder/widgets/tkscrolledframe.py | sozuer53/BBC |
import komand
from .schema import RegistrantMonitorInput, RegistrantMonitorOutput
# Custom imports below
from komand_domaintools.util import util
class RegistrantMonitor(komand.Action):
def __init__(self):
super(self.__class__, self).__init__(
name="registrant_monitor",
descriptio... | [
{
"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 | plugins/domaintools/komand_domaintools/actions/registrant_monitor/action.py | lukaszlaszuk/insightconnect-plugins |
from typing import Dict
from sqlalchemy import MetaData, Table
class SqlAlchemyTables:
metadata: MetaData
tables: Dict[str, Table]
def __init__(self, metadata: MetaData):
self.metadata = metadata
self.tables = {}
def __getitem__(self, key: str) -> Table:
return self.tables[k... | [
{
"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 | rapdevpy/database/sql_alchemy_tables.py | MislavJaksic/rapdevpy |
import sqlite3
import click
from flask import current_app, g
from flask.cli import with_appcontext
def get_db():
if 'db' not in g:
g.db = sqlite3.connect(
'database.db',
detect_types=sqlite3.PARSE_DECLTYPES
)
g.db.row_factory = sqlite3.Row
return g.db
def cl... | [
{
"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 | db.py | TheWebRage/Blog-Flask |
'''
netwerk utilities
2017_0604 WeMOS Lolin32 - first version
'''
def doConnect(essid, password):
import network
wlan = network.WLAN(network.STA_IF)
wlan.active(True)
if not wlan.isconnected():
print('connecting to network... ', essid)
wlan.connect(essid, password)
while not... | [
{
"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 | demos-esp32/network/doconnect.py | flashypepo/myMicropython-Examples |
import numpy as np
import pandas as pd
def file_combine(start,finish):
combine_df = pd.DataFrame()
for i in range(start,finish,500):
temp = pd.read_csv("~/Desktop/Chess/data/train_data{}".format(i), index_col = 0)
combine_df = combine_df.append(temp, ignore_index=True)
print (i)
re... | [
{
"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 | preprocess/combine_data.py | tzmhuang/chess-nn |
import torch
from ..distances import CosineSimilarity
from ..utils import common_functions as c_f
from .generic_pair_loss import GenericPairLoss
class NTXentLoss(GenericPairLoss):
def __init__(self, temperature=0.07, **kwargs):
super().__init__(mat_based_loss=False, **kwargs)
self.temperature = t... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inherita... | 3 | src/pytorch_metric_learning/losses/ntxent_loss.py | keshav47/pytorch-metric-learning |
# -*- coding: utf-8 -*-
"""a function of ploting figures."""
import numpy as np
import matplotlib.pyplot as plt
def cross_validation_visualization(lambds, mse_tr, mse_te):
"""visualization the curves of mse_tr and mse_te."""
plt.semilogx(lambds, mse_tr, marker=".", color='b', label='train error')
plt.semi... | [
{
"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": tru... | 3 | labs/ex04/template/plots.py | kcyu1993/ML_course_kyu |
import numpy as np
from skimage.filters import gabor_kernel
import cv2
class KernelParams:
def __init__(self, wavelength, orientation):
self.wavelength = wavelength
self.orientation = orientation
def __hash__(self):
return hash((self.wavelength, self.orientation))
def __eq__(se... | [
{
"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_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},... | 3 | core/gabor.py | guilhermealvess/emotions |
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
def get_p... | [
{
"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 | onnxmltools/convert/keras/operator_converters/common.py | Oewyn/onnxmltools |
from manimlib.imports import *
class TripleScene(Scene):
CONFIG = {
"good_file": "good",
"coin_file": "coin",
"favo_file": "favo",
}
def construct(self):
self.get_svg()
good = self.good
coin = self.coin
favo = self.favo
self.play(
... | [
{
"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 | tony_useful/bilibili.py | Tony031218/manim-projects |
import traceback
from ..utils import config
from ..utils.log import logger
from ..utils.recognize import Scene, RecognizeError
from ..utils.solver import BaseSolver, StrategyError
class MailSolver(BaseSolver):
"""
收取邮件
"""
def __init__(self, adb=None, recog=None):
super(MailSolver, self).__i... | [
{
"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 | arknights_mower/solvers/mail.py | yuanyan3060/arknights-mower |
# -*- coding: utf-8 -*-
#-----------------------------------------------------------------------------
# Copyright (c) 2005-2021, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License (version 2
# or later) with exception for distributing the bootloader.
#
# The full license is... | [
{
"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 | tests/functional/test_hooks/test_six.py | yoda-vid/pyinstaller |
import secrets
from base64 import urlsafe_b64encode as b64e, urlsafe_b64decode as b64d
from cryptography.fernet import Fernet
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC
class Aes_128_cbc_p... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
}... | 3 | ciphit/basemods/Crypto/aes_128_cbc_pass.py | sgrkmr/ciph |
from .fhirbase import fhirbase
class Annotation(fhirbase):
"""
A text note which also contains information about who made the
statement and when.
Args:
authorReference: The individual responsible for making the annotation.
authorString: The individual responsible for making the anno... | [
{
"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 | cardea/fhir/Annotation.py | sarahmish/Cardea |
# coding=utf-8
"""
@author: magician
@date: 2018/8/25
"""
import collections
class StrKeyDict(collections.UserDict):
"""
key is str
"""
def __missing__(self, key):
if isinstance(key, str):
raise KeyError(key)
return self[str(key)]
def __contains__(se... | [
{
"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 | fluent_python/array/dictionary.py | ftconan/python3 |
from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
import compas
from compas_rhino.forms import Form
try:
from System.Windows.Forms import TextBox
from System.Windows.Forms import DockStyle
from System.Windows.Forms import ScrollBars
from Syste... | [
{
"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/compas_rhino/forms/text.py | yijiangh/compas |
import mock
import tornado.web
from shelter.core.config import Config
from shelter.core.web import BaseRequestHandler, NullHandler
def test_base_request_handler():
app = tornado.web.Application([], context=1, interface=2)
req = mock.Mock()
h = BaseRequestHandler(app, req)
assert h.context == 1
... | [
{
"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 | tests/test_core_web.py | gjask/shelter |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.