source
string
points
list
n_points
int64
path
string
repo
string
#!/usr/bin/env python # encoding: utf-8 """ copyright (c) 2016-2017 Earth Advantage. All rights reserved ..codeauthor::Paul Munday <paul@paulmunday.net> """ # Setup # Constants # Data Structure Definitions # Private Functions # Public Classes and Functions class APIClientError(Exception): """Indicates erro...
[ { "point_num": 1, "id": "more_functions_than_classes", "question": "Does this file define more functions than classes?", "answer": true }, { "point_num": 2, "id": "every_class_has_docstring", "question": "Does every class in this file have a docstring?", "answer": true }, { ...
3
pyseed/exceptions.py
SEED-platform/py-seed
from polyphony import testbench class D: def __init__(self, x): self.x = x class C: def __init__(self, x, y): self.d1 = D(x) self.d2 = D(y) def composition02(x, y): c = C(x, y) a = c.d1.x + c.d2.x c.d1.x = 10 return a + c.d1.x @testbench def test(): assert 13 == c...
[ { "point_num": 1, "id": "all_function_names_snake_case", "question": "Are all function names in this file written in snake_case?", "answer": true }, { "point_num": 2, "id": "more_functions_than_classes", "question": "Does this file define more functions than classes?", "answer": ...
3
tests/class/composition02.py
ktok07b6/polyphony
# -*- coding: utf-8 -*- """ Created on Tue Jan 03 13:30:41 2012 @author: jharston """ import webapp2 as webapp from google.appengine.ext.webapp.util import run_wsgi_app from google.appengine.ext.webapp import template import os class fellerarleyDescriptionPage(webapp.RequestHandler): def get(self): text_f...
[ { "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
poptox/fellerarley/fellerarley_description.py
quanted/poptox
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Fri Sep 8 18:56:28 2017 @author: ahefny """ from __future__ import print_function import numpy as np import rpsp.globalconfig as globalconfig from rpsp.rpspnets.psr_lite.utils.nn import CallbackOp class PredictionError(Exception): def __init__(self, ...
[ { "point_num": 1, "id": "no_function_exceeds_5_params", "question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?", "answer": true }, { "point_num": 2, "id": "all_function_names_snake_case", "question": "Are all function names in this file written...
3
rpsp/rpspnets/nn_diags.py
ahefnycmu/rpsp
# Panther is a scalable, powerful, cloud-native SIEM written in Golang/React. # Copyright (C) 2020 Panther Labs Inc # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of t...
[ { "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
internal/compliance/remediation_aws/src/remediations/aws_s3_enable_bucket_logging.py
fossabot/panther
import unittest,math from datatype import DataTypes import numpy as np from scipy import stats class TDD_GETTING_STARTED(unittest.TestCase): def test_mse(self): a=[1,2,3] b=[4,5,6] self.assertRaises(TypeError,DataTypes({'a':a}).getMSE,b) def test_datatypes(self): d=DataTypes(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": "every_function_has_docstring", "question": "Does every function in this file have a docstring?", "answer":...
3
py/getting_started.py
qcgm1978/formula
from verifier_base import Verifier class Verifier1(Verifier): def __init__(self, id, iota_host, seed, push=False): super(Verifier1, self).__init__(id, iota_host, seed, push) def verification(self, topic, value): # Write any logic here to verify value for topic. # What is returned from...
[ { "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
tangle_mqtt/verifiers_sample.py
siriusblac37/iota-mqtt
"""Simon Says Exercises 1. Speed up tile flash rate. 2. Add more tiles. """ from random import choice from time import sleep from turtle import * from rohans2dtlkit import floor, square, vector pattern = [] guesses = [] tiles = { vector(0, 0): ('red', 'dark red'), vector(0, -200): ('blue', 'dark blue'), ...
[ { "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
rohans2dtlkit/simonsays.py
rohan-patra/2DGameDevToolkit
# Copyright 2016 F5 Networks Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writi...
[ { "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
test/functional/net/test_interface.py
yuanfm/f5-common-python
from app import create_app,db from flask_script import Manager,Server from app.models import User,Pitch,Comment from flask_migrate import Migrate, MigrateCommand #creating app instance app = create_app('development') manager = Manager(app) manager.add_command('server',Server) migrate = Migrate(app,db) manager.ad...
[ { "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
manage.py
amwaniki180/pitches
import sys import numpy import time import ctrigrid_bindings # this needs to be copied in the local directory s=0.5 cube_vertices=[ -s, -s, -s, s, -s, -s, s, s, -s, -s, s, -s, -s, -s, s, s, -s, s, s, s, s, -s, s, s, ] x=0.577350269 ...
[ { "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
python/tests/test_grid.py
tvogiannou/ctrigrid
import requests from termcolor import cprint class feedback_sqli: def __init__(self,url): self.url = url def feedcheck(self): headers = { "User-Agent": "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_8; en-us) AppleWebKit/534.50 (KHTML, like Gecko) Version/5.1 Safari/534.50" ...
[ { "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
script/feedback_js_sqli.py
bingpo/dedecmscan
# # # import unittest, sys import IfxPy import config from testfunctions import IfxPyTestFunctions class IfxPyTestCase(unittest.TestCase): def test_148_CallSPDiffBindPattern_01(self): obj = IfxPyTestFunctions() obj.assert_expect(self.run_test_148) def run_test_148(self): conn = IfxPy.connect(conf...
[ { "point_num": 1, "id": "has_multiple_inheritance", "question": "Does any class in this file use multiple inheritance?", "answer": false }, { "point_num": 2, "id": "any_function_over_40_lines", "question": "Is any function in this file longer than 40 lines?", "answer": true }, ...
3
IfxPy/tests/test_148_CallSPDiffBindPattern_01.py
jaimundada/IfxPy
from direct.directnotify import DirectNotifyGlobal from toontown.coghq import CogHQExterior from toontown.dna.DNAParser import loadDNAFileAI, DNAStorage from toontown.hood import ZoneUtil class SellbotHQExterior(CogHQExterior.CogHQExterior): notify = DirectNotifyGlobal.directNotify.newCategory('SellbotHQExterior'...
[ { "point_num": 1, "id": "every_function_under_20_lines", "question": "Is every function in this file shorter than 20 lines?", "answer": false }, { "point_num": 2, "id": "more_functions_than_classes", "question": "Does this file define more functions than classes?", "answer": true...
3
toontown/coghq/SellbotHQExterior.py
CrankySupertoon01/Toontown-2
#!/usr/bin/env python # -*- coding: utf-8 -*- import pytest import random from momblish.corpus_analyzer import CorpusAnalyzer from momblish import Momblish __author__ = "Stephen Prater" __copyright__ = "Stephen Prater" __license__ = "mit" test_corpus = [ 'abcd', 'abdc', 'acbd', 'acdb', 'adbc', 'adc...
[ { "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
tests/test_moblish.py
foobarbecue/momblish
from datetime import datetime, date from marqeta.response_models import datetime_object import json import re class ClearingRetryModel(object): def __init__(self, json_response): self.json_response = json_response def __str__(self): return json.dumps(self.json_response, default=self.json_seri...
[ { "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
marqeta/response_models/clearing_retry_model.py
marqeta/marqeta-python
import importlib import pytest from helpers import running_on_ci import janitor.chemistry # noqa: disable=unused-import # Skip all tests if rdkit not installed pytestmark = pytest.mark.skipif( (importlib.util.find_spec("rdkit") is None) & ~running_on_ci(), reason="rdkit tests only required for CI", ) @pyt...
[ { "point_num": 1, "id": "every_function_has_docstring", "question": "Does every function in this file have a docstring?", "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
tests/chemistry/test_morgan_fingerprint.py
vishalbelsare/pyjanitor
from functools import wraps from flask import jsonify,current_app from flask import request import jwt # 对token进行解码可以使用pyJWT # pyjwt : python 实现的 JSON Web Token: def token_required(f): ''' 验证前端发来的token信息是否合法,如果不合法,返回错误信息,不支持被装饰的函数f 如果合法,执行被装饰的函数f ''' @wraps(f) def __verfy(*args,**kwargs): ...
[ { "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
backend/surveyapi/decorator.py
sunwenquan/iSurvey
import os from torch.utils.tensorboard import SummaryWriter from .plot_image import * def get_writer(output_directory, log_directory): logging_path=f'{output_directory}/{log_directory}' if os.path.exists(logging_path): raise Exception('The experiment already exists') else: os.mkdir(log...
[ { "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
utils/writer.py
Deepest-Project/Transformer-TTS
import numpy as np def print_matrix(data): data_i = [] for i in list(data): data_j = [] for j in i: data_j.append(int("%d" % j)) data_i.append(data_j) print(data_i) def print_array(data): datas = [] for i in data: datas.append(float("%.3f" % i)) prin...
[ { "point_num": 1, "id": "every_function_under_20_lines", "question": "Is every function in this file shorter than 20 lines?", "answer": true }, { "point_num": 2, "id": "every_function_has_docstring", "question": "Does every function in this file have a docstring?", "answer": fals...
3
tests/numpy/asarray.py
Fryguy/py2rb
"""Tests of the DiscreteCategorical class.""" import pytest from gemd.entity.value.discrete_categorical import DiscreteCategorical def test_probabilities_setter(): """Test that the probabilities can be set.""" test_probabilities = {"solid": 0.9, "liquid": 0.1} test_categorical = DiscreteCategorical() ...
[ { "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
gemd/entity/value/tests/test_discrete_categorical.py
ventura-rivera/gemd-python
from uuid import UUID from app.models.customer import Customer from app.schemas.customer import CustomerInSchema async def create(payload: CustomerInSchema) -> Customer: customer = await Customer.create(**payload.dict()) return customer async def get(customer_id: UUID) -> Customer: customer = await Cus...
[ { "point_num": 1, "id": "all_return_types_annotated", "question": "Does every function in this file have a return type annotation?", "answer": true }, { "point_num": 2, "id": "every_function_has_docstring", "question": "Does every function in this file have a docstring?", "answer...
3
project/app/repositories/customer.py
rvaccari/sbgo
# -*- coding: utf-8 -*- import h5py def make_missing(npdata): import random import numpy as np rows, cols = npdata.shape random_cols = range(cols) for col in random_cols: random_rows = random.sample(range(rows - 1), int(0.1 * rows)) npdata[random_rows, col] = np.nan return np...
[ { "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
ycimpute/datasets/dpath.py
egemenzeytinci/ycimpute
import jieba # 使用jieba进行分词 def Rouge_1(model, reference): # terms_reference为参考摘要,terms_model为候选摘要 ***one-gram*** 一元模型 terms_reference = jieba.cut(reference) # 默认精准模式 terms_model = jieba.cut(model) grams_reference = list(terms_reference) grams_model = list(terms_model) temp = 0 ngram_all = ...
[ { "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
code/model/metrics.py
chenyangjun45/Mutimode-language-generation
import argparse from src.formula import Formula, Assignment from src.solver.utils import Falselist from src.solver.gsat import gsat_distribution, GSATContext from src.solver.walksat import walksat_distribution, DefensiveContext from src.solver.probsat import probsat_distribution parser = argparse.ArgumentParser() grp ...
[ { "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
generate_graph_defs.py
SRechenberger/Masterarbeit_Code
# Time: O(n) # Space: O(1) class Solution(object): # @param a, a string # @param b, a string # @return a string def addBinary(self, a, b): result, carry, val = "", 0, 0 for i in range(max(len(a), len(b))): val = carry if i < len(a): val += int(a[...
[ { "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_class_has_docstring", "question": "Does every class in this file have a docstring?"...
3
Python/add-binary.py
sm2774us/leetcode_interview_prep_2021
""" Implementation of gaussian filter algorithm """ from cv2 import imread, cvtColor, COLOR_BGR2GRAY, imshow, waitKey from numpy import pi, mgrid, exp, square, zeros, ravel, dot, uint8 from itertools import product def gen_gaussian_kernel(k_size, sigma): center = k_size // 2 x, y = mgrid[0 - center : k_size -...
[ { "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
digital_image_processing/filters/gaussian_filter.py
czuo0303/Python
import pytest from raft.network.NetworkUtil import * @pytest.mark.parametrize(["addr1", "addr2"], [("999.999.999.999", "999.999.999.999"), ("localhost", "localhost"), ("localhost", "127.0.0.1"), ("localhost", get_localhost_ip_addr()), ("127.0.0.1", "localhost"), ("127.0.0.1", "127.0.0.1"), ("127.0.0.1", get_loca...
[ { "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
tests/NetworkUtil_test.py
mdmiller002/raft-py
from volttron.platform.vip.pubsubservice import PubSubService, ProtectedPubSubTopics from mock import Mock, MagicMock import pytest @pytest.fixture(params=[ dict(has_external_routing=True), dict(has_external_routing=False) ]) def pubsub_service(request): moc...
[ { "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
volttrontesting/services/test_pubsub_service.py
gnmerritt/volttron
import copy from dataclasses import asdict from erica.domain.ElsterXml.common.basic_xml_data_representation import EXml class CustomDictParser(dict): """ Parse the given object to a dict structure that xmltodict will interpret correctly. Attributes starting with "xml_attr_" will be interpreted as XML att...
[ { "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
erica/domain/ElsterXml/common/xml_conversion.py
punknoir101/erica-1
# -*- coding: utf-8 -*- # Created at 03/09/2020 __author__ = 'raniys' import math import pytest from factorial_example import factorial_function @pytest.mark.sample def test_factorial_functionality(): print("Inside test_factorial_functionality") assert factorial_function(0) == 1 assert factorial_func...
[ { "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
test_factorial_example.py
gaoshanyu/web_ui_test_sample
import numpy as np from prml.nn.optimizer.optimizer import Optimizer class AdaDelta(Optimizer): """ AdaDelta optimizer """ def __init__(self, parameter, rho=0.95, epsilon=1e-8): super().__init__(parameter, None) self.rho = rho self.epsilon = epsilon self.mean_squared_d...
[ { "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": "more_functions_than_classes", "question": "Does this file define more functions than cla...
3
books/PRML/PRML-master-Python/prml/nn/optimizer/ada_delta.py
iamfaith/DeepLearning
import sys sys.path.append('./datastructures') from datastructures import Stack, StackNode class SetOfStacks: LIMIT_PER_STACK = 2 def __init__(self): self.main_stack = Stack() def pop(self): if self.is_empty(): return None elif self._top_stack().is_empty(): ...
[ { "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
cracking-code-interview/chapter_03/3-3_stack_of_plates.py
italo-batista/problems-solving
#!/usr/bin/env python3 # -*- coding:utf-8 -*- # author: bigfoolliu """ 主页: https://docs.locust.io/en/stable/ 压力测试框架,有web ui """ from locust import HttpLocust, TaskSet, between, task # 定义的用户行为集合 class UserBehavior(TaskSet): """用户单次需要执行的任务""" def on_start(self): """当所有任务集合开始之前调用""" self.log...
[ { "point_num": 1, "id": "every_class_has_docstring", "question": "Does every class in this file have a docstring?", "answer": true }, { "point_num": 2, "id": "all_function_names_snake_case", "question": "Are all function names in this file written in snake_case?", "answer": true ...
3
language/python/modules/locustio/locustio_module.py
bigfoolliu/liu_aistuff
"""Helper functions """ import h5py _mapping = { h5py.File: "file", h5py.Group: "group", h5py.Dataset: "dataset", } def register_h5pyd(): import h5pyd _mapping[h5pyd.File] = "file" _mapping[h5pyd.Group] = "group" _mapping[h5pyd.Dataset] = "dataset" def check_class(obj_class): """Che...
[ { "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
h5glance/utils.py
t20100/h5glance
from unittest import TestCase, mock from iclientpy import AbstractMap class AbstractMapTestCase(TestCase): def test_compute_bounds(self): data = [[1, 2, 3], [4, 5, 6]] lat_key = lambda d: d[0] lng_key = lambda d: d[1] map = AbstractMap() result = map.compute_bound...
[ { "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
iclientpy/test/viz/test_abstractmap.py
SuperMap/iClientPython
import os from glob import glob import pandas as pd def get_list_of_full_child_dirs(d): """ For a directory d (full path), return a list of its subdirectories in a full path form. """ children = (os.path.join(d, child) for child in os.listdir(d)) dirs = filter(os.path.isdir, children) ...
[ { "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
pdata/dirstructure.py
semeniuta/pdata
# -*- coding: utf-8 -*- """ propulsion_base.py generated by WhatsOpt 1.10.4 """ # DO NOT EDIT unless you know what you are doing # whatsopt_url: # analysis_id: 3 import numpy as np from numpy import nan from os import path from importlib import import_module from yaml import load, FullLoader from openmdao.api impo...
[ { "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
examples/ssbj/mda/propulsion_base.py
OneraHub/WhatsOpt-Tutorial
import csv def save_statistics(experiment_name, line_to_add): with open("{}.csv".format(experiment_name), 'a') as f: writer = csv.writer(f) writer.writerow(line_to_add) def load_statistics(experiment_name): data_dict = dict() with open("{}.csv".format(experiment_name), 'r') as f: l...
[ { "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
MetaLearning/MatchingNetworks/storage.py
likesiwell/DL_Code_Repos
import socket class sUDPsocket(): def __init__(self): self.sock = socket.socket(socket.AF_INET,socket.SOCK_DGRAM) self.retimeout = 5 self.timeout = None def bind(self, addres): self.sock.bind(addres) def recvfrom(self, bytes): msg , address = self.sock.recvfrom(byte...
[ { "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": "more_functions_than_classes", "question": "Does this file define more functions than cla...
3
SUDP/SUDP.py
artegoser/sUDP
# INVERTED HIERARCHY import prior_handler as phandle import math import numpy as np import os cwd = os.path.dirname(os.path.realpath(__file__)) print(cwd) prior_handler = phandle.PriorHandler(cwd) con = prior_handler.c n_pars = prior_handler.n_pars def prior(cube, n_dims, n_pars): return prior_handler.scale(cube)...
[ { "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
example_workspace/inverted_hierarchy/model.py
anicokatz/PyMultiNestPlus
from __future__ import division import sys import pandas as pd def calc_coverage(csv_file): """Return the mutation coverage from the csv output of pitest Arguments ------------- - csv_file: the path of the csv file storing the result of the mutation """ frame = pd.read_csv( csv_file,...
[ { "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
effectiveness/mutation/mutation_calc.py
jakubdabek/lightweight-effectiveness
import logging import azure.functions as func from azure.iot.hub import IoTHubRegistryManager # Note that Azure Key Vault doesn't support underscores # and some other special chars; # we substitute with a hyphen for underscore CONNECTION_STRING = "{c2d connection string}" DEVICE_ID = "{device to invoke}" ME...
[ { "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
azure_iot_hub/azure/templates/led_matrix_esp32_iot_hub/__init__.py
codycodes/gix-mkrfridays-iot
class StatsMixin: def get_stats(self): unique_governments = self.df["Government"].unique() return len(unique_governments), unique_governments # num_msg: str # list_msg: str def print_stats(self, num_msg="", list_msg=""): num_govs, list_of_govs = self.get_stats() if num_m...
[ { "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
scripts/src/util/stats_mixin.py
ConorSheehan1/InfoVisD3
from flask import request from app.errors import bp from app import db import elasticsearch import sentry_sdk from .errors import NatlasServiceError, NatlasSearchError from .responses import get_response, get_supported_formats def build_response(err: NatlasServiceError): selected_format = request.accept_mimetype...
[ { "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
natlas-server/app/errors/handlers.py
purplesecops/natlas
#!/usr/bin/env python3 import rclpy from rclpy.node import Node from std_msgs.msg import Int64 class NumberPublisher(Node): def __init__(self): super().__init__('number_publisher') self.publisher_ = self.create_publisher(Int64, 'numbers', 10) timer_period = 0.5 # seconds self.ti...
[ { "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
fizzbuzz/fizzbuzz/number_publisher_node.py
ericboehlke/ros_fizzbuzz
import tensorflow as tf from contextlib import contextmanager from PIL import Image from keras import backend as K from keras.utils.data_utils import OrderedEnqueuer def heteroscedastic_loss(attention=False, block_attention_gradient=False, mode='l2'): ''' Heteroscedastic loss.''' def h...
[ { "point_num": 1, "id": "every_function_under_20_lines", "question": "Is every function in this file shorter than 20 lines?", "answer": false }, { "point_num": 2, "id": "all_params_annotated", "question": "Does every function parameter in this file have a type annotation (excluding s...
3
util.py
changwoolee/gradient-rescaling-attention-model
#!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.constant.ParamConstants import * class BillDingBizOrderSum(object): def __init__(self): self._biz_date = None self._expenses = None self._income = None @property def biz_date(self): return 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": "more_functions_than_classes", "question": "Does this file define more functions than classes?", "answer": true }...
3
alipay/aop/api/domain/BillDingBizOrderSum.py
snowxmas/alipay-sdk-python-all
#!/usr/bin/env python3 import requests import multiprocessing import time session = None def set_global_session(): global session if not session: session = requests.Session() def download_site(url): with session.get(url) as response: name = multiprocessing.current_process().name ...
[ { "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
concurrency-overview/io_mp.py
syberflea/materials
from io import BufferedIOBase import os import sys if sys.platform == 'win32': import _winapi import msvcrt class WindowsPipe: def __init__(self, experiment_id: str): self.path: str = r'\\.\pipe\nni-' + experiment_id self.file = None self._handle = _winapi.Crea...
[ { "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
nni/experiment/pipe.py
sharpe5/nni
import os import subprocess import sys from typing import Dict, List, Union from app.pipelines import Pipeline class SentenceSimilarityPipeline(Pipeline): def __init__( self, model_id: str, ): # At the time, only public models from spaCy are allowed in the inference API. full_...
[ { "point_num": 1, "id": "every_function_under_20_lines", "question": "Is every function in this file shorter than 20 lines?", "answer": false }, { "point_num": 2, "id": "more_functions_than_classes", "question": "Does this file define more functions than classes?", "answer": true...
3
docker_images/spacy/app/pipelines/sentence_similarity.py
huggingface/api-inference-community
#!/usr/bin/python # # Copyright 2020 Google LLC # # 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 ag...
[ { "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
google-datacatalog-connectors-commons/src/google/datacatalog_connectors/commons/prepare/base_tag_template_factory.py
dlminvestments/datacatalog-connectors
import pytest import os from pyutils import here def test_here_default(): assert here(__file__) == os.path.dirname(__file__) def test_here_appends_paths(): assert here(__file__, "a", "path") == os.path.join(os.path.dirname(__file__), "a", "path") def test_here_gets_abs_path(): assert here(__file__, "..")...
[ { "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
src/pyutils/test/test_here.py
dzhang32/pyutils
# 텍스트 요약 API # KoBART 기반 import torch from kobart import get_kobart_tokenizer from transformers.models.bart import BartForConditionalGeneration def load_model(): model = BartForConditionalGeneration.from_pretrained("./kobart_summary") return model # 텍스트 요약 def summarize(text_origin): model = load_model(...
[ { "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
ai-backend/cv_summarizer.py
osamhack2021/WEB_AI_POOL_YD
# -*- coding: utf-8 -*- from typing import Iterator, TypeVar, Sequence, Generic import abc import typing as t from ..core import TestOutcome, Test from ..container import ProgramContainer from ..environment import Environment T = TypeVar('T', bound=Test) class TestSuite(Generic[T]): _environment: Environment ...
[ { "point_num": 1, "id": "more_functions_than_classes", "question": "Does this file define more functions than classes?", "answer": true }, { "point_num": 2, "id": "all_return_types_annotated", "question": "Does every function in this file have a return type annotation?", "answer"...
3
src/darjeeling/test/base.py
rshariffdeen/Darjeeling
import logging from flask import Flask from flask_cors import CORS from nimble_iot_bc.apis import blueprint as api from nimble_iot_bc.databases import mongo, influx logging.basicConfig(level=logging.DEBUG) logger = logging.getLogger(__name__) main_app = Flask(__name__) def configure_app(flask_app): '''Configure...
[ { "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
nimble_iot_bc/app.py
nimble-platform/tracking-iot-blockchain-service
import os import sys import ctypes from PyQt5 import uic from PyQt5 import QtCore, QtGui, QtWidgets from PyQt5.QtWidgets import QApplication, QMainWindow from PyQt5.QtGui import QIcon #from .tools.threadWorker import Worker application_path = os.path.abspath("") if sys.platform == "win32": myappid = u...
[ { "point_num": 1, "id": "every_function_under_20_lines", "question": "Is every function in this file shorter than 20 lines?", "answer": true }, { "point_num": 2, "id": "more_functions_than_classes", "question": "Does this file define more functions than classes?", "answer": true ...
3
gui/Window1Final.py
BETRU21/PresentationPyQT5
import json preConf = {'removeID' : '_A_'} try: with open(os.path.join('processlib', 'pre.json')) as configdata: preConf = json.load(configdata) except: print('no config file, defaulting preprocess') def removeUnwanted(Filelist): #remove unwated csv from file list #print(Filelist) newFi...
[ { "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
processlib/preProcess.py
Dead-Lemon/csvDir2influx
import json import requests from utils import get_secret from utils import is_pro def send_slack(text="", channel="test", blocks=None): assert channel in ["test", "events", "general"] webhook = get_secret(f"SLACK_WEBHOOK_{channel.upper()}") data = {"text": text} if blocks: data["blocks"] ...
[ { "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
src/slack.py
villoro/airflow_tasks
from django.contrib.auth import get_user_model from django.db import models class Turma(models.Model): nome = models.CharField(max_length=64) slug = models.SlugField(max_length=64) inicio = models.DateField() fim = models.DateField() alunos = models.ManyToManyField(get_user_model(), through='Matri...
[ { "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": false }...
3
pypro/turmas/models.py
taniodev/curso-django
import os import datetime import uuid import logging from time import sleep import gevent from gevent.wsgi import WSGIServer from flask import Flask, jsonify from kazoo.client import KazooClient, EventType from kazoo.exceptions import NodeExistsException, NoNodeException logging.basicConfig() zoo_hosts = os.getenv('...
[ { "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
main.py
EvgeneOskin/hello-zookeeper
############################################################################## # Copyright (c) 2017 Huawei Technologies Co.,Ltd and others. # # All rights reserved. This program and the accompanying materials # are made available under the terms of the Apache License, Version 2.0 # which accompanies this distribution, ...
[ { "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
yardstick/benchmark/scenarios/cmri/openlab/router_add_interface.py
mythwm/yardstick-wm
import operator from django.utils.formats import get_format from django.utils.translation import get_language, to_locale from babel import numbers from babel.core import Locale def get_currencies(): """ Returns a list of currencies. """ return sorted( Locale.default().currencies.items(), ...
[ { "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
mymoney/core/utils/currencies.py
ychab/mymoney
""" Unit test for multiple modules This module illustrates what a proper unit test should look like. Each function being tested has its own test procedure. It also has a segment of "script code" that invokes the test procedure when this module is run as an script. Author: Walker M. White Date: February 14, 2019 ""...
[ { "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
docs/cornell CS class/lesson 10. Algorithm Design/demos/test_helpers.py
LizzieDeng/kalman_fliter_analysis
import io import PIL.Image import torch from torchvision.prototype import features from torchvision.transforms.functional import pil_to_tensor __all__ = ["raw", "pil"] def raw(buffer: io.IOBase) -> torch.Tensor: raise RuntimeError("This is just a sentinel and should never be called.") def pil(buffer: io.IOBas...
[ { "point_num": 1, "id": "every_function_under_20_lines", "question": "Is every function in this file shorter than 20 lines?", "answer": true }, { "point_num": 2, "id": "all_return_types_annotated", "question": "Does every function in this file have a return type annotation?", "an...
3
torchvision/prototype/datasets/decoder.py
mechaot/vision
import sys def get_digits_ignore_zero(x): digits = {} for digit in str(x): if digit == '0': continue if digit in digits: digits[digit] += 1 else: digits[digit] = 1 return digits def following_integer(x): original_digits = get_digits_ignore_ze...
[ { "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
2-hard/following-integer/main.py
mpillar/codeeval
import urllib.parse from selenium.webdriver import Chrome, ChromeOptions from selenium.webdriver.common.by import By from webium import BasePage, Find from webium.driver import close_driver, get_driver import pytest import webium.settings class HeadlessChrome(Chrome): def __init__(self): chrome_options ...
[ { "point_num": 1, "id": "more_functions_than_classes", "question": "Does this file define more functions than classes?", "answer": true }, { "point_num": 2, "id": "has_multiple_inheritance", "question": "Does any class in this file use multiple inheritance?", "answer": false },...
3
tests/kibana/test_integration.py
felixbarny/apm-integration-testing
import datetime import re import pytest from fastjsonschema import JsonSchemaValueException exc = JsonSchemaValueException('data must be date-time', value='{data}', name='data', definition='{definition}', rule='format') @pytest.mark.parametrize('value, expected', [ ('', exc), ('bla', exc), ('2018-02-05T...
[ { "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
tests/test_format.py
jedie/python-fastjsonschema
from pygame import Surface from .player import Team, Player class Game: """ The state of the game. Is determined by the state of the canvas, the list of player states, the list of team states, and the game format. """ def __init__(self, form, canvas = None): if canvas: self.canvas = canvas e...
[ { "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
app/main/engine/game.py
trojsten/paintgame
# # # import re import random import time COMMA_DELIMITER_1 = ',(?=([^"]*"[^"]*")*[^"]*$)' COMMA_DELIMITER_2 = ',(?=([^"\\]*"\\[^"\\]*"\\)*[^"\\]*$)' # # def print_separator(): print(" " * 30) print(" #" * 30) print(" " * 30) # # line2 = '1;"Goroka";"Goroka";"Papua New Guinea";"GKA";"AYGA";-6.081689;145....
[ { "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
src/main/py/com/example/utils/commons.py
brijeshdhaker/spark-python-examples
from django.test import TestCase from django.contrib.auth import get_user_model from core import models def sample_user(email='test@gmail.com', password='test1234'): return get_user_model().objects.create_user(email, password) class ModelTests(TestCase): def test_create_user_with_email_successful(self): ...
[ { "point_num": 1, "id": "every_function_under_20_lines", "question": "Is every function in this file shorter than 20 lines?", "answer": true }, { "point_num": 2, "id": "has_multiple_inheritance", "question": "Does any class in this file use multiple inheritance?", "answer": false...
3
app/core/tests/test_models.py
Adamakk10/recepie-app-api
from kaggle.api.kaggle_api_extended import KaggleApi from zipfile import ZipFile from tqdm import tqdm import os def kaggle_dataset(args): if args.dataset == "pokemon": path = 'lantian773030/pokemonclassification' out_path = "data" elif args.dataset == "anime": path = "splcher/...
[ { "point_num": 1, "id": "every_function_has_docstring", "question": "Does every function in this file have a docstring?", "answer": false }, { "point_num": 2, "id": "any_function_over_40_lines", "question": "Is any function in this file longer than 40 lines?", "answer": true },...
3
src/Data.py
rohitkuk/PokeGAN
# (C) Datadog, Inc. 2018 # All rights reserved # Licensed under a 3-clause BSD style license (see LICENSE) import json import os import pytest from datadog_checks.dev import docker_run from datadog_checks.mesos_slave import MesosSlave from . import common from .utils import read_fixture @pytest.fixture(scope='sess...
[ { "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
mesos_slave/tests/conftest.py
jstoja/integrations-core
"""Module for HGVS tokenization.""" from typing import Optional from .tokenizer import Tokenizer from variation.tokenizers.reference_sequence import REFSEQ_PREFIXES from variation.schemas.token_response_schema import Token, TokenMatchType from hgvs.parser import Parser from hgvs.exceptions import HGVSParseError, HGVSIn...
[ { "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
variation/tokenizers/hgvs.py
GenomicMedLab/varlex
from app.config import db def get_all(): try: conn = db.conn() with conn.cursor() as cursor: sql = '''SELECT * FROM ig_usernames ORDER BY id DESC''' cursor.execute(sql) conn.commit() conn.close() return cursor.fetchall() except Exception as e: ...
[ { "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
app/models/Username.py
haryobagus/haryo_ig
from django.db import models from tinymce.models import HTMLField from config.settings.base import STATIC_URL class Componente(models.Model): nombre = models.CharField(max_length=50) codigo = models.CharField(max_length=5, verbose_name='Código') descripcion = HTMLField(blank=True, null=True, ver...
[ { "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
ovu/core/models/componente.py
moisesmayet/ovu
import pytest from pyVmomi import vim from tests import utils from vnc_api import vnc_api from cvfm import models @pytest.fixture def vmware_dpg(): net_data = { "key": "dvportgroup-1", "name": "dpg-1", "type": vim.DistributedVirtualPortgroup, "dvs-name": "dvs-1", "vlan": 5...
[ { "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/functional/dpg_events/test_dpg_renamed.py
atsgen/tf-vcenter-fabric-manager
#!/usr/bin/python # # Copyright 2002-2021 Barcelona Supercomputing Center (www.bsc.es) # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 ...
[ { "point_num": 1, "id": "every_function_has_docstring", "question": "Does every function in this file have a docstring?", "answer": false }, { "point_num": 2, "id": "all_return_types_annotated", "question": "Does every function in this file have a return type annotation?", "answe...
3
compss/programming_model/bindings/python/src/pycompss/tests/api/dummy/test_dummy_binary.py
eflows4hpc/compss
import re from social_core.backends.oauth import OAuthAuth NAME_RE = re.compile(r'([^O])Auth') LEGACY_NAMES = ['username', 'email'] def backend_name(backend): name = backend.__name__ name = name.replace('OAuth', ' OAuth') name = name.replace('OpenId', ' OpenId') name = name.replace('Sandbox', '') ...
[ { "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
site/social_auth/filters.py
776166/yggdrasil-django
# -*- coding: utf-8 -*- # Copyright (c) 2017, Frappe and contributors # For license information, please see license.txt from __future__ import unicode_literals import frappe from frappe import _ from frappe.model.document import Document class Meeting(Document): def validate(self): """Set missing names an...
[ { "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
meeting/meeting/doctype/meeting/meeting.py
rasec70/meeting
import sys import pytest import numpy as np import torch from numpy.testing import assert_ sys.path.append("../../../") from pycroscopy.learn import Trainer, models def assert_weights_equal(m1, m2): eq_w = [] for p1, p2 in zip(m1.values(), m2.values()): eq_w.append(np.array_equal( p1.det...
[ { "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
tests/learn/dl/test_trainer.py
itsalexis962/pycroscopy
from typing import Optional from dash import html, Dash from .. import WebvizPluginABC, EncodedFile class ExampleDataDownload(WebvizPluginABC): def __init__(self, app: Dash, title: str): super().__init__() self.title = title self.set_callbacks(app) @property def layout(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_under_20_lines", "question": "Is every function in this file shorter than 20 lines?", "answ...
3
webviz_config/generic_plugins/_example_data_download.py
anders-kiaer/webviz-conf
# -*- coding: utf-8 -*- import numpy as np import pandas as pd from patchwork._sample import find_unlabeled, find_fully_labeled from patchwork._sample import find_partially_labeled from patchwork._sample import stratified_sample, unlabeled_sample testdf = pd.DataFrame({ "filepath":["a.jpg", "b.jpg", "c.jpg",...
[ { "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
patchwork/tests/test_sample.py
mediocretech/patchwork
from olympia.amo.install import addons from olympia.amo.tests import TestCase from olympia.amo.urlresolvers import reverse from olympia.amo.utils import urlparams class InstallTests(TestCase): def test_generic(self): url = reverse('api.install') r = self.client.get(urlparams(url, ...
[ { "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/olympia/amo/tests/test_install.py
jpetto/olympia
""" Capture projection pattern and decode x-coorde. """ import cv2 import numpy as np import structuredlight as sl def imshowAndCapture(cap, img_pattern, delay=250): cv2.imshow("", img_pattern) cv2.waitKey(delay) ret, img_frame = cap.read() img_gray = cv2.cvtColor(img_frame, cv2.COLOR_BGR2GRAY) ret...
[ { "point_num": 1, "id": "every_function_has_docstring", "question": "Does every function in this file have a docstring?", "answer": false }, { "point_num": 2, "id": "every_function_under_20_lines", "question": "Is every function in this file shorter than 20 lines?", "answer": fal...
3
examples/capture_x.py
elerac/codepattern
# -*- coding: utf-8 -*- # # Copyright 2019 - Swiss Data Science Center (SDSC) # A partnership between École Polytechnique Fédérale de Lausanne (EPFL) and # Eidgenössische Technische Hochschule Zürich (ETHZ). # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compli...
[ { "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": true...
3
renku/core/utils/urls.py
cyberhck/renku-python
""" Prompt: Given a non-negative number, N, return the last digit of the factorial of N. The factorial of N, which is written as N!, is defined as the product of all of the integers from 1 to N. Given 3 as N, the factorial is 1 x 2 x 3 = 6 Given 6 as N, the factorial is 1 x 2 x 3 x 4 x 5 x 6 = 720 Given 9 as N, the...
[ { "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
module_2/last_factorial.py
makhmudislamov/coding_challanges_python3
from constants import * from data import IMAGE_ID from random import randint from actor.skills.base_skill import BaseSkill from util import dice class GrassCutter(BaseSkill): def __init__(self, x=0, y=0, name="grass_cutter"): super().__init__( name=name, image=IMAGE_ID[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": "every_function_under_20_lines", "question": "Is every function in this file shorter than ...
3
actor/skills/grass_cutter.py
tamamiyasita/Roguelike-Tutorial-2020
#!/usr/bin/env python3 # Copyright (c) 2018 The Bethel Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. from test_framework.test_framework import BethelTestFramework from test_framework.staticr_util import * import...
[ { "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
qa/rpc-tests/staticr-tx-send.py
diyathrajapakshe/bethel-core
''' Selection sort is an O(n^2) sorting algorithm. The logic is to go over the array from arr[1] to arr[n-1], compare it with the elements to the left, and swap it into the right position (if a swap is needed). At the end of the kth iteration, the element arr[k] will be in the right position considering only the elem...
[ { "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_params_annotated", "question": "Does every function parameter in this file have a type annotation (ex...
3
Sorting/insertion_sort.py
gvevance/Algorithms
# coding: utf-8 """ Copyright 2017 Square, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable la...
[ { "point_num": 1, "id": "every_function_under_20_lines", "question": "Is every function in this file shorter than 20 lines?", "answer": true }, { "point_num": 2, "id": "all_function_names_snake_case", "question": "Are all function names in this file written in snake_case?", "answ...
3
test/test_v1_apply_modifier_list_request.py
shaminmeerankutty/connect-python-sdk
# coding: utf-8 # Copyright 2013 The Font Bakery Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless re...
[ { "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": true...
3
bakery_lint/tests/downstream/test_check_font_tables.py
lowks/fontbakery-cli
# -*- encoding: utf-8 -*- # Date: 27/Apr/2020 # Author: Steven Huang, Auckland, NZ # License: MIT License """ Description: Update json file """ import json import datetime def write_file(file, content): with open(file, 'w', newline='\n', encoding='utf-8') as f: f.write(content) def get_datetime(): ...
[ { "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
coronavirus/json_update.py
StevenHuang2020/WebSpider
import asyncio from .protocol import stock_pb2 from . import providerdict class KrossClient: def __init__(self, socket, node): self.sock = socket self.node = node self.write_lock = asyncio.Lock() async def send_object(self, data): async with self.write_lock: await...
[ { "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
ktrade/client.py
krosstrading/ktrade
from gym_minigrid.minigrid import * from gym_minigrid.roomgrid import RoomGrid from gym_minigrid.register import register class BlockedUnlockPickup(RoomGrid): """ Unlock a door blocked by a ball, then pick up a box in another room """ def __init__(self, seed=None): room_size = 6 s...
[ { "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
gym_minigrid/envs/blockedunlockpickup.py
kanaadp/gym-minigrid
from ..package import MYPReader def addScript(name: str, command: str, description: str = ""): myp = MYPReader() myp.add_script( name=name, command=command, description=description, ) myp.write() print('Script added successfully.') def removeScript(name: str): myp = MY...
[ { "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
myp/scripts/funcs.py
YunisDEV/py-scripts
# -*- coding: utf-8 -*- # # author: oldj # blog: http://oldj.net # email: oldj.wu@gmail.com # def get_max_size(data): max_w = 0 max_h = 0 for hit in data: w = hit[0] h = hit[1] if w > max_w: max_w = w if h > max_h: max_h = h return max_w + 1, m...
[ { "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": "any_function_over_40_lines", "question": "Is any function in this file longer than 40 lines?", "answer...
3
pyheatmap/inc/cf.py
feixuexue731/pyheatmap
"""remove_aggs Revision ID: 7467e77870e4 Revises: c829ff0b37d0 Create Date: 2018-07-22 08:50:01.078218 """ import sqlalchemy as sa from alembic import op # revision identifiers, used by Alembic. revision = "7467e77870e4" down_revision = "c829ff0b37d0" def upgrade(): with op.batch_alter_table("table_columns") a...
[ { "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
rabbitai/migrations/versions/7467e77870e4_remove_aggs.py
psbsgic/rabbitai
from msysutils import msysActive, msysShell from os import environ from shlex import split as shsplit from subprocess import PIPE, Popen def captureStdout(log, commandLine): '''Run a command and capture what it writes to stdout. If the command fails or writes something to stderr, that is logged. Returns the captur...
[ { "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
build/executils.py
D15C0DE/openMSX
from flask import Flask, request, jsonify from fastai.basic_train import load_learner from fastai.vision import open_image from flask_cors import CORS,cross_origin app = Flask(__name__) CORS(app, support_credentials=True) # load the learner learn = load_learner(path='./models', file='trained_model.pkl') classes = lear...
[ { "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
app.py
lmcdo/tradingtester