source
string
points
list
n_points
int64
path
string
repo
string
# -*- mode: python; coding: utf-8 -*- # Copyright 2019 the AAS WorldWide Telescope project # Licensed under the MIT License. import numpy as np import pytest from .. import pyramid from ..pyramid import Pos def test_next_highest_power_of_2(): assert pyramid.next_highest_power_of_2(1) == 256 assert pyramid.n...
[ { "point_num": 1, "id": "every_function_under_20_lines", "question": "Is every function in this file shorter than 20 lines?", "answer": true }, { "point_num": 2, "id": "every_function_has_docstring", "question": "Does every function in this file have a docstring?", "answer": fals...
3
toasty/tests/test_pyramid.py
imbasimba/toasty
from lnbits.db import open_ext_db def m001_initial(db): """ Initial tposs table. """ db.execute( """ CREATE TABLE IF NOT EXISTS tposs ( id TEXT PRIMARY KEY, wallet TEXT NOT NULL, name TEXT NOT NULL, currency TEXT NOT NULL ); "...
[ { "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
lnbits/extensions/tpos/migrations.py
frankhinek/lnbits
import logging from utils import emit logger = logging.getLogger(__name__) discovered_samples = {} def resource(decorated_resource): def decorate(sample_func): def run(*args, **kwargs): emit("Running `{0}.{1}`".format(sample_func.__module__, sample_func.__name__)) sample_func(*a...
[ { "point_num": 1, "id": "every_function_has_docstring", "question": "Does every function in this file have a docstring?", "answer": false }, { "point_num": 2, "id": "all_function_names_snake_case", "question": "Are all function names in this file written in snake_case?", "answer"...
3
src/samples/__init__.py
DanEdens/azure-devops-python-samples
from ma import ma from models.emergency_contact import EmergencyContactModel from marshmallow import fields, validates, ValidationError from schemas.contact_number import ContactNumberSchema class EmergencyContactSchema(ma.SQLAlchemyAutoSchema): class Meta: model = EmergencyContactModel contact_numb...
[ { "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
schemas/emergency_contact.py
whiletrace/dwellinglybackend
from werkzeug.exceptions import Unauthorized from base64 import standard_b64decode from .base import BaseAuth class BasicAuth(BaseAuth): class Unauthorized(Unauthorized): def __init__(self, *args, **kwargs): self.realm = kwargs.get('realm') or 'Authorization required' super(Unauth...
[ { "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
dread/auth.py
rugginoso/dread
import unittest from os.path import abspath, join from robot import api, model, parsing, reporting, result, running from robot.utils.asserts import assert_equals class TestExposedApi(unittest.TestCase): def test_test_case_file(self): assert_equals(api.TestCaseFile, parsing.TestCaseFile) def test_...
[ { "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
utest/api/test_exposed_api.py
moto-timo/robotframework
def test_token(token): assert token def test_authentification(client): assert client.get_requester()
[ { "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
functional_tests/test_client.py
ZackPashkin/toloka-kit
import os import sys import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data mnist_path = "/Users/liyanan/Documents/Test/Tensorflow/data/mnist_data/" #print mnist data def mnistInfo(): batch_size = 100 #read mnist data mnist = input_data.read_data_sets(mnist_path,one_hot =...
[ { "point_num": 1, "id": "has_nested_function_def", "question": "Does this file contain any function defined inside another function?", "answer": false }, { "point_num": 2, "id": "every_function_under_20_lines", "question": "Is every function in this file shorter than 20 lines?", ...
3
src/mnist_fully_network/mnist_practice/mnist_data_info.py
belivem/Study
import unittest import pandas as pd import os from pprint import pprint from ds_connectors.handlers.s3_handlers import S3SourceHandler, S3PersistHandler from aistac.handlers.abstract_handlers import ConnectorContract, HandlerFactory class S3HandlerTest(unittest.TestCase): def setUp(self): pass def ...
[ { "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/aws/s3_handler_test.py
project-hadron/discovery-connectors
import basic_SPN as cipher pbox = {0:0, 1:4, 2:8, 3:12, 4:1, 5:5, 6:9, 7:13, 8:2, 9:6, 10:10, 11:14, 12:3, 13:7, 14:11, 15:15} # test pbox functionality/symmetry def testPBox(statem: list, pbox: dict): staten = [0]*len(pbox) for tpi, tp in enumerate(statem): staten[pbox[tpi]] = tp #print (staten) ...
[ { "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
basic_SPN_tests.py
hkscy/Basic-SPN-cryptanalysis
from typing import Optional class Solution: def search(self, node: Optional[TreeNode], target: int): if target - node.val in self.set and target - node.val != node.val: self.flag = True return self.set.add(node.val) if node.left: self.search(node.left, 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_under_20_lines", "question": "Is every function in this file shorter than 20 lines?", "answer": true ...
3
submissions/two-sum-iv-input-is-a-bst/solution.py
Wattyyy/LeetCode
import json import pytest from conftest import CI_ENV @pytest.mark.skipif(CI_ENV, reason="avoid issuing HTTP requests on CI") def test_user_tweets(api_client): expected_keys = ['created_at', 'score_bert', 'score_lr', 'score_nb', 'status_id', 'status_text'] response = api_client.get('/api/v1/user_tweets/ber...
[ { "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_api_v1.py
s2t2/tweet-analyzer-py
import cv2 import numpy as np def preprocessing(frame, mean, std): # normalize and quantize input # with paramaeters obtained during # model calibration frame *= (1 / 255) expd = np.expand_dims(frame, axis=0) quantized = (expd / std + mean) return quantized.astype(np.uint8) def postproc...
[ { "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
image/processing.py
Yuchong-Geng/lanefinder
import os import json def combine_schema(borough_name): borough_name = borough_name.lower() neighborhood_data = "" with open('../scraped_data/borough_schema/' + borough_name + ".json", 'r', encoding='utf-8') as json_file: data = json.load(json_file) for zipCodes in range(len(data[borough_n...
[ { "point_num": 1, "id": "every_function_under_20_lines", "question": "Is every function in this file shorter than 20 lines?", "answer": true }, { "point_num": 2, "id": "has_nested_function_def", "question": "Does this file contain any function defined inside another function?", "...
3
web-scrapers/combine-schema.py
matildarehm/big-city
from uontypes.units.quantity import Quantity class Time(Quantity): pass class Second(Time): def __str__(self): return "s" def to_binary(self): return b"\x22" class Minute(Time): def __str__(self): return "min" def to_binary(self): return b"\x45"
[ { "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
uontypes/units/time.py
uon-language/uon-parser
from typing import Dict, Tuple from rsocket.frame_helpers import parse_type, serialize_128max_value from rsocket.helpers import serialize_well_known_encoding from rsocket_broker.well_known_keys import WellKnownKeys def parse_key_value_map(buffer: bytes, offset: int) -> Tuple[Dict[bytes, bytes], int]: key_value_...
[ { "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
rsocket_broker/frame_helpers.py
gabis-precog/rsocket-broker-py
"""Unit tests for numbers.py.""" import math import unittest from numbers import Complex, Real, Rational, Integral from test import test_support class TestNumbers(unittest.TestCase): def test_int(self): self.assertTrue(issubclass(int, Integral)) self.assertTrue(issubclass(int, Complex)) ...
[ { "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
AppPkg/Applications/Python/Python-2.7.2/Lib/test/test_abstract_numbers.py
CEOALT1/RefindPlusUDK
import os class RepeatPrinter: """ The class allows printing repeating messages on the last line of a terminal (Unix only). This can be used to display a counter that does not scroll the terminal example: printer = RepeatPrinter() printer.prompt('Hello World') for i in range(20): ...
[ { "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
cellpack/mgl_tools/mglutil/util/repeatPrinter.py
mesoscope/cellpack
class Email: """A model representing an email. Attributes: subject: The subject line of the email. text: The plain text of the email. Currently, the only allowed HTML element in here is <br>. """ def __init__(self, contents): """Creates an email from the contents of...
[ { "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
src/email.py
atomhacks/email
from setuptools import setup import json import glob def readme(): with open('README.rst') as f: return f.read() def get_version(): with open('version.json') as json_file: data = json.load(json_file) if 'dev' in data: return "{}.{}.{}-dev{}".format( data['major'], data['minor'], d...
[ { "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
setup.py
olafsarnow/ecc
class SyntaxTree(object): def add_child(self, node): assert isinstance(node, SyntaxTree) self.children.append(node) def __init__(self, name='root', children=None): self.name = name self.children = [] if children is not None: for child in children: ...
[ { "point_num": 1, "id": "has_multiple_inheritance", "question": "Does any class in this file use multiple inheritance?", "answer": false }, { "point_num": 2, "id": "has_nested_function_def", "question": "Does this file contain any function defined inside another function?", "answ...
3
SyntaxTree.py
wdvictor/Pascal-compiler
class Vector2D(object): # @param vec2d {List[List[int]]} def __init__(self, vec2d): # Initialize your data structure here self.i = 0 self.j = 0 self.vec2d = [v for v in vec2d if len(v)>0] # @return {int} a next element def next(self): # Write your code h...
[ { "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
601. Flatten 2D Vector/main.py
ChanchalKumarMaji/LintCode
from abc import ABC, abstractmethod from collections import deque from typing import Iterable class AbsMovingAverage(ABC): def __init__(self): pass @abstractmethod def record(self, data: object): """Record the historical data for forecasting. Args: data (object): The ...
[ { "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
maro/forecasting/moving_average.py
yangboz/maro
from django.db import models from django.utils import timezone class MarketIndex(models.Model): ticker = models.CharField(max_length=100, unique=True) name = models.CharField(max_length=100, unique=True) class Meta: verbose_name_plural = 'market_indices' def __str__(self): ...
[ { "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
main_board/models.py
ralphqq/pse-indices-scoreboard
import cv2 import numpy as np import matplotlib.pyplot as plt import glob import pickle # read in all the images in the calibration folder calib_images = glob.glob(".\camera_cal\*.jpg") #define chess board parameters: nx = 9 ny = 6 # Arrays to store image point and opbject points imgpoints = [] objpoints = [] def g...
[ { "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
claib_cam.py
m4xst3r/Udacity-AdvancedLaneLines
import logging import sys import os from functools import lru_cache def _configLogger(name, filename=None, loglevel=logging.INFO): # define a Handler which writes INFO messages or higher to the sys.stdout logger = logging.getLogger(name) logger.setLevel(loglevel) console = logging.StreamHandler(sys.st...
[ { "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
utils/logger.py
faroukmokhtar/weaver
class Storage: _ID = 0 def __init__(self, node_id = -1 , round =-1): self.id = self.__class__._ID self.__class__._ID += 1 self.round = round self.node_id = node_id self.XK = [] self.XC = [] self.SKA = [] self.CA = [] se...
[ { "point_num": 1, "id": "every_function_under_20_lines", "question": "Is every function in this file shorter than 20 lines?", "answer": true }, { "point_num": 2, "id": "more_functions_than_classes", "question": "Does this file define more functions than classes?", "answer": true ...
3
Storage.py
sardarlaltu/UnattendedWSN
""" Module for discount exceptions """ class ItemPriceIsBad(Exception): """ Exception when item price is < 0 """ def __init__(self, message): super(ItemPriceIsBad, self).__init__(message) class ItemIsNowFreeException(Exception): """ Exception when Item price is too low (<= 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
2019/workshop/checkout/discount_exception.py
jkalmar/PythonDays
# Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: MIT-0 import boto3 import logging import traceback logger = logging.getLogger() logger.setLevel(logging.INFO) client = boto3.client('sagemaker') def stop_training_job(trainingName): try: response = client....
[ { "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
src/detective_control/inspect_sagemaker_resource.py
dcoder4/secure-data-science-reference-architecture
# Copyright 2017 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. DEPS = [ 'archive', 'depot_tools/bot_update', 'depot_tools/gclient', 'recipe_engine/path', 'recipe_engine/properties', ] def RunSteps(api): api...
[ { "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": "every_function_under_20_lines", "question": "Is every function in this file shorter than 20 lines?", "a...
3
scripts/slave/recipe_modules/archive/tests/zip_and_upload_build.py
bopopescu/chromium-build
# encoding: utf8 from __future__ import unicode_literals, print_function from spacy.lang.ru import RussianDefaults, Russian from ru2.lemmatizer import RussianLemmatizer from .syntax_iterators import SYNTAX_ITERATORS class Russian2Defaults(RussianDefaults): syntax_iterators = SYNTAX_ITERATORS @classmethod d...
[ { "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
ru2/__init__.py
ex00/spacy-ru
import pytest from evm.db.backends.memory import MemoryDB from evm.db import ( get_db_backend, ) pytest.importorskip('leveldb') # Sets db backend to leveldb @pytest.fixture def config_env(monkeypatch): monkeypatch.setenv('CHAIN_DB_BACKEND_CLASS', 'evm.db.backends.level.LevelDB') @py...
[ { "point_num": 1, "id": "all_params_annotated", "question": "Does every function parameter in this file have a type annotation (excluding self/cls)?", "answer": false }, { "point_num": 2, "id": "has_nested_function_def", "question": "Does this file contain any function defined inside...
3
tests/database/test_leveldb_db_backend.py
zixuanzh/py-evm
"""Implementation of chess board object on client side of application Authors: Peter Hamran xhamra00@stud.fit.vutbr.cz Date: 20.01.2020 """ class Board: def __init__(self): self.dimensions = (8, 8) def get_background(self): ... #TODO
[ { "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
Client/board.py
hamyhamz/chess-game
from django.db import models from django.contrib.auth.models import User from django.db.models import signals import registration GENDER_CHOICES = ( (u'M',u'Male'), (u'F',u'Female'), (u'N',u"Don't wish to reveal") ) YEAR_CHOICES = ( (u'U1',u'Undergraduate 1st year'), (u'U2',u'Undergraduate 2nd year'), (u'U3',...
[ { "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
panel/models.py
SebastinSanty/QuarkWebsite2017
# python3 from collections import namedtuple Bracket = namedtuple("Bracket", ["char", "position"]) def are_matching(left, right): return (left + right) in ["()", "[]", "{}"] def find_mismatch(text): opening_brackets_stack = [] mismatch = [] for i, next in enumerate(text): # Process ...
[ { "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
check_brackets.py
mrcrnkovich/random_scripts
class Tree(): children = [] def __init__(self,token): self.__token = token self.children = [] def addChild(self,token): self.children.append(Tree(token)) def getChild(self,index): return self.children[index] def getToken(self): return self.__token def setT...
[ { "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
src/models/tree.py
marijadebe/lab
import torch from scipy.spatial.distance import cosine from transformers import BertModel, BertTokenizer import os class SentenceSimilarity: def __init__(self, model_path='bert-base-uncased'): self.tokenizer = BertTokenizer.from_pretrained(model_path) self.model = BertModel.from_pretrained(model_...
[ { "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
mdsearch/Similarity/sentence_similarity.py
lydia07/mdsearch
import numpy as np from collections import defaultdict import sys from typing import Any class TimeSeries(object): def __init__(self): self.class_timeseries = '' self.dimension_name = '' self.discmP = {} self.threshP = {} self.timeseries = None self.matched = False ...
[ { "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
SE4TeC_demo/utils/timeseries.py
JingweiZuo/SE2TeC
import os.path import tempfile from unittest import TestCase from code.nn import NeuralNetwork class NeuralNetworkTestCase(TestCase): def setUp(self): self.net = NeuralNetwork(vocab_sizes={ 'forms': 42, 'lemmas': 42, 'morph': 104, 'pos_tags': 18}) def test_model_files_error(self): with tempfile.Temp...
[ { "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
code/tests/test_nn.py
pavelsof/mstnn
#!/usr/bin/python # -*- coding: utf-8 -*- # Tests of i18n scripts. # # Copyright 2013 Google Inc. # https://blockly.googlecode.com/ # # 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...
[ { "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
extern/blockly/i18n/tests.py
hongiklee/entryjs
# Isekai'd playtest bot import lightbulb import math, sys, random # might switch to numpy uniform dist or poisson/gaussian dis if clock time random lib is not good enough DICE = [0, 1, 1, 1, 2, 2] bot = lightbulb.BotApp(token='', default_enabled_guilds=(931625225672617984)) @bot.command @lightbulb.command('summon', ...
[ { "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
isebot.py
AtharvVohra/iseakai-d-bot
#!/usr/bin/env python # -*- coding: utf-8 -*- """ 構文木変数クラス """ from node.node import Node from code import Code class Symbol(Node): def __init__(self, symbol): try: self.number = int(symbol) # 変数の番号 except: raise Exception("Error: Illigal symbol") def getNumber(self): return self.number def run(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": "every_function_has_docstring", "question": "Does every function in this file have a docstring?", "answer": fals...
3
docs/tools/adv/node/symbol.py
syun77/EscEditor5
#! /usr/bin/python # https://www.reddit.com/r/dailyprogrammer/comments/7cnqtw/20171113_challenge_340_easy_first_recurring/ ''' a program that outputs the first recurring character in a string ''' from __future__ import unicode_literals, print_function, division, absolute_import import argparse import sys import log...
[ { "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
340_easy_first_recurring/first_recurring.py
jacobmorzinski/dailyprogrammer
""" Base client outlining how we fetch and parse responses """ import json import logging import httplib2 from .utils import NotFound, CongressError, u log = logging.getLogger('congress') class Client(object): """ Client classes deal with fetching responses from the ProPublica Congress API and parsing w...
[ { "point_num": 1, "id": "no_function_exceeds_5_params", "question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?", "answer": true }, { "point_num": 2, "id": "has_nested_function_def", "question": "Does this file contain any function defined insid...
3
congress/client.py
giltolley/propublica-congress
# Definition for singly-linked list. class ListNode: def __init__(self, val=0, next=None): self.val = val self.next = next class Solution: def addTwoNumbers(self, l1: ListNode, l2: ListNode) -> ListNode: return addTwoNumbers(l1, l2, 0, None, None) def addTwoNumbers(l1: ListNode...
[ { "point_num": 1, "id": "every_class_has_docstring", "question": "Does every class in this file have a docstring?", "answer": false }, { "point_num": 2, "id": "no_function_exceeds_5_params", "question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)...
3
tests/two_sum.py
airportyh/cpython
def average_precision(actual, recommended, k=30): ap_sum = 0 hits = 0 for i in range(k): product_id = recommended[i] if i < len(recommended) else None if product_id is not None and product_id in actual: hits += 1 ap_sum += hits / (i + 1) return ap_sum / k def no...
[ { "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
src/metrics.py
StepDan23/faiss-user-based-method
# Copyright (c) 2017-2022 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved. # SPDX-License-Identifier: Apache-2.0 from dazl.damlast import DarFile, daml_types as daml from dazl.damlast.daml_lf_1 import DottedName, ModuleRef, PackageRef, TypeConName from dazl.damlast.lookup import MultiPackag...
[ { "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
python/tests/unit/test_pretty_daml.py
DACH-NY/dazl-client
class Node: def __init__(self, value, next_item=None): self.value = value self.next_item = next_item class Queue: def __init__(self): self.size = 0 self.head = None self.last = None def put(self, x): node = Node(value=x) if self.size == 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": "all_function_names_snake_case", "question": "Are all function names in this file written...
3
from LAptop/study/Queue_Rel_List.py
larush1/study
# -*- coding: utf-8 -*- from qcloudsdkcore.request import Request class CreateDsaHostRequest(Request): def __init__(self): super(CreateDsaHostRequest, self).__init__( 'dsa', 'qcloudcliV1', 'CreateDsaHost', 'dsa.api.qcloud.com') def get_area(self): return self.get_params().get('ar...
[ { "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
qcloudsdkdsa/CreateDsaHostRequest.py
f3n9/qcloudcli
from stack import Stack as s class Queue: def __init__(self, iter=[]): self.stack_one = s() self.stack_two = s() self._len = 0 for item in iter: self.enqueue(item) def enqueue(self, value): if value: self.stack_one.push(value) self....
[ { "point_num": 1, "id": "every_function_has_docstring", "question": "Does every function in this file have a docstring?", "answer": false }, { "point_num": 2, "id": "every_function_under_20_lines", "question": "Is every function in this file shorter than 20 lines?", "answer": tru...
3
queue-with-stacks/queue_with_stacks.py
brandonholderman/data-structures-and-algorithms
"""Models for final hackbright project """ from flask import Flask from flask_sqlalchemy import SQLAlchemy db = SQLAlchemy() app = Flask(__name__) class Legislator(db.Model): """ Info on current legislators. """ __tablename__ = "current_legislators" legislator_id = db.Column(db.Integer, autoincrement=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_under_20_lines", "question": "Is every function in this file shorter than 20 lines?", "answer": true ...
3
model.py
adinahhh/educated-citizen
""" Filename: RobotsParser.py Author: Maxwell Goldberg Last modified: 06.09.17 Description: Helper class for parsing individual robots.txt records. """ # CONSTANTS from constants import RECORD_MAX_LEN # PYTHON BUILTINS import re, unicodedata, logging def test_ctrl_chars(s): return len(s) != len("".join(ch for ch in ...
[ { "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
crawler/lib/RobotsParser.py
wilsonsk/Node-React-Python-D3-Crawler-App
import game_framework from pico2d import * import title_state name = "StartState" image = None logo_time = 0.0 def enter(): global image image = load_image('kpu_credit.png') def exit(): global image del(image) def update(): global logo_time if (logo_time > 1.0): logo_time = 0.8 ...
[ { "point_num": 1, "id": "all_function_names_snake_case", "question": "Are all function names in this file written in snake_case?", "answer": true }, { "point_num": 2, "id": "has_nested_function_def", "question": "Does this file contain any function defined inside another function?", ...
3
supermario/supermario 1105(2)/start_state.py
Kimmiryeong/2DGP_GameProject
import json import os.path tags = { '1.0': '1__0__3', '1.1': '1__1__4', } schema_url = 'https://standard.open-contracting.org/schema/{}/release-schema.json' def path(filename): return os.path.join('tests', 'fixtures', filename) def read(filename, mode='rt', encoding=None, **kwargs): with open(path...
[ { "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
tests/__init__.py
open-contracting/ocds-merge
from huobi.model import InstrumentStatus class ReferenceCurrency: """ The Huobi supported static reference information for each currency. :member currency: currency instStatus: Instrument status chains: chain list """ def __init__(self): self.currency = "" ...
[ { "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
huobi/model/referencecurrency.py
xiaohuid/huobi_Python
from django.shortcuts import render, redirect from django.http import HttpResponse from django.views.generic import ListView, TemplateView, View from django.views.generic.edit import FormView from django.core.files.storage import FileSystemStorage from .forms import UploadFirmwareForm from .utils import * # / , main ...
[ { "point_num": 1, "id": "every_class_has_docstring", "question": "Does every class in this file have a docstring?", "answer": false }, { "point_num": 2, "id": "all_function_names_snake_case", "question": "Are all function names in this file written in snake_case?", "answer": true...
3
app/firmware_analysis/views.py
dnr6419/iot_project
import pytest from webtest import TestApp from pyramid.config import Configurator from pyramid.response import Response def test_app(): def hello(request): return Response('Hello world!') config = Configurator() config.add_route('hello_world', '/') config.add_view(hello, route_name='hello_wo...
[ { "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
tests/conftest.py
timgates42/pyramid_sacrud
#!/usr/bin/env python # -*- encoding: utf-8 -*- # 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...
[ { "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
examples/src/python/bolt/half_ack_bolt.py
Munyola/incubator-heron
# -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import functools from unittest.case import SkipTest from multiprocessing import Process, Queue from time import sleep, time def _run_process(fu...
[ { "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
Lib/site-packages/SiQt/siqt/tests/test_importers.py
fochoao/cpython
# Copyright 2019, Cray Inc. All rights reserved. """ These are the routes that are mapped to from connexion """ import uuid import urllib3 urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) from flask import current_app as app from sts import client as c def put_token(): """ PUT /token - Genera...
[ { "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
sts/routes.py
Cray-HPE/cray-sts
import unittest import pprint from atlascli.atlasapi import AtlasAPI class TestAPIMixin(unittest.TestCase): def setUp(self): self._api= AtlasAPI() self._api.authenticate() def tearDown(self): pass def test_get(self): r = self._api.get("https://httpbin.org/get") ...
[ { "point_num": 1, "id": "more_functions_than_classes", "question": "Does this file define more functions than classes?", "answer": true }, { "point_num": 2, "id": "every_function_under_20_lines", "question": "Is every function in this file shorter than 20 lines?", "answer": true ...
3
test/test_atlas_apimixin.py
gregbanks/atlascli
from exercises.structures.src.treasure_map import TreasureMap tm = TreasureMap() tm.populate_map() def test_beach_key(): assert tm.map['beach'] == 'sandy shore'.casefold() def test_coast_key(): assert tm.map['coast'] == 'ocean reef'.casefold() def test_volcano_key(): assert tm.map['volcano'] == 'hot ...
[ { "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
exercises/structures/test/test_treasure_map.py
bmazey/summer2020
import os from abc import ABCMeta from munch import Munch DIFFLR_MODULE_PATH = os.path.dirname(os.path.abspath(__file__)) DIFFLR_DATA_PATH = os.path.dirname(os.path.abspath(__file__)) + '/data/' DIFFLR_EXPERIMENTS_PATH = os.path.dirname(os.path.abspath(__file__)) + '/experiments/' DIFFLR_EXPERIMENTS_RUNS_PATH = os.pat...
[ { "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
difflr/__init__.py
kingspp/differentiable_learning
class MockFile: def read(self): return False class RequestHandler: def __init__(self): self.contentType = "" self.contents = MockFile() def getContents(self): return self.contents.read() def read(self): return self.contents def setStatus(self, status): ...
[ { "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
response/requestHandler.py
AloisJanicek/org-roam-server-light
# name : Shoby Gnanasekaran # net id: shoby from dungeonchar import DungeonCharacter from healable import Healable from hero import Hero class Priestess(Hero, Healable): """ Priestess is a hero with it own statistics. The basic behaviour is same as the hero. Special ability is to heal everytime after taking ...
[ { "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
priestess.py
nvanbaak/dungeon-adventure-2
import contextlib import os from collections.abc import Mapping # noqa from typing import Any, List, Optional, Union import dask import dask.array as da import distributed import packaging.version import pandas import sklearn import sklearn.utils.validation SK_VERSION = packaging.version.parse(sklearn.__version__) D...
[ { "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
dask_ml/_compat.py
eric-czech/dask-ml
import re import time from pyquery import PyQuery as pq from policy_crawl.common.fetch import get,post from policy_crawl.common.save import save from policy_crawl.common.logger import alllog,errorlog def parse_detail(html,url): alllog.logger.info("广西省药品监督管理局: %s"%url) doc=pq(html) data={} data["title...
[ { "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
spiders/npma/all/guangxi.py
JJYYYY/policy_crawl
# automatically generated by the FlatBuffers compiler, do not modify # namespace: tflite_fb import flatbuffers from flatbuffers.compat import import_numpy np = import_numpy() class LogicalOrOptions(object): __slots__ = ['_tab'] @classmethod def GetRootAsLogicalOrOptions(cls, buf, offset): n = fl...
[ { "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
nnef_tools/io/tensorflow/tflite_fb/LogicalOrOptions.py
rgiduthuri/NNEF-Tools
from panda3d.core import NodePath, Shader, LVecBase2i, Texture, GeomEnums from Code.Globals import Globals from Code.RenderPass import RenderPass from Code.RenderTarget import RenderTarget class OcclusionBlurPass(RenderPass): """ This pass performs a edge preserving blur by comparing the scene normals duri...
[ { "point_num": 1, "id": "all_function_names_snake_case", "question": "Are all function names in this file written in snake_case?", "answer": false }, { "point_num": 2, "id": "has_multiple_inheritance", "question": "Does any class in this file use multiple inheritance?", "answer":...
3
Code/RenderPasses/OcclusionBlurPass.py
kergalym/RenderPipeline-version_1_release
import typing import sys class BitCnt(): def __call__( self, n: int, ) -> int: a = self.__a if n == 0: return 0 if n in a: return a[n] c = self(n // 2) + n % 2 a[n] = c return c def __init__( self, ) -> typing.NoReturn: self.__a = dict() def solve( n: int,...
[ { "point_num": 1, "id": "all_function_names_snake_case", "question": "Are all function names in this file written in snake_case?", "answer": true }, { "point_num": 2, "id": "more_functions_than_classes", "question": "Does this file define more functions than classes?", "answer": ...
3
src/atcoder/dp/o/sol_0.py
kagemeka/competitive-programming
import configparser import psycopg2 from sql_queries import copy_table_queries, insert_table_queries def load_staging_tables(cur, conn): for query in copy_table_queries: print('Loading data by: '+query) cur.execute(query) conn.commit() def insert_tables(cur, conn): for query in inser...
[ { "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
Project_3_Data_Warehouse/etl.py
gulbulut/udacity-data-engineering-nanodegree-projects
# coding=utf8 # Copyright 2018 JDCLOUD.COM # # 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 ...
[ { "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
jdcloud_sdk/services/rds/apis/ModifyInstanceNameRequest.py
Tanc009/jdcloud-sdk-python
import json import os projectpath ="./" reuterspath = "./Reuters" def writeToFile(item,filename): # 将数据写入到文件中 file = open(filename,'w') str = json.JSONEncoder().encode(item) file.write(str) file.close() #获取文档名中的文档的id def getDocID(filename): end = filename.find('.') docId...
[ { "point_num": 1, "id": "all_function_names_snake_case", "question": "Are all function names in this file written in snake_case?", "answer": false }, { "point_num": 2, "id": "every_function_has_docstring", "question": "Does every function in this file have a docstring?", "answer"...
3
tools.py
Doraemon-h/Information-Retrieval
# -*- coding: utf-8 -*- """ Application exception views. Views rendered by the web application in response to exceptions thrown within views. """ from pyramid.view import forbidden_view_config from pyramid.view import notfound_view_config from pyramid.view import view_config from h.i18n import TranslationString as ...
[ { "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
h/views/errors.py
y3g0r/h
from django.contrib.auth import get_user_model from django.test import TestCase # Create your tests here. class UserManagersTests(TestCase): def test_create_user(self): User = get_user_model() user = User.objects.create_user( email="normal@user.com", password="testing@123") 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": "has_multiple_inheritance", "question": "Does any class in this file use multiple inheritance?", "answer": fals...
3
user/tests.py
Vr3n/django_react_cart_system
# -*- coding: utf-8 -*- # # 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 #...
[ { "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
tests/dags/test_cli_triggered_dags.py
fengzhongzhu1621/xAirflow
# chat/consumers.py from channels.generic.websocket import AsyncWebsocketConsumer import json class ChatConsumer(AsyncWebsocketConsumer): async def connect(self): self.room_name = self.scope['url_route']['kwargs']['room_name'] self.room_group_name = 'chat_%s' % self.room_name # Join room g...
[ { "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
helloWorld/helloWorldApp/consumers.py
jcheon/reddit_clone
#Dieses Skript funktioniert nicht!!! #Erstellen einer Liste von wilkürlich gewählten Buchstaben def enthalten_buchstaben(s, #Wilkürlich erstellte Liste von Buchstaben x #gewählter Buchstabe nach dem gesucht werden soll ): print(s) ...
[ { "point_num": 1, "id": "has_nested_function_def", "question": "Does this file contain any function defined inside another function?", "answer": false }, { "point_num": 2, "id": "every_function_under_20_lines", "question": "Is every function in this file shorter than 20 lines?", ...
3
Suchen_in_Alphabet_Liste.py
ostseegloeckchen/basics
# -*- coding: utf-8 -*- __author__ = "MJ (tsngmj@gmail.com)" __license__ = "Apache 2.0" # standard library from abc import ABC, abstractmethod # scip plugin from ribbon.loadbalancer.server_list_filter import ServerListFilter """ Interface that defines the methods sed to obtain the List of Servers """ # scip plugin...
[ { "point_num": 1, "id": "all_function_names_snake_case", "question": "Are all function names in this file written in snake_case?", "answer": true }, { "point_num": 2, "id": "more_functions_than_classes", "question": "Does this file define more functions than classes?", "answer": ...
3
ribbon/loadbalancer/server_list.py
haribo0915/Spring-Cloud-in-Python
############################################################################### # # Tests for XlsxWriter. # # Copyright (c), 2013-2016, John McNamara, jmcnamara@cpan.org # import unittest from ...compatibility import StringIO from ...worksheet import Worksheet class TestWriteHeaderFooter(unittest.TestCase): """ ...
[ { "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
xlsxwriter/test/worksheet/test_write_header_footer.py
totdiao/XlsxWriter
''' Define functions for the detuning of an atomic system ''' from LASED.state import * from LASED.constants import * def delta(e, g): """Detunings between substates. Parameters: e (State): State object g (State): State object Returns: float: Difference in angular freque...
[ { "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
base-LASED/LASED/.ipynb_checkpoints/detuning-checkpoint.py
mvpmanish/LASED
import networkx as nx def create_nxgraph(net, only_in_service=True): """ Convert a given network into a NetworkX MultiGraph :param net: the given network :param only_in_service: if True, convert only the pipes that are in service (default: True) :return: a MultiGraph """ g = nx.OrderedDi...
[ { "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
pandangas/topology.py
ppuertocrem/pandangas
from __future__ import annotations from typing import TYPE_CHECKING, Callable, TypeVar from returns.interfaces.specific.reader_result import ReaderResultLikeN from returns.primitives.hkt import Kinded, KindN, kinded if TYPE_CHECKING: from returns.context import ReaderResult # noqa: WPS433 _FirstType = TypeVar(...
[ { "point_num": 1, "id": "has_nested_function_def", "question": "Does this file contain any function defined inside another function?", "answer": true }, { "point_num": 2, "id": "all_return_types_annotated", "question": "Does every function in this file have a return type annotation?"...
4
returns/pointfree/bind_context_result.py
ftruzzi/returns
from datetime import datetime import datetime def yesterday(today=datetime.datetime.now()): yesterday = today - datetime.timedelta(days=1) yesterday_timestamp = int(yesterday.timestamp()) * 1000 return yesterday_timestamp def extractDate(name, prefix, fileType): prefixLen = len(prefix) fileTypeL...
[ { "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/etl/common/timehelpers.py
vatdaell/spotify-analysis
import os, unittest from binascii import hexlify from pure25519_blake2b.basic import encodepoint from pure25519_blake2b.dh import dh_start, dh_finish class DH(unittest.TestCase): def assertElementsEqual(self, e1, e2): self.assertEqual(hexlify(encodepoint(e1)), hexlify(encodepoint(e2))) def assertBytesE...
[ { "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
pure25519_blake2b/test_dh.py
orhanhenrik/python-pure25519-blake2b
# -*- coding: utf-8 -*- # filename: receive.py import xml.etree.ElementTree as ET def parse_xml(web_data): if len(web_data) == 0: return None xmlData = ET.fromstring(web_data) msg_type = xmlData.find('MsgType').text if msg_type == 'text': return TextMsg(xmlData) elif msg_type == 'i...
[ { "point_num": 1, "id": "all_function_names_snake_case", "question": "Are all function names in this file written in snake_case?", "answer": true }, { "point_num": 2, "id": "no_function_exceeds_5_params", "question": "Does every function in this file take 5 or fewer parameters (exclu...
3
server/wechat_service/receive.py
xiaotianyi/INTELLI-City
#!/usr/bin/env python #fileencoding=utf-8 import time import logging import hashlib from scaff import Scaffold def hash_pwd(pwd, salt): return hashlib.sha1(pwd+'|'+salt).hexdigest()[:16] class Runner(Scaffold): def main(self): logging.info('Start to build index...') self.db.user.ensure_index...
[ { "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
scripts/init.py
liangsun/firstblog
from os.path import exists def file_type(filepath): imexts = ['.png', '.bmp', '.jpg', 'jpeg'] if filepath.endswith('.hdf5') or filepath.endswith('.h5'): return 'hdf5' if filepath.endswith('.csv'): return 'csv' if filepath.endswith('.grm.raw'): return 'grm.raw' if filepath.e...
[ { "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
limix/io/util.py
fpcasale/limix
import signal import sys import threading from time import sleep import zmq context = zmq.Context() client = context.socket(zmq.REQ) def signal_handler(signal, frame): print('shutdown') sys.exit(0) def main(): client.connect("tcp://172.18.0.11:5091") client.send_string("") # Get the reply. ...
[ { "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
samples/zeromq/capabilities_request/__main__.py
Neoklosch/fog_node_prototype
import pygame, os, re, pygame.freetype from pygame.locals import * pygame.init() class resource_handler(object): def get_data_from_folder(self, data_dir, extension, iterfunc): data = [] for file in os.listdir(data_dir): if extension in file: data.append({ 'name': file,...
[ { "point_num": 1, "id": "every_class_has_docstring", "question": "Does every class in this file have a docstring?", "answer": false }, { "point_num": 2, "id": "more_functions_than_classes", "question": "Does this file define more functions than classes?", "answer": true }, { ...
3
game_data.py
EthanRiley/Arkon
from django import forms from .models import Event,Attendee from .utils import generate_event_url class CreateNewEvent(forms.ModelForm): class Meta(): model = Event fields = ['event_name', 'event_type', 'event_url'] widgets = { 'event_type': forms.TextInput(attrs={'class':'form-control ', }), 'event_name'...
[ { "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
records/forms.py
Chaitya62/E-Certificates
# Copyright 2017-2020 Amazon.com, Inc. or its affiliates. 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. A copy of # the License is located at # # http://aws.amazon.com/apache2.0/ # # or in the "license" fil...
[ { "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
src/sagemaker/user_agent.py
billdoors/sagemaker-python-sdk
# -*- coding: utf-8 -*- import json import redis from .base import BaseStatusWrapper _HOST = 'localhost' _PORT = '6379' _DB_ID = 0 _STATUS_KEY = "okq_status:{name}" class StatusWrapper(BaseStatusWrapper): """A wrapper for redis connection and custom methods""" def create_cnx(self, db_settings): 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
openkongqi/status/redisdb.py
libokj/openkongqi
#!/usr/bin/env python3 import os from setuptools import setup, find_packages def get_version(): from pyxrd.__version import __version__ if __version__.startswith("v"): __version__ = __version__.replace("v", "") return "%s" % __version__ def get_install_requires(): return [ 'setuptools...
[ { "point_num": 1, "id": "has_nested_function_def", "question": "Does this file contain any function defined inside another function?", "answer": false }, { "point_num": 2, "id": "every_function_has_docstring", "question": "Does every function in this file have a docstring?", "ans...
3
setup.py
PyXRD/pyxrd
# coding: utf-8 # 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"...
[ { "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
python/mxnet/optimizer/utils.py
mchoi8739/incubator-mxnet
# This file is part of Indico. # Copyright (C) 2002 - 2020 CERN # # Indico is free software; you can redistribute it and/or # modify it under the terms of the MIT License; see the # LICENSE file for more details. from __future__ import unicode_literals from flask import redirect, request, session from werkzeug.except...
[ { "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
indico/modules/events/static/controllers.py
tobiashuste/indico
from django.contrib.auth import get_user_model, authenticate from rest_framework import serializers from django.utils.translation import ugettext_lazy as _ class UserSerializer(serializers.ModelSerializer): '''Serializer for the user object''' class Meta: model = get_user_model() fields = ( ...
[ { "point_num": 1, "id": "more_functions_than_classes", "question": "Does this file define more functions than classes?", "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
app/user/serializers.py
grihenrik/django-recipe-app
import pytest class InvalidCharacterNameError(Exception): pass class InvalidClassNameError(Exception): pass class Character: pass VALID_CLASSES = ["sorcerer", "warrior"] def create_character(name: str, class_name: str) -> Character: """ Creates a new character and inserts it into the datab...
[ { "point_num": 1, "id": "every_class_has_docstring", "question": "Does every class in this file have a docstring?", "answer": false }, { "point_num": 2, "id": "all_function_names_snake_case", "question": "Are all function names in this file written in snake_case?", "answer": true...
3
Code Bundle/Chapter02/tests/test_checks.py
ghanigreen/pytest_code
import cryptops class Crypto: def __init__(self, key): self.key = key def apply(self, msg, func): return func(self.key, msg) crp=Crypto('secretkey') encrypted=crp.apply('hello world', cryptops.encrypt) decrypted=crp.apply(encrypted, cryptops.decrypt)
[ { "point_num": 1, "id": "all_params_annotated", "question": "Does every function parameter in this file have a type annotation (excluding self/cls)?", "answer": false }, { "point_num": 2, "id": "has_nested_function_def", "question": "Does this file contain any function defined inside...
3
Code/crypto.py
Tim-eyes/Beamer-Template-LaTex
""" Tests for Horizon service """ from unittest.mock import patch from click.testing import CliRunner import voithos.cli.service.horizon def test_horizon_group(): """ test the horizon group cli call """ runner = CliRunner() result = runner.invoke(voithos.cli.service.horizon.get_horizon_group()) asser...
[ { "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
test/cli/service/test_horizon.py
breqwatr/voidith