source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
import jdatetime
class Wodev:
def __init__(self, is_shamsi=True, first_week=None):
self.is_shamsi = is_shamsi
self.today = jdatetime.date.today()
if first_week:
self.first_week = first_week
else:
if is_shamsi:
self.first_week = jdatetime.date... | [
{
"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 | wodev/wodev.py | MohammadSalek/WOdEv |
import numpy as np
import matplotlib.pyplot as plt
def plot(base_name):
def get_hist(s):
return s["summary"][0]*s["diplo_hist"]
motif = np.load(base_name + "/limited_summits_alignments_motif_summary.npz")
nonmotif = np.load(base_name + "/limited_summits_alignments_nonmotif_summary.npz")
motif_... | [
{
"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 | graph_peak_caller/analysis/diploratio_v_motifrate.py | uio-bmi/graph_peak_caller |
"""empty message
Revision ID: 8bd5fd537d97
Revises: 492842fc3ad0
Create Date: 2020-03-26 16:11:46.839537
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '8bd5fd537d97'
down_revision = '492842fc3ad0'
branch_labels = None
depends_on = None
def upgrade():
# ... | [
{
"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/8bd5fd537d97_.py | danisaleem/Flask_App |
""" Tests `core.framework` """
import pytest
from sap.cf_logging.core.context import Context
from sap.cf_logging.core.request_reader import RequestReader
from sap.cf_logging.core.response_reader import ResponseReader
from sap.cf_logging.core.framework import Framework
# pylint: disable=abstract-method
CONTEXT = Conte... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
}... | 3 | tests/unit/core/test_framework.py | mhaas/cf-python-logging-support |
import requests
import time
from bs4 import BeautifulSoup
class crawl:
"""Keep track of time between scrape requests.
args:
wait: time between requests
retry_max: number of times to retry
"""
def __init__(self, wait, retry_max):
self.wait = wait
self.retry_max = retry_... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written... | 3 | manual_crawler.py | seanbreckenridge/MALUserVsAverage |
from datetime import datetime
def get_this_month():
month = datetime.now()
return month.strftime("%B")
def get_this_day():
day = datetime.today()
return day.day
def get_month_and_day():
return f"{get_this_month()}_{get_this_day()}" | [
{
"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 | scraper/utils.py | sixfwa/so-on-this-day-app |
# Copyright 2013 Red Hat, 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 agre... | [
{
"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 | nova/tests/cast_as_call.py | vmthunder/nova |
#-*- coding: utf-8 -*-
# Author: Matt Earnshaw <matt@earnshaw.org.uk>
from __future__ import absolute_import
import os
import sys
import sunpy
from PyQt4.QtGui import QApplication
from sunpy.gui.mainwindow import MainWindow
from sunpy.io import UnrecognizedFileTypeError
class Plotman(object):
""" Wraps a MainWin... | [
{
"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 | sunpy/gui/__init__.py | astrofrog/sunpy |
def DFT(graph, node, edge):
print(edge, end = ' ')
node.remove(edge)
for a in graph[edge]:
if a in node:
DFT(graph, node, a)
def BFT(graph, visited, edge):
if edge == []:
return ''
print(edge[0], end = ' ')
for a in graph[edge[0]]:
if a not in visited:
... | [
{
"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 | Datastruc/lab11/traverse.py | ppbasleng/CE-Classroom |
"""
Copyright [2021] [DenyS]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
dist... | [
{
"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_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
... | 3 | multibar/core/variants/lib_info.py | Animatea/DiscordProgressbar |
import sys
with open('input.txt', 'r') as reader:
earliest = int(reader.readline())
ids = [i for i in reader.readline().strip().split(',')]
def part1():
# depart = min((id * (earliest // id) + 1) for id in ids)
min = sys.maxsize * 2
for id in ids:
if id == 'x':
continue
... | [
{
"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 | 2020/aoc13/code.py | Quetute/AdventOfCode |
"""
Tests for list_util module
"""
# Import package, test suite, and other packages as needed
import sermacs_workshop as acs
import pytest
import sys
def test_title_case():
"""Sample test, will always pass so long as import statement worked"""
test_string = 'this IS a Test sTrinG'
title_string = acs.title... | [
{
"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 | sermacs_workshop/tests/test_list_util.py | whitneyjmorgan/SERMACS_is_really_cold |
import torch.nn as nn
class Generator(nn.Module):
def __init__(self, nc, ngf, nz):
super(Generator,self).__init__()
self.layer1 = nn.Sequential(nn.ConvTranspose2d(nz,ngf*32,kernel_size=4),
nn.BatchNorm2d(ngf*32),
nn.ReLU())
... | [
{
"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 | dcgan-generat images/model/Generator.py | OSUPCVLab/PlantDiseaseCNN |
import googletrans as gt
gt = gt.Translator()
class tr():
@staticmethod
def fr(text):
res = gt.translate(text, dest='fr')
return res.text
@staticmethod
def ar(text):
res = gt.translate(text, dest='ar')
return res.text
@staticmethod
def en(text):
res = gt.translate(text, d... | [
{
"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 | translator.py | yassirfariz/translator-in-kivy |
import torch
import numpy as np
from scipy.io import loadmat
from skimage.io import imread
def default_loader(path_):
return imread(path_)
def mat_loader(path_):
return loadmat(path_)
def make_onehot(index_map, n):
# Only deals with tensors with no batch dim
old_size = index_map.size()
z = torch... | [
{
"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/data/common.py | StarGazer1995/FCN-CD-PyTorch |
# MODELS contains a set of functions for minimisation to seismic spectra.
# It can be modified as appropriate.
import numpy as np
from . import config as cfg
MODS = ["BRUNE", "BOATWRIGHT"]
# UTIL FUNCS
def which_model(mod):
if mod in MODS:
if mod == "BRUNE":
return BRUNE_MODEL
if mod =... | [
{
"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 | specmod/Models.py | sgjholt/SpecMod |
from selenium import webdriver
from fixture.session import SessionHelper
from fixture.group import GroupHelper
from fixture.contact import ContactHelper
class Application:
def __init__(self, browser, base_url):
if browser == "firefox":
self.wd = webdriver.Firefox()
elif browser == "ch... | [
{
"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 | fixture/application.py | dmi-vor/python_training |
# coding=utf-8
# Author: Diego González Chávez
# email : diegogch@cbpf.br / diego.gonzalez.chavez@gmail.com
#
# Resistance Controller
#
# TODO:
# Make documentation
import time
import numpy
__all__ = ['ResistanceController']
class ResistanceController(object):
# Controllador de SourceMeter para medidas de resi... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer":... | 3 | controllers/resistance_controller.py | Vrekrer/magdynlab |
import frappe
import logging
import logging.config
import os
import json
from pprint import pformat
class ContextFilter(logging.Filter):
"""
This is a filter which injects request information (if available) into the log.
"""
def filter(self, record):
record.form_dict = pformat(getattr(frappe.local, 'form_dict',... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 lines?",
"answer": true
},
... | 3 | frappe/setup_logging.py | pawaranand/phr_frappe |
'''
Michael Lam
ASTP-720, Spring 2020
Set of functions to perform interpolation
Should only do linear interpolation for now
as we haven't discussed matrices yet, sorry
'''
def linear_interpolator(xs, ys):
"""
Linear interpolation of points (x, y)
Parameters
----------
xs : list, np.ndarray
... | [
{
"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 | HW1/interpolation.py | mtlam/ASTP-720_F2020 |
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
df = pd.read_csv("question-2-features.csv")
df2 = pd.read_csv("question-2-labels.csv")
x_train = df.to_numpy()
y_train = df2.to_numpy()
def add_bias(x):
if (len(x.shape)==1):
x=x[:,np.newaxis]
b=np.ones((x.shape[0],1))
x=np.c... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",... | 3 | q2/q2.py | gunkaynar/cs464_hw2 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from django.core.management import call_command
from sentry.models import Event, Group, GroupTagValue, TagValue, TagKey
from sentry.testutils import TestCase
ALL_MODELS = (Event, Group, GroupTagValue, TagValue, TagKey)
class SentryCleanupTest(TestCase... | [
{
"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/sentry/management/commands/test_cleanup.py | vperron/sentry |
# -*- coding: utf-8 -*-
from datetime import date
from dateutil.relativedelta import relativedelta
from lotus_core.utils import dbutil
def choose():
cursor = dbutil.get_connection().cursor()
trade_date = str(date.today() + relativedelta(days=-1))
stock_codes_on_pe = _choose_on_pe(cursor, trade_date)
... | [
{
"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 | lotus-crawler/lotus_core/stock/choice.py | nicee/xshirmp |
from django.db import models
class Mission(models.Model):
name = models.CharField(max_length=200)
start_date = models.DateTimeField('date discovered')
def __unicode__(self):
return self.name
class Planet(models.Model):
name = models.CharField(max_length=200)
discovery_date = models.DateT... | [
{
"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 | exoplanets/models.py | zemogle/astropony |
"""Every now and then I run into an issue where a derived union returns a
unioncache.
It looks like there is a unioncache packed in a unioncache.
What makes the issue even more weird is that the derived field is not even assigned on this type.
"""
import pytest
from gaphor import UML
from gaphor.application import ... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written... | 3 | tests/test_unioncache_in_derived_response.py | bertob/gaphor |
import time
import threading
import subprocess
import helpers
from settings import Settings
def listener():
global data_source
print("**** SIDE_THREAD ID == ", threading.get_ident())
while True:
return_data = subprocess.run([data_source.settings.loaded['localization_bin']], stdout=subprocess.PIPE)
... | [
{
"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 | virtual_filesystem/localization.py | joaovitor123jv/rontext |
# VMware vSphere Python SDK
# Copyright (c) 2008-2014 VMware, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# ... | [
{
"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 | pyVmomi/Version.py | virtdevninja/pyvmomi-ce |
# coding: utf-8
"""
ProcessMaker API
This ProcessMaker I/O API provides access to a BPMN 2.0 compliant workflow engine api that is designed to be used as a microservice to support enterprise cloud applications. The current Alpha 1.0 version supports most of the descriptive class of the BPMN 2.0 specification... | [
{
"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 | test/test_input_output.py | ProcessMaker/pmio-sdk-python |
# -*- coding: utf8 -*-fr
"""
ItopapiOSVersion is a abstraction of Rack representation on iTop
"""
from itopapi.model.prototype import ItopapiPrototype
__version__ = '1.0'
__authors__ = ['Julien Nauroy <julien.nauroy@u-psud.fr>']
class ItopapiOSVersion(ItopapiPrototype):
# Configuration specific to itop
it... | [
{
"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 | itopapi/model/osVersion.py | guillaume-philippon/python-itop-api |
"""Tests for the saddle-points exercise
Implementation note:
The saddle_points function must validate the input matrix and raise a
ValueError with a meaningful error message if the matrix turns out to be
irregular.
"""
import unittest
from pymath.saddle_points import saddle_points
class SaddlePointTest(unittest.Tes... | [
{
"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/pymath/test_saddle_points.py | JASTYN/pythonmaster |
from lib.common import helpers
import base64
class Module:
def __init__(self, mainMenu, params=[]):
self.info = {
'Name': 'ListDirectory',
'Author': ['@harmj0y'],
'Description': ('ls'),
'Background' : False,
'OutputExtension' : None,
... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cl... | 3 | lib/modules/dotnet/management/list_directory.py | tyraniter/Empire |
from django.db import models
class Feedback(models.Model):
name = models.CharField(max_length=30, blank=False)
email = models.EmailField()
message = models.TextField(max_length=1000, blank=False)
def __str__(self):
return '%s - %s' % (self.name, self.email)
class Project(models.Model):
... | [
{
"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 | wangwe/models.py | wwangwe/Portfolio |
import cPickle as pickle
def save_model(params, epoch = 0, annotation='', namestub = '', savepath = '../data/models/', test_score=0.0):
savedFileName = namestub + '_' + str(epoch) + '_pars_' + annotation +'.pkl'
gg = open(savepath + savedFileName, 'wb')
pickle.dump(params, gg, protocol=pickle.HIGHEST_PRO... | [
{
"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 | newmu/data_utils.py | laputian/dml |
# coding=utf-8
# Copyright 2021 The Uncertainty Baselines Authors.
#
# 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 ap... | [
{
"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 | baselines/diabetic_retinopathy_detection/experiments/dropout_tune_final.py | y0ast/uncertainty-baselines |
"""Test component helpers."""
# pylint: disable=protected-access
from collections import OrderedDict
from openpeerpower import helpers
def test_extract_domain_configs():
"""Test the extraction of domain configuration."""
config = {
"zone": None,
"zoner": None,
"zone ": None,
"... | [
{
"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 | tests/helpers/test_init.py | pcaston/core |
import unittest
from robotide.preferences.settings import SettingsMigrator
from robotide.utils import overrides
class SettingsMigrationTestCase(SettingsMigrator, unittest.TestCase):
def __init__(self, methodName='runTest'):
unittest.TestCase.__init__(self, methodName=methodName)
def setUp(self):
... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer":... | 3 | utest/preferences/test_settings.py | veryl-technologies/t24-tests-ide |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# filename: getSignature.py
#
# getSignature 函数演示
#
from util import MD5
def __get_signature(params, uid, sid, salt):
if not uid: # uid == 0 or ''
uid = sid = ''
return MD5("{paramsString}{salt}{uid}{sid}".format(
paramsString = "".join("".jo... | [
{
"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 | docs/code/Joyrun/getSignature.py | kkmumu/PKURunningHelper |
import requests
from requests.api import request
from .entities import Account
class AuthorizationException(Exception):
pass
class ForbiddenException(Exception):
pass
class MonzoClient:
BASE_URL = 'https://api.monzo.com'
def __init__(self, access_token):
self._auth_header = {'authorizat... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?... | 3 | monzopy/client.py | kevbradwick/monzopy |
# -*- coding: utf-8 -*-
# IFD.A-8 :: Версия: 1 :: Проверка ввода невалидного значения в поле "код IATA" для выбора аэропорта
# Шаг 1
def test_check_invalid_value_IATA_to_select_airport(app):
app.session.enter_login(username="test")
app.session.enter_password(password="1245")
app.airport.open_form_add_airpo... | [
{
"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 | test/test_check_invalid_value_IATA_code.py | Sergei-Soldatov/IFD.A |
from antlr4 import *
class PlSqlBaseParser(Parser):
_isVersion10 = False
_isVersion12 = True
def isVersion10(self):
return self._isVersion10
def isVersion12(self):
return self._isVersion12
def setVersion10(self, value):
self._isVersion10 = value
def setVersion12(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_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer":... | 3 | third_party/antlr_grammars_v4/sql/plsql/Python3/PlSqlBaseParser.py | mikhan808/rsyntaxtextarea-antlr4-extension |
'''
35. Search Insert Position
Given a sorted array and a target value, return the index if the target is found. If not,
return the index where it would be if it were inserted in order.
You may assume no duplicates in the array.
Example 1:
Input: [1,3,5,6], 5
Output: 2
Example 2:
Input: [1,3,5,6], 2
Output: 1
Ex... | [
{
"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 | DS-Career-Resources-master/leetcode/search_insert_position.py | anushka-DS/DS-Interview-Prep |
class Node:
def __init__(self,value):
self.value=value
self.next=None
def ntolastnode(head):
item=head
count=0
while item is not None:
item=item.next
count=count+1
p=head
for i in range(count-n):
p=p.next
return p
a=Node(1)
b=Node(2)
c=Node(3)
d=Node(4)
a.next=b
b.next=c
c.next=d
n = int(input('Enter ... | [
{
"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 | Link-Lists/python/ntolastnode.py | vinitraj10/Algorithms |
"""
Example demonstrating how to add DID with the role of Trust Anchor to ledger.
Uses seed to obtain Steward's DID which already exists on the ledger.
Then it generates new DID/Verkey pair for Trust Anchor.
Using Steward's DID, NYM transaction request is built to add Trust Anchor's DID and Verkey
on the ledger with th... | [
{
"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 | doc/how-tos/write-did-and-query-verkey/python/template.py | ssyijiu/indy-sdk |
# Copyright 2019 Huawei Technologies Co., Ltd
#
# 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... | [
{
"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 | tests/st/ops/ascend/vector/test_elemwise_mul_ad_001.py | tianjiashuo/akg |
"""
Using the csv module.
"""
import csv
def parse(csvfilename):
"""
Reads CSV file named csvfilename, parses
it's content and returns the data within
the file as a list of lists.
"""
table = []
with open(csvfilename, "r") as csvfile:
csvreader = csv.reader(csvfile,
... | [
{
"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 | PythonScripting/CSVFiles/examples3_csvmodule.py | Neo-sunny/pythonProgs |
#!/usr/bin/env python3
# Copyright (c) 2017-2018 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test wallet replace-by-fee capabilities in conjunction with the fallbackfee."""
from test_framework.tes... | [
{
"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 | test/functional/wallet_fallbackfee.py | danecoin/Danecoin |
# backend/server/apps/endpoints/serializers.py file
from rest_framework import serializers
from apps.endpoints.models import Endpoint
from apps.endpoints.models import MLAlgorithm
from apps.endpoints.models import MLAlgorithmStatus
from apps.endpoints.models import MLRequest
class EndpointSerializer(serializers.ModelS... | [
{
"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 | backend/server/apps/endpoints/serializers.py | netoferraz/tutorial_deploy_ml_service |
def remove_middle(a, b, c):
cross = (a[0] - b[0]) * (c[1] - b[1]) - (a[1] - b[1]) * (c[0] - b[0])
dot = (a[0] - b[0]) * (c[0] - b[0]) + (a[1] - b[1]) * (c[1] - b[1])
return cross < 0 or cross == 0 and dot <= 0
def convex_hull(points):
spoints = sorted(points)
hull = []
for p in spoints + spoin... | [
{
"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 | pyrival/geometry/convex_hull.py | MattJDavidson/aoc2021 |
class UserLogs(object):
def __init__(self,**kwargs):
if 'user' in kwargs:
self.user = kwargs['user']
if 'url' in kwargs:
self.url = kwargs['url']
if 'action' in kwargs:
self.action = kwargs['action']
if 'model_name' in kwargs:
self.mod... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": ... | 3 | managing/log_save.py | pincoin/iclover |
#!/usr/bin/python3
"""
__reference:
"""
from tkinter import *
import tabs
import guideInfoStrings as gis
import outputFunctions
import menubar
def updateVariableText(thisTab, returnString):
""" This function updates the label when called """
change = StringVar(thisTab)
change.set(returnString)
... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answ... | 3 | run.py | maysam-h/pdf-toolz |
"""Test for the appeaser strategy."""
import axelrod
from .test_player import TestPlayer
C, D = axelrod.Actions.C, axelrod.Actions.D
class TestAppeaser(TestPlayer):
name = "Appeaser"
player = axelrod.Appeaser
expected_classifier = {
'memory_depth': float('inf'), # Depends on internal memory.
... | [
{
"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 | axelrod/tests/unit/test_appeaser.py | lipingzhu/Zero-determinant |
# -*- coding: utf-8 -*-
"""
Utility functions for simplifying interactions with lenstronomy classes.
"""
from lenstronomy.ImSim.Numerics.numerics_subframe import NumericsSubFrame
class PSFHelper():
"""Class for simplifying interactions with the lenstronomy PSF class
when using 2d images generated outside lenstronom... | [
{
"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 | paltas/Utils/lenstronomy_utils.py | swagnercarena/paltas |
import logging
from croncierge import cmd_services
def log_cmd(cmd_response):
logging.info(f"Command response:\n{cmd_response}")
def test_cmd_stdout():
cmd = "python3 /home/maxim/projects/celecron/tests/test_croncierge/debug_cmd.py"
log_cmd(cmd_services.run_cmd(cmd))
def test_cmd_stderr():
cmd = "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": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer"... | 3 | tests/test_croncierge/test_cmd_services.py | mburdeev/croncierge |
from ..schema.nexusphp import VisitHR
from ..utils.net_utils import NetUtils
class MainClass(VisitHR):
URL = 'https://ccfbits.org/'
SUCCEED_REGEX = '欢迎回到CCFBits'
USER_CLASSES = {
'uploaded': [5497558138880],
'downloaded': [322122547200],
'share_ratio': [2],
'days': [224]
... | [
{
"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 | ptsites/sites/ccfbits.py | synthpop123/flexget_qbittorrent_mod |
# -*- coding: utf-8 -*-
def run():
number = int(raw_input('Ingresa un numero: '))
state = is_prime(number)
if state == True:
print('Es primo')
else:
print('No es primo')
def is_prime(number):
if number < 2:
return False
elif number == 2:
return True
elif numb... | [
{
"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 | primo.py | MrInternauta/Python-apuntes |
from typing import Optional
# Definition for a binary tree node.
class TreeNode:
def __init__(self, val=0, left=None, right=None):
self.val = val
self.left = left
self.right = right
class Solution:
# recursive solution
# Depth-first search going right, then left
def invertTre... | [
{
"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 | LeetCode/1-1000/201-300/226-250/226. Invert Binary Tree/solution-python.py | adubois85/coding_challenge_websites |
# coding: utf-8
"""
iEngage 2.0 API
This API enables Intelligent Engagement for your Business. iEngage is a platform that combines process, augmented intelligence and rewards to help you intelligently engage customers.
OpenAPI spec version: 2.0
Generated by: https://github.com/swagger-api/swagge... | [
{
"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 | test/test_verve_response_notification_list.py | iEngage/python-sdk |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer":... | 3 | aliyun-python-sdk-yundun/aliyunsdkyundun/request/v20150416/SetDdosAutoRequest.py | sdk-team/aliyun-openapi-python-sdk |
import enforce
from web3tools import web3util, web3wallet
@enforce.runtime_validation
class BToken:
def __init__(self, contract_address):
name = self.__class__.__name__
abi = web3util.abi(name)
web3 = web3util.get_web3()
self.contract = web3.eth.contract(contract_address, abi=abi)
... | [
{
"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": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excl... | 3 | web3engine/btoken.py | LinuxIsCool/tokenspice2 |
import tabulate
import matplotlib.pyplot as plt
import math
import numpy as np
Data=[]
data=[]
x_axis=[]
y_axis=[]
def falci(func,a,b,error_accept):
def f(x):
f = eval(func)
return f
error=b-a
if(f(a)*f(b)>=0 and a>=b):
print("wrong a,b")
return
x=a
n... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (e... | 3 | 1st_formula.py | Shakil-Mahmud-Programmer/Regular-Falsi-Method-or-False-Position-Method |
from options import Options
options = Options()
options.add_option('order', 2, 'Order n of linear program (aka number of equations)')
options.add_option('mu', 3.0, 'Determines `shape` of constraint region (Must be >= 3.0; Epsilon = 1/mu)')
options.add_option('pivot_type', 'largest_coefficient', 'Choice of pivot rule',... | [
{
"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 | exploits/linear_programming/simplex.py | drjerry/acsploit |
import pytest
import os
from airflow import DAG
from datetime import datetime, timedelta
from airflow.utils.dates import days_ago
from gusty import create_dag
# This module is intended to test the default behavior of gusty
# Given a directory of tasks without any metadata located in those directories
# A sort of base... | [
{
"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 | tests/test_ignore_subfolders.py | chriscardillo/gusty |
"""empty message
Revision ID: 0c18ff62b414
Revises: ad7d196d91e9
Create Date: 2021-07-12 14:07:02.060217
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '0c18ff62b414'
down_revision = 'ad7d196d91e9'
branch_labels = None
depends_on = None
def upgrade():
# ... | [
{
"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/0c18ff62b414_.py | CsarChvz/SkyTools |
import pygame
# TODO: make these configurable
c_UP = pygame.K_UP
c_DOWN = pygame.K_DOWN
c_LEFT = pygame.K_LEFT
c_RIGHT = pygame.K_RIGHT
c_PREV = pygame.K_LEFTBRACKET
c_NEXT = pygame.K_RIGHTBRACKET
c_START = pygame.K_RETURN
c_1 = pygame.K_1
c_2 = pygame.K_2
c_3 = pygame.K_3
c_4 = pygame.K_4
c_5 = pygame.K_5
c_6 = py... | [
{
"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 | ceControl.py | byackley/dodec |
# Copyright (C) 2017 Open Information Security Foundation
#
# You can copy, redistribute or modify this Program under the terms of
# the GNU General Public License version 2 as published by the Free
# Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; wi... | [
{
"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 | suricata-4.1.4/suricata-update/suricata/update/commands/removesource.py | runtest007/dpdk_surcata_4.1.1 |
from rq_scheduler.scheduler import Scheduler
import rq
from redis import Redis
import os
import sys
import init_log
import logging
def _run_scheduler():
with rq.Connection(Redis.from_url(os.environ.get("REDIS_URL") or "redis://")):
q = rq.Queue()
scheduler = Scheduler(queue=q)
scheduler.... | [
{
"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 | gtfs_converter/scheduler.py | etalab/gtfs_converter |
import requests
import jmespath
class Client:
opts = {
'data_url': 'https://data.opencrypto.io/data.json'
}
def __init__(self, options={}):
for key in options:
print(key)
self.opts[key] = options[key]
self.data = None
self.load()
def load(self):
if self.data is None:
pri... | [
{
"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 | ocd/client.py | opencrypto-io/data.py |
from typing import Dict, List, Optional
from yach.rpc.rpc_client import RpcClient
from yach.types.blockchain_format.sized_bytes import bytes32
class FarmerRpcClient(RpcClient):
"""
Client to Yach RPC, connects to a local farmer. Uses HTTP/JSON, and converts back from
JSON into native python objects befor... | [
{
"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 | yach/rpc/farmer_rpc_client.py | Yach-Network/yach-blockchain |
from flask import Flask, Blueprint, request, current_app
from flask_login import login_user
from notifications import Notifications, db
from user import User
import json, requests
from datetime import datetime
user_api = Blueprint('user_api', __name__)
@user_api.route("/signup", methods=["POST"])
def signup():
da... | [
{
"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 | app/FrontendMicroservice/service_calls/call_user_service.py | AdavisSnakes/GrocerySaaS |
# Copyright (c) 2017 Sony Corporation. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | [
{
"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 | python/src/nnabla/backward_function/sinc.py | sdonatti/nnabla |
#!/usr/bin/env python3
from abc import ABC, abstractmethod
class AgentBase(ABC):
def __init__(self):
""" Initialize agent.
Params
======
"""
pass
@abstractmethod
def select_action(self, state):
""" Given the state, select an action.
Params
... | [
{
"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 | drlnd/core/agents/base_agent.py | yycho0108/DRLND_Core |
import pytest
from django.contrib.auth.models import User
from social_django.models import UserSocialAuth
from .models import Reporter
@pytest.mark.django_db
def test_reporter_get_user_creates_user():
reporter = Reporter.objects.create(
external_id="auth0:auth0|60634083d767850069d0ee83",
name="Ba... | [
{
"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 | vaccinate/core/test_reporter_get_user.py | MoralCode/vial |
#!/usr/bin/env python
import rospy
from std_msgs.msg import String
def run_publisher():
pub1 = rospy.Publisher('/terrapin/velocity', String, queue_size=10)
pub2 = rospy.Publisher('/terrapin/messages', String, queue_size=10)
pub3 = rospy.Publisher('/terrapin/misc', String, queue_size=10)
rate ... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": fals... | 3 | src/terrapin/terrapin_tests/scripts/tests.py | gmanjames/terrapinpoint |
# String masquerading as ppm file (version P3)
import io
ppmfileout = io.StringIO('')
def writeppmp3(self, f):
self.writeppm(f, ppmformat='P3')
def writeppm(self, f, ppmformat='P6'):
assert ppmformat in ['P3', 'P6'], 'Format wrong'
magic = ppmformat + '\n'
comment = '# generated from Bitmap.writeppm\n... | [
{
"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 | Task/Bitmap-Write-a-PPM-file/Python/bitmap-write-a-ppm-file.py | mullikine/RosettaCodeData |
from typing import List
from adventofcode.util.helpers import solution_timer
from adventofcode.util.input_helpers import get_input_for_day
@solution_timer(2021, 1, 1)
def part_one(input_data: List[str]):
increasing_count = 0
for i in range(1, len(input_data)):
if int(input_data[i - 1]) < int(input_da... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"ans... | 3 | src/adventofcode/year_2021/day_01_2021.py | Frazzer951/Advent-Of-Code |
# -*- coding: utf-8 -*-
import pytest
from wemake_python_styleguide.violations.best_practices import (
BaseExceptionViolation,
)
from wemake_python_styleguide.visitors.ast.keywords import (
WrongExceptionTypeVisitor,
)
use_base_exception = """
try:
execute()
except BaseException:
raise
"""
use_excep... | [
{
"point_num": 1,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excl... | 3 | tests/test_visitors/test_ast/test_keywords/test_base_exception.py | bekemaydin/wemake-python-styleguide |
import unittest
from entigen.types import Type
class TestTypes(unittest.TestCase):
def test_basic(self) -> None:
t = Type.from_string("string")
self.assertEqual(t.name, "string")
self.assertEqual(t.children, None)
def test_composedl(self) -> None:
t = Type.from_string("list<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": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": tru... | 3 | tests/test_types.py | Stiivi/entigen |
# -*- coding: utf-8 -*-
"""
Created on Fri Jun 26 12:46:36 2020
This class defines t-Student distribution for ARMA-GARCH models
@author: Ian Khrashchevskyi
"""
from .distModel import DistModel
import numpy as np
import scipy.stats as stats
from scipy.special import gamma
class tStudent(DistModel):
... | [
{
"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 | armagarch/tStudent.py | iankhr/armagarch |
from django.contrib import admin
from django.db import models
from django.utils.html import format_html
from django.utils.translation import gettext_lazy as _
from .widgets import ZoomRangeWidget
from .models import Marker, MarkerGroup
class MarkerGroupAdmin(admin.ModelAdmin):
"""
Admin for creating collecti... | [
{
"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 | fluentcms_googlemaps/admin.py | edoburu/fluentcms-googlemaps |
from rlpython.utils.argument_parser import ReplArgumentParser
from rlpython.utils.table import write_table
class LonaConnectionsCommand:
"""
List all current connections to Lona
"""
NAME = 'lona_connections'
def __init__(self, repl):
self.repl = repl
def run(self, argv):
# p... | [
{
"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 | lona/shell/commands/lona_connections.py | korantu/lona |
"""
Created by Epic at 10/13/20
Original script by FireDiscordBot on GitHub
"""
import logging
from copy import copy
from logging import Logger, DEBUG
import sys
BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE = range(8)
RESET_SEQ = "\033[0m"
COLOR_SEQ = "\033[1;%dm"
BOLD_SEQ = "\033[1m"
def getcolor(color=N... | [
{
"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 | color_format.py | among-us-bot/aque-worker |
import numpy as np
from toolbox.sqDistance import *
from toolbox.oneOfK import *
class KnnModel():
def fit(self, X, y, K, C=None):
self.X = X
self.y = y
self.K = K
if C is not None:
self.C = C
else:
self.C = np.size(np.unique(y))
... | [
{
"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": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excl... | 3 | practice/toolbox/knn.py | colinzuo/MLAPP_Solution |
# -*- coding: utf-8 -*-
"""Language identification result model"""
class LanguageIdentificationResult:
def __init__(self, top_language, language_confidences):
"""
:param top_language: Language code of predicted language
:param language_confidences: List of all potential languages with thei... | [
{
"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/rev_ai/models/language_id/language_id_result.py | revdotcom/revai-python-package |
from django.db import models
from django.utils import timezone
from django.contrib.auth.models import User
from django.urls import reverse
class Post(models.Model):
title = models.CharField(max_length=100)
content = models.TextField()
date_posted = models.DateTimeField(default=timezone.now)
author = models.Forei... | [
{
"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 | django_project_base/blog/models.py | Sanketkgboy/Blog_app_repo |
from xml.dom import minidom
from django.utils.datastructures import MultiValueDict
from django import forms
from django.utils.html import format_html, mark_safe
from django.forms.utils import flatatt
class SelectMultipleSVG(forms.SelectMultiple):
class Media:
js = ('django_svgselect.js',)
def __init_... | [
{
"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 | django_svgselect/forms.py | jmickela/django_svgselect |
from django.test import TestCase
from django.contrib.auth import get_user_model, authenticate
class UsersManagersTests(TestCase):
def test_create_user(self):
User = get_user_model()
user = User.objects.create_user(username='normal_user', password='foo')
self.assertEqual(user.username, 'nor... | [
{
"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 | users/tests.py | bolanebyla/Django-template |
import torch
from torch import nn
from torch.nn import functional as F
from torch.nn.parameter import Parameter
AdaptiveAvgPool2d = nn.AdaptiveAvgPool2d
class AdaptiveConcatPool2d(nn.Module):
def __init__(self, sz=None):
super().__init__()
sz = sz or (1, 1)
self.ap = nn.AdaptiveAvgPool2d(... | [
{
"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 | src/kvt/models/layers/pooling.py | Ynakatsuka/birdclef-2021 |
from django.db import models
class Place(models.Model):
title = models.CharField(max_length=150, verbose_name='Наименование')
description_short = models.TextField(blank=True, verbose_name='Краткое описание')
description_long = models.TextField(blank=True, verbose_name='Полное описание')
lng = models.D... | [
{
"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 | where_to_go/places/models.py | MZen2610/Yandex-poster |
from robot_control import Robot
from game_interfaces.msg import PlayerCommand
class NullController(Robot):
def __init__(self):
pass
def get_action(self, my_pos_efcs, ball_pos_efcs, team_positions_wcs=None, opponents_positions_wcs=None):
l_rpm = 0
r_rpm = 0
action = 0
r... | [
{
"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 | robocup_ws/src/Planner/src/stay_in_place_controller.py | OmarJabri7/RoboCupChallenge |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
class MybankCreditCreditriskDsddAdmitConsultModel(object):
def __init__(self):
self._smid = None
@property
def smid(self):
return self._smid
@smid.setter
def smid(self... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": ... | 3 | alipay/aop/api/domain/MybankCreditCreditriskDsddAdmitConsultModel.py | antopen/alipay-sdk-python-all |
# -*- coding: utf-8 -*-
# Copyright: (c) 2019, Dag Wieers (@dagwieers) <dag@wieers.com>
# GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# pylint: disable=invalid-name,missing-docstring
from __future__ import absolute_import, division, print_function, unicode_literals
import... | [
{
"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 | test/test_api.py | frodo19/script.module.inputstreamhelper |
import pandas as pd
from Event import Event
from Team import Team
from Constant import Constant
import numpy as np
class Game:
"""A class for keeping info about the games"""
def __init__(self, path_to_json):
# self.events = None
self.home_team = None
self.guest_team = None
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 | datasets/nba/Game.py | MediaBrain-SJTU/GroupNet |
import logging
import pandas as pd
from stock.models import MyStock
from stock.models import ValuationRatio
from yahooquery import Ticker
logger = logging.getLogger("stock")
class MyValuationRatio:
def __init__(self, symbol):
self.stock = MyStock.objects.get(symbol=symbol)
def get(self):
s... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true... | 3 | backend/stock/workers/get_valuation_ratio.py | fengxia41103/stock |
import unittest
from app.models import Source, Article
class SourceArticleTest(unittest.TestCase):
'''
Test Class to test the behaviour of the Source class
'''
def setUp(self):
'''
Set up method that will run before every Test
'''
self.new_source = Source('abc-news',... | [
{
"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 | test/source_article_test.py | waruiian21/Ipwk3 |
from typing import List
from functools import partial
import torch
from .core import DecoderSpec
from ..blocks.core import _get_block
from ..blocks.psp import PSPBlock
from ..abn import ABN
class PSPDecoder(DecoderSpec):
def __init__(
self,
in_channels: List[int],
in_strides: List[int],
... | [
{
"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 | catalyst/contrib/models/segmentation/decoder/psp.py | sergeyshilin/catalyst |
"""Common configure functions for lldp"""
# Python
import logging
log = logging.getLogger(__name__)
def configure_lldp(device):
""" Enables lldp on target device
Args:
device ('obj'): Device object
Returns:
None
"""
device.configure(['lldp'])
def u... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 lines?",
"answer": false
},... | 3 | pkgs/sdk-pkg/src/genie/libs/sdk/apis/iosxr/lldp/configure.py | jbronikowski/genielibs |
"""
Read in a library with a version number of 0.0.0, make sure we produce a good version.
"""
import lldb
from lldbsuite.test import decorators
import lldbsuite.test.lldbutil as lldbutil
from lldbsuite.test.lldbtest import *
class TestGetVersionForZero(TestBase):
mydir = TestBase.compute_mydir(__file__)
... | [
{
"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 | lldb/packages/Python/lldbsuite/test/macosx/version_zero/TestGetVersionZeroVersion.py | medismailben/llvm-project |
"""Test illud.outputs.standard_output."""
import sys
from typing import Any
from unittest.mock import MagicMock, patch
import pytest
from illud.output import Output
from illud.outputs.standard_output import StandardOutput
def test_inheritance() -> None:
"""Test illud.outputs.standard_output.StandardOutput inher... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written... | 3 | tests/outputs/test_standard_output.py | AustinScola/illud |
import torch
from syft.generic import object_storage
def test_clear_objects():
obj_storage = object_storage.ObjectStorage()
x = torch.tensor(1)
obj_storage.set_obj(x)
objs = obj_storage.current_objects()
assert len(objs) == 1
assert objs[x.id] == x
ret_val = obj_storage.clear_objects(... | [
{
"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 | test/generic/test_object_storage.py | linamnt/PySyft |
import os
from glob import glob
from pathlib import Path
import torch
_root_dir = os.path.dirname(os.path.abspath(__file__))
ROOT_PATH = Path(_root_dir).parent.parent
def mkdir_ifnotexists(directory):
if not os.path.exists(directory):
os.mkdir(directory)
def get_class(kls):
parts = kls.split('.')
... | [
{
"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 | code/utils/general.py | jamesrosstwo/idr-dif |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.