source
string
points
list
n_points
int64
path
string
repo
string
# TF code scaffolding for building simple models. # 为模型训练和评估定义一个通用的代码框架 import tensorflow as tf # 初始化变量和模型参数,定义训练闭环中的运算 # initialize variables/model parameters # define the training loop operations def inference(X): # compute inference model over data X and return the result # 计算推断模型在数据X上的输出,并将结果返回 return...
[ { "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
chapters/04_machine_learning_basics/generic.py
Asurada2015/TF-_for_MI
""" From http://stackoverflow.com/a/13504757 """ from scipy.interpolate import interp1d from scipy.interpolate._fitpack import _bspleval import numpy as np class fast_interpolation: def __init__(self, x, y, axis=-1): assert len(x) == y.shape[axis] self.x = x self.y = y self.axis =...
[ { "point_num": 1, "id": "every_function_has_docstring", "question": "Does every function in this file have a docstring?", "answer": false }, { "point_num": 2, "id": "no_function_exceeds_5_params", "question": "Does every function in this file take 5 or fewer parameters (excluding sel...
3
bem/fast_interpolation.py
ricklupton/py-bem
from django.db import models from django.utils import timezone from django.db.models import Sum #from cycle_2018.models import ScheduleA import datetime class BaseModel(models.Model): active = models.BooleanField(default=True) created = models.DateTimeField(default=timezone.now) updated = models.DateTimeF...
[ { "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_under_20_lines", "question": "Is every function in this file shorter than 20 lines?", "answer": true...
3
donor/models.py
curtmerrill/cnn-fec
from flask import current_app, Response from flask_login import LoginManager from models import User from . import basic_auth from . import token_auth login_manager = LoginManager() @login_manager.request_loader def load_user_from_auth_header(req) -> User: """Try via both http basic check and token auth to get ...
[ { "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
large_app/python/api/auth/__init__.py
sahilGupta89/large_flask_app
from selenium import webdriver from selenium.webdriver.common.keys import Keys import time # pip install selenium==2.53.6 """ if you wanna run it on your regular browser profile. profile = webdriver.FirefoxProfile('/home/{your_username}/.mozilla/firefox/{your_default_profile}') driver = webdriver.Fire...
[ { "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
app.py
abdu1aziz/10-Fast-Fingers
import socket import threading class UDPClient: def __init__(self, IPAddress, port): self.IPAddress = IPAddress self.port = port self.buffer_size = 2048 self.client = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) self.last_package = None def connect(self): t...
[ { "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
UDPClient.py
fsikansi/simple-dash-pcars
#!/usr/bin/env python3 # Copyright (c) 2017-present, Facebook, Inc. # All rights reserved. # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. An additional grant # of patent rights can be found in the PATENTS file in the same directory. imp...
[ { "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
parlai/tasks/insuranceqa/agents.py
markr-fu-berlin/ParlAI
# -*- coding: utf-8 -*- from scrapy import Spider, Request from ..items import Article from ..items import Lien class MyScraper(Spider): name = u'myscraper' def start_requests(self): urlToVisit = {} Request( url='http://www.google.fr/', callback=self.parse, ...
[ { "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
myscraper/spiders/myscraper.py
melki/scrapeSlate
from sujson.Csv2json import Csv2json import unittest import filecmp class ConvertCsvToJson(unittest.TestCase): def setUp(self): self.csv_to_json = Csv2json() def test_conversion(self): self.csv_to_json.load("files/Netflix.csv", delimiter=";") self.csv_to_json.convert("files/Netflix_jte...
[ { "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_tidy_csv_to_sureal_json.py
PotasnikM/translator-to-suJSON
from typing import Dict, Union from types import ModuleType from importlib import util as ImportUtil # noqa from importlib import import_module from os.path import sep class Import: _dyn_imported_cache: Dict[str, ModuleType] = {} @staticmethod def from_(module_path: str, bypass_cache: bool = False) -> U...
[ { "point_num": 1, "id": "has_multiple_inheritance", "question": "Does any class in this file use multiple inheritance?", "answer": false }, { "point_num": 2, "id": "all_params_annotated", "question": "Does every function parameter in this file have a type annotation (excluding self/c...
3
Python/empire/imports/imports.py
Tombmyst/Empire
from __future__ import absolute_import import argparse import json import sys from ._reflect import namedAny from .validators import validator_for def _namedAnyWithDefault(name): if "." not in name: name = "jsonschema." + name return namedAny(name) def _json_file(path): with open(path) as file:...
[ { "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
avalon/vendor/jsonschema/cli.py
bumpybox/core
import numpy as np import torch import os import random class EarlyStopMonitor(object): def __init__(self, max_round=3, higher_better=True, tolerance=1e-3): self.max_round = max_round self.num_round = 0 self.epoch_count = 0 self.best_epoch = 0 self.last_best = None ...
[ { "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
models/CAW/utils.py
HSE-DynGraph-Research-team/DynGraphModelling
from unittest import TestCase, skipIf class TestAll(TestCase): def test_passing(self): pass def test_erroring(self): raise Exception("Ima broke") def test_failing(self): self.assertEquals(2 + 2 * 2, 8) @skipIf(2 > 1, "Skip everytime") def test_skipped(self): pass...
[ { "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/resources/functional/test_all.py
IamSaurabh1/taurus
import numpy as np import pandas as pd from time import sleep from airbnb_pricer.utils.async_run import async_run mile_per_degree__latitude = 111.32 * 0.621371 mile_per_degree__longitude = 84.35 * 0.621371 def get_dist_to_clusters(location_data, cluster_data): location_data = location_data.copy() cluster_dat...
[ { "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
X_airbnb_revisited/airbnb_pricer/utils/get_dist_to_clusters.py
djsegal/metis
from system.core.model import Model from flask import jsonify class Lead(Model): def __init__(self): super(Lead, self).__init__() def get_leads(self, name, early, late, page, sort, order): query = 'SELECT * FROM leads' data = {} prev = False if name != '': query += ' WHERE CONCAT(first_name, " ", last...
[ { "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
Project Files/app/models/Lead.py
s3llsw0rd/demo_ajax_db_search
# -*- coding: utf-8 -*- def test_calls_add(slack_time): assert slack_time.calls.add def test_calls_end(slack_time): assert slack_time.calls.end def test_calls_info(slack_time): assert slack_time.calls.info def test_calls_update(slack_time): assert slack_time.calls.update def test_calls_partici...
[ { "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
tests/test_methods/test_calls.py
jackwardell/SlackTime
import sqlite3 from .db import DB class CounsellingInfoTable(DB): def __init__(self): self.table_name = 'WB_counselling' self.table_desc = 'West Bengal ambulance and tele-counselling information' self.cols = self.getcolumns() def getcolumns(self): cols = { '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
data_extractor/db/WB_tables/WB_counselling.py
sushovande/covid19-india-data
from geographiclib.geodesic import Geodesic from pyproj import CRS, Transformer from .geometry import Vector, Line def azimuth(p1: Vector, p2: Vector): """:return: azimuth of geodesic through p1 and p2 in p1 with WGS84""" res = Geodesic.WGS84.Inverse(p1.y, p1.x, p2.y, p2.x) return res['azi1'] def dist...
[ { "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
linesman/geo.py
burrscurr/linesman
def get_days(hours,minutes,seconds): minutes=float(minutes)+float(seconds)/60 hours=float(hours)+float(minutes)/60 days=float(hours)/24 return float(days); def convert_to_days(): hours=input("Enter number of hours: ") minutes=input("Enter numberof minutes: ") seconds=input("Enter number of ...
[ { "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
C-Programming/4 week/7-1.py
Kormap/Side-Projects
# A time delay class for the micropython board. Based on the scheduler class. 24th Aug 2014 # Author: Peter Hinch # V1.0 25th Aug 2014 # Used by Pushbutton library. # This class implements the software equivalent of a retriggerable monostable. When first instantiated # a delay object does nothing until it trigger metho...
[ { "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/delay.py
danicampora/Micropython-scheduler
#!/usr/bin/env python """ Author: Robin Ankele <robin.ankele@cs.ox.ac.uk> http://users.ox.ac.uk/~kell4062 Copyright (c) 2017, University of Oxford All rights reserved. """ from gameBasic import G class G_PS(G): def __init__(self): G.__init__(self) def __finialize__(self): G.__finia...
[ { "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
gamePS.py
robinankele/privacy-games
# WordFilter.py # # Strip, Tokenize, Lemmatize, Remove non-alphabetical phrases # and performs dictionary checks on input and returns an array of strings from nltk.tokenize import word_tokenize from nltk.stem import SnowballStemmer from nltk.corpus import stopwords from enchant import Dict import sys reload(sys) sys....
[ { "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
EmotionDetection/WordFilter.py
emotion-detection-analysis/Emotion-detection
import torch from torch.optim import Optimizer class OptimWrapper(Optimizer): # Mixin class that defines convenient functions for writing Optimizer Wrappers def __init__(self, optim): self.optim = optim def __getstate__(self): return self.optim.__getstate__() def __sets...
[ { "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
torchlars/wrapper.py
aknckaan/scrl
# coding:utf-8 import datetime import random import unittest import click import bench_genetic # @click.command() # @click.option('--lens', help='Length of PassWord.') class GuessPasswordTests(unittest.TestCase): gene_set = " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!." def guess_hello(self):...
[ { "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
Genetic-Tutorial/guess_password/bench_guess_test.py
hscspring/AI-Methods
from unittest import TestCase from tests import get_data from pytezos.michelson.contract import ContractStorage class BigMapCodingTestopBU9Y(TestCase): def setUp(self): self.maxDiff = None def test_big_map_opBU9Y(self): section = get_data( path='big_map_diff/opBU9Yy4UJpXYSip...
[ { "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
tests/big_map_diff/opBU9Yy4UJpXYSipcDMAWGot2Rb9KoLxCQ4KQTZJPRrTfU2SU99/test_big_map_opBU9Y.py
juztin/pytezos-1
"""Sun2 Helpers.""" from datetime import timedelta from homeassistant.const import EVENT_CORE_CONFIG_UPDATE from homeassistant.core import callback from homeassistant.helpers.dispatcher import dispatcher_send from homeassistant.helpers.sun import get_astral_location SIG_LOC_UPDATED = 'sun2_loc_updated' _LOC = 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": "no_function_exceeds_5_params", "question": "Does every function in this file take 5 or fewer parameters (excluding sel...
3
config/custom_components/sun2/helpers.py
nagubal/home-assistant-config
#!/usr/bin/env python # -*- coding: utf-8 -*- import tornado.gen import bcrypt __all__ = ["create_new_user"] @tornado.gen.coroutine def get_next_id(db, collection): counter = yield db.counters.find_and_modify( {"_id": "{}id".format(collection)}, {"$inc": {"seq": 1}}, new=True, ) ...
[ { "point_num": 1, "id": "every_function_under_20_lines", "question": "Is every function in this file shorter than 20 lines?", "answer": true }, { "point_num": 2, "id": "no_function_exceeds_5_params", "question": "Does every function in this file take 5 or fewer parameters (excluding ...
3
trebol/interface.py
ilkerkesen/trebol
# Copyright (c) Jeremías Casteglione <jrmsdev@gmail.com> # See LICENSE file. from os import path from pytest import raises from _sadm.errors import EnvError, ServiceError from _sadm.plugin import service def test_defaults(testing_env): env = testing_env(name = 'service', profile = 'plugin') assert env.name() == 's...
[ { "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
t/plugin/plugin_900service_test.py
jrmsdev/pysadm
def retorno(): resp=input('Deseja executar o programa novamente?[s/n] ') if(resp=='S' or resp=='s'): verificar() else: print('Processo finalizado com sucesso!') pass def cabecalho(titulo): print('-'*30) print(f'{titulo:^30}') print('-'*30) pass def mensagem_er...
[ { "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": "any_function_over_40_lines", "question": "Is any function in this file longer than 40 lines?", "answer": t...
3
maior_menor_lista.py
eduardobaltazarmarfim/PythonC
import datetime import pandas as pd import pytz from pandas_market_calendars.exchange_calendar_hkex import HKEXExchangeCalendar def test_time_zone(): assert HKEXExchangeCalendar().tz == pytz.timezone('Asia/Shanghai') assert HKEXExchangeCalendar().name == 'HKEX' def test_2018_holidays(): hkex = HKEXExc...
[ { "point_num": 1, "id": "has_nested_function_def", "question": "Does this file contain any function defined inside another function?", "answer": false }, { "point_num": 2, "id": "every_function_under_20_lines", "question": "Is every function in this file shorter than 20 lines?", ...
3
tests/test_hkex_calendar.py
rakesh1988/pandas_market_calendars
from tensorflow.keras.callbacks import LambdaCallback from tensorflow.keras.models import Sequential from tensorflow.keras.layers import Dense, Activation, LSTM from tensorflow.keras.layers import Dropout, TimeDistributed try: from tensorflow.python.keras.layers import CuDNNLSTM as lstm except: from tensorflow....
[ { "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
model.py
Wowol/Piano-Bot
try: from userbot.modules.sql_helper import SESSION, BASE except ImportError: raise AttributeError from sqlalchemy import BigInteger, Column, Numeric, String, UnicodeText class Welcome(BASE): __tablename__ = "welcome" chat_id = Column(String(14), primary_key=True) previous_welcome = Column(BigInt...
[ { "point_num": 1, "id": "all_function_names_snake_case", "question": "Are all function names in this file written in snake_case?", "answer": true }, { "point_num": 2, "id": "has_multiple_inheritance", "question": "Does any class in this file use multiple inheritance?", "answer": ...
3
userbot/modules/sql_helper/welcome_sql.py
Thegreatfoxxgoddess/RemixGeng
import os import torch import colossalai def ensure_divisibility(numerator, denominator): """Ensure that numerator is divisible by the denominator.""" assert numerator % denominator == 0, '{} is not divisible by {}'.format(numerator, denominator) def set_missing_distributed_environ(key, value): if key ...
[ { "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
fastfold/distributed/core.py
hpcaitech/FastFold
# This program uses a pie chart to display the percentages of the overall grade represented by a project's, # quizzes, the midterm exam, and the final exam, 20 percent of the grade and its value is displayed in red, # quizzes are 10 percent and are displayed in blue, the midterm exam is 30 percent and is displayed ...
[ { "point_num": 1, "id": "all_params_annotated", "question": "Does every function parameter in this file have a type annotation (excluding self/cls)?", "answer": false }, { "point_num": 2, "id": "more_functions_than_classes", "question": "Does this file define more functions than clas...
3
chpt9/piechart.py
GDG-Buea/learn-python
# scaleGenerator.py # Scales are in terms of times per cycle (period) rather # than pitch. # import math SCALE = ['C', 'Cx', 'D', 'Dx', 'E', 'F', 'Fx', 'G', 'Gx', 'A', 'Ax', 'B'] def calculateOctave(baseLength): periods = [baseLength / math.exp(x*math.log(2)/12) for x in range(0, 12)] periods = [int(rou...
[ { "point_num": 1, "id": "all_function_names_snake_case", "question": "Are all function names in this file written in snake_case?", "answer": false }, { "point_num": 2, "id": "all_params_annotated", "question": "Does every function parameter in this file have a type annotation (exclud...
3
Chapter05_Serial-IO/serialOrgan/scaleGenerator.py
ONEV2/AVR-Programming
import tensorflow as tf def merge_summaries(sd, id): summaries = [] for key in sd.keys(): summaries.append(tf.summary.scalar(key, sd[key])) for key in id.keys(): summaries.append(tf.summary.image(key, id[key])) return tf.summary.merge(summaries) def pack_images(images, rows, cols): ...
[ { "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
rns/util.py
matwilso/relation-networks
import pytest from thefeck.rules.python_execute import match, get_new_command from thefeck.types import Command @pytest.mark.parametrize('command', [ Command('python bar', ''), Command('python bar', '')]) def test_match(command): assert match(command) @pytest.mark.parametrize('command, new_command', [ ...
[ { "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
tests/rules/test_python_execute.py
eoinjordan/thefeck
#!/usr/bin/env python # -*- coding: utf-8 -*- import MySQLdb _connectedDb = None _dbCursor = None def ConnectToDb(self, userID, userPassword): if self._connectedDb is not None: DisconnectDb(self) self._connectedDb = MySQLdb.connect(host="localhost", user = userID, passwd=userPassword) self._dbCursor = self._co...
[ { "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
php/python/DatabaseManager.py
the16bitgamer/YourflixMkII
import logging from pylons.controllers.util import abort, redirect_to from kwmo.lib.strings import message_codes_map from kwmo.lib.base import BaseController, render from kwmo.lib.uimessage import ui_warn log = logging.getLogger(__name__) class MessageController(BaseController): # Show generic message and/or er...
[ { "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
web/kwmo/kwmo/controllers/message.py
tmbx/kas
from unittest import TestCase from capstoneproject.content_rating.algorithm.content_rating import isalphanum from capstoneproject.content_rating.algorithm.content_rating import ContentRatingAlgorithm from django.contrib.auth.models import AnonymousUser, User from django.test import RequestFactory class TestIsalphanum(...
[ { "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
capstoneproject/tests/test_rating/test_content_rating.py
athrun22/content-rating
import math import nltk import pyphen import regex from collections import Counter from nltk import SnowballStemmer from zeeguu.model import Language AVERAGE_SYLLABLE_LENGTH = 2.5 """ Collection of simple text processing functions """ def split_words_from_text(text): words = regex.findall(r'(\b\p{L}+\b)', ...
[ { "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
zeeguu/util/text.py
alinbalutoiu/Zeeguu-Core
from hashtable.linked_list import * class HashTable : def __init__(self, size = 1024): self.size = size self._buckets = [None] *self.size def hash(self,key:str)->int: ''' hash will hashed the key means convert the key string into a value of int parameters: key: a string Argumen...
[ { "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
python/hashtable/hashtable/hash_table.py
RoaaMustafa/data-structures-and-algorithms
from bite_003 import load_words, calc_word_value, max_word_value words = load_words() def test_load_words(): assert len(words) == 235886 assert words[0] == 'A' assert words[-1] == 'Zyzzogeton' assert ' ' not in ''.join(words) def test_calc_word_value(): assert calc_word_value('bob'...
[ { "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
days/day021/bite_003_Word_Values/test_bite_003.py
alex-vegan/100daysofcode-with-python-course
from __future__ import division from leapp.libraries.actor.library import (MIN_AVAIL_BYTES_FOR_BOOT, check_avail_space_on_boot, inhibit_upgrade) from leapp import reporting from leapp.libraries.common.testutils import create_report_m...
[ { "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
repos/system_upgrade/el7toel8/actors/checkbootavailspace/tests/unit_test.py
panovotn/leapp-repository
# -*- coding: utf-8 -*- import random import itertools from collections import defaultdict class Chat(object): cache_size = 200 # user_num = list(range(1, 100)) # random.shuffle(user_num) colors = ['赤', '青', '黄', '緑', '紫', '黒', '茶', '灰色', '金', '銀'] fruits = ['りんご', 'みかん', 'メロン', 'パイナップル', 'ぶどう', ...
[ { "point_num": 1, "id": "no_function_exceeds_5_params", "question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?", "answer": true }, { "point_num": 2, "id": "has_multiple_inheritance", "question": "Does any class in this file use multiple inherit...
3
handlers/brainstorming/chat.py
tech-sketch/Brain_Hacker
"""This module will contain fixtures to test graph.py.""" import pytest from ..depth_first import Graph @pytest.fixture() def graph_empty(): g = Graph() return g @pytest.fixture() def graph_one(): g = Graph() g.gdict = { 'A': {'B': 10}, 'B': {'A': 5, 'D': 15, 'C': 20}, 'C': ...
[ { "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
data_structures/depth_first/tests/conftest.py
joyliao07/data_structures_and_algorithms
"""Common classes and functions for Zoom.""" from datetime import timedelta from logging import getLogger from typing import Any, Dict import async_timeout from homeassistant.core import HomeAssistant from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed from custom_components.niceh...
[ { "point_num": 1, "id": "has_multiple_inheritance", "question": "Does any class in this file use multiple inheritance?", "answer": false }, { "point_num": 2, "id": "all_return_types_annotated", "question": "Does every function in this file have a return type annotation?", "answer...
3
custom_components/nicehash/common.py
ivanpavlina/ha_nicehash
from typing import Optional, Tuple import cv2 import numpy as np from pyk4a import ImageFormat def convert_to_bgra_if_required(color_format: ImageFormat, color_image): # examples for all possible pyk4a.ColorFormats if color_format == ImageFormat.COLOR_MJPG: color_image = cv2.imdecode(color_image, cv...
[ { "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
example/helpers.py
animuku/pyk4a
"""An Abstract Base Class for Managers """ import abc from py2c.utils import verify_attribute __all__ = ["Manager"] class Manager(object, metaclass=abc.ABCMeta): """Base class of all managers """ def __init__(self): super().__init__() verify_attribute(self, "options", dict) @abc.a...
[ { "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
py2c/abc/manager.py
timgates42/Py2C
# -*- coding: utf-8 -*- # Copyright (c) 2021, ifitwala and contributors # For license information, please see license.txt from __future__ import unicode_literals import frappe from frappe import _ from frappe.utils import flt from frappe.model.document import Document from ifitwala_ed.controllers.accounts_controller 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": "all_params_annotated", "question": "Does every function parameter in this file have a type annotation (excludi...
3
ifitwala_ed/accounting/doctype/sales_taxes_and_charges_template/sales_taxes_and_charges_template.py
nbhatti/ifitwala_ed
#Shape of capital Q: def for_Q(): """printing capital 'Q' using for loop""" for row in range(6): for col in range(7): if col%5==0 and row%5!=0 or row in(0,5) and col not in(0,5,6) or row==3 and col==4 or row==5 and col==6: print("*",end=" ") else: ...
[ { "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
ALPHABETS/CAPITAL_ALPHABETS/Q.py
charansaim1819/Python_Patterns
# File: S (Python 2.4) from direct.gui.DirectGui import * from pandac.PandaModules import * from pirates.piratesgui import PiratesGuiGlobals from pirates.piratesgui import InventoryItemList from pirates.piratesgui import ShipItemGUI from pirates.piratesbase import PiratesGlobals class ShipItemList(InventoryItemList.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": "all_params_annotated", "question": "Does every function parameter in this file have a type annotation (excluding se...
3
pirates/piratesgui/ShipItemList.py
ksmit799/POTCO-PS
#!/usr/bin/env python # # Copyright (c) 2014, Yelp, Inc. # class HTTPError(IOError): """Initialize HTTPError with 'response' and 'request' object """ def __init__(self, *args, **kwargs): response = kwargs.pop('response', None) self.response = response # populate request either fro...
[ { "point_num": 1, "id": "every_class_has_docstring", "question": "Does every class in this file have a docstring?", "answer": true }, { "point_num": 2, "id": "has_multiple_inheritance", "question": "Does any class in this file use multiple inheritance?", "answer": false }, { ...
3
swaggerpy/exception.py
bkbarry/swagger-py
""" Python implementation of the toy problem By: - Gidel et al., Frank-Wolfe Algorithms for Saddle Point Problems (2016) """ from __future__ import print_function, division import numpy as np from saddle_point_problem import SaddlePointProblem import warnings class ToyProblem(SaddlePointProblem): """A simple s...
[ { "point_num": 1, "id": "all_function_names_snake_case", "question": "Are all function names in this file written in snake_case?", "answer": true }, { "point_num": 2, "id": "all_params_annotated", "question": "Does every function parameter in this file have a type annotation (excludi...
3
test_suite/toy_problem.py
shashank-srikant/reckless-minimax
"""FileDialog with magicgui.""" from pathlib import Path from typing import Sequence from magicgui import event_loop, magicgui @magicgui(filename={"mode": "r"}) def filepicker(filename=Path("~")): """Take a filename and do something with it.""" print("The filename is:", filename) return filename # Sequ...
[ { "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": "has_nested_function_def", "question": "Does this file contain any function defined inside another function?...
3
examples/file_dialog.py
jni/magicgui
import logging import os import re import unittest.mock # Default to turning off all but critical logging messages logging.basicConfig(level=logging.CRITICAL) def mock_open_url(url, allow_local=False, timeout=None, verify_ssl=True, http_headers=None): """Open local files instead of URLs. If it's a local file ...
[ { "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
tests/__init__.py
orest-d/libhxl-python
import gym from .base import Policy class RandomPolicy(Policy): def __init__(self, action_space: gym.Space): super().__init__() self.action_space = action_space def reset(self, observation): pass def step(self, action, observation): pass def sample_action(self, stat...
[ { "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
asym_rlpo/policies/random.py
abaisero/asym-porl
"""Utility functions for parcinging Freesurfer output files.""" from os.path import join import nibabel as nb import numpy as np def _vectorize_fs_surf(file_path): """ Read surface information from a file and turn it into a vector. Parameters ---------- file_path : str The path to a file...
[ { "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
camcan/utils/file_parsing.py
dengemann/engemann-2020-multimodal-brain-age
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models from include import IncludeManager from osf.models.base import BaseModel, ObjectIDMixin from osf.utils.workflows import RequestTypes from osf.models.mixins import NodeRequestableMixin, PreprintRequestableMixin class Abstrac...
[ { "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
osf/models/request.py
gaybro8777/osf.io
#!/usr/bin/env python # -*- coding: UTF-8 -*- """ @File :constants.py @Author :frankdevhub@gmail.com @Blog : http://blog.frankdevhub.site @Date :2021/9/4 18:34 """ class Xpath: """ selenium dicts web element attribute name 页面对象常用属性参数 """ def __init__(self): pass ATTRIBUTE_NAM...
[ { "point_num": 1, "id": "every_class_has_docstring", "question": "Does every class in this file have a docstring?", "answer": true }, { "point_num": 2, "id": "has_multiple_inheritance", "question": "Does any class in this file use multiple inheritance?", "answer": false }, { ...
3
blog_sites/bsoup/dicts/constants.py
frankdevhub/Blog-Documents
from allauth.socialaccount.providers.base import ProviderAccount from allauth.socialaccount.providers.oauth2_provider.provider import OAuth2Provider class InstagramAccount(ProviderAccount): PROFILE_URL = "http://instagram.com/" def get_profile_url(self): return self.PROFILE_URL + self.account.extra_...
[ { "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
allauth/socialaccount/providers/instagram_provider/provider.py
Fuzzwah/django-allauth
from django.contrib.auth.models import AbstractUser from django.db import models from django.urls import reverse class Tag(models.Model): name = models.CharField(max_length=127) class City(models.Model): name = models.CharField(max_length=127) class User(AbstractUser): email = models.EmailField(unique...
[ { "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
project/user_app/models.py
avidyakov/vidnet
from easydict import EasyDict import numpy as np def merge_configs(config_list): if config_list == None or len(config_list) == 0: return None base_config = config_list[0] if type(base_config) is dict: base_config = EasyDict(base_config) if type(base_config) is not EasyDict: pr...
[ { "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
2.6/faster_rcnn/utils/config_helpers.py
waikato-datamining/cntk
# ----------------------------------------------------- # File: temperature.py # Author: Tanner L # Date: 09/20/19 # Desc: Temperature sensor communication # Inputs: # Outputs: temperature # ----------------------------------------------------- import threading as th import logging import time import interface import a...
[ { "point_num": 1, "id": "all_function_names_snake_case", "question": "Are all function names in this file written in snake_case?", "answer": true }, { "point_num": 2, "id": "has_multiple_inheritance", "question": "Does any class in this file use multiple inheritance?", "answer": ...
3
byke_interface/temperature.py
tdroque/byke_interface
from pyopenproject.api_connection.exceptions.request_exception import RequestError from pyopenproject.api_connection.requests.post_request import PostRequest from pyopenproject.business.exception.business_error import BusinessError from pyopenproject.business.services.command.work_package.work_package_command import Wo...
[ { "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
pyopenproject/business/services/command/work_package/create_form.py
webu/pyopenproject
#!/usr/bin/env python3 # A plugin to nmap targets slow motion, to evade sensors from plugins.base.attack import AttackPlugin, Requirement class MetasploitScreengrabPlugin(AttackPlugin): # Boilerplate name = "metasploit_screengrab" description = "Grab a screenshot" ttp = "T1055" references = ["h...
[ { "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
plugins/default/metasploit_attacks/metasploit_screengrab_t1113/metasploit_screengrab.py
Thorsten-Sick/PurpleDome
# __BEGIN_LICENSE__ #Copyright (c) 2015, United States Government, as represented by the #Administrator of the National Aeronautics and Space Administration. #All rights reserved. # __END_LICENSE__ try: import uuid except ImportError: uuid = None from django.db import models if uuid: def makeUuid(): ...
[ { "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
geocamUtil/models/UuidField.py
geocam/geocamUtilWeb
#!/usr/bin/env python import sys last_pkt_num = -1 daystart_pkt_num = -1 daystart_recv_time = -1 daystart_hwrecv_time = -1 dayend_pkt_num = -1 dayend_recv_time = -1 dayend_hwrecv_time = -1 def process_line(line): global last_pkt_num global daystart_pkt_num, daystart_recv_time, daystart_hwrecv_time glob...
[ { "point_num": 1, "id": "every_function_has_docstring", "question": "Does every function in this file have a docstring?", "answer": false }, { "point_num": 2, "id": "every_function_under_20_lines", "question": "Is every function in this file shorter than 20 lines?", "answer": fal...
3
src/scripts/process-loss-rate-output.py
gmporter/TritonVFN
import ray import socket ray.init() import pickle import docker from contextlib import closing @ray.remote class Predictor(object): """Actor that adds deploys specified container. result = "Recieved " + input_batch. """ def __init__(self, container): with closing(socket.socket(socket.AF_INET, ...
[ { "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
python/ray/experimental/serve/examples/test.py
RehanSD/ray
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from refinery.units.pattern import PatternExtractor from refinery.units import RefineryCriticalException from refinery.lib.patterns import wallets class xtw(PatternExtractor): """ Extract Wallets: Extracts anything that looks like a cryptocurrency wallet address....
[ { "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
refinery/units/pattern/xtw.py
bronxc/refinery
from pprint import pprint from django.conf import settings from django.views.generic import ListView, DetailView from django.utils.decorators import classonlymethod from .models import Location class LocationList(ListView): model = Location class LocationDetail(DetailView): model = Location template_...
[ { "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
ch06/myproject_virtualenv/src/django-myproject/myproject/apps/locations/views.py
PacktPublishing/Django-3-Web-Development-Cookbook
from flask import Flask, render_template, redirect from flask_pymongo import PyMongo import scrape_mars app = Flask(__name__) mongo = PyMongo(app, uri="mongodb://localhost:27017/mars_app") @app.route("/") def index(): mars = mongo.db.mars.find_one() return render_template("index.html", mars = mars) @app.r...
[ { "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
app.py
ankitapatel9/web-scraping-challenge
"""add x,y to markers Revision ID: 20f14f4f1de7 Revises: 21b54c24a2c8 Create Date: 2018-10-01 23:27:21.307860 """ # revision identifiers, used by Alembic. revision = '20f14f4f1de7' down_revision = '21b54c24a2c8' branch_labels = None depends_on = None import sqlalchemy as sa from alembic import op def upgrade(): ...
[ { "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
alembic/versions/20f14f4f1de7_add_x_y_to_markers.py
AlonMaor14/anyway
from typing import Tuple import pandas as pd class RuntimeStats: def __init__(self, all_data_shape: Tuple[int, int]): self._x_shape = [] self._data_size = [] self._current_x_shape = None self._data_shape = all_data_shape def as_dataframe(self) -> pd.DataFrame: res = p...
[ { "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
tree/optimized_train/runtime_stats.py
A4Vision/naive-decision-tree
def repl(elt, req, eq): r = req.copy() q = r[elt] // eq['qte'] if r[elt] % eq['qte'] != 0: q += 1 for i in eq['inp']: if i not in r: r[i] = 0 r[i] += q * eq['inp'][i] r[elt] -= q * eq['qte'] return r def optimize(need, dest, eqs): req = need.copy() while any(req[i] > 0...
[ { "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
day14.py
OpesMentis/AdventOfCode_2019
import youtube_dl import sys from youtubesearchpython import VideosSearch ydl_opts = { 'format': 'bestaudio/best', 'outtmpl': '/Users/edoardo/Desktop/songDW/songs/%(title)s.%(ext)s', 'postprocessors': [{ 'key': 'FFmpegExtractAudio', 'preferredcodec': 'mp3', 'preferredquality': '320'...
[ { "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
song_dl.py
dodobardo/SongDW
import json from gittip.testing import Harness from gittip.testing.client import TestClient class Tests(Harness): def change_username(self, new_username, user='alice'): self.make_participant('alice') client = TestClient() response = client.get('/') csrf_token = response.request....
[ { "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_username_json.py
bountysource/www.gittip.com
import RPi.GPIO as GPIO import time,threading LED = 26 KEY = 20 GPIO.setmode(GPIO.BCM) GPIO.setup(LED,GPIO.OUT) GPIO.setup(KEY, GPIO.IN,GPIO.PUD_UP) # 上拉电阻 freq=1#闪烁频率 state=0#当前状态(亮/暗) pulse_time=time.time()#记录时间轴上最近一次上跳沿的时刻 p = GPIO.PWM(LED,freq) def callback1(ch): global state state=1 if state==0 else...
[ { "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
2/led_control.py
ZYM-PKU/Raspberry-3B
"""Various helper functions""" import os from PyQt5 import QtWidgets, QtCore import cv2 def disconnect(signal, *args, **kwargs): """Disconnects the signal, catching any TypeError""" try: signal.disconnect(*args, **kwargs) return True except TypeError: pass else: retur...
[ { "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
videotracker/helpers.py
lysogeny/videotracker
import numpy def functional_iteration(f, x0, max_steps=100, tol=1e-10): x = numpy.zeros(max_steps+1) x[0] = x0 step = 0 g = lambda x : x - f(x) while abs(f(x[step])) > tol and step < max_steps: step = step + 1 x[step] = g(x[step-1]) return x[:step+1] if __name__=="__main__"...
[ { "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
Lectures/tex/codes/lecture9.py
josh-gree/NumericalMethods
""" Module for Serialization and Deserialization of a KNX Disconnect Request information. Connect requests are used to disconnect a tunnel from a KNX/IP device. """ from xknx.exceptions import CouldNotParseKNXIP from .body import KNXIPBody from .hpai import HPAI from .knxip_enum import KNXIPServiceType class Discon...
[ { "point_num": 1, "id": "every_function_has_docstring", "question": "Does every function in this file have a docstring?", "answer": true }, { "point_num": 2, "id": "all_function_names_snake_case", "question": "Are all function names in this file written in snake_case?", "answer":...
3
xknx/knxip/disconnect_request.py
marvin-w/xknx
from django.test import TestCase from graphql_jwt.path import PathDict, filter_strings class FilterStringsTests(TestCase): def test_filter_strings(self): items = filter_strings(['0', '1', 0, '2']) self.assertIsInstance(items, tuple) self.assertNotIn(0, items) class PathDictTests(TestC...
[ { "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
tests/test_path.py
bndr/django-graphql-jwt
from apps.settings import BASE_DIR from django.shortcuts import render from django.views.generic import TemplateView from django.core.files.storage import FileSystemStorage from search import service class Home(TemplateView): template_name = 'home.html' def upload(request): context = {} if request.meth...
[ { "point_num": 1, "id": "has_multiple_inheritance", "question": "Does any class in this file use multiple inheritance?", "answer": false }, { "point_num": 2, "id": "every_function_under_20_lines", "question": "Is every function in this file shorter than 20 lines?", "answer": fals...
3
apps/core/views.py
sont85518/corelsearch
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2020/6/2 23:02 # @Author : Tom_tao # @Site : # @File : views.py # @Software: PyCharm from django.http import HttpResponse from django.shortcuts import render def index(request): return render(request, "index.html") def login(request): next = request....
[ { "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
chapter03/template_url_demo/template_url_demo/views.py
Tomtao626/django
"""Check whether a sequence can be converted to a Lena Sequence.""" # otherwise import errors arise # from . import source def is_fill_compute_el(obj): """Object contains executable methods 'fill' and 'compute'.""" return hasattr(obj, 'fill') and hasattr(obj, 'compute') \ and callable(obj.fill) an...
[ { "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
lena/core/check_sequence_type.py
ynikitenko/lena
# # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # ...
[ { "point_num": 1, "id": "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
heat/engine/clients/os/aodh.py
noironetworks/heat
""" WORK IN PROGRESS """ # Imports from data.db_interface.read import ReadFromDatabase from data.db_interface.write import WriteToDatabase # Syncs the new followers with the DB follower list class FollowersHelper: def __init__(self, screen_name, new_followers): self.new_followers = new_followers ...
[ { "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
controllers/helpers/followers_helper.py
pattpattpatt/twitter_siphon
# -*- coding: utf-8 -*- # cf.http://d.hatena.ne.jp/white_wheels/20100327/p3 import numpy as np import matplotlib.pylab as plt from mpl_toolkits.mplot3d import Axes3D def _numerical_gradient_no_batch(f, x): h = 1e-4 #0.0001 grad = np.zeros_like(x) #xと同じ形状の配列を作成 for idx in range(x.size): tmp_val...
[ { "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
ch04/gradient_2d.py
OnsenTamagoYoshi/DeepLearningFromScratch
from dataclasses import dataclass from typing import Sequence from openapi.data.fields import str_field from openapi.utils import docjoin from .pagination import from_filters_and_dataclass class SearchVisitor: def apply_search(self, search: str, search_fields: Sequence[str]) -> None: raise NotImplemente...
[ { "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": "every_function_under_20_lines", "question": "Is every function in this file shorter than 2...
3
openapi/pagination/search.py
lendingblock/aio-openapi
from django.contrib.auth.mixins import LoginRequiredMixin from django.shortcuts import render, redirect, get_object_or_404 from django.urls.base import reverse_lazy from django.views import View from django.views.generic.edit import CreateView, UpdateView, DeleteView from autos.models import Auto, Make # Create your ...
[ { "point_num": 1, "id": "more_functions_than_classes", "question": "Does this file define more functions than classes?", "answer": false }, { "point_num": 2, "id": "any_function_over_40_lines", "question": "Is any function in this file longer than 40 lines?", "answer": false },...
3
mysite/autos/views.py
MarcosSalib/mysite_django
# import discord from discord.ext import commands import bot.checks class Sheeptrainer(commands.Cog, command_attrs={"hidden": True}): _GUILD = 296463400064647168 def __init__(self, bot): self.bot = bot @bot.checks.in_guild(_GUILD) async def cog_check(self, ctx): print("a") r...
[ { "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
bot/cogs/guilds/sheeptrainer.py
issuemeaname/rammus-discord-bot
import math class Station: def __init__(self, csv_line_tup, lat=0, lng=0): self.station_name = csv_line_tup[1] self.division = csv_line_tup[2] if 'D.M.R' not in csv_line_tup[2] else 'Dublin' self.x = csv_line_tup[3] self.y = csv_line_tup[4] self.murders = list(map(int, csv_l...
[ { "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
garda_stations.py
VoyTechnology/safer-place
import aiohttp import pytest import os from fpl import FPL from fpl.models import Fixture, H2HLeague, User, ClassicLeague, Team, Gameweek from tests.test_classic_league import classic_league_data from tests.test_fixture import fixture_data from tests.test_h2h_league import h2h_league_data from tests.test_team import t...
[ { "point_num": 1, "id": "every_function_has_docstring", "question": "Does every function in this file have a docstring?", "answer": false }, { "point_num": 2, "id": "all_function_names_snake_case", "question": "Are all function names in this file written in snake_case?", "answer"...
3
tests/conftest.py
amosbastian/python-fpl
class Event(object): """ Represents a GUI event. """ def __init__(self, tk_event): """ Args: tk_event: The underlying Tkinter event to wrap. """ self._tk_event = tk_event @classmethod def get_identifier(cls): """ Returns: The Tkinter identifier for this event. """ raise Not...
[ { "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
simulator/event.py
djpetti/molecube
import json from datetime import datetime from test.test_const import CONST_BASE_URL, CONST_PORT, CONST_SSL from unittest import TestCase from pygrocydm.userobject import USEROBJECTS_ENDPOINT, UserObject from pygrocydm.grocy_api_client import GrocyApiClient class TestUserEntity(TestCase): def setUp(self): ...
[ { "point_num": 1, "id": "every_function_under_20_lines", "question": "Is every function in this file shorter than 20 lines?", "answer": true }, { "point_num": 2, "id": "has_multiple_inheritance", "question": "Does any class in this file use multiple inheritance?", "answer": false...
3
test/test_userobject.py
fossabot/pygrocydm
from flask import jsonify from flask_mail import Message from api.common.utils import build_email_body from run import execute_spiders def force_data_update(): message = 'All data was updated' try: execute_spiders() except Exception: message = 'Could not fetch data properly' retur...
[ { "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
api/common/helpers.py
edumco/sanguine-scrapy
""" Methods for interacting with the SQL database """ import discord import logging import pymysql from common import * class SQL: @staticmethod def _get_db_connection(bot=None): if bot and bot.connection: bot.connection.ping(reconnect=True) return bot.connection loggi...
[ { "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
sql.py
dannybd/template-discord-bot
import os import requests import pickle import logging import urlparse import json BASE_PATH = os.path.dirname(os.path.abspath(__file__)) class Widget: def __init__(self, widget_name): self.widget_name = widget_name pass def log(self, message): logging.basicConfig(filename='/{}/{}'.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": "every_function_under_20_lines", "question": "Is every function in this file shorter than 20 lines?", "answ...
3
github-reviews.widget/widget.py
gitzerai/ubersicht-github-reviews
from pathlib import Path from urllib.parse import urljoin, urlparse, unquote def _get_url_file_name(url): path = urlparse(url).path try: path = unquote(path) except (TypeError, ValueError): pass return Path(path).name def dav_index(context, data): """List files in a WebDAV direct...
[ { "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": "no_function_exceeds_5_params", "question": "Does every function in this file take 5 or fewer parameters (excluding...
3
memorious/operations/webdav.py
Rosencrantz/memorious
from vstruct import VStruct from vstruct.primitives import v_bytes from vstruct.primitives import v_uint32 from vstruct.primitives import v_wstr from vstruct.primitives import v_enum PATCH_ACTIONS = v_enum() PATCH_ACTIONS.PATCH_REPLACE = 0x2 PATCH_ACTIONS.PATCH_MATCH = 0x4 MAX_MODULE = 32 # from: https://github.co...
[ { "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
sdb/patchbits.py
evil-e/python-sdb