source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
"""
Simple tests for the integration scheme for ProjectedCF (thus far). Doesn't work
as yet, since it tries to import the libraries from *this* folder, rather than
installation (which doesn't work because the fortran code isn't installed.)
"""
import inspect
import os
#LOCATION = "/".join(os.path.dirname(os.path.abspa... | [
{
"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 | tests/test_integrate_corr.py | zhaotingchen/halomod |
from ..output import OutputDevice
class SocketIOOutputDevice (OutputDevice):
""" SocketIOOutputDevice: Support for sending note on/off events via websockets.
Two types of event are sent at the moment:
note [ index, velocity, channel ] : The MIDI note number depressed.
... | [
{
"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 | isobar/io/socketio/output.py | rvega/isobar |
from bottle import SimpleTemplate
from bottle import request
from .game import Game
from .player import AIPlayer
from .recorder import save_game, get_stats, get_last_training
player_names = {
'm': 'Bob',
'h': 'You'
}
def render_field(idx, game):
current_state = game.states[-1]
if current_state[idx] ... | [
{
"point_num": 1,
"id": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 lines?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},... | 3 | appengine/tictactoe/webhandler.py | salendron/ai-kindergarten |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | [
{
"point_num": 1,
"id": "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 | aliyun-python-sdk-cloudauth/aliyunsdkcloudauth/request/v20190307/DescribeRPSDKRequest.py | yndu13/aliyun-openapi-python-sdk |
from __future__ import absolute_import, print_function, unicode_literals
import sys
import os
here = os.path.split(os.path.abspath(__file__))[0]
root = os.path.abspath(os.path.join(here, '../../'))
sys.path[0:0] = [root]
from streamparse.bolt import BatchingBolt
class DummyBatchingBoltAutoFail(BatchingBolt):
... | [
{
"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 | test/ipc/dummy_batching_bolt_auto_fail.py | singhdev/streamparse |
'''
文件目录帮助类
'''
import os
import shutil
from utils.commonUtil import CommonUtil
class FileUtil:
'''
处理文件路径
'''
@staticmethod
def cleanPath(path):
path=path.strip('\\');
return path
'''
判断路径是否存在
'''
@staticmethod
def isExists(path):
return os.path.ex... | [
{
"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 | utils/file.py | xia-deng/lawerWeb |
# -*- coding: utf-8 -*-
# Copyright (c) 2016 Mirantis 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 ... | [
{
"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 | plugins/playbook/add_mon/decapod_plugin_playbook_add_mon/exceptions.py | angry-tony/ceph-lcm-decapod |
pkgname = "zlib"
version = "1.2.11"
revision = 0
build_style = "configure"
short_desc = "Compression/decompression Library"
maintainer = "q66 <q66@chimera-linux.org>"
license = "Zlib"
homepage = "http://www.zlib.net"
distfiles = [f"{homepage}/{pkgname}-{version}.tar.gz"]
checksum = ["c3e5e9fdd5004dcb542feda5ee4f0ff0744... | [
{
"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 | main/zlib/template.py | ismith/cports |
"""
Revision ID: 0256_set_postage_tmplt_hstr
Revises: 0255_another_letter_org
Create Date: 2019-02-05 14:51:30.808067
"""
from alembic import op
import sqlalchemy as sa
revision = '0256_set_postage_tmplt_hstr'
down_revision = '0255_another_letter_org'
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": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": fals... | 3 | migrations/versions/0256_set_postage_tmplt_hstr.py | tlwr/notifications-api |
from django.db import models
from django.contrib.auth.models import PermissionsMixin
from django.contrib.auth.models import BaseUserManager, AbstractBaseUser
class UserProfilesManager(BaseUserManager):
""" Manager for user creation """
def create_user(self, email, name, password=None):
""" Create new... | [
{
"point_num": 1,
"id": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 lines?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/... | 3 | profiles_api/models.py | ankit-cashify/profiles-rest-api |
from datetime import datetime
from .command import Command
from .const import (
ATTR_NAME,
ATTR_CREATED_AT,
ATTR_ID,
)
class ApiResource:
"""Base object for resources returned from the gateway."""
def __init__(self, raw):
"""Initialize base object."""
self.raw = raw
@propert... | [
{
"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 | pytradfri/resource.py | spektren/pytradfri |
# -*- coding: utf-8 -*-
from __future__ import print_function, unicode_literals, absolute_import, division
"""Find the last ten digits of the series, 1^1 + 2^2 + 3^3 + ... + 1000^1000.
10digit surpass the int32
"""
def ProjectEuler48():
print(str(sum([i**i for i in range(1,1000)]))[-10:])
#sum = 1... | [
{
"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 | projecteuler/projectEuler48.py | qingfengxia/python-projecteuler |
import discord, os
from discord.ext import commands
bot = commands.Bot(
command_prefix="-",
case_insensitive=False,
help_command=None,
intents=discord.Intents.all(),
)
TOKEN = ""
@bot.command()
async def invite(ctx):
embed = discord.Embed(
title="Invite Me!",
descrip... | [
{
"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 | main.py | SockYeh/Scattergories |
# coding: utf-8
"""
Isilon SDK
Isilon SDK - Language bindings for the OneFS API # noqa: E501
OpenAPI spec version: 6
Contact: sdk@isilon.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import isi_sdk_8_1_1
from i... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true... | 3 | isi_sdk_8_1_1/test/test_hdfs_racks_extended.py | mohitjain97/isilon_sdk_python |
# Reverse Linked List
# Definition for singly-linked list.
class ListNode:
def __init__(self, val=0, next=None):
self.val = val
self.next = next
def __repr__(self):
tail = "<EMPTY>" if self.next is None else repr(self.next)
return f"{self.val} - {tail}"
class Solution:
def... | [
{
"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 | solutions/206.py | pacokwon/leetcode |
import os
import unittest
import time
import tinygrad.optim as optim
import numpy as np
from tinygrad.tensor import Tensor
from extra.training import train
from extra.utils import get_parameters
from models.efficientnet import EfficientNet
from models.transformer import Transformer
from models.resnet import ResNet18, R... | [
{
"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_train.py | Henistein/tinygrad |
"""
All the SAML-specific exceptions this library can throw.
"""
class SAML2Exception(Exception):
"""Base exception for all flask_saml2 exceptions."""
pass
class MessageException(SAML2Exception):
"""An exception with a nicely formatted error message."""
def __init__(self, msg):
self.msg = ms... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": true
},
{
... | 3 | flask_saml2/exceptions.py | SvyatoslavArtymovych/flask-saml2 |
from django.conf import settings
import stripe
from brambling.payment.core import LIVE
def stripe_prep(api_type):
stripe.api_version = '2016-03-07'
if api_type == LIVE:
stripe.api_key = settings.STRIPE_SECRET_KEY
else:
stripe.api_key = settings.STRIPE_TEST_SECRET_KEY
def stripe_test_set... | [
{
"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 | brambling/payment/stripe/core.py | Shivanjain023/django-brambling |
"Integration tests. Makes actual calls to Google Spreadsheets API."
import re
from datetime import date
from dojo_emailer.app import (
GDOCS_URL_PREFIX,
GDOCS_URL_SHEET_NAME,
SPREADSHEET_NAME
)
from dojo_emailer.sheet import (
get_dojo_data_from_date,
get_first_cell_by_prefix,
get_spreadsheet_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": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": fals... | 3 | tests/test_sheet.py | tomviner/dojo-monthly-emailer |
"""The Growatt server PV inverter sensor integration."""
from homeassistant import config_entries
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from .const import PLATFORMS
async def async_setup_entry(
hass: HomeAssistant, entry: config_entries.ConfigEntry
) ->... | [
{
"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 | homeassistant/components/growatt_server/__init__.py | MrDelik/core |
from flask import session
from functools import wraps
def login_required(f):
@wraps(f)
def decorated_function(*args, **kwargs):
user = dict(session).get('profile', None)
# You would add a check here and usethe user id or something to fetch
# the other data for that user/check if they 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": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"... | 3 | appengine/standard_python37/GoogleAuth/auth_decorator.py | poojarampariya/LoginFlask |
from __future__ import unicode_literals
import youtube_dl
class YoutubeDLClient():
"""docstring for YoutubeDLClient"""
def __init__(self, ydl_opts):
ydl_opts.update({'logger': self.MyLogger()})
ydl_opts.update({'progress_hooks': [self.my_hook]})
self.ydl_opts = ydl_opts
self.ydl... | [
{
"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 | youtube_dl_client.py | franciscoGPS/youtdl |
# -*-coding:utf-8-*-
import re
from torchtext import data
import jieba
import logging
jieba.setLogLevel(logging.INFO)
regex = re.compile(r'[^\u4e00-\u9fa5aA-Za-z]')
def word_cut(text):
text = regex.sub(' ', text)
return [word for word in text if word.strip()]
def joint_word_cut(text):
return [word for... | [
{
"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 | utils/dataset.py | Justprogramer/JBLACN |
from django.db import models
from django.contrib.auth.models import AbstractUser
from django.core.files.uploadedfile import InMemoryUploadedFile
from PIL import Image
from io import BytesIO
import sys
MAX_IMAGE_WIDTH = 160
MAX_IMAGE_HEIGHT = 160
class Member(AbstractUser):
ACAD_YEAR_CHOICES = [
'Fresh... | [
{
"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 | users/models.py | maxweis/Web-App |
# -*- coding: utf-8 -*-
import re
import os
import unix
import weakref
from .. import Linux, Chroot, LinuxError
from unix.linux.services import Initd, Upstart, Systemd
DISTRIBS = ('RedHat', 'CentOS')
_CONFDIR = '/etc/sysconfig'
_NETFILE = os.path.join(_CONFDIR, 'network')
def RedHat(host, force=False):
unix.is... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 lines?",
"answer": true
... | 3 | unix/linux/gnu/redhat.py | fmenabe/python-unix |
from app import create_app,db
from flask_script import Manager,Server
from flask_migrate import Migrate, MigrateCommand
from app.models import User,Role
app = create_app('production')
manager = Manager(app)
manager.add_command('server',Server)
migrate = Migrate(app,db)
manager.add_command('db',MigrateCommand)
@ma... | [
{
"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 | manage.py | dunyung1/Bookmodel |
import random
import numpy as np
def uniform_matrix(shape, low=0.0, high=1.0):
"""Generate a uniformly random matrix of the given shape."""
return np.random.uniform(low=low, high=high, size=shape)
def randint_matrix(shape, low=0, high=100):
"""Generate a matrix of random integers of the given shape."""... | [
{
"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 | benchmarks/utils.py | jdmoorman/clapsolver |
#!/usr/bin/env python
import roslib; roslib.load_manifest('flexbe_core')
import tf
class ProxyTransformListener(object):
_listener = None
def __init__(self):
if ProxyTransformListener._listener is None:
ProxyTransformListener._listener = tf.TransformListener()
def listener(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": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"ans... | 3 | flexbe_core/src/flexbe_core/proxy/proxy_transform_listener.py | HannesBachter/flexbe_behavior_engine |
from tkinter import *
import tkinter.filedialog as tkFileDialog
root = Tk("Text Editor")
text = Text(root)
text.grid()
def saveas():
global text
t = text.get("1.0", "end-1c")
savelocation= tkFileDialog.asksaveasfilename()
file1=open(savelocation, "w+")
file1.write(t)
file1.close()
button=Butto... | [
{
"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 | texteditor.py | p10rahulm/python-basics |
from django.db import models
from django.contrib.auth.models import AbstractBaseUser, BaseUserManager, PermissionsMixin
class UserManager(BaseUserManager):
def create_user(self, email, password=None, **extra_fields):
if not email:
raise ValueError('User must have an email address')
... | [
{
"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 | app/core/models.py | shreyask543/Recipe-api |
from fileops import resolve_path, get_mode, mode_isdir, auto, chdir
from printing import eprint
def complete_cd(self, text, line, begidx, endidx):
return self.directory_complete(text, line, begidx, endidx)
def do_cd(self, line):
"""cd DIRECTORY
Changes the current directory. ~ expansion is supported,... | [
{
"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 | lib/do/do_cd.py | MCer4294967296/shell49 |
#!/usr/bin/env python3
from contextlib import contextmanager
from os import path as osp
import joblib
import pandas as pd
from sklearn.ensemble import AdaBoostClassifier
from sklearn.svm import SVC
DEMO_DIR = osp.abspath(osp.dirname(__file__))
DATA_DIR = osp.join(DEMO_DIR, "data")
MODELS_DIR = osp.join(DEMO_DIR, "m... | [
{
"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 | demo/train_models.py | oasislabs/ready-layer-2 |
# coding: utf-8
"""
Jamf Pro API
## Overview This is a sample Jamf Pro server which allows for usage without any authentication. The Jamf Pro environment which supports the Try it Out functionality does not run the current beta version of Jamf Pro, thus any newly added endpoints will result in an error and sh... | [
{
"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 | test/test_static_user_group.py | jensenbox/python-jamf |
# Code Taken from https://github.com/LYH-YF/MWPToolkit
# -*- encoding: utf-8 -*-
# @Author: Yihuai Lan
# @Time: 2021/08/29 21:49:49
# @File: gcn.py
import torch
from torch import nn
from torch.nn import functional as F
from module.Layer.graph_layers import GraphConvolution
class GCN(nn.Module):
def __init__(se... | [
{
"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 | mwp_solver/module/Graph/gcn.py | max-stack/MWP-SS-Metrics |
"""
Tests for Reactions
"""
from src.common import constants as cn
from src.common.simple_sbml import SimpleSBML
from src.common import simple_sbml
from src.common.function_definition import FunctionDefinition
from tests.common import helpers
import copy
import libsbml
import numpy as np
import unittest
IGNORE_TEST ... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
}... | 3 | tests/test_function_definition.py | joseph-hellerstein/symSBML-deprecated |
from conans import ConanFile, CMake
class AwsConan(ConanFile):
name = "aws-sdk-cpp"
version = "1.3.21"
license = "Apache License 2.0"
description = "AWS SDK for C++"
url = "https://github.com/aws/aws-sdk-cpp"
settings = "arch", "build_type", "compiler", "os"
generators = "cmake"
def p... | [
{
"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 | conanfile.py | PaladinAI/aws-sdk-cpp |
#!/usr/bin/python
#-*- coding:utf-8 -*-
"""
Author: AsherYang
Email: 1181830457@qq.com
Date: 2017/7/24
"""
class Token():
@property
def access_token(self):
return self.access_token
@property
def access_token(self, value):
self.access_token = value
@property
def expire_in(... | [
{
"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 | server/shserver/Token.py | AsherYang/ThreeLine |
"""Adds a discoverable field to terms.
Revision ID: 85bff3e51dc4
Revises: ab9879051d6c
Create Date: 2020-07-09 09:54:09.343487
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "85bff3e51dc4"
down_revision = "ab9879051d6c"
branch_labels = None
depends_on = None
... | [
{
"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/dispatch/alembic/versions/85bff3e51dc4_.py | mclueppers/dispatch |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# __author__ : stray_camel
# __description__ : 用户部门管理等
# __REFERENCES__ :
# __date__: 2020/09/28 09
from django.db import models
from django.conf import settings
from datetime import datetime
AUTH_USER_MODEL = getattr(settings, 'AUTH_USER_MODEL', 'auth.User')
class Department... | [
{
"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 | apps/department/models.py | xiaozhi-12121/Django_web |
from detect import (detect_logos, detect_text)
import pandas as pd
import re
import os
#from __future__ import print_function
from google.cloud import vision
images_path = "C:\\Users\\heinz\\Yagora GmbH\\Ievgen Kyrda - Crawler\\images\\foodnewsgermany_images/"
file_names = os.listdir(os.path.dirname(images_path))
f... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than ... | 3 | samples/snippets/detect/label-products.py | glaswasser/python-vision |
from conans import ConanFile, CMake
class TargetConan(ConanFile):
name = "android_aar"
version = "1.0.0"
settings = "os", "compiler", "build_type", "arch"
options = {"shared": [True, False], "fPIC": [True, False]}
default_options = {
"shared": False,
"fPIC": True,
"sqlite3:... | [
{
"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 | files/targets/android_aar/conan/recipe/conanfile.py | Leo-Neves/ezored |
import Event, RemoveFocusEvent
import eventFunction, mouseFunction
print('FalseClickEvent library imported')
class FalseClickEvent(Event.Event):
def update(self):
RemoveFocusEvent.RemoveFocusEvent(self.object)
self.updateStatus(eventFunction.Status.RESOLVED)
def __init__(self,application,
... | [
{
"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 | api/src/domain/event/click/FalseClickEvent.py | SamuelJansen/Application |
import unittest
from db import mssql
def connect_mssql():
obj_sql = mssql.MsSqlDb(None)
conn = obj_sql.get_connection
if conn is None:
return False
else:
return True
class MyTest(unittest.TestCase):
def test(self):
self.assertTrue(connect_mssql(), True)
if __name__... | [
{
"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 | tests/mssql_test.py | technetbytes/ModelService |
from unittest import main
from ... import smf100a
from .. import mock_smf100a
from ...tests.server.test_smf100a import SMF100ATest
# Don't lose the real device.
real_SMF100A = smf100a.SMF100A
is_mock = SMF100ATest.mock
def setup():
# Run the tests with a fake device.
smf100a.SMF100A = mock_smf100a.MockSMF100A
... | [
{
"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_return_types_annotated",
"question": "Does every function in this file have a return type annotation?... | 3 | spacq/devices/rohde_schwarz/mock/tests/test_mock_smf100a.py | bleutooth65/SpanishAcquisition3 |
import sys
import math
def main():
change_owed = float(input("How much change is owed?: "))
while change_owed < 0:
change_owed = float(input("How much change is owed?: "))
greed(change_owed)
return(0)
def greed(y): # a function that calculates and prints the number of coins owe... | [
{
"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 | greedy.py | Nelias/CS50-pset6 |
from typing import TypeVar, Callable
import unittest
from ._types import TestMethod
_F = TypeVar("_F", bound=TestMethod)
def test(method: _F) -> _F:
"""Decorator that flags a method as a test method."""
method._dectest_test = True # type: ignore
return method
def before(method: _F) -> _F:
"""Deco... | [
{
"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 | dectest/_decorators.py | srittau/python-dectest |
"""Test transitions to test extra_exec_rustc_flags."""
def _extra_exec_rustc_flags_transition_impl(_settings, attr):
return {
"//:extra_exec_rustc_flags": attr.extra_exec_rustc_flags,
}
_extra_exec_rustc_flags_transition = transition(
implementation = _extra_exec_rustc_flags_transition_impl,
i... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (exclu... | 3 | test/extra_exec_rustc_flags/defs.bzl | silas-enf/rules_rust |
#
# CORE
# Copyright (c)2011-2014 the Boeing Company.
# See the LICENSE file included in this distribution.
#
# author: Jeff Ahrenholz <jeffrey.m.ahrenholz@boeing.com>
#
'''
Helpers for loading and saving XML files. savesessionxml(session, filename) is
the main public interface here.
'''
import os.path
from core.netn... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true... | 3 | daemon/core/misc/xmlsession.py | cudadog/coreemu |
import time
from numba import jit
import numpy as np
@jit()
def jit_sum_conbination(N):
xs = [i for i in range(N)]
ys = [i for i in range(N)]
total = 0
for x in xs:
for y in ys:
total += x+y
return total
def py_sum_conbination(N):
xs = np.arange(N)
ys = np.arange(N)
... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": fals... | 3 | cythonTest/onlineSample/combination/jit_combination.py | terasakisatoshi/pythonCodes |
from tkinter import *
from tkinter import messagebox
import os
def newTask():
task = my_entry.get()
if task != "":
lb.insert(END, task)
my_entry.delete(0, "end")
else:
messagebox.showwarning("warning", "Please enter some task.")
def deleteTask():
lb.delete(ANCHOR)
def... | [
{
"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 | page2.py | VsuManiego/construction-ans |
from jd.api.base import RestApi
class KeplerXuanpinSearchSkuRequest(RestApi):
def __init__(self,domain='gw.api.360buy.com',port=80):
RestApi.__init__(self,domain, port)
self.queryParam = None
self.pageParam = None
self.orderField = None
def getapiname(self):
return 'jd.kepler.xuanpin.search.sku'
... | [
{
"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 | jd/api/rest/KeplerXuanpinSearchSkuRequest.py | fengjinqi/linjuanbang |
import django
from django.db import models
from django.core.exceptions import ValidationError
from .fields import DictionaryField
if django.get_version() < '1.7':
from . import apps
class SchemaModel(models.Model):
"""
adds support for hstore virtual fields
"""
class Meta:
abstract = Tr... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{... | 3 | django_hstore/models.py | chelis/django-hstore |
from bson import ObjectId
from .field import Field
class ObjectIdField(Field):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
def to_mongo(self, value):
return ObjectId(value) if value else None
async def from_mongo(self, value, resolver=None):
return str... | [
{
"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 | motorodm/fields/object_id_field.py | rob-blackbourn/motorodm |
def setup(B):
@B.listen()
async def on_message(M):"💀"in M.content and await M.channel.send("http://tenor.com/view/10107813")
| [
{
"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 | extensions/skull.py | Kev-in123/joshgone |
import unittest
from blindreviewparser.parser.blind_review_parser import *
class TestElasticService(unittest.TestCase):
def setUp(self) -> None:
self.es_endpoint = 'http://localhost:9200'
self.elastic_service = ElasticService(self.es_endpoint)
self.sample = Review(
... | [
{
"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/test_elastic_service.py | occidere/blind-review-parser |
from django.test import TestCase
from whateverapp.models import *
import factory
class CityFactory(factory.DjangoModelFactory):
class Meta:
model = City
name = "New York City"
class HotelFactory(factory.DjangoModelFactory):
class Meta:
model = Hotel
name = "Omni",
room_charge =... | [
{
"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 | whateverapp/tests.py | justinbellamy/whateverprojectPython |
import pandas as pd
import numpy as np
import os, pdb, sys
def netIncome():
df = pd.read_csv('usda_data/net_income.csv')
df = df[df['Year'] == 2017].reset_index().drop(['index'], axis = 1)
df = df[['Year', 'State', 'State ANSI', 'County', 'County ANSI', 'Zip Code', 'Value']]
df.columns = ['yr', 'st', ... | [
{
"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": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 lines?",
"answer": ... | 3 | usda_data/joinUSDA.py | christophershultz/spatial_ag |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import codecs
import os
import re
import sys
from setuptools import setup
PY2 = sys.version_info[0] == 2
def get_version(package):
"""
Return package version as listed in `__version__` in `init.py`.
"""
matches = re.search(
r"__version__[\s]+=[\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": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"ans... | 3 | setup.py | peopledoc/django-sortedm2m |
import itertools
import numpy as np
def pairwise(iterable):
"s -> (s0,s1), (s1,s2), (s2, s3), ..."
a, b = itertools.tee(iterable)
next(b, None)
return zip(a, b)
def struct_to_ndarray(array):
"""Turns returns a view of a structured array as a regular ndarray."""
return array.view(array.dtype[0... | [
{
"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 | ratcave/utils/vertices.py | aforren1/ratcave |
from wingedsheep.carcassonne.objects.coordinate import Coordinate
from wingedsheep.carcassonne.objects.side import Side
class CoordinateWithSide:
def __init__(self, coordinate: Coordinate, side: Side):
self.coordinate = coordinate
self.side = side
def __eq__(self, other):
return self... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a ty... | 3 | wingedsheep/carcassonne/objects/coordinate_with_side.py | SuryaVikram/CarcassonneMaster |
from flask_philo import app
from flask_philo.db.postgresql.orm import BaseModel
from flask_philo.db.postgresql import syncdb
from flask_philo.db.postgresql.connection import get_pool
from flask_philo.db.redis.connection import get_pool as get_redis_pool
from flask_philo.db.elasticsearch.connection import get_pool as ge... | [
{
"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 | flask_philo/test.py | maigfrga/flask-philo |
import os
import pandas as pd
from demo import utils
URL = r'https://ti.arc.nasa.gov/c/6/'
PWD = os.path.dirname(__file__)
def _download_data():
output = os.path.join(PWD, 'download')
utils.download(URL, output)
def _data():
path = os.path.join(PWD, 'download', 'train_FD004.txt')
if not os.path.exi... | [
{
"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 | docs/source/examples/demo/turbofan_degredation/__init__.py | flowersw/compose |
from flask_wtf import FlaskForm
from wtforms import StringField,PasswordField,BooleanField,SubmitField
from wtforms.validators import Required,Email,EqualTo,Length
from ..models import User
from wtforms import ValidationError
class LoginForm(FlaskForm):
email = StringField('Your Email Address',validators=[Required... | [
{
"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 | app/auth/forms.py | k-wayne/PitchApp |
from stack import Stack
def postfix_eval(postfix_expression):
operand_stack = Stack()
token_list = postfix_expression.split()
for token in token_list:
if token in "0123456789":
operand_stack.push(int(token))
else:
operand2 = operand_stack.pop()
... | [
{
"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 | DataStructure_implementation/Stack/postfix.py | Jason0LiYaoCN/University-Assignments |
class Order():
def __init__(self, pair, direction, amount, price):
if direction.upper() not in ['BUY', 'SELL']:
raise ValueError("{} is not a valid direction".format(direction))
self.pair = pair
self.direction = direction
self.amount = float(amount)
self.price = f... | [
{
"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 | crypto_balancer/order.py | GRTTX/crypto_balancer |
__copyright__ = \
"""
Copyright ©right © (c) 2019 The Board of Trustees of Purdue University and the Purdue Research Foundation.
All rights reserved.
This software is covered by US patents and copyright.
This source code is to be used for academic research purposes only, and no commercial use is allowed.
For any ... | [
{
"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 | extern/locating-objects-without-bboxes/object-locator/models/utils.py | YuHsin1998/EllSeg |
import unittest
from webcamlib.Config import Config
from webcamlib.SendAlert import SendAlert
import logging
import os
"""
"unit" test (more of a functional test) to make sure the Sending SMS works
"""
class TestSendSMSMethods(unittest.TestCase):
def setUp(self):
self.config = Config('../config.json')
... | [
{
"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 | tests/test_sendalert.py | mbuckaway/trailcam |
import torch
import numpy as np
import smplx
from smplx import SMPL as _SMPL
from smplx.body_models import ModelOutput
from smplx.lbs import vertices2joints
import spin.config as config
import spin.constants as constants
class SMPL(_SMPL):
""" Extension of the official SMPL implementation to support more joints "... | [
{
"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 | spin/models/smpl.py | krumo/SPIN |
from purplex.grammar import Grammar, Production, END_OF_INPUT
def test_grammar_mostly():
noop = lambda args: args
grammar = Grammar(['+', '*', '(', ')', 'id'], [
Production("E : T E'", noop),
Production("E' : + T E'", noop),
Production("E' : <empty>", noop),
Production("T : F T... | [
{
"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 | purplex/test/test_grammar.py | movermeyer/purplex |
import json
import os
import tempfile
import shutil
import importlib
from typing import Optional
import docker
from notebook.base.handlers import IPythonHandler, APIHandler, HTTPError
from notebook.utils import url_path_join
from pigar.core import parse_packages
from ..container.creator import ContainerCreator
from ... | [
{
"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 | disjotter/backend/handlers/environment_handler.py | WilcoKruijer/DisJotter |
import re
import os
from bsearch.plugins.base import Plugin
from bsearch.utils import base64decode
class UniqueCSP(Plugin):
CSP = 'Content-Security-Policy'
CSP_RE = re.compile('Content-Security-Policy: (.*?)\n')
NONCE_RE = re.compile("'nonce-(.*?)'")
TARGET = os.environ.get('TARGET', None)
def ... | [
{
"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 | bsearch/plugins/unique_csp.py | andresriancho/burp-proxy-search |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from ddf_library.ddf import DDF
from ddf_library.utils import generate_info
from pycompss.api.api import compss_barrier
from pycompss.api.task import task
import pandas as pd
import numpy as np
import time
@task(returns=2)
def generate_partition(size, col_feature, col... | [
{
"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/benchmark/aggregation/test.py | eubr-bigsea/Compss-Python |
import torch
from torch import nn
from pytti.Image.differentiable_image import DifferentiableImage
class EMAImage(DifferentiableImage):
"""
Base class for differentiable images with Exponential Moving Average filtering
Based on code by Katherine Crowson
"""
def __init__(self, width, height, tenso... | [
{
"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 | src/pytti/Image/ema_image.py | wizardhead/pytti-core |
from mod_pywebsocket import handshake
def web_socket_do_extra_handshake(request):
message = (b'HTTP/1.1 101 Switching Protocols\r\n'
b'Upgrade: websocket\r\n'
b'Connection: Upgrade\r\n'
b'Sec-WebSocket-Accept: XXXXthisiswrongXXXX\r\n'
b'\r\n')
reques... | [
{
"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 | third_party/blink/web_tests/http/tests/websocket/handshake-fail-by-wrong-accept-header_wsh.py | zealoussnow/chromium |
# Combination Sum
'''
Given an array of distinct integers candidates and a target integer target, return a list of all unique combinations of candidates where the chosen numbers sum to target. You may return the combinations in any order.
The same number may be chosen from candidates an unlimited number of times. Two... | [
{
"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 | October/Week1/Combination Sum.py | vinaykumar7686/Leetcode-August_Challenge |
class Workspace:
def __init__(self, name: str = None):
#PK
self.name = name
self.members = []
self.member_ids= []
self.roles = {} #{owners:[user1], administrators:[user5, user8], etc}
self.channels = []
#name
def getName(self):
return self.na... | [
{
"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 | src/models/workspace.py | Mtortolani/slack-backend |
# coding:utf-8
'''
python 3.5
mxnet 1.3.0
gluoncv 0.3.0
visdom 0.1.7
gluonbook 0.6.9
auther: helloholmes
'''
import mxnet as mx
import numpy as np
import os
import time
import pickle
from mxnet import gluon
from mxnet import init
from mxnet import nd
from mxnet import autograd
from mxnet.gluon import nn
class VGG16(nn... | [
{
"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 | dog_recognition/models/vgg.py | helloholmes/dog_detection_gluoncv |
from django.db.models.query import QuerySet
class TestQuerySet(QuerySet):
def field_one_true(self, queryset, user, request):
return queryset.filter(field_one=True)
def field_two_true(self, queryset, user, request):
return queryset.filter(field_two=True)
def field_three_true(self, querys... | [
{
"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 | CRUDFilters/tests/managers.py | timhaley94/django-crud-filters |
#!/usr/bin/env python3
import unittest
import subprocess
import tempfile
import requests
import os
TEST_ROOT = os.path.abspath(os.path.dirname(__file__))
class ServicesTest(unittest.TestCase):
@staticmethod
def _test_service(service_name: str, binary_path: str):
print(f'Testing {service_name}')
with open(bin... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
}... | 3 | tests/test.py | rojaster/mdec |
from pdb import set_trace as T
from nmmo import Task
from collections import namedtuple
class Tier:
REWARD_SCALE = 15
EASY = 4 / REWARD_SCALE
NORMAL = 6 / REWARD_SCALE
HARD = 11 / REWARD_SCALE
def player_kills(realm, player):
return player.history.playerKills
def equipmen... | [
{
"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 | tasks.py | zhm9484/baselines |
#!/usr/bin/env python3
import os
import sys
from trello import TrelloClient, ResourceUnavailable
def usage():
print("""Usage: list_trello_boards show
Shows ids and names of Trello boards that the user specified with
TRELLO_API_KEY, TRELLO_API_SECRET, TRELLO_TOKEN and TRELLO_TOKEN_SECRET
environment ... | [
{
"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 | list_trello_boards.py | cl0ne/trello-to-kanboard-migrate |
import discord
def embed_color(title, desc, color=None, **kwargs):
return discord.Embed(title=title, description=desc, color=color, **kwargs)
def embed_success(title=None, desc=None, **kwargs):
return embed_color(title, desc, color=0x2ABF4A, **kwargs)
def embed_info(title=None, desc=None, **kwargs):
ret... | [
{
"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 | ta_bot/utils/discord_embeds.py | ToxicPie/discord-ta-bot |
'''Copyright © 2015 Sunoru Sidw <s@sunoru.com>
MIT license
http://sunoru.mit-license.org/
'''
import sys
import os
import openpyxl
def qexit():
os.system('pause')
sys.exit()
def main():
if len(sys.argv) < 2 or not os.path.exists(sys.argv[1]):
print("输入文件错误", file=sys.stderr)
... | [
{
"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 | pokeusage/main.py | sunoru/pokeusage |
import logging
logger = logging.getLogger(__name__)
from mykrobe.species_data import DataDir
def describe(parser, args):
args = parser.parse_args()
ddir = DataDir(args.panels_dir)
print(f"Gathering data from {ddir.root_dir}")
ddir.print_panels_summary()
def update_metadata(parser, args):
args = 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 | src/mykrobe/cmds/panels.py | Zhicheng-Liu/mykrobe |
# 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.
import io
import os
import pkgutil
import unittest
from unittest import TestCase
import pandas as pd
from kats.consts import TimeSeriesData
fro... | [
{
"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 | kats/tests/models/test_lstm_model.py | mike-scott1/Kats |
from pytest_bdd import given, when, then
from model.group import Group
import random
@given('a group list')
def group_list(db):
return db.get_group_list()
@given('a group with <name>, <header> and <footer>')
def new_group(name, header, footer):
return Group(name=name, header=header, footer=footer)
@when ('I ... | [
{
"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 | bdd/group_steps.py | russa1995/python_training |
from django.contrib.contenttypes.fields import GenericForeignKey, GenericRelation
class ProxyGenericForeignKey(GenericForeignKey):
def __init__(self, *args, **kwargs):
kwargs['for_concrete_model'] = False
super(ProxyGenericForeignKey, self).__init__(*args, **kwargs)
class ProxyGenericRelation(Ge... | [
{
"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 | widgy/generic/__init__.py | isopets/django-widgy |
"""***********************************************************************
This file was created by Astraea, Inc., 2018 from an excerpt of the
original:
Copyright (c) 2013-2018 Commonwealth Computer Research, Inc.
All rights reserved. This program and the accompanying materials
are made available under ... | [
{
"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 | pyrasterframes/python/geomesa_pyspark/types.py | jdenisgiguere/rasterframes |
#!/usr/bin/env python3
# Copyright (c) 2016 The Bitcoin Core developers
# Copyright (c) 2017 The Ravencoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test using named arguments for RPCs."""
from test_framew... | [
{
"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 | test/functional/rpcnamedargs.py | randboy/BAYEMCOIN |
#
# SPDX-License-Identifier: MIT
#
from oeqa.runtime.case import OERuntimeTestCase
from oeqa.runtime.decorator.package import OEHasPackage
class GstreamerCliTest(OERuntimeTestCase):
@OEHasPackage(['gstreamer1.0'])
def test_gst_inspect_can_list_all_plugins(self):
status, output = self.target.run('gst-... | [
{
"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 | poky-dunfell/meta/lib/oeqa/runtime/cases/gstreamer.py | lacie-life/YoctoPi |
# Copyright 2016 Cisco Systems, 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 writin... | [
{
"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 | imcsdk/__init__.py | kenrusse/imcsdk |
# Copyright 2016 Google 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, ... | [
{
"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 | speech/unit_tests/test_connection.py | ammayathrajeshnair/googlecloudpython |
from marshmallow import Schema, fields, pre_load, post_dump
class UserSchema(Schema):
id = fields.Int()
title = fields.Str()
subtitle = fields.Str()
intro = fields.Str()
logo = fields.Str()
@pre_load
def make_user_data(self, data):
return data
@post_dump
def dump_user(self... | [
{
"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 | ports/blog/blog_schema.py | Jinxes/pipe |
# Copyright (c) 2017 Intel Corporation. All rights reserved.
# Use of this source code is governed by a MIT-style
# license that can be found in the LICENSE file.
class AlertCondition(object):
def __init__(self, *args, **kwargs):
self._id = kwargs.pop('id', None)
def id(self):
raise NotImplem... | [
{
"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 | chroma-manager/chroma_core/lib/storage_plugin/base_alert_condition.py | GarimaVishvakarma/intel-chroma |
# coding: utf-8
"""
Memsource REST API
Welcome to Memsource's API documentation. To view our legacy APIs please [visit our documentation](https://wiki.memsource.com/wiki/Memsource_API) and for more information about our new APIs, [visit our blog](https://www.memsource.com/blog/2017/10/24/introducing-rest-apis... | [
{
"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 | test/test_analyse_v2_dto.py | unofficial-memsource/memsource-cli-client |
# Copyright 2013-2019 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
import sys
class Pixman(AutotoolsPackage):
"""The Pixman package contains a library that provide... | [
{
"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 | var/spack/repos/builtin/packages/pixman/package.py | nkianggiss/spack |
from PIL import Image
import numpy as np
import colorsys
import os, sys
import argparse
import matplotlib.pyplot as plt
rgb_to_hsv = np.vectorize(colorsys.rgb_to_hsv)
hsv_to_rgb = np.vectorize(colorsys.hsv_to_rgb)
def crop(image, box=None):
if box:
imageBox = box
else:
imageBox = image.getbb... | [
{
"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 | scripts/rainbow.py | orrinjelo/AedanWallpaper |
import unittest
import os
import intel_extension_for_pytorch._C as core
def get_ipex_isa_env_setting():
env_isa = os.getenv('ATEN_CPU_CAPABILITY')
return env_isa
def get_currnet_isa_level():
return core._get_current_isa_level().lower()
class TestDynDisp(unittest.TestCase):
def test_env_setting(self... | [
{
"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/cpu/test_dyndisp.py | Manny27nyc/intel-extension-for-pytorch |
from mk2.plugins import Plugin
from mk2.events import Hook
class Save(Plugin):
warn_message = Plugin.Property(default="WARNING: saving map in {delay}.")
message = Plugin.Property(default="MAP IS SAVING.")
def setup(self):
self.register(self.save, Hook, public=True, name='save', doc='save... | [
{
"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 | mk2/plugins/save.py | mcdevs/mark2 |
import numpy as np
from kmeans import Kmeans
class ImageQuantizer:
def __init__(self, b):
self.b = b
def quantize(self, img):
b = self.b
C, R, D = img.shape
self.img = img
X = np.reshape(img, (C * R, D))
model = Kmeans(k=pow(2, b))
model.f... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer":... | 3 | quantize_image.py | micromoon1997/ImageProcessingDSL |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.