source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
# --- Imports --- #
import torch
import torch.nn.functional as F
# --- Perceptual loss network --- #
class LossNetwork(torch.nn.Module):
def __init__(self, vgg_model):
super(LossNetwork, self).__init__()
self.vgg_layers = vgg_model
self.layer_name_mapping = {
'3': "relu1_2",
... | [
{
"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 | perceptual.py | liuh127/Two-branch-dehazing |
class UserMixin:
@property
def is_annotator(self):
return False
def has_permission(self, user):
if user.active_organization in self.organizations.all():
return True
return False
| [
{
"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 | label_studio/users/mixins.py | mehdibenamorr/label-studio |
# -*- coding: utf-8 -*-
from tortilla.formatters import hyphenate, mixedcase, camelcase
def test_hyphenate(api, endpoints):
assert 'hyphenated-endpoint' == hyphenate('hyphenated_endpoint')
api.config.formatter = hyphenate
assert api.hyphenated_endpoint.get() == \
endpoints['/hyphenated-endpoint'... | [
{
"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 | tests/test_formatters.py | rxuriguera/tortilla |
import zipfile
import argparse
import os
from squad_preprocess import maybe_download
def setup_args():
parser = argparse.ArgumentParser()
parser.add_argument("--download_dir", required=True) # where to put the downloaded glove files
return parser.parse_args()
def main():
args = setup_args()
glove... | [
{
"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 | code/preprocessing/download_wordvecs.py | theblind/squad_challenge |
# Copyright (C) 2016 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
"""
Remove gGRC Admin hardcoded permissions
Create Date: 2016-06-10 07:10:22.781593
"""
# disable Invalid constant name pylint warning for mandatory Alembic variables.
# pylint: disable=invalid-name
from ... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answ... | 3 | src/ggrc_basic_permissions/migrations/versions/20160610071022_5208a8371512_remove_ggrc_admin_hardcoded_permissions.py | sbilly/ggrc-core |
#!/usr/bin/envpython
# -*- coding: utf-8 -*-
def black(string):
return'\033[30m'+string+'\033[0m'
def blue(string):
return'\033[94m'+string+'\033[0m'
def gray(string):
return'\033[1;30m'+string+'\033[0m'
def green(string):
return'\033[92m'+string+'\033[0m'
def cyan(string):
return'\033[96m'+str... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docst... | 3 | utils/color.py | WangYihang/Reverse-Shell-Manager |
import yaml
import json
from st2tests.base import BaseActionTestCase
class ZabbixBaseActionTestCase(BaseActionTestCase):
__test__ = False
def setUp(self):
super(ZabbixBaseActionTestCase, self).setUp()
self._full_config = self.load_yaml('full.yaml')
self._blank_config = self.load_yam... | [
{
"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_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"ans... | 3 | tests/zabbix_base_action_test_case.py | StackStorm-Exchange/zabbix |
#############################
# Author: Aravind Kashyap
# File: lis.py
# comments: This programme outputs the Longest Strictly Increasing Subsequence in O(NLogN)
# Where N is the Number of elements in the list
#############################
def CeilIndex(v, l, r, key):
while r - l > 1:
m = (l + r) ... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (... | 3 | dynamic_programming/longest_increasing_subsequence_o(nlogn).py | Pratiyush27/Python |
import connexion
from flask_cors import CORS
import api
from flask import request
import sys
def create_app():
app = connexion.FlaskApp(__name__, specification_dir='openapi/')
app.add_api('my_api.yaml')
@app.app.route("/v1/plugin/<name>/<path:path>", methods=["GET", "POST"])
def plugin(name, path):
... | [
{
"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 | api/server.py | xu-hao/tx-router |
import torch
# f = w * x
# f = 2 * x
X = torch.tensor([1,2,3,4], dtype=torch.float32) # training sample
Y = torch.tensor([2,4,6,8], dtype=torch.float32) # testing sample
w = torch.tensor(0.0, dtype=torch.float32, requires_grad=True)
#model prediction
def forward(x):
return w * x
# loss = MSE
def loss(y, y_pred... | [
{
"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 | Data Science/MachineLearningFromPytorch.py | bradduy/computer_vision |
from typing import Union
from ...kernel import core
from ...kernel.core import VSkillModifier as V
from ...kernel.core import CharacterModifier as MDF
from ...character import characterKernel as ck
from functools import partial
class OverloadManaBuilder():
def __init__(self, vEhc, num1, num2) -> None:
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": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/... | 3 | dpmModule/jobs/jobbranch/magicians.py | BBTibber/maplestory_dpm_calc |
from mock import Mock
from backdrop import StatsClient
class TestStatsd(object):
def setup(self):
self.client = Mock()
self.wrapper = StatsClient(self.client)
def test_timer(self):
self.wrapper.timer('foo.bar', data_set='monkey')
self.client.timer.assert_called_with('monkey.fo... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
... | 3 | tests/test_statsd.py | NRCan/backdrop |
import numpy as np
from numba import from_dtype, cuda
from numba.cuda.testing import skip_on_cudasim, SerialMixin
import unittest
class TestAlignment(SerialMixin, unittest.TestCase):
def test_record_alignment(self):
rec_dtype = np.dtype([('a', 'int32'), ('b', 'float64')], align=True)
rec = from_dty... | [
{
"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 | numba/cuda/tests/cudapy/test_alignment.py | ARF1/numba |
"""
mobility configuration
"""
from tkinter import ttk
from typing import TYPE_CHECKING
import grpc
from core.gui.dialogs.dialog import Dialog
from core.gui.errors import show_grpc_error
from core.gui.themes import PADX, PADY
from core.gui.widgets import ConfigFrame
if TYPE_CHECKING:
from core.gui.app import App... | [
{
"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 | daemon/core/gui/dialogs/mobilityconfig.py | montag451/core |
"""
Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy of this
software and associated documentation files (the "Software"), to deal in the Software
without restriction, including without limitation the rights to ... | [
{
"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 | test/rules/conditions/test_configuration.py | j0lly/cfn-python-lint |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | [
{
"point_num": 1,
"id": "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 | aliyun-python-sdk-hbase/aliyunsdkhbase/request/v20190101/SwitchHbaseHaSlbRequest.py | liumihust/aliyun-openapi-python-sdk |
#!/bin/python
import platform
import fabric.api
from fabric.contrib.files import exists as remote_exists
from cloudify import ctx
from cloudify.exceptions import NonRecoverableError
def _get_distro_info():
distro, _, release = platform.linux_distribution(
full_distribution_name=False)
return '{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": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": fal... | 3 | components/nginx/scripts/retrieve_agents.py | AlexAdamenko/cloudify-openstack |
import json
import logging
import os
_logger = logging.getLogger(__name__)
def load_json_specs(kibana_dir):
oss_path = os.path.join(
kibana_dir, 'src', 'plugins', 'console', 'server', 'lib', 'spec_definitions')
xpack_path = os.path.join(
kibana_dir, 'x-pack', 'plugins', 'console_extensions', ... | [
{
"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 | peek/es_api_spec/spec_json.py | ywangd/peek |
from argparse import Namespace, ArgumentParser
from spotty.commands.abstract_config_command import AbstractConfigCommand
from spotty.commands.writers.abstract_output_writrer import AbstractOutputWriter
from spotty.providers.abstract_instance_manager import AbstractInstanceManager
class StartCommand(AbstractConfigComm... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 2... | 3 | spotty/commands/start.py | Inculus/spotty |
#!/usr/bin/env python
# this node will be implemented on the master node
# this is a test script for drive motor
# in function of stop and front lights detection
# this script will be implemented in another node
# import libraries
import rospy,sys,time,atexit,numpy
from std_msgs.msg import String,Int16MultiArray
... | [
{
"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 | deprecated/led_control.py | isarlab-department-engineering/ros_dt_stop_light_detection |
from django.test import TestCase
from django.urls import reverse
from rest_framework import status
from rest_framework.test import APIClient
QUIZZES_URL = reverse('questionary:quiz-list')
class PublicQuizzesApiTests(TestCase):
"""Test the publicly available tags API"""
def setUp(self):
self.client ... | [
{
"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/questionary/tests/test_quiz.py | brakebrinker/django-englishtest |
import collections
import functools
from typing import Dict, List, Tuple, Counter
from tool.runners.python import SubmissionPy
def parse(s: str) -> Tuple[List[str], Dict[Tuple[str, str], str]]:
lines = s.splitlines()
initial = list(lines[0].strip())
mapping = {}
for line in lines[2:]:
if strip... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
... | 3 | day-14/part-2/skasch.py | lypnol/adventofcode-2021 |
from ikomia import dataprocess
# --------------------
# - Interface class to integrate the process with Ikomia application
# - Inherits dataprocess.CPluginProcessInterface from Ikomia API
# --------------------
class IkomiaPlugin(dataprocess.CPluginProcessInterface):
def __init__(self):
dataprocess.CPlug... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answ... | 3 | infer_resnet_action_recognition.py | Ikomia-dev/infer_resnet_action_recognition |
"""
Add version column to history_dataset_association table
"""
import logging
from sqlalchemy import (
Column,
Integer,
MetaData,
Table,
)
log = logging.getLogger(__name__)
version_column = Column("version", Integer, default=1)
def upgrade(migrate_engine):
print(__doc__)
metadata = MetaDa... | [
{
"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 | lib/galaxy/model/migrate/versions/0138_add_hda_version.py | yvanlebras/galaxy |
"""modify message table
Revision ID: d2f3d6010615
Revises: fbb3ebcf5f90
Create Date: 2020-12-24 11:56:01.558233
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'd2f3d6010615'
down_revision = 'fbb3ebcf5f90'
branch_labels = None
depends_on = None
def upgrade():... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": fals... | 3 | backend/migrations/versions/d2f3d6010615_modify_message_table.py | ClassesOver/Stories |
#对不同的split生成openmatch的文件
import json
def get_q_d():
for t in ['00', '01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', \
'17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31']:
query_file=open('/home/dihe/Projects/data/QG/queries'+... | [
{
"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 | get_data.py | playing-code/OpenMatch_test |
# coding: utf-8
"""
Isilon SDK
Isilon SDK - Language bindings for the OneFS API # noqa: E501
OpenAPI spec version: 3
Contact: sdk@isilon.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import isi_sdk_8_0
from isi... | [
{
"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 | isi_sdk_8_0/test/test_smb_shares_extended.py | mohitjain97/isilon_sdk_python |
# coding: utf-8
"""
Talon.One API
The Talon.One API is used to manage applications and campaigns, as well as to integrate with your application. The operations in the _Integration API_ section are used to integrate with our platform, while the other operations are used to manage applications and campaigns. #... | [
{
"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 | test/test_integration_profile_entity.py | talon-one/talon_one.py |
from sepal_ui import sepalwidgets as sw
from ipywidgets import dlink
from component import parameter as cp
class ParamTile(sw.Card):
def __init__(self, model):
# read the model
self.model = model
# add the base widgets
self.close = sw.Icon(children=["mdi-close"], small=True)
... | [
{
"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 | component/tile/param_tile.py | 12rambau/weplan |
import numpy as np
class sc_max_pooling:
"""applies max pooling on the absolute values of the sparse codes in Z"""
def __call__(self, Z):
return np.max(np.abs(Z), axis=1)
class max_pooling:
"""applies max pooling on the the sparse codes in Z"""
def __call__(self, Z):
return np.max(Z,... | [
{
"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 | lyssa/feature_extract/pooling.py | himanshukgp/Lyssandra |
import os
import pytest
import shutil
import tempfile
from pathlib import Path
from nip import parse, dump, load, construct
from nip.utils import deep_equals
import builders
class TestConfigLoadDump:
save_folder: Path
@classmethod
def setup_class(cls):
cls.save_folder = Path(tempfile.mkdtemp())... | [
{
"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 | tests/test_read_write.py | Spairet/nip |
# qubit number=4
# total number=31
import pyquil
from pyquil.api import local_forest_runtime, QVMConnection
from pyquil import Program, get_qc
from pyquil.gates import *
import numpy as np
conn = QVMConnection()
def make_circuit()-> Program:
prog = Program() # circuit begin
prog += X(3) # number=1
prog... | [
{
"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 | benchmark/startPyquil1973.py | UCLA-SEAL/QDiff |
"""Initial Migration
Revision ID: ab67ea40134e
Revises:
Create Date: 2020-11-03 16:20:25.216470
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'ab67ea40134e'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto ... | [
{
"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 | migrations/versions/ab67ea40134e_initial_migration.py | BihawaM/Bloggers |
import json
import pytest
import os
import sys
abs_path = os.path.dirname(os.path.abspath(__file__))
sys.path.append(f'{abs_path}/../..')
sys.path.append(f'{abs_path}/../../..')
print(sys.path[-1])
from moto import mock_dynamodb2
from redirect_handler import app
import boto_utils
from constants import TABLE_NAME
import... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 lines?",
"answer": t... | 3 | sam-app-py/tests/unit/test_handler.py | abhinavDhulipala/SAM-URL |
import pytest
from awsassume.assume_role_cache_executor import AssumeRoleCacheExecutor
from awsassume.assume_role_executor_factory import AssumeRoleExecutorFactory
from awsassume.assume_role_no_cache_executor import AssumeRoleNoCacheExecutor
from awsassume.data_models import CliArgs
@pytest.fixture(scope='module', p... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
... | 3 | tests/test_assume_role_executor_factory.py | zulhilmizainuddin/aws-assumerole |
#!/bin/python
"""
This is a class for loading input sentences
"""
class SentenceAttr:
def __init__(self, attr_list):
self.article_id = attr_list[1]
self.title = attr_list[2]
self.sentence = attr_list[3]
self.article_structure = attr_list[4]
self.place = attr_list[5]
de... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?... | 3 | src/util/load_sentence.py | lychyzclc/High-throughput-relation-extraction-algorithm |
# Copyright 2019 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# pylint: disable=W0401,W0614
from telemetry import story
from telemetry.page import page as page_module
from telemetry.page import shared_page_state
clas... | [
{
"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 | skia/tools/skp/page_sets/skia_capitalvolkswagen_mobile.py | jiangkang/renderer-dog |
# Copyright 2017 The TensorFlow 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 required by applica... | [
{
"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 | resnet/official/utils/logs/cloud_lib_test.py | biolins/frivolous_dnns |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | [
{
"point_num": 1,
"id": "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 | aliyun-python-sdk-cusanalytic_sc_online/aliyunsdkcusanalytic_sc_online/request/v20190524/GetEMapRequest.py | yndu13/aliyun-openapi-python-sdk |
import click
import os
from flask import current_app
from flask.cli import with_appcontext
from pathlib import Path
def init_db():
db_location = os.path.join(current_app.instance_path, "app.db")
db = Path(db_location)
db.unlink(missing_ok=True)
@click.command("init-db")
@with_appcontext
def init_db_com... | [
{
"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/server/controllers/db.py | ffyuanda/Involution |
# Import the tests module
import geomstats.backend as gs
import geomstats.tests
from geomstats.geometry.heisenberg import heisenberg
class TestMyManifold(geomstats.tests.TestCase):
# Use the setUp method to define variables that stay constant
# during all tests. For example, here we test the
# 4-dimensi... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
... | 3 | tests/test_heisenberg.py | mortenapedersen/geomstats |
import unittest
from translator import english_to_french, french_to_english
class TestEnglishToFrench(unittest.TestCase):
def testE2F(self):
self.assertEqual(english_to_french("Hello"), "Bonjour")
self.assertNotEqual(english_to_french("Null"), "")
class FrenchEnglishToEnglish(unittest.TestCase):... | [
{
"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 | final_project/machinetranslation/tests/test_translator.py | BrunoYH/xzceb-flask_eng_fr |
"""
Copyright 2020 The OneFlow 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 required by applicable law or agr... | [
{
"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 | oneflow/python/nn/modules/cast.py | vycezhong/oneflow |
import unittest
import chainer
from chainer import testing
from chainer_tests.dataset_tests.tabular_tests import dummy_dataset
@testing.parameterize(
{'mode': tuple},
{'mode': dict},
{'mode': None},
)
class TestAsTuple(unittest.TestCase):
def test_as_tuple(self):
dataset = dummy_dataset.Dumm... | [
{
"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/chainer_tests/dataset_tests/tabular_tests/test_as_mode.py | zaltoprofen/chainer |
from flask_restful import Resource, fields, marshal_with
from flask_jwt_extended import jwt_required, get_jwt_identity
from mini_gplus.daos.user import find_user
from mini_gplus.daos.notification import get_notifications, mark_notification_as_read, mark_all_notifications_as_read
from .users import user_fields
from .pag... | [
{
"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 | mini_gplus/resources/notifications.py | KTachibanaM/mini-gplus |
from dataclasses import dataclass
from typing import List
from shamrock.consensus.cost_calculator import NPCResult
from shamrock.types.blockchain_format.coin import Coin
from shamrock.types.blockchain_format.program import SerializedProgram
from shamrock.types.blockchain_format.sized_bytes import bytes32
from shamrock... | [
{
"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 | shamrock/types/mempool_item.py | zcomputerwiz/shamrock-blockchain |
# coding=utf-8
import os
from flask import jsonify
from lib._logging import logger
def gpio_info():
gpio_info = ['ERROR']
try:
gpio_info = os.popen("gpio readall|grep -v '\-\-\-'| grep -v 'Physical'|tr -s ' ' 2>/dev/null").read().replace('||', '|').splitlines()
except:
logger.error('Error ... | [
{
"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 | lib/gpio_utils.py | bcarroll/PiControl |
#!/usr/bin/env python
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software... | [
{
"point_num": 1,
"id": "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 | test/functional/android/chrome_tests.py | socialpoint/appium-python-client |
from __future__ import absolute_import
from django.conf import settings
from six.moves.urllib.parse import urlparse
import os
import socket
import pytest
_service_status = {}
def cassandra_is_available():
if "cassandra" in _service_status:
return _service_status["cassandra"]
try:
socket.cre... | [
{
"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": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"... | 3 | src/sentry/testutils/skips.py | kinghuang/sentry |
from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
from .validators import is_item_iterable
def coerce_sequence_of_tuple(sequence):
"""Make sure all items of a sequence are of type tuple.
Parameters
----------
sequence : sequence
A se... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answ... | 3 | src/compas/data/coercion.py | Sam-Bouten/compas |
# Copyright 2021 Edoardo Riggio
#
# 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 writin... | [
{
"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 | exercises/search_in_sorted_matrix.py | edoriggio/algorithms-and-data-structures |
import resource
import sys
import time
from threading import Thread
from memory_profiler import memory_usage
import GPUtil
import torch
# _cudart = ctypes.CDLL('libcudart.so')
#
#
# def start_cuda_profile():
# # As shown at http://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__PROFILER.html,
# # the re... | [
{
"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 | benchmark/memory_profile_tool.py | coolteemf/coolteemf-deformetrica |
import os
from os import path
import stat
import mmap
import directio
from setting import (
LONGHORN_SOCKET_DIR, LONGHORN_DEV_DIR, PAGE_SIZE,
)
def readat_direct(dev, offset, length):
pg = offset / PAGE_SIZE
in_page_offset = offset % PAGE_SIZE
# either read less than a page, or whole pages
if in_... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true... | 3 | integration/data/frontend.py | MalibuKoKo/longhorn-engine |
"""
Copyright [2013] [Rackspace]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"... | 3 | shipper/auto.py | obukhov-sergey/shipper |
from collections import UserDict
from cerberus import Validator
from genesis.platforms import PLATFORM_MAPPINGS
class ConfigException(Exception):
pass
class Config(UserDict):
SCHEMA = {
'name': {
'type': 'string',
'required': True,
},
'description': {
... | [
{
"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 | genesis/config.py | ubnetdef/genesis |
from django.db import models
import time
import random
from functools import partial
def _update_filename(instance, filename, path):
return path + str(time.time()) + '_' + str(random.randint(0,1000)) + '_' + filename
def upload_to(path):
return partial(_update_filename, path=path)
# Create your models here.
cl... | [
{
"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 | image_finder/models.py | jecel0911/ImageLocalFinder |
# pylint: disable=redefined-outer-name
# pylint: disable=unused-argument
import json
import pytest
from async_asgi_testclient import TestClient
from async_asgi_testclient.response import Response
pytestmark = pytest.mark.asyncio
def assert_200_empty(response: Response) -> bool:
assert response.status_code == ... | [
{
"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 | services/dynamic-sidecar/tests/unit/test_api_mocked.py | colinRawlings/osparc-simcore |
import abc
class BaseDecisionMaker(object):
"""
"""
def __init__(self, search_context, logger):
self._search_context = search_context
self._logger = logger
@abc.abstractmethod
def decide(self):
"""
Abstract method - must be implemented by an inheriting class.
... | [
{
"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 | simiir/stopping_decision_makers/base_decision_maker.py | ArthurCamara/simiir_subtopics |
"""added branch name
Revision ID: d5b5eb2e8dd0
Revises: 69a7e464fef3
Create Date: 2021-03-03 21:30:29.597634
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
from sqlalchemy.sql import column, table
revision = 'd5b5eb2e8dd0'
down_revision = '69a7e464fef3'
branch_labels = N... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"ans... | 3 | auth-api/migrations/versions/d5b5eb2e8dd0_added_branch_name.py | karthik-aot/sbc-auth |
'''
@author: Sevval MEHDER
Filling one cell: O(1)
Filling all cells: O(2xn) = O(n)
'''
def find_maximum_cost(Y):
values = [[0 for _ in range(2)] for _ in range(len(Y))]
# Go on with adding these 2 options
i = 1
while i < len(Y):
# Put these two options
values[i][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": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"ans... | 3 | Dynamic Programming/Create Maximum Cost List/solution.py | iabhimanyu/Algorithms |
# Definition for a binary tree node.
class TreeNode:
def __init__(self, val=0, left=None, right=None):
self.val = val
self.left = left
self.right = right
class Solution:
def maxDepth(self, root: TreeNode) -> int:
if root is None:
return 0
return 1 + max(self... | [
{
"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 | python/maximum_depth_of_binary_tree.py | anishLearnsToCode/leetcode-algorithms |
class Node:
def __init__(self, value):
self.value = value
self.left = None
self.right = None
class BinaryTree:
def __init__(self):
self.root = None
| [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answ... | 3 | python/hashmap_tree_intersection/hashmap_tree_intersection/tree.py | RoaaMustafa/data-structures-and-algorithms |
import datetime
from .base import BaseFilter
class Timeout(BaseFilter):
def get_default_options(self):
return {
"key": "timestamp",
"timestamp_format": "%Y-%m-%d %H:%M:%S",
}
def __call__(self, event):
key = self.options["key"]
fmt = self.options["time... | [
{
"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 | examples/ServiceMonitor/monitor/filters/timeout.py | frikyalong/vnpy |
import re
from HouseMarketTracker.parser.ImagesParser import ImagesParser
from HouseMarketTracker.parser.ParseUtil import ParseUtil
class HouseHomePageParser():
def parse(self, response):
meta = response.meta
item = meta['item']
item['house_layout'] = self.parse_layout(response)
... | [
{
"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 | HouseMarketTracker/parser/HouseHomePageParser.py | SuperFireFoxy/HouseMarketTracker |
import sys
from PyQt5 import QtWidgets
class game(QtWidgets.QMainWindow):
def __init__(self):
self.ap = QtWidgets.QApplication(sys.argv)
super(game, self).__init__()
self.setGeometry(100,100,200,200)
self.conts()
self.x = 50
self.y = 50
def moving(self):
s... | [
{
"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 | Python/FromUniversity/PYQT5/testgame.py | programmer-666/Codes |
import pymongo
from flask import Flask, jsonify, request
def get_db_connection(uri):
client = pymongo.MongoClient(uri)
return client.cryptongo
app = Flask(__name__)
db_connection = get_db_connection('mongodb://localhost:27017/')
def get_documents():
params = {}
name = request.args.get('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": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"ans... | 3 | api/main.py | MineiToshio/cryptongo |
import csv
import logging
from io import TextIOWrapper
import requests
from django.core.management.base import BaseCommand
from mapusaurus.fetch_zip import fetch_and_unzip_file
from respondents.management.commands.load_reporter_panel import ReporterRow
logger = logging.getLogger(__name__)
def fetch_pre_2017(year: ... | [
{
"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 | respondents/management/commands/fetch_load_reporter_panels.py | cmc333333/mapusaurus |
"""
Test utils module.
"""
import logging
from uwgroups.utils import reconcile, grouper
from .__init__ import TestBase
log = logging.getLogger(__name__)
class TestReconcile(TestBase):
def test01(self):
to_add, to_remove = reconcile(
current=set(),
desired=set())
self.as... | [
{
"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 | tests/test_utils.py | nhoffman/uwgroups |
from moto.swf.models import GenericType
import sure # noqa # pylint: disable=unused-import
# Tests for GenericType (ActivityType, WorkflowType)
class FooType(GenericType):
@property
def kind(self):
return "foo"
@property
def _configuration_keys(self):
return ["justAnExampleTimeout"]
... | [
{
"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 | tests/test_swf/models/test_generic_type.py | symroe/moto |
# coding=utf-8
#
# Copyright 2014-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 la... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true... | 3 | f5/iworkflow/shared/authz/user.py | nghia-tran/f5-common-python |
STEVILO_DOVOLJENIH_NAPAK = 10
PRAVILNA_CRKA = '+'
PONOVLJENA_CRKA = 'o'
NAPACNA_CRKA = '-'
ZMAGA = 'w'
PORAZ = 'x'
class Igra:
def __init__(self, geslo, crke):
self.geslo = geslo
self.crke = crke[:]
def napacne_crke(self):
return [crka for crka in self.crke if crka not in self.geslo]
... | [
{
"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 | model.py | MajaKomic/Vislice |
import cv2
import numpy as np
import torch
import torch.nn as nn
from torch.nn import functional as F
class GuidedBackProp():
def __init__(self, model, use_cuda):
self.model = model.eval()
self.use_cuda = use_cuda
if self.use_cuda:
self.model = self.model.cuda()
... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding... | 3 | src/guidedBackProp.py | kamata1729/visualize-pytorch |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
from lib.rnn_cells.base_cell import BaseCell
from lib import linalg
#***************************************************************
clas... | [
{
"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 | lib/rnn_cells/rnn_cell.py | wanghm92/Singlish_parser_tf0.12 |
import jvcr
class InputEx:
def __init__(self, release_time=0.2) -> None:
self.release_time = release_time
self._history = {}
def btnp(self, id, player_id=0):
if jvcr.btn(id, player_id):
time_not_pressed = self._history.get(id, self.release_time + 0.1)
if time_n... | [
{
"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 | game/inputs.py | cat-in-the-dark/ludum_43_game |
from project.customer import Customer
from project.equipment import Equipment
from project.exercise_plan import ExercisePlan
from project.subscription import Subscription
from project.trainer import Trainer
class Gym:
def __init__(self):
self.customers = []
self.trainers = []
self.equipmen... | [
{
"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 | Python OOP/Class and Static Methods/Gym/gym.py | bvoytash/Software-University |
import torch.nn as nn
from .registry import Registry
COMPRESSION_MODULES = Registry('compression modules')
class ProxyModule:
def __init__(self, module):
self._module = module
def __getattr__(self, name):
return getattr(self._module, name)
class _NNCFModuleMixin:
def __init__(self, *a... | [
{
"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 | nncf/layer_utils.py | krodyush/nncf |
#!/usr/bin/env python3
# Macaw
#
# Testing file open and string concatenation.
import random
import pkgutil
def main():
# This dictionary of words is for testing only and should *not* be considered secure.
# Courtesy of https://gist.github.com/deekayen/4148741
#f = open('dictionary.txt')
f = pkgutil... | [
{
"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 | macaw/macaw.py | dcchambers/macaw |
from app.routers.audio import router
AUDIO_SETTINGS_URL = router.url_path_for("audio_settings")
GET_CHOICES_URL = router.url_path_for("get_choices")
START_AUDIO_URL = router.url_path_for("start_audio")
def test_get_settings(audio_test_client):
response = audio_test_client.get(url=AUDIO_SETTINGS_URL)
assert r... | [
{
"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_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"ans... | 3 | tests/test_audio.py | Lisafiluz/calendar |
import logging
class Authenticator:
method = 2
have_users = True
def __new__(cls, *args, **kwargs):
if not hasattr(cls, 'instance'):
cls.instance = super().__new__(cls)
return cls.instance
def __init__(self, **options):
for option_name, option_value in options.ite... | [
{
"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 | saturn/auth/dict/core.py | Yurzs/saturn |
import os
import pickle
import torch
import numpy as np
def save(toBeSaved, filename, mode='wb'):
dirname = os.path.dirname(filename)
if not os.path.exists(dirname):
os.makedirs(dirname)
file = open(filename, mode)
pickle.dump(toBeSaved, file)
file.close()
def load(filename, mode='rb'):
... | [
{
"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 | utils.py | bakwadunka/dunka3 |
# coding: utf-8
#
# Copyright (c) 2021 Target Brands, Inc. All rights reserved.
"""
Vela server
API for the Vela server # noqa: E501
OpenAPI spec version: 0.6.1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import ... | [
{
"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 | test/test_pipeline_build.py | go-vela/sdk-python |
import numpy as np
from kinematics.dhparameters import DHParameters
class Kinematics:
def __init__(self):
self.joint1_dh = DHParameters(0, 0.1625, 0)
self.joint2_dh = DHParameters(0, 0, np.pi / 2)
self.joint3_dh = DHParameters(-0.425, 0, 0)
self.joint4_dh = DHParameters(-0.39225, ... | [
{
"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 | webots/controllers/ur_controller/kinematics/kinematics.py | EmilRyberg/P8LH7Grounding |
from django.contrib.gis.geos import Point
from data_collection.management.commands import BaseXpressDemocracyClubCsvImporter
class Command(BaseXpressDemocracyClubCsvImporter):
council_id = "E07000146"
stations_name = "parl.2019-12-12/Version 1/west-norfolk.gov.uk-1572885849000-.tsv"
addresses_name = "parl... | [
{
"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 | polling_stations/apps/data_collection/management/commands/import_kings_lynn.py | alexsdutton/UK-Polling-Stations |
import os
class Config:
SECRET_KEY = os.environ.get('SECRET_KEY')
SQLALCHEMY_TRACK_MODIFICATIONS = False
UPLOADED_PHOTOS_DEST = 'app/static/photos'
# email configurations
MAIL_SERVER = 'smtp.googlemail.com'
MAIL_PORT = 587
MAIL_USE_TLS = True
MAIL_USERNAME = os.environ.get("MAIL_USER... | [
{
"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 | config.py | AnnabelNkir/My_Hello_World |
#!/bin/python3
# Swaps case of all chars in provided string
def swap_case(s):
formattedStr = "".join(map(swapChar, s))
return formattedStr
def swapChar(char):
if char.islower():
return char.upper()
else:
return char.lower()
n=input()
if len(n)==1:
print(swapChar(n))
else:
... | [
{
"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 | Hackerrank/swap-case.py | sourav1122/Hacktoberfest |
import numpy.testing as npt
import volpy
import unittest
class BBoxTestCase(unittest.TestCase):
def setUp(self):
self.bbox = volpy.BBox([[1, 1, 1, 1],
[5, 5, 5, 1]])
def test_transform1(self):
result = self.bbox.transform().dot(self.bbox.corners[0])
... | [
{
"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 | tests/test_geometry.py | OEP/volpy |
import os
import shutil
import git
import yaml
from configuration import Configuration
from repoLoader import getRepo
from aliasWorker import replaceAliases
from commitAnalysis import commitAnalysis
from centralityAnalysis import centralityAnalysis
from tagAnalysis import tagAnalysis
def main():
tr... | [
{
"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 | DevNetworkPython/main.py | ManikHossain08/Metrics-Extraction-from-GitHub-MSR_Python |
import torch
from torch import nn
from torch.nn import init
from torch.utils.data import DataLoader
from overrides import overrides
import numpy as np
import time
from models.BaseModel import BaseModel
class PCAModel(BaseModel):
def __init__(self, configs: object):
super().__init__(configs.model.model_na... | [
{
"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 | models/PCA.py | madcpt/MachineWontLie |
"""
tl_polarization_enums.py
"""
from enum import IntEnum
class _CTypesEnum(IntEnum):
@classmethod
def from_param(cls, obj):
return int(obj)
class POLAR_PHASE(_CTypesEnum):
"""
The possible polarization angle values (in degrees) for a pixel in a polarization sensor. The polarization phase
... | [
{
"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": false
},
{... | 3 | hardware/thorlabs cameras/thorlabs_tsi_sdk-0.0.7/thorlabs_tsi_sdk/tl_polarization_enums.py | fenning-research-group/PASCAL |
"""Currying.
Transform a function that takes multiple arguments into a function for which some of the arguments are preset.
Source: Adrian
"""
# Implementation author: cym13
# Created on 2015-11-30T12:37:28.255934Z
# Last modified on 2019-09-26T16:59:21.413984Z
# Version 3
from functools import partial
def f(a):
... | [
{
"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": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answ... | 3 | examples/idioms/programs/037.0671-currying.py | laowantong/paroxython |
import logging
import zmq
import sys
import time
import uptime
import pickle
from datetime import datetime
from os import path
try:
from gps_config import (init, GPS_TOPIC)
except ImportError:
raise Exception('failed to import init method')
sys.exit(-1)
def gen_gps_message():
return [
time.t... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": fal... | 3 | src/sim_msb_gps.py | flucto-gmbh/msb_gps |
from flask_wtf import FlaskForm
from wtforms import StringField, PasswordField, BooleanField, SubmitField, IntegerField
from wtforms.validators import ValidationError, DataRequired, Email, EqualTo
from app.models import User
class LoginForm(FlaskForm):
username = StringField('Username', validators=[DataRequired(... | [
{
"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 | app/forms.py | TimothyBenger/top_lists |
import draftlog
from draftlog.ansi import * # For colors
from random import randrange
draft = draftlog.inject()
def progress_bar(progress):
if progress >= 100:
progress = 100
units = int(progress / 2)
return ("[{0}{1}] " + GREEN + "{2}%" + END).format(BBLUE + "#" * units + END, "-" * (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": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
... | 3 | examples/progress.py | cooperhammond/python-draftlog |
from asm68.registers import *
from asm68.mnemonics import TFR
from asm68.asmdsl import AsmDsl, statements
from asm68.assembler import assemble, InterRegisterError
from helpers.code import check_object_code
from pytest import raises
def test_tfr_a_a():
check_object_code('1F 88', TFR, (A, A))
def test_tfr_a_b():
... | [
{
"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/instructions/test_tfr.py | rob-smallshire/asm68 |
from sklearn.metrics import accuracy_score, precision_score, f1_score, recall_score, confusion_matrix
import pandas as pd
def getClassification_scores(true_classes, predicted_classes):
acc = accuracy_score(true_classes, predicted_classes)
prec = precision_score(true_classes, predicted_classes,average="macro")
... | [
{
"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 | classifEvaluationFunctions.py | a18shasa/a18shasa |
import json
import os
srt_path = '/home/lyp/桌面/MAE_论文逐段精读【论文精读】.457423264.zh-CN.srt'
json_path = '/home/lyp/桌面/caption.json'
txt_path = '/home/lyp/桌面'
def srt2txt(path):
out_path= os.path.join(txt_path,path.split('.')[0]+'.txt')
with open(path,'r+') as f:
with open(out_path, 'w+') as out:
fo... | [
{
"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 | test_model/utils/caption2txt.py | lyp2333/External-Attention-pytorch |
#!/usr/bin/env python3
"""Scrapes the list of provided subreddits for images and downloads them to a local directory"""
__author__ = "Patrick Guelcher"
__copyright__ = "(C) 2016 Patrick Guelcher"
__license__ = "MIT"
__version__ = "4.0"
import json
import os
import requests
import urllib.error
import wget
# Configur... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"ans... | 3 | redditscrape.py | aerovolts/python-scripts |
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from elasticsearch import Elasticsearch
from flask_caching import Cache
from flask_mail import Mail
from celery import Celery
app = Flask(__name__)
app.config['SERVER_NAME'] = 'localhost:5000'
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:////tmp/test... | [
{
"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": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"... | 3 | Chapter12/my_app/__init__.py | shalevy1/Flask-Framework-Cookbook-Second-Edition |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# -----------------------------------------------------------------... | [
{
"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/databricks/azext_databricks/__init__.py | haroonf/azure-cli-extensions |
import os
def load(name):
"""
This method creates and loads a new journal.
:param name: The base name of the journal to load.
:return: A new journal data structure populated with the file data.
"""
data = []
filename = get_full_pathname(name)
if os.path.exists(filename):
with... | [
{
"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 | Journal App/journalfunctions.py | rayjustinhuang/PythonApps |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.