source
string
points
list
n_points
int64
path
string
repo
string
class Solution: def getPermutation(self, n, k): import math nums = range(1, n + 1) ans = '' k -= 1 while n > 0: n -= 1 index, k = divmod(k, math.factorial(n)) ans += str(nums[index]) nums.remove(nums[index]) return ans ...
[ { "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
PermutationSequence60.py
Bit64L/LeetCode-Python-
import numpy as np import matplotlib.pyplot as plt def plot_graph(x, y, fit): plt.figure() plt.scatter(x, y) if fit is not None: plt.plot(x, fit, '--') plt.tick_params(direction='in', top=True, right=True) plt.xlim(5, 9) plt.ylim(2, 16) plt.xticks(range(5, 10, 1)) # plt.yticks(...
[ { "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
Max2SAT_quantum/plot_av_inf_time_prob_n.py
puyamirkarimi/quantum-walks
# Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: MIT-0 """ Model for handling AWS accounts within the organization. The Account class allows you to create or update a new account. """ class Account: def __init__( self, full_name, ...
[ { "point_num": 1, "id": "all_params_annotated", "question": "Does every function parameter in this file have a type annotation (excluding self/cls)?", "answer": false }, { "point_num": 2, "id": "has_multiple_inheritance", "question": "Does any class in this file use multiple inherita...
3
src/lambda_codebase/initial_commit/bootstrap_repository/adf-build/provisioner/src/account.py
stevenjbridle/aws-deployment-framework
""" Entity module tests """ import unittest from txtai.pipeline import Entity class TestEntity(unittest.TestCase): """ Entity tests. """ @classmethod def setUpClass(cls): """ Create entity instance. """ cls.entity = Entity("dslim/bert-base-NER") def testEnt...
[ { "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": true },...
3
test/python/testpipeline/testentity.py
malywonsz/txtai
""" A triangle is an "almost right triangle" if one of its angles differs from 90 degrees by at most 15 degrees. A triangle is an "almost isosceles triangle" if two of its angles differ from each other by at most 15 degrees. Prove that all acute triangles are either almost right or almost isosceles. Note: if "at most ...
[ { "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
almost-triangles/almost-triangles.py
cdstanford/curiosities
# Copyright 2016-2021 Swiss National Supercomputing Centre (CSCS/ETH Zurich) # ReFrame Project Developers. See the top-level LICENSE file for details. # # SPDX-License-Identifier: BSD-3-Clause import reframe as rfm import reframe.utility.sanity as sn @rfm.simple_test class GpuDirectCudaCheck(rfm.RegressionTest): ...
[ { "point_num": 1, "id": "more_functions_than_classes", "question": "Does this file define more functions than classes?", "answer": true }, { "point_num": 2, "id": "has_nested_function_def", "question": "Does this file contain any function defined inside another function?", "answe...
3
cscs-checks/mch/gpu_direct_cuda.py
CLIP-HPC/reframe
from nose.tools import assert_equal, assert_raises class TestSolution(object): def test_find_busiest_period(self): solution = Solution() assert_raises(TypeError, solution.find_busiest_period, None) assert_equal(solution.find_busiest_period([]), None) data = [ Data(3, 2...
[ { "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
online_judges/busiest_period/test_find_busiest_period.py
rajatppn/interactive-coding-challenges
class CannotOverwriteExistingCassetteException(Exception): def __init__(self, *args, **kwargs): message = self._get_message(kwargs["cassette"], kwargs["failed_request"]) super(CannotOverwriteExistingCassetteException, self).__init__(message) def _get_message(self, cassette, failed_request): ...
[ { "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
vcr/errors.py
arthurHamon2/vcrpy
from _dependencies.graph import _Graph class _LazyGraph: def __init__(self, attrname, namespace): self.attrname = attrname self.namespace = namespace def __get__(self, instance, owner): graph = _Graph() for base in reversed(owner.__bases__): graph.update(base.__dep...
[ { "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
src/_dependencies/lazy.py
dry-python/dependencies
import os import sys import yaml from pyrfdata.file import File class Template: def __init__(self, loc, request): self.loc = loc self.request = request self.files = [] self.template_yml = None def load(self): template_file = open(self.loc, "r") self.template_ym...
[ { "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
src/pyrfdata/template.py
prasanna/pyrfdata
import os import random import sys """ Notes: - While this does the job it just defers the operation of summing - Let me add a bit more complexity: include a parameter which specifies at what value the sum should begin: sum_of_list(some_list, start_at=10) sum_of_list(list(range(1, 10)), start_at=20) should giv...
[ { "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
week6/problem0.py
jgathogo/python_level_1
def identity(f): return f @identity def foo(): return 'bar' def foo2(): return 'bar' foo2 = identity(foo2)
[ { "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
ch09/ch09_01/ch09_01.py
AngelLiang/the-hackers-guide-to-python-3rd-edition
from collections import OrderedDict from .utility import Utility from .base import OperatorLayerBase class RandPerm(OperatorLayerBase): def __init__(self, d): marker = eval(d.argMarker[0]) mod = marker['mod'] op = marker['op'] args = marker['args'] self.marker = marker self.mod_ = mod self.op_ = op ...
[ { "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
apex/pyprof/prof/randomSample.py
oyj0594/apex
""" Module: 'ds18x20' on esp8266 v1.9.4 """ # MCU: (sysname='esp8266', nodename='esp8266', release='2.2.0-dev(9422289)', version='v1.9.4-8-ga9a3caad0 on 2018-05-11', machine='ESP module with ESP8266') # Stubber: 1.1.2 - updated from typing import Any class DS18X20: """""" def convert_temp(self, *argv) -> Any...
[ { "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
stubs/micropython-v1_9_4-esp8266/ds18x20.py
mattytrentini/micropython-stubs
from typing import Generic, Iterable, List, TypeVar from gevent.event import Event from gevent.queue import Queue T = TypeVar("T") class NotifyingQueue(Event, Generic[T]): """This is not the same as a JoinableQueue. Here, instead of waiting for all the work to be processed, the wait is for work to be availa...
[ { "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
raiden/utils/notifying_queue.py
tirkarthi/raiden
import uuid from starlette.datastructures import URLPath, URL from starlette.requests import Request from . import config from .models import User, db def get_user_id(request: Request): uid = request.session.get("uid") # noinspection PyBroadException try: return uuid.UUID(hex=uid) except Exc...
[ { "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
src/fencex/utils.py
uc-cdis/fencex
from flask import Flask, g app = Flask(__name__) # arg = 'i' @app.before_request def sd(): arg = 123 bf(arg) def bf(arg): # global arg g.x = arg return arg @app.route("/index", methods=["POST", "GET"]) def index(): g.x = 123 return "index" @app.route("/test", methods=["POST", "GET"]...
[ { "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
test1/test2/test27.py
qwert-f/flask
from itertools import permutations def isPrimery(n: int): i = 2 while i * i <= n: if n % i == 0: return False i += 1 return True def solution(numbers: str) -> int: numbers = list(numbers) l = len(numbers) comb = set() for i in range(1, l + 1): comb |= ...
[ { "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
programmers/lv2/42839.py
KLumy/Basic-Algorithm
class Solution: def isAlienSorted(self, words: List[str], order: str) -> bool: if len(words) <= 1: return True self.dic = {} for i, char in enumerate(order): self.dic[char] = i for i in range(1, len(words)): if self.cmp(words[i], words[i-1]) == -1:...
[ { "point_num": 1, "id": "all_params_annotated", "question": "Does every function parameter in this file have a type annotation (excluding self/cls)?", "answer": false }, { "point_num": 2, "id": "has_multiple_inheritance", "question": "Does any class in this file use multiple inherita...
3
LeetCode/953. Verifying an Alien Dictionary.py
QinganZhao/LXXtCode
import unittest import theano import theano.tensor as T import numpy as np from layers.svm import SVMLayer def compile_objective(): scores = T.matrix() y_truth = T.ivector() objective, acc = SVMLayer.objective(scores, y_truth) return theano.function([scores, y_truth], [objective, acc]) def objec...
[ { "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
src/tests/svm.py
shoaibahmed/pl-cnn
""" Budget module """ class Budget: """ Create a budget for placing bets """ def __init__(self, balance: float = 0.00, period: str = "Day") -> None: """ Initialize the budget object >>> budget = Budget() >>> budget <__main__.Budget object at 0x...> >>> budget....
[ { "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": "no_function_exceeds_5_params", "question": "Does every function in this file take 5 or few...
3
gamepicker/budget.py
rouleau/gamepicker
# 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": "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
jdcloud_sdk/services/vm/apis/DeleteImageRequest.py
jdcloud-apigateway/jdcloud-sdk-python
from scheduler import Scheduler from collections import deque class Spn(Scheduler): name = "Shortest Process Next (SPN)" ejecutados = [] ejecutados_visual = "" def __init__(self,procesos=[]): self.spn_queue = deque() self.t = procesos[0].arrvl_time self.procesos = procesos ...
[ { "point_num": 1, "id": "more_functions_than_classes", "question": "Does this file define more functions than classes?", "answer": true }, { "point_num": 2, "id": "all_function_names_snake_case", "question": "Are all function names in this file written in snake_case?", "answer": ...
3
tareas/3/ManzanaresJorge-SalazarJesus/spn.py
jorgelmp/sistop-2022-1
import requests import json from pathlib import Path class _networkCalc(): apiAddress = "https://networkcalc.com/api" def __init__(self, ca=None, requestTimeout=15): self.requestTimeout = requestTimeout if ca != None: if type(ca) is str: self.ca = str(Path(ca)) ...
[ { "point_num": 1, "id": "has_nested_function_def", "question": "Does this file contain any function defined inside another function?", "answer": false }, { "point_num": 2, "id": "no_function_exceeds_5_params", "question": "Does every function in this file take 5 or fewer parameters (...
3
includes/networkCalc.py
z1pti3/jimiPlugin-networkCalc
from timem import profile if __name__ == "__main__": @profile(memory=False) def delay(secs): import time time.sleep(secs) @profile(timer=False) def isPal(s): return s == s[::-1] @profile def hello_world(): print("hello world!") print(isPal("OOO")) ...
[ { "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
example.py
TanayKarve/timem
from otree.api import * doc = """ Select a random round for payment """ class C(BaseConstants): NAME_IN_URL = 'pay_random_round' PLAYERS_PER_GROUP = None NUM_ROUNDS = 4 ENDOWMENT = cu(100) class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): ...
[ { "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
pay_random_round/__init__.py
oTree-org/snippets
# # @lc app=leetcode id=118 lang=python3 # # [118] Pascal's Triangle # # @lc code=start class Solution: def generate(self, numRows: int) -> [[]]: # 当numRows为0时, 返回空list if not numRows: return [] elif numRows == 1: return [[1]] elif numRows == 2: return [[1], [1,1]] # 注意为res...
[ { "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
leetcode/118/118.pascals-triangle.py
Yu-Ren-NEU/Leetcode
import boto3, botocore from botocore.client import ClientError from config import BUCKET_NAME # from config import S3_KEY, S3_SECRET, S3_BUCKET # s3 = boto3.client( # "s3", # # aws_access_key_id=S3_KEY, # # aws_secret_access_key=S3_SECRET # ) s3 = boto3.client("s3") from botocore.client import ClientError ...
[ { "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
backend/utils/helpers.py
hemanth346/laghu.ai
import shutil import tempfile import zlib from mediaman.middleware import abstract class CompressionMiddlewareService(abstract.SimpleMiddleware): def compress(self, file_path): tempfile_ref = tempfile.NamedTemporaryFile(mode="wb+") with open(file_path, "rb") as infile: tempfile_ref....
[ { "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
mediaman/middleware/compression.py
MattCCS/MediaMan
from airflow.hooks.postgres_hook import PostgresHook # select session, count(*) from timeout_err_20200726 where error = 'null' group by session # select error, count(*) from timeout_err_20200726 group by error def push_message(instance, message): print(f'Push message: error_count={message}') instance.xcom_pus...
[ { "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
dags/count_errors.py
parampavar/airflow
import pytest from os.path import join import pandas as pd from delphi_utils import read_params from delphi_nchs_mortality.pull import pull_nchs_mortality_data params = read_params() export_start_date = params["export_start_date"] export_dir = params["export_dir"] static_file_dir = params["static_file_dir"] token =...
[ { "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
nchs_mortality/tests/test_pull.py
JedGrabman/covidcast-indicators
class Converters: @staticmethod def as_string(line): return line @staticmethod def as_integer(line): return int(line)
[ { "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
python-advent-of-code/advent/utilities/converters.py
AKiwiCoder/advent-of-code
import ast import tokenize from io import StringIO import pytest from pandas_dev_flaker.__main__ import run def results(s): return { "{}:{}: {}".format(*r) for r in run( ast.parse(s), list(tokenize.generate_tokens(StringIO(s).readline)), ) } @pytest.mark.par...
[ { "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/numpy_random_test.py
vrserpa/pandas-dev-flaker
# Copyright (c) 2021. # The copyright lies with Timo Hirsch-Hoffmann, the further use is only permitted with reference to source import urllib.request from RiotGames.API.RiotApi import RiotApi class Match(RiotApi): __timeline_by_match_id_url: str = "https://{}.api.riotgames.com/lol/match/v4/timelines/by-matc...
[ { "point_num": 1, "id": "has_nested_function_def", "question": "Does this file contain any function defined inside another function?", "answer": false }, { "point_num": 2, "id": "more_functions_than_classes", "question": "Does this file define more functions than classes?", "answ...
3
RiotGames/API/Match.py
Timohiho/RiotGames
class DemoManager(object): def __enter__(self): pass def __exit__(self, ex_type, ex_value, ex_tb): if ex_type is IndexError: print(ex_value.__class__) return True if ex_type is TypeError: print(ex_value.__class__) return # return None w...
[ { "point_num": 1, "id": "more_functions_than_classes", "question": "Does this file define more functions than classes?", "answer": true }, { "point_num": 2, "id": "has_nested_function_def", "question": "Does this file contain any function defined inside another function?", "answe...
3
magic_method_3.py
godontop/python-work
import librosa import os class SoundModel: def split_file(self, file, output_file, duration=0.4): if os.path.isfile(file): os.system( "ffmpeg -i " + file + " -f segment -segment_time " + str( duration) + " -c copy " + output_file) else: ...
[ { "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
Models/SoundModel.py
xuhaoteoh/car-sound-classification-with-keras
""" Ory APIs Documentation for all public and administrative Ory APIs. Administrative APIs can only be accessed with a valid Personal Access Token. Public APIs are mostly used in browsers. # noqa: E501 The version of the OpenAPI document: v0.0.1-alpha.42 Contact: support@ory.sh Generated by: htt...
[ { "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
clients/client/python/test/test_project_patch.py
russelg/sdk
#!/usr/bin/env python import os import sys import slackweb username = 'CircleCI' icon_url = 'https://i.imgur.com/FLjAA35.png' def main(): message = sys.argv[1] if message == 'started': _notify('Deploy started', '#66d3e4') elif message == 'successful': _notify('Deploy successful', '#41aa5...
[ { "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
scripts/notify.py
pine/eg-web-appview
_EPSILON = 0.00001 def assert_count(collection, count): """Asserts number of items in the collection.""" assert len(collection) == count, \ f"count {len(collection)} is not equal to {count}" def assert_float(actual, expected): """Asserts that two floats are equal.""" assert equal(actual,...
[ { "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
features/steps/asserts.py
cloose/ray-tracer-challenge
import unittest import larcv from random import Random random = Random() # Testing import of Point.h objects: def test_import_Point_h(): pt = larcv.Point2D() pt = larcv.Point3D() def test_import_BBox_h(): bb = larcv.BBox2D() bb = larcv.BBox3D() # Testing import of Vertex.h objects: def test_impor...
[ { "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
tests/larcv/core/dataformat/test_dataformat_binding.py
zhulcher/larcv3
import torch import torch.nn as nn import torch.nn.functional as F import numpy as np from LovaszSoftmax.pytorch.lovasz_losses import lovasz_hinge class SoftDiceLoss(nn.Module): def __init__(self): super(SoftDiceLoss, self).__init__() def forward(self, input, target): smooth = 1e-5 i...
[ { "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
losses.py
4uiiurz1/kaggle-tgs-salt-identification-challenge
# Note: This Queue class is sub-optimal. Why? class Queue(): def __init__(self): self.queue = [] def enqueue(self, value): self.queue.append(value) def dequeue(self): if self.size() > 0: return self.queue.pop(0) else: return None def size(self): ...
[ { "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
projects/graph/util.py
Nolanole/Graphs
# problem 37 # Project Euler __author__ = 'Libao Jin' __date__ = 'July 17, 2015' def rotateDigits(number): string = str(number) rotatedString = string[::-1] rotatedNumber = int(rotatedString) return rotatedNumber def isSymmetrical(number): rotatedNumber = rotateDigits(number) if rotatedNumber == number: ret...
[ { "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
Python/Project.Euler/Answers.Python/36.py
jinlibao/toolkits
from typing import Union, Optional, Callable, Dict, Mapping, TypeVar, Type from types import MappingProxyType import yaml from mashumaro.serializer.base import DataClassDictMixin DEFAULT_DICT_PARAMS = { 'use_bytes': False, 'use_enum': False, 'use_datetime': False } EncodedData = Union[str, bytes] Encode...
[ { "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
mashumaro/serializer/yaml.py
LegartisTech/mashumaro
from sklearn.cluster import KMeans from sklearn.cluster import MiniBatchKMeans import matplotlib.pyplot as plt def plot_clustering(data): ''' Definition: This function plot the squared error for the clustered points args: data to be clusterd returns: None ''' cost =[] max_clusters = 20 for i ...
[ { "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
cluster.py
vgp314/Udacity-Arvato-Identify-Customer-Segments
from pwn import * # context.terminal = ['tmux', 'split', '-h'] # context.log_level = 'debug' p = process('./hack') # p = remote('127.0.0.1', 23455) def addi(size, content): p.sendlineafter('choice>', '1') p.sendlineafter('size>', str(size)) p.sendlineafter('content>', content) def deli(index): p.sen...
[ { "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
lab12/heap_hack/exp.py
leitianjian/CS323-Compilers
import warnings warnings.simplefilter('ignore') from pygments.lexers import LEXERS, get_lexer_by_name warnings.resetwarnings() from pygments import highlight from pygments.formatters import HtmlFormatter from pprint import pprint import re from django.utils.encoding import smart_unicode class ListHtmlFormatter(HtmlFor...
[ { "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
django_pygments/utils.py
octomike/hellodjango
import json import os import boto3 print('Loading function') def init(): print('init() enter') my_config = json.loads(os.environ['botoConfig']) from botocore import config config = config.Config(**my_config) global personalize personalize = boto3.client('personalize', config=config) def la...
[ { "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
src/offline/lambda/check-batch-inference-job-status-lambda.py
jjin-2019/recommender-system-dev-workshop-code
import numpy as np import matplotlib.pyplot as plt from matplotlib.widgets import Slider from kalman_filter import KalmanFilter raw_data = np.loadtxt("barometer_data.txt") # Truncate raw data (it's super long) raw_data = raw_data[:raw_data.size//4] raw_data_step = np.loadtxt("barometer_data_step.txt") t1 = np.arange(0...
[ { "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
test_data/barometer_kalman.py
theo-brown/ahrs
import pyradox import re def get_units(beta = False): game = 'HoI4_beta' if beta else 'HoI4' return pyradox.parse_merge('common/units', game = game, merge_levels = 1)['sub_units'] def get_technologies(beta = False): game = 'HoI4_beta' if beta else 'HoI4' return pyradox.parse_merge('common/tec...
[ { "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
scripts/hoi4/hoi4/load.py
SaucyPigeon/pyradox
# -*- coding:UTF-8 -*- # Author:Tiny Snow # Date: Fri, 26 Feb 2021, 00:55 # Project Euler # 060 Prime pair sets #==================================================================Solution import os, sys BASE_DIR = os.path.dirname(os.path.abspath(__file__)) sys.path.append(BASE_DIR) sys.path.append(BASE_DIR.partition('...
[ { "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
PE-Python/P060/P060.py
Tiny-Snow/Project-Euler-Problem-Solutions
#!/usr/bin/env python # Copyright Singapore-MIT Alliance for Research and Technology import re from point import Point class Polyline(Point): regexp = re.compile("aimsun::polyline section-id=(\d+), x=(\d+), y=(\d+)") def __init__(self, x, y, section): super(Polyline, self).__init__(x, y) sel...
[ { "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
dev/tools/snake-eye/polyline.py
gusugusu1018/simmobility-prod
from collections import namedtuple import numpy as np import talib from jesse.helpers import get_candle_source, np_shift from jesse.helpers import slice_candles GATOR = namedtuple('GATOR', ['upper', 'lower', 'upper_change', 'lower_change']) def gatorosc(candles: np.ndarray, source_type: str = "close", sequential: ...
[ { "point_num": 1, "id": "every_function_has_docstring", "question": "Does every function in this file have a docstring?", "answer": true }, { "point_num": 2, "id": "all_params_annotated", "question": "Does every function parameter in this file have a type annotation (excluding self/c...
3
jesse/indicators/gatorosc.py
slipperlobster/flipper
# Copyright 2012 Nebula, Inc. # Copyright 2013 IBM Corp. # # 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...
[ { "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
nova/tests/functional/api_sample_tests/test_fping.py
zjzh/nova
from backtest.indicators.StochRSI import StochRSI import backtrader as bt from backtest.indicators.ConnorsRSI import ConnorsRSI class CRSI(bt.Strategy): params = (("ratio", 0.2),) def __init__(self) -> None: super().__init__() self.rsi = ConnorsRSI(self.data) def next(self): posi...
[ { "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
backtest/strategies/RSI.py
webclinic017/bitrush
# coding=utf-8 from thenounproject.client import Client from thenounproject.models import Collection as CollectionModel from thenounproject.models import Icon as IconModel class User(Client): def __init__(self, **kwargs): super(User, self).__init__(**kwargs) self.url = "user" def collections...
[ { "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
thenounproject/user.py
yakupadakli/python-thenounproject
import pytest from gaphor.core.modeling import NamedElement, Presentation from gaphor.diagram.general import Box, CommentLineItem, Ellipse, Line from gaphor.diagram.presentation import Classified, Named from gaphor.diagram.support import get_model_element from gaphor.UML import Classifier, diagramitems def _issubcla...
[ { "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
gaphor/UML/tests/test_diagramitems.py
seryafarma/gaphor
import pytest import torch import torch.nn.functional as F from lean_transformer.utils import pad_to_multiple, GELU import numpy as np @pytest.mark.forked def test_pad_to_multiple(): x = torch.randn(3, 3) assert pad_to_multiple(x, multiple=3, dims=0) is x assert pad_to_multiple(x, multiple=3, dims=1) is ...
[ { "point_num": 1, "id": "has_nested_function_def", "question": "Does this file contain any function defined inside another function?", "answer": false }, { "point_num": 2, "id": "every_function_has_docstring", "question": "Does every function in this file have a docstring?", "ans...
3
tests/test_utils.py
krunt/lean_transformer
class Solution: def twoSum(self, nums, target): """ :type nums: List[int] :type target: int :rtype: List[int] """ d = {} for i in range(0, len(nums)): if nums[i] in d: return [d[nums[i]], i] d[target - nums[i]] = i 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
python/hash_table/0001_two_sum.py
linshaoyong/leetcode
def reverseList(head, tail): prev = None while prev != tail: prev, prev.next, head = head, prev, head.next return prev def reverseNodesInKGroups(l, k): if k < 2: return l p = ListNode(-1) p.next = l ret = p while True: flag = True tmp = p for i ...
[ { "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
WEEKS/wk19/sprint-prep/prac/gists/reverseNodesInKGroups.py
webdevhub42/Lambda
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class Eztrace(AutotoolsPackage): """EZTrace is a tool to automatically generate execution traces...
[ { "point_num": 1, "id": "has_multiple_inheritance", "question": "Does any class in this file use multiple inheritance?", "answer": false }, { "point_num": 2, "id": "every_function_has_docstring", "question": "Does every function in this file have a docstring?", "answer": false ...
3
var/spack/repos/builtin/packages/eztrace/package.py
robertodr/spack
from chatbot.common.chat_share_data import ShareData from chatbot.common.chat_knowledge_mem_dict import ChatKnowledgeMemDict class EntityRegex(ShareData): def __init__(self, cb_id): self.cb_id = cb_id def parse(self, data): 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": "more_functions_than_classes", "question": "Does this file define more functions than classes?", "answer": true }...
3
skp_edu_docker/code/chatbot/nlp/entity_regexp.py
TensorMSA/hoyai_docker
#!/usr/bin/python3 import sys # dueling generators # two generators, A and B # same algorithm: take prev value, multiply by factor, # divide by 2147483647, keep remainder # generator A uses factor of 16807, B uses 48271 # example: A starts with 65 and B starts with 8921 # if lowest 16 bits of both values match, incr...
[ { "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
Day15b/Day15b.py
mathuin/advent-of-code-2017
from abc import ABC, abstractclassmethod class DriverInterface(ABC): @abstractclassmethod def start(self) -> object: raise NotImplementedError() @abstractclassmethod def getContent(self) -> str: raise NotImplementedError() @abstractclassmethod def goTo(self) -> None: ...
[ { "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
workerInfra/domain/driverInterface.py
jtom38/newsbot.worker
# Import controller file from controllers import controllers # Router endpoint def router(app, parser, line_bot_api): @app.route("/", methods=['GET']) def index(): return controllers.index() @app.route("/", methods=['POST']) def callback(): return controllers.handler(app,parser,line_bot...
[ { "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
router/router.py
CEB2017/Gabot
# -*- coding: utf-8 -*- from qcloudsdkcore.request import Request class CdbTdsqlAssignToProjectRequest(Request): def __init__(self): super(CdbTdsqlAssignToProjectRequest, self).__init__( 'tdsql', 'qcloudcliV1', 'CdbTdsqlAssignToProject', 'tdsql.api.qcloud.com') def get_cdbInstanceIds(sel...
[ { "point_num": 1, "id": "more_functions_than_classes", "question": "Does this file define more functions than classes?", "answer": true }, { "point_num": 2, "id": "all_function_names_snake_case", "question": "Are all function names in this file written in snake_case?", "answer": ...
3
qcloudsdktdsql/CdbTdsqlAssignToProjectRequest.py
f3n9/qcloudcli
# -*- coding: utf-8 -*- """ Created on Sun Sep 23 2018 @author: Emily """ import http.server as https import logging import json import api_token def parseCeleryScript(contentDict): return None def apiHandleCeleryScript(httpHandler): requestContent = httpHandler.getRequestContent() logging.getLogger(...
[ { "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
raspberry-server/src/api_celery_scripts.py
EmilyTripoul/WeedDetection
# emacs: at the end of the file # ex: set sts=4 ts=4 sw=4 et: # ## ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### # """ Stub file for a guaranteed safe import of duecredit constructs: if duecredit is not available. To use it, place it into your project codebase to be imported, e.g. copy as ...
[ { "point_num": 1, "id": "more_functions_than_classes", "question": "Does this file define more functions than classes?", "answer": true }, { "point_num": 2, "id": "all_function_names_snake_case", "question": "Are all function names in this file written in snake_case?", "answer": ...
3
{{ cookiecutter.repo_name }}/{{ cookiecutter.repo_name }}/due.py
gpnlab/cookiecutter-gpnlab
from django.contrib.contenttypes import generic from django.contrib.contenttypes.models import ContentType from django.contrib.auth.models import User from django.db import models from voting.managers import VoteManager SCORES = ( (u'+1', +1), (u'-1', -1), ) class Vote(models.Model): """ ...
[ { "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_class_has_docstring", "question": "Does every class in this file have a docstring?", "answer": false...
3
colab/apps/voting/models.py
caseywstark/colab
"""Adding parent duns number and name to (Published)AwardFinancialAssistance Revision ID: 1fabe0bdd48c Revises: 6973101b6853 Create Date: 2018-03-27 15:07:45.721751 """ # revision identifiers, used by Alembic. revision = '1fabe0bdd48c' down_revision = '6973101b6853' branch_labels = None depends_on = None from alemb...
[ { "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
dataactcore/migrations/versions/1fabe0bdd48c_adding_parent_duns_number_and_name_to_.py
brianherman/data-act-broker-backend
import requests from flask import Flask, Response, jsonify from flask import request as flask_request from flask_caching import Cache from ddtrace import tracer, patch from ddtrace.contrib.flask import TraceMiddleware from bootstrap import create_app from models import Thought from time import sleep patch(redis=T...
[ { "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
apm/step05/thinker.py
l0k0ms/TrainingEnvironment
import os import torch import torch.utils.data import numpy as np import skimage.io import skimage.transform MNIST_CLASSES = ( "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" ) class MNISTMetaData(): def __init__(self): self.cls = MNIST_CLASSES def get_num_clas...
[ { "point_num": 1, "id": "more_functions_than_classes", "question": "Does this file define more functions than classes?", "answer": true }, { "point_num": 2, "id": "all_function_names_snake_case", "question": "Are all function names in this file written in snake_case?", "answer": ...
3
datasets/mnist.py
ubc-vision/mist
# coding:utf-8 __author__ = "gaunt" import enum # layui页面框架的表格成功标识 layui_table_code = 0 class BaseEnum(enum.Enum): pass class ResultEnum(BaseEnum): success = {"code": 200, "msg": "操作成功"} error = {"code": 500, "msg": "操作失败"} error400 = {"code": 400, "msg": "400 - 请求参数错误"} error401 = {"code": 4...
[ { "point_num": 1, "id": "more_functions_than_classes", "question": "Does this file define more functions than classes?", "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
enums.py
chenghao/haoAdmin
import objc from Foundation import * from AppKit import * from PyObjCTools import NibClassBuilder, AppHelper class StatusBar(NSObject): def setFront(self): NSRunningApplication.currentApplication_().activateWithOptions_(NSApplicationActivateIgnoringOtherApps) def applicationDidFinishLaunching_(self, n...
[ { "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
pyRotateDisplayStatusBar.py
Licht-T/pyRotateDisplayForMac
"""This is an example app, demonstrating usage.""" import os from flask import Flask from flask_jsondash.charts_builder import charts app = Flask(__name__) app.config['SECRET_KEY'] = 'NOTSECURELOL' app.config.update( JSONDASH_FILTERUSERS=False, JSONDASH_GLOBALDASH=True, JSONDASH_GLOBAL_USER='global', ) ...
[ { "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
example_app/app.py
quanpower/flask_jsondash
#!/usr/bin/env python # -*- coding:utf-8 -*- # Author: Donny You(youansheng@gmail.com) from __future__ import absolute_import from __future__ import division from __future__ import print_function from models.backbones.resnet.resnet_backbone import ResNetBackbone from models.backbones.mobilenet.mobilenet_backbone imp...
[ { "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
models/backbones/backbone_selector.py
diceryas/torchcv-seg
# Developed by Alexander Bersenev from Hackerdom team, bay@hackerdom.ru """Common functions and consts that are often used by other scripts in this directory""" import subprocess import sys import time import os import shutil # change me before the game ROUTER_HOST = "127.0.0.1" SSH_OPTS = [ "-o", "StrictHostK...
[ { "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
deploy/ansible/roles/cloud_master/files/api_srv/cloud_common.py
vient/proctf-2019
from easilyb.urlselector import UrlSelector from easilyb.net.requestqueue import Requester from lxml.html import fromstring import logging logger = logging.getLogger(__name__) def _crawler_callback(resp, index=None): url,counter, depth, crawler = index crawler._parse_response(url, depth, resp) class LxmlX...
[ { "point_num": 1, "id": "more_functions_than_classes", "question": "Does this file define more functions than classes?", "answer": true }, { "point_num": 2, "id": "has_nested_function_def", "question": "Does this file contain any function defined inside another function?", "answe...
3
easilyb/crawler/__init__.py
xaled/easilyb
from .Farm import Farm from jumpscale import j JSBASE = j.application.jsbase_get_class() class FarmFactory(JSBASE): def __init__(self): self.__jslocation__ = "j.sal_zos.farm" JSBASE.__init__(self) def get(self, farmer_iyo_org): """ Get sal for farm Arguments: ...
[ { "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
JumpscaleLib/sal_zos/farm/FarmFactory.py
threefoldtech/jumpscale_lib9
""" Define custom exceptions for the API """ class ApiException(Exception): status_code = 500 def __init__(self, message, status_code=None, payload=None): Exception.__init__(self) self.message = message if status_code is not None: self.status_code = status_code self...
[ { "point_num": 1, "id": "has_nested_function_def", "question": "Does this file contain any function defined inside another function?", "answer": false }, { "point_num": 2, "id": "no_function_exceeds_5_params", "question": "Does every function in this file take 5 or fewer parameters (...
3
server/python/exceptions.py
GjjvdBurg/wrattler
import fastapi as _fastapi import fastapi.encoders as _encoders import fastapi.responses as _responses import services as _services app = _fastapi.FastAPI() @app.get("/programmer-memes") def get_programmer_meme(): image_path = _services.select_random_image("ProgrammerHumor") return _responses.FileResponse(...
[ { "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/main.py
sixfwa/fastapi-memes
from ..service import Service from ..exception import TombaException class Count(Service): def __init__(self, client): super(Count, self).__init__(client) def email_count(self, domain): """get Email Count""" if domain is None: raise TombaException('Missing required param...
[ { "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
tomba/services/count.py
tomba-io/python
# import custom forms libraries from flask_wtf import FlaskForm # import classes for form field types from wtforms import PasswordField, StringField, SubmitField, ValidationError from wtforms.validators import DataRequired, Email, EqualTo # import db query class to 'user' table from ..models import User # define r...
[ { "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": false ...
3
kharon/auth/forms.py
tommmmi/Universal-Mapper
from sqlalchemy import ForeignKey, Enum, Sequence from sqlalchemy.orm import relationship, backref from extensions import db class Person(db.Model): __tablename__ = 'person' id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(), nullable=False) def __repr__(self): return ...
[ { "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
models.py
Tomvictor/KochiPython
"""empty message Revision ID: 275b21a69463 Revises: Create Date: 2019-08-21 08:19:09.908339 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '275b21a69463' down_revision = None branch_labels = None depends_on = None def upgrade(): # ### commands auto gene...
[ { "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_nested_function_def", "question": "Does this file contain any function defined inside another function?", ...
3
parrot/alembic/versions/275b21a69463_.py
chicken-house/parrot
# Copyright 2015 Isotoma Limited # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing...
[ { "point_num": 1, "id": "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
touchdown/aws/apigateway/rest_api.py
yaybu/touchdown
from torch import nn from cvpods.layers import ShapeSpec from cvpods.modeling.backbone import Backbone from cvpods.modeling.backbone import build_resnet_backbone from cvpods.utils import comm from barlow_twins import BarlowTwins def build_backbone(cfg, input_shape=None): """ Build a backbone from `cfg.MODE...
[ { "point_num": 1, "id": "no_function_exceeds_5_params", "question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?", "answer": true }, { "point_num": 2, "id": "all_params_annotated", "question": "Does every function parameter in this file have a ty...
3
examples/barlowtwins/BarlowTwins.res50.imagenet.256bs.224size.300e/net.py
poodarchu/SelfSup
import threading import sys is_py2 = sys.version[0] == '2' if is_py2: import Queue as queue else: import queue as queue def isScalar(x): return not isinstance(x, (list, tuple)) def isList(x): return isinstance(x, (list)) def asString(x): return str(x) def makeDict(): return {'a': 1.0, 'c': 3.0, 'b': ...
[ { "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
inst/python/rpytools/test.py
bjungbogati/reticulate
import sys import os sys.path.append(os.path.abspath(".")) sys.dont_write_bytecode = True __author__ = "COSAL" from misconceptions.rUtils import functions def process_file(file_path): r_functions = functions.get_r_functions(file_path) n_valid = 0 print("Processing %d functions from '%s' ... " % (len(r_funct...
[ { "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
code/src/main/python/expt/test_R.py
anonfse/COSAL_Anonymized
import itertools from aocd import get_data, submit DAY = 8 YEAR = 2021 def part1(data: str) -> str: lines = data.splitlines() ans = 0 for line in lines: left, right = line.split('|') segments = left.split(' ') code = right.split(' ') for item in code: if len(it...
[ { "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
days/day8.py
vanHavel/AdventOfCode2021
import numpy as np from numpy.testing import assert_allclose from scipy.stats import norm from astroML.density_estimation import\ EmpiricalDistribution, FunctionDistribution def test_empirical_distribution(N=1000, rseed=0): np.random.seed(rseed) X = norm.rvs(0, 1, size=N) dist = EmpiricalDistribution(...
[ { "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
astroML/density_estimation/tests/test_empirical.py
aragilar/astroML
from cumulus.chain import step from cumulus.util.template_query import TemplateQuery from troposphere import autoscaling class BlockDeviceData(step.Step): def __init__(self, volume): step.Step.__init__(self) self.volume = volume def handle(self, chain_context): launc...
[ { "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
cumulus/steps/ec2/block_device_data.py
john-shaskin/cumulus
import pytest import stix2generator.exceptions def test_string(object_generator, num_trials): for _ in range(num_trials): value = object_generator.generate_from_spec({ "type": "string", "minLength": 1, "maxLength": 5 }) assert 1 <= len(value) <= 5 ...
[ { "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
stix2generator/test/test_object_generator_string.py
majacQ/cti-stix-generator
class ImapToolsError(Exception): """Base lib error""" class MailboxFolderStatusValueError(ImapToolsError): """Wrong folder status value error""" class UnexpectedCommandStatusError(ImapToolsError): """Unexpected status in IMAP command response""" def __init__(self, command_result: tuple, expected: s...
[ { "point_num": 1, "id": "every_function_has_docstring", "question": "Does every function in this file have a docstring?", "answer": false }, { "point_num": 2, "id": "has_multiple_inheritance", "question": "Does any class in this file use multiple inheritance?", "answer": false ...
3
imap_tools/errors.py
unqx/imap_tools
# -*- coding: utf-8 -*- """ Created on Wed Jul 29 17:52:00 2020 @author: hp """ import cv2 import numpy as np def get_face_detector(modelFile = "models/res10_300x300_ssd_iter_140000.caffemodel", configFile = "models/deploy.prototxt"): """ Get the face detection caffe model of OpenCV's D...
[ { "point_num": 1, "id": "every_function_has_docstring", "question": "Does every function in this file have a docstring?", "answer": true }, { "point_num": 2, "id": "all_params_annotated", "question": "Does every function parameter in this file have a type annotation (excluding self/c...
3
face_detector.py
testinground/Proctoring-AI
from django.db import models from django.conf import settings import datetime from django.db import models from django.db.models import permalink # Create your models here. class Org(models.Model): name = models.CharField(max_length=50, unique=True) created_date = models.DateTimeField(auto_now_add=True, null=...
[ { "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
org/models.py
Ortus-Team/Moim
import logging import os import shutil import subprocess logger = logging.getLogger("Main") def configure_argument_parser(environment, configuration, subparsers): # pylint: disable = unused-argument parser = subparsers.add_parser("test", help = "run the test suite") parser.add_argument("--configuration", required...
[ { "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
development/commands/test.py
BenjaminHamon/Overmind.ImageManager
# The client could call service directly # but only in other service or main threading. import requests class Client: """ 通过 TDD 的方式,允许自己编写 SDK """ def __init__(self, service_name) -> None: self.service_name = service_name self.served = False def get(self, url, data): ""...
[ { "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
micro/client.py
Svtter/micro
import libtmux def ensure_server() -> libtmux.Server: ''' Either create new or return existing server ''' return libtmux.Server() def spawn_session(name: str, kubeconfig_location: str, server: libtmux.Server): if server.has_session(name): return else: session = server.new_ses...
[ { "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
kmux/tmux.py
kiemlicz/kmux
from abc import abstractmethod from test.stubs.sublime import View class TextCommand: def __init__(self): self.view = View() @abstractmethod def run(self, edit): raise NotImplementedError class EventListener: pass class WindowCommand: def __init__(self, window): self....
[ { "point_num": 1, "id": "every_function_has_docstring", "question": "Does every function in this file have a docstring?", "answer": false }, { "point_num": 2, "id": "has_multiple_inheritance", "question": "Does any class in this file use multiple inheritance?", "answer": false ...
3
test/stubs/sublime_plugin.py
jtsternberg/gist