source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
# Copyright (c) 2015 Pixomondo
#
# CONFIDENTIAL AND PROPRIETARY
#
# This work is provided "AS IS" and subject to the MIT License included in this
# distribution package. See LICENSE.
# By accessing, using, copying or modifying this work you indicate your
# agreement to the MIT License. All rights
# not expressly grante... | [
{
"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 | app.py | ajoss/tk-houdini-geometrynode |
from django.contrib.gis.db import models
from django.contrib.gis.tests.utils import mysql, spatialite
# MySQL spatial indices can't handle NULL geometries.
null_flag = not mysql
class Country(models.Model):
name = models.CharField(max_length=30)
mpoly = models.MultiPolygonField() # SRID, by default, is 4326
... | [
{
"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 | lib/django-1.4/django/contrib/gis/tests/geoapp/models.py | MiCHiLU/google_appengine_sdk |
# 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... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answ... | 3 | python/sedona/core/enums/join_build_side.py | andreicovaliov/incubator-sedona |
import os
from flake8.api import legacy as f8
import re
heredir = os.path.abspath(os.path.dirname(__file__))
unit_test_directory = os.path.join(heredir, '../unit')
code_directory = os.path.join(heredir, '../../eventslib')
def flake8_examine(file_location):
style_guide = f8.get_style_guide()
result = style_gu... | [
{
"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 | tool/tests/style/test_a_flake8.py | cloudpassage/halo-events-archiver |
import unittest
from models import news
News = news.News
class NewsTest(unittest.Testcase):
'''
Test Class to test the behaviour of the News class
'''
def setUp(self):
'''
Set up method that will run before every Test
'''
self.new_news = News(1234,'Python Must Be Crazy'... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answ... | 3 | news_test.py | Rickyngotho/news-highlights |
import sys
sys.path.append('../../')
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import pathlib
from accuracy import *
from plot import *
def get_accuracy_for_joints(experiment, needed_acc = 0.1):
current_file_path = pathlib.Path(__file__).parent.absolute()
gt_file = f'{current_fil... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding ... | 3 | topview/results/make_latex_accuracies.py | mmlab-cv/ICIP-2021-2346 |
#!/usr/bin/env python
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# Michael A.G. Aivazis
# California Institute of Technology
# (C) 1998-2005 All Rights Reserved
#
# {LicenseText}
#
# ~~~~~~~~~~~~~~~~~~~~~~~~... | [
{
"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 | pythia/opal/content/Style.py | willic3/pythia |
import discord
from discord.ext import commands
from modules import database
from discord.utils import get
from speasier import client
import sqlite3
database = database.database
class MessageHandler(commands.Cog):
def __init__(self, bot):
self.bot = bot
@commands.Cog.listener()
async def on_mess... | [
{
"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 | modules/messages.py | rik079/Speasier |
# GENERATED BY KOMAND SDK - DO NOT EDIT
import insightconnect_plugin_runtime
import json
class Input:
CREDENTIALS = "credentials"
HOSTNAME = "hostname"
PORT = "port"
class ConnectionSchema(insightconnect_plugin_runtime.Input):
schema = json.loads("""
{
"type": "object",
"title": "Variable... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{... | 3 | plugins/cybereason/icon_cybereason/connection/schema.py | lukaszlaszuk/insightconnect-plugins |
#!/usr/bin/python3
import json
from flask import Flask, jsonify, request, abort
from subprocess import call
#import cert_issuer.config
#from cert_issuer.blockchain_handlers import bitcoin
#import cert_issuer.issue_certificates
app = Flask(__name__)
config = None
# def get_config():
# global config
# if config ... | [
{
"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 | app.py | CA-CODE-Works/cert-issuer-dev |
import sys
from algorithms.baselines.ppo.agent_ppo import AgentPPO
from algorithms.baselines.ppo.ppo_utils import parse_args_ppo
from utils.envs.envs import create_env
def train(ppo_params, env_id):
def make_env_func():
return create_env(env_id)
agent = AgentPPO(make_env_func, params=ppo_params)
... | [
{
"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 | algorithms/baselines/ppo/train_ppo.py | alex-petrenko/landmark-exploration |
# 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
# distributed under t... | [
{
"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 | ecl/tests/unit/identity/test_identity_service.py | keiichi-hikita/eclsdk |
from django.db import models
class CurrentTranslation(models.ForeignObject):
"""
Creates virtual relation to the translation with model cache enabled.
"""
# Avoid validation
requires_unique_target = False
def __init__(self, to, on_delete, from_fields, to_fields, **kwargs):
# Disable ... | [
{
"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 | tests/indexes/models.py | danhayden/django |
import cPickle
import numpy as np
def unpickle(file):
fo = open(file, 'rb')
dict = cPickle.load(fo)
fo.close()
return dict
def clean(data):
imgs = data.reshape(data.shape[0], 3, 32, 32)
grayscale_imgs = imgs.mean(1)
cropped_imgs = grayscale_imgs[:, 4:28, 4:28]
img_data = cropped_imgs... | [
{
"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 | ch09_cnn/cifar_tools.py | susantamoh84/TensorFlow-Book |
"""Tests the communication module."""
import json
from mock import patch, call
import control.communication
@patch('serial.Serial')
def test_receiving_valid_data(mock_serial_class):
"""Confirm the json data is returned as actual data."""
expected = {'test': 5} # Random data
serial_mock = mock_serial_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": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding ... | 3 | tests/unit/test_communication.py | team-204/uas-control |
import os
import shutil
import tempfile
import ansibleflow
from ansibleflow import venv
from spec import BaseSpec
from specter import Spec, expect
class VirtualEnvTests(BaseSpec):
def can_get_env_path(self):
path = venv.ENV_PATH
expect('/.venv').to.be_in(path)
def invalid_argument_does_nothi... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
... | 3 | spec/venv.py | jmvrbanac/ansible-flow |
from django import forms
from django.contrib.auth.forms import ReadOnlyPasswordHashField
from django.core.exceptions import ValidationError
from users.models import User
class UserCreationForm(forms.ModelForm):
"""A form for creating new users. Includes all the required
fields, plus a repeated password."""
... | [
{
"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_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},... | 3 | users/rest_apis/forms.py | sharif-42/Personal_Website |
# -*- coding: utf-8 -*-
"""
:codeauthor: Nicole Thomas <nicole@saltstack.com>
"""
# Import Python Libs
from __future__ import absolute_import, print_function, unicode_literals
import logging
# Import Salt Libs
from salt.utils.versions import LooseVersion
# Import Salt Testing Libs
from tests.integration.cloud.h... | [
{
"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/integration/cloud/clouds/test_msazure.py | Noah-Huppert/salt |
import pytest
from tests.plugins.upload_to_s3 import upload_file_to_s3_by_job_id
pytest_plugins = (
"tests.examples.examples_report_plugin",
"tests.integration.integration_tests_plugin",
"tests.plugins.bokeh_server",
"tests.plugins.image_diff",
"tests.plugins.jupyter_notebook",
"tests.plugins.... | [
{
"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/conftest.py | mtinning/bokeh |
from typing import Iterator
from .base import Fork
from .byzantium import Byzantium
from .constantinople import Constantinople
from .frontier import Frontier
from .homestead import Homestead
from .istanbul import Istanbul
from .muir_glacier import MuirGlacier
from .petersburg import Petersburg
from .spurious_dragon im... | [
{
"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 | evm_asm/forks/__init__.py | fubuloubu/evm-asm |
from model.Sender import Sender
from model.SenderType import SenderType
import logging
import math
import numpy as np
class NoobSender(Sender):
def __init__(self, id, deliveryRate, debug=True):
super().__init__(id, SenderType.Noob, deliveryRate=deliveryRate, debug=debug)
def getNumberOfPacketsToCreat... | [
{
"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 | model/NoobSender.py | adhocmaster/netmad |
#!/usr/bin/env python3
import os
import shutil
import threading
from selfdrive.swaglog import cloudlog
from selfdrive.loggerd.config import ROOT, get_available_bytes, get_available_percent
from selfdrive.loggerd.uploader import listdir_by_creation
from selfdrive.dragonpilot.dashcam import DASHCAM_FREESPACE_LIMIT
MIN_B... | [
{
"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 | selfdrive/loggerd/deleter.py | JoeOIVOV/ArnePilot |
from typing import (
Any,
)
from aiohttp import web
import inspect
class ClassRouteTableDef(web.RouteTableDef):
def __repr__(self) -> str:
return "<ClassRouteTableDef count={}>".format(len(self._items))
def route(self,
method: str,
path: str,
**kwargs: Any):
def inner(handler: Any) -> Any:
#... | [
{
"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": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (e... | 3 | webserver/routers.py | AutumnSky/smart-drone |
from .eLABJournalObject import *
import json
import pandas as pd
import numbers
class SampleSerie(eLABJournalObject):
def __init__(self, api, data):
"""
Internal use only: initialize sample serie
"""
if ((data is not None) & (type(data) == dict) &
("name" in ... | [
{
"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 | elabjournal/elabjournal/SampleSerie.py | matthijsbrouwer/elabjournal-python |
from .context import mango
def test_constructor():
secret_key = [0] * 32
actual = mango.Wallet(secret_key)
assert actual is not None
assert actual.logger is not None
assert actual.secret_key == secret_key
assert actual.account is not None
def test_constructor_with_longer_secret_key():
se... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"... | 3 | tests/test_wallet.py | mschneider/mango-explorer |
from decimal import ROUND_DOWN, Decimal
from django.db import models
from lorikeet.exceptions import PaymentError
from lorikeet.models import (
Adjustment,
DeliveryAddress,
LineItem,
Payment,
PaymentMethod,
)
AUSTRALIAN_STATES = (
("NSW", "New South Wales"),
("VIC", "Victoria"),
("QLD"... | [
{
"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 | testproject/shop/models.py | excitedleigh/lorikeet |
import os
from m2cgen import ast
from m2cgen.interpreters import mixins
from m2cgen.interpreters import utils
from m2cgen.interpreters.interpreter import ToCodeInterpreter
from m2cgen.interpreters.c_sharp.code_generator import CSharpCodeGenerator
class CSharpInterpreter(ToCodeInterpreter, mixins.LinearAlgebraMixin):... | [
{
"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 | m2cgen/interpreters/c_sharp/interpreter.py | mrshu/m2cgen |
# -*- coding: utf-8 -*-
# @Time : 2020/10/18 12:39
# @Author : ooooo
from typing import *
# Definition for singly-linked list.
class ListNode:
def __init__(self, val=0, next=None):
self.val = val
self.next = next
class Solution:
def removeNthFromEnd(self, head: ListNode, n: int) -> Lis... | [
{
"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 | 0019-Remove-Nth-Node-From-End-of-List/py_0019/solution1.py | ooooo-youwillsee/leetcode |
#!/usr/bin/env python
# coding: utf-8
"""Matching raw log messages and its templates
that is generated by external tools."""
import re
from collections import defaultdict
# shortest match
REPLACER_REGEX_ESCAPED = re.compile(r"\\\*[A-Z]*?\\\*")
def add_esc_external(tpl):
"""Add escape sequence for imported exte... | [
{
"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 | amulog/external/tpl_match.py | cpflat/amulog |
import os
import sys
import errno
import random
import pickle
import numpy as np
import torch
import torchvision
import torch.nn.functional as F
from torch.utils.data.dataset import Dataset
from torch.utils.data import Dataset, DataLoader
from torch.utils.data.sampler import BatchSampler
from torchvision.datasets imp... | [
{
"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 | src/pytorch-template/old/models/baseline_3D_single.py | kaderghal/ADNI_Data_processing |
def sum_irregular(data):
"""
Sums all elements in passed sequence.
Sequence can contain plain numbers as well as other sequences with numbers
>>> sum_irregular([3, 6, 9])
18
>>> sum_irregular([3, [6, 9]])
18
>>> sum_irregular([3, [6, [9]]])
18
>>> sum_irregular(range(10))
45... | [
{
"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 | irregular_sequence.py | qagroup-py/python-october-2016-test-Sent1nelD |
# Licensed to the StackStorm, Inc ('StackStorm') 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 use th... | [
{
"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 | st2client/st2client/utils/color.py | UbuntuEvangelist/st2 |
from enginelib import script
import glm
from enginelib.level.reload import reloadable
class CrateSpinner(script.Script):
# allow changes to speed to persist across restarts
savable_attributes = {'speed': 'speed'}
# all scripts are given a reference to the entity they're attached to and the game god obje... | [
{
"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 | src/example/scripts/spin.py | biglizards/hypothetical-engine |
# -*- coding: utf-8 -*-
from fastapi import APIRouter, Body, Security
from pycloud_api.crud.tenant import get_tenant_by_id
from pycloud_api.crud.user import get_current_user, check_free_username_and_email
from pycloud_api.models.schemas.tenant import Tenant, TenantInResponse
from pycloud_api.models.schemas.user import ... | [
{
"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 | backend/pycloud_api/api/endpoints/user.py | git-albertomarin/pycloud |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.7.1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
im... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer":... | 3 | kubernetes/test/test_v1_node_condition.py | jraby/kubernetes-client-python |
"""
outputs.py is a decorator function that prints to stdout.
This eliminates lots of boilerplate code in superviseModelTrainer.
"""
import inspect
from functools import partial, wraps
def trainer_output(func):
"""
Trainer output decorator for functions that train models.
This is a decora... | [
{
"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 | healthcareai/common/trainer_output.py | vijayphugat/Practice |
from transformers import pipeline
class QuestionAnswering(object):
def __init__(self, model_path):
self._model_path = model_path
self.pipeline = pipeline("question-answering", model=model_path)
def find_answers(self, data, topk=1):
answers = []
# see data/formatted/squad/dev-v... | [
{
"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 | src/pipeline.py | geblanco/qa-server |
import torch
from torch import nn
from torch.nn import functional as F
from torchutils import to_device
class FocalLoss(nn.Module):
"""weighted version of Focal Loss"""
def __init__(self, alpha=.25, gamma=2, device=None):
super(FocalLoss, self).__init__()
self.alpha = torch.tensor([alpha, 1 ... | [
{
"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 | torchutils/losses/losses.py | tchaye59/torchutils |
from datetime import datetime
from flask_sqlalchemy import SQLAlchemy
from werkzeug.security import generate_password_hash, check_password_hash
db = SQLAlchemy()
class Base (db.Model):
__abstract__ = True
created_at = db.Column(db.DateTime, default=datetime.utcnow)
updated_at = db.Column(db.DateTime,
... | [
{
"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 | project_alpha/simpledu/simpledu/models.py | rainbowjlinux/shiyanlou_edu1 |
''' Encapsulation : Part 1
Encapsulation is the process of restricting access to methods and variables in a class in order to prevent direct data modification so it prevents accidental data modification.
Encapsulation basically allows the internal representation of an object to be hidden from the view o... | [
{
"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 | .history/ClassFiles/OOP/Encapsulation_20210105151519.py | minefarmer/Comprehensive-Python |
"""A Jupyter server extension for managing Dask clusters."""
from jupyter_server.utils import url_path_join
from . import config
from .clusterhandler import DaskClusterHandler
from .dashboardhandler import DaskDashboardCheckHandler, DaskDashboardHandler
from ._version import get_versions
__version__ = get_versions... | [
{
"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 | dask_labextension/__init__.py | vkaidalov-rft/dask-labextension |
# coding: utf-8
"""
Isilon SDK
Isilon SDK - Language bindings for the OneFS API # noqa: E501
OpenAPI spec version: 4
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_1
from i... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
... | 3 | isi_sdk_8_0_1/test/test_network_groupnet_extended.py | mohitjain97/isilon_sdk_python |
import hashlib
import binascii
CONFIG_FILE = './config.cfg'
def redirect(data):
return None
def load_from_config(data):
return None
def process_request(request):
password = request.GET["password"]
# BAD: Inbound authentication made by comparison to string literal
if password == "myPa55word"... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fe... | 3 | src/codeql/examples/hardcoded_credentials.py | my-devsecops/lab |
import requests
import json
from errors import BotException
import logging
logger = logging.getLogger(__name__)
class Github(object):
def __init__(self, repo_slug: str):
"""
Args:
repo_slug: The slug (user/repo_name) of the github repository
"""
# TODO: Add support fo... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},... | 3 | github.py | anoadragon453/msc-chatbot |
from pillowtop.logger import pillow_logging
from pillowtop.processors.interface import BulkPillowProcessor, PillowProcessor
class NoopProcessor(PillowProcessor):
"""
Processor that does absolutely nothing.
"""
def process_change(self, change):
pass
class LoggingProcessor(PillowProcessor):
... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)... | 3 | corehq/ex-submodules/pillowtop/processors/sample.py | dimagilg/commcare-hq |
# Copyright 2014: Mirantis Inc.
# 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 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": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true... | 3 | rally/cli/commands/info.py | LorenzoBianconi/rally |
from os.path import join as pjoin, splitext, basename as pbasename
def generate_interface_emitter(target, source, env):
base = str(target[0])
return (['%s.pyf' % base], source)
def do_generate_fake_interface(target, source, env):
"""Generate a (fake) .pyf file from another pyf file (!)."""
# XXX: do t... | [
{
"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 | scipy/lib/lapack/scons_support.py | lesserwhirls/scipy-cwt |
import unittest
from db_env.DatabaseEnvironment import DatabaseEnvironment
from db_env.mock.RandomTpchMockDatabase import RandomTpchMockDatabase
from db_env.mock.MockDatabase import MockDatabase
from agent.Agent import Agent
from agent.AgentActionFeatures import Agent as AgentAF
class TestAgent(unittest.TestCase):
... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer":... | 3 | test/test_agent.py | Chotom/rl-db-indexing |
import dependency_injector.providers as providers
import dependency_injector.containers as containers
class Engine(object):
def go(self):
return "I'm going."
class Car(object):
def __init__(self, engine: Engine):
self.engine = engine
def go(self):
print(self.engine.go())
cla... | [
{
"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 | src/unittest/python/injection_tests.py | DMRSystem/dmr-cli |
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: https://docs.scrapy.org/en/latest/topics/item-pipeline.html
# useful for handling different item types with a single interface
import pymysql
from pymysql import cursors
DB_HOST = '172.20.52.114'
DB_PORT = 33... | [
{
"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 | bili/bili/pipelines.py | MRmac1/net-spiders |
# 電子レンジ
def get_E_Elc_microwave_d_t(P_Elc_microwave_cook_rtd, t_microwave_cook_d_t):
"""時刻別消費電力量を計算する
Parameters
----------
P_Elc_microwave_cook_rtd : float
調理時の定格待機電力, W
t_microwave_cook_d_t : ndarray(N-dimensional array)
1年間の全時間の調理時間を格納したND配列, h
d日t時の調理時間が年開始... | [
{
"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 | src/pyhees/section10_j1_f.py | jjj-design/pyhees |
from django.core.management.base import BaseCommand, CommandError
from optparse import make_option
from tourney.tournament.models import Player, Tournament
class Command(BaseCommand):
args = ''
help = 'Lists all players with their options'
option_list = BaseCommand.option_list + (
make_option('-... | [
{
"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 | tourney/tournament/management/commands/players.py | jonejone/tourney |
# -*- coding: utf8 -*-
import json
from console.models import Resource, resource_repo
from console.exceptions import NotFound, AlreadyExist, PermissionDenied
from console.factory import logger
class ResourceService:
resource_repo = resource_repo
def __init__(self, rid: str = None, task_intra_id: str = None... | [
{
"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": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file writte... | 3 | efls-console/console/resource/service.py | universe-hcy/Elastic-Federated-Learning-Solution |
from time import sleep
from gpiozero import LED
from hm_pyhelper.hardware_definitions import is_rockpi, is_raspberry_pi
from gatewayconfig.gatewayconfig_shared_state import GatewayconfigSharedState
from gatewayconfig.logger import get_logger
LOGGER = get_logger(__name__)
LED_REFRESH_SECONDS = 2
class LEDProcessor:
... | [
{
"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 | gatewayconfig/processors/led_processor.py | ganey/hm-config |
import datetime
import app
class Order:
def __init__(self, orderId, custId, orderDate, orderStatus, shipDate, creditCardNumber,
street, city, state, zipCode, emailAddress):
self.orderId = orderId
self.custId = custId
self.orderDate = orderDate
self.orderStatus = or... | [
{
"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 | app/model/Order.py | ShiftLeftSecurity/tarpit-python |
from django.shortcuts import render, redirect, get_object_or_404
from django.views.decorators.http import require_POST
from shop.models import Product
from .cart import Cart
from .forms import CartAddProductForm
from coupons.forms import CouponApplyForm
from shop.recommender import Recommender
@require_POST
def cart_... | [
{
"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 | Chapter09/myshop/cart/views.py | kableson/panda |
"""Elasticsearch resource for querying events
Uses the events index to filter for all events. Can use more specific queries
for `location_name`, `name` and description.
"""
from flask import request
from flask_rest_jsonapi.resource import Resource
from elasticsearch_dsl import Search
from app.models.search.event imp... | [
{
"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 | app/api/full_text_search/events.py | akashtalole/python-flask-restful-api |
import sys
import math
import time
class GraphTool():
def __init__(self):
pass
def plot_pr(self):
pass
def plot_roc(self):
pass
| [
{
"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 | graph_tool.py | weaponsjtu/RecommederSystem |
from easygraphics.turtle import *
def arcl(side, degree):
for i in range(degree):
fd(side)
lt(1)
def arcr(side, degree):
for i in range(degree):
fd(side)
rt(1)
def main():
create_world(800, 600)
set_speed(50)
arcr(2, 90)
arcl(2, 90)
pause()
close_w... | [
{
"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 | appendix/introduction.to.programming.with.turtle/4-1-1.custom.function.py | royqh1979/programming_with_python |
"""
web api for haipproxy
"""
import os
from flask import (
Flask, jsonify as flask_jsonify)
from ..client.py_cli import ProxyFetcher
from ..config.rules import VALIDATOR_TASKS
def jsonify(*args, **kwargs):
response = flask_jsonify(*args, **kwargs)
if not response.data.endswith(b"\n"):
response.... | [
{
"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 | haipproxy/api/core.py | haoflynet/haipproxy |
from ...error import GraphQLError
from .base import ValidationRule
# Necessary for static type checking
if False: # flake8: noqa
from ..validation import ValidationContext
from ...language.ast import Document, OperationDefinition, Name
from typing import Any, List, Optional, Union, Dict
class UniqueOper... | [
{
"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 | graphql/validation/rules/unique_operation_names.py | ThanksBoomerang/graphql-core-legacy |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
sys.path.append("..")
try:
import os
import signal
import time
from conf import *
from lib import logger
from lib import mqtt
except Exception as e:
print(f"Import error: {str(e)} line {sys.exc_info()[-1].tb_lineno}, check requi... | [
{
"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 | tests/signaltest.py | zibous/ha-miscale2 |
from django.http import HttpResponse
from django.shortcuts import redirect, render
from django.views.generic import View
def view_func1(request):
# Whether this is safe depends on template.html -- annoyingly
return HttpResponse(request.GET.get("untrusted"))
def view_func2(request, path='default'):
env =... | [
{
"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 | python/ql/test/3/library-tests/web/django/views.py | PavelBansky/ql |
from flask import Blueprint, request, Response
from flask_restful import Api, Resource, reqparse
from server.app import app
from server.api.v1 import api_tickets
from server.api.v1 import api_admin
from server.api.v1 import api_login
from server.api.v1 import api_user
import json
# NOTE: all the following resources by... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answ... | 3 | server/api/v1/api.py | amitab/helpqueue |
from collections import namedtuple
from functools import wraps
from operator import itemgetter
def dirfmt(func):
@wraps(func)
def inner(directory):
new_directory = []
for person in directory:
title = 'Mr.' if person.sex == 'M' else 'Ms.'
new_directory.append((title, pe... | [
{
"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 | Python/decornamedir.py | sockduct/Hackerrank |
import click
import configparser
import json
import sys
from arxtools import export_clues, fetch_clues
from arxtools.clue import Clue
@click.group()
def cli():
pass
def get_character_info(name):
config = configparser.ConfigParser()
config.read('arxtools.ini')
try:
return config[name.lower()]... | [
{
"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 | cli.py | stesla/arxtools |
#!/usr/bin/env python
import argparse
import hashlib
import requests
import os
from http.server import HTTPServer, BaseHTTPRequestHandler
from socketserver import ThreadingMixIn
host_target = os.environ['AIS_TARGET_URL']
class Handler(BaseHTTPRequestHandler):
def log_request(self, code='-', 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": "all_params_annotated",
"question": "Does every function parameter in this file have a ty... | 3 | transformers/md5/server.py | NVIDIA/ais-etl |
from typing import Optional
from fastapi import Depends, FastAPI, Security
from fastapi.security import APIKeyHeader
from fastapi.testclient import TestClient
from pydantic import BaseModel
app = FastAPI()
api_key = APIKeyHeader(name="key", auto_error=False)
class User(BaseModel):
username: str
def get_curre... | [
{
"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_security_api_key_header_optional.py | jfunez/fastapi |
import threading
from queue import Queue
import attr
from ..cli.context import ExecutionContext
from ..cli.handlers import EventHandler
from ..runner import events
from . import worker
from .constants import DEFAULT_URL, STOP_MARKER, WORKER_JOIN_TIMEOUT
@attr.s(slots=True) # pragma: no mutate
class ServiceReporter... | [
{
"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": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
... | 3 | src/schemathesis/service/handler.py | gluhar2006/schemathesis |
#!/usr/bin/env python3
import json
from pathlib import Path
def get_valid_file_path(file_path: str) -> Path:
"""Check if file exists and return valid Path object"""
path = Path(file_path).resolve()
if not path.is_file():
raise Exception("No file found! Please check your path and try again.")
... | [
{
"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": "all_function_names_snake_case",
"question": "Are all function names in this file written i... | 3 | scripts/convert_protocols_to_exams.py | timptner/farafmb.de |
from rest_framework import serializers
from goods.models import SKU
class CartAddSerializer(serializers.Serializer):
sku_id = serializers.IntegerField()
count = serializers.IntegerField(min_value=1,max_value=5)
selected = serializers.BooleanField(default=True,required=False)
def validated_sku_id(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": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{... | 3 | meiduo_1/meiduo_1/apps/carts/serializers.py | zjc0520/meiduo |
# Definition for a binary tree node.
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
def isSymmetric(self, root: TreeNode) -> bool:
if not root:
return True
return self.checkNodes(root.left, root.right)
... | [
{
"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 | algorithms/python/SymmetricTree/SymmetricTree.py | artekr/LeetCode |
# Copyright 2018 Open Source Robotics Foundation, 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... | [
{
"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 | launch/test/launch/test_launch_description_source.py | bedieber/launch |
#####
#
# This class is part of the Programming the Internet of Things project.
#
# It is provided as a simple shell to guide the student and assist with
# implementation for the Programming the Internet of Things exercises,
# and designed to be modified by the student as needed.
#
from programmingtheiot.data.Sensor... | [
{
"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 | src/main/python/programmingtheiot/cda/emulated/HumiditySensorEmulatorTask.py | NULishengZhang/piot-python-components |
import csv
import math
import numpy as np
import matplotlib.pyplot as plt
def read_csv_file(name):
file = open(name)
type(file)
csvreader = csv.reader(file)
header = []
header = next(csvreader) #First line of CSV is name of headers
"Populates array with rows from CSV [[shoulder_angle_1,elbow_... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
... | 3 | datasets/plot.py | cplan082-tech/project_csi4103 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import sys
import gzip
import marshal
from math import log, exp
from ..utils.frequency import AddOneProb
class Bayes(object):
def __init__(self):
self.d = {}
self.total = 0
def save(self, fname, iszip=True):
d = {}
... | [
{
"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 | snownlp/classification/bayes.py | raxxarr/snownlp |
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": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{... | 3 | config.py | devseme/Blogs-App |
"""
Contains the definition of PatternFill.
"""
from .fill import Fill
class PatternFill(Fill):
"""
Represents an image fill style.
"""
def __init__(self, width, height, scale_behavior, image_href):
"""Instantiates this PatternFill."""
super().__init__()
self.width = width
... | [
{
"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 | xdtools/style/pattern_fill.py | tjcjc/xdtools |
import requests
from django.utils.http import urlencode
from config.settings import AUTH_BASE_URL
from users.exceptions import AuthProcessError
class AuthService(object):
AUTH_URL = AUTH_BASE_URL + '/oauth/authorize/'
USER_URL = AUTH_BASE_URL + '/oauth/user/'
ACCESS_TOKEN_URL = AUTH_BASE_URL + '/oauth/ac... | [
{
"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 | users/services.py | joway/python-china |
# Created on Sep 2, 2020
# author: Hosein Hadipour
# contact: hsn.hadipour@gmail.com
import os
output_dir = os.path.curdir
def zsnow2(T=12):
cipher_name = 'zsnow2'
recommended_mg = 9
recommended_ms = 12
eqs = '#%s %d Rounds\n' % (cipher_name, T)
eqs += 'connection relations\n'
for t in range(... | [
{
"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 | ciphers/SNOW2/snow2_v1.py | j-danner/autoguess |
import responses
from urllib.parse import urlencode
from tests.util import random_str
from tests.util import mock_http_response
from binance.spot import Spot as Client
from binance.error import ParameterRequiredError
mock_item = {"key_1": "value_1", "key_2": "value_2"}
key = random_str()
secret = random_str()
asset... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answ... | 3 | tests/spot/margin/test_margin_asset.py | Banging12/binance-connector-python |
# -*- coding: utf-8 -*-
"""
pagarmecoreapi
This file was automatically generated by APIMATIC v2.0 ( https://apimatic.io ).
"""
class CreateCheckoutCardInstallmentOptionRequest(object):
"""Implementation of the 'CreateCheckoutCardInstallmentOptionRequest' model.
Options for card instal... | [
{
"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": fals... | 3 | pagarmecoreapi/models/create_checkout_card_installment_option_request.py | pagarme/pagarme-core-api-python |
# -*- coding: utf-8 -*-
from captcha.fields import ReCaptchaField
from crispy_forms.bootstrap import FormActions
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Submit
from django import forms
from django.conf import settings
from django.core.mail import send_mail
from django.http import Http... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 lines?",
"answer": false
}... | 3 | clock/contact/forms.py | chgad/django-clock |
from django.shortcuts import render
from listings.models import Listings
from listings import choices
from realtors.models import Realtor
def index(request):
lisitngs = Listings.objects.order_by(
'-is_data'
).filter(is_published=True)[:3]
context = {
'listings': lisitngs,
'sta... | [
{
"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 | btre-project/pages/views.py | amirzp/btre-project |
"""Users and pitch changes
Revision ID: ff2aeab22c7b
Revises: 36d7e307135b
Create Date: 2019-07-01 07:38:51.291891
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = 'ff2aeab22c7b'
down_revision = '36d7e307135b'
branch_lab... | [
{
"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/ff2aeab22c7b_users_and_pitch_changes.py | Julzpeter/Pitches |
#!/usr/bin/env python
#-*- coding:utf-8; mode:python; indent-tabs-mode: nil; c-basic-offset: 2; tab-width: 2 -*-
from collections import namedtuple
import codecs, sys
import subprocess
import os.path as path
from .unit_test import unit_test
class program_unit_test(unit_test):
def _make_command(self, program, arg... | [
{
"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 | lib/bes/testing/program_unit_test.py | reconstruir/bes |
import hashlib
import random
import string
import time
from django.core.cache import cache
import requests
from common.config import WECHAT_GET_JSSDK_TICKET_URL, WECHAT_GET_ACCESS_TOKEN_URL
class Signature:
"""
Get Wechat JSSDK signature
"""
def __init__(self,url):
self.ret = {
'n... | [
{
"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 | kessk_web/device/wexinSignature.py | yungs2017/kessk-switch |
from amaru.utilities import constants
def generate_subsets(current_tree_bottom):
current_distances = []
subsets = []
current_point = 0
while current_point < len(current_tree_bottom) - 1:
current_distances.append(current_tree_bottom[current_point + 1][1] - current_tree_bottom[current_point][1])... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fe... | 3 | amaru/utilities/subsets.py | TeamSerpentine/angry-birds-level-gen-2020 |
import numpy as np
from skimage.transform import resize as imresize
def batch(batch):
format_size = batch[0][0].shape[1]
format_batch = []
for index, item in enumerate(batch):
original_image = item[0]
transpose_image = np.transpose(original_image, (1, 2, 0))
resized_image = imresi... | [
{
"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 | clib/converts/format_image_size.py | Swall0w/clib |
#!/usr/bin/env python
"""Import AWS Bills into BigQuery from GCS"""
#
# Started with code from:
# https://github.com/drewrothstein/simplebirdmail
# https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/bigquery/api/load_data_from_csv.py
#
# All are licensed under Apache License, Version 2.0
# http:... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer":... | 3 | main.py | drewrothstein/omg-my-aws-bills-are-crazy |
from random import shuffle
from copy import deepcopy
class Deck:
def __init__(self, cards = []):
self.cards = cards
def shuffle(self, times = 1):
result = deepcopy(self.cards)
for _ in range(times):
shuffle(result)
return Deck(result)
def top(self, number = 1)... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/c... | 3 | scripts/deck.py | geosteffanov/arithmeticards |
import numpy as np
import librosa
from scipy import signal
import fnmatch
import os
def preemphasis(x, coeff=0.97):
return signal.lfilter([1, -coeff], [1], x)
def inv_preemphasis(x, coeff=0.97):
return signal.lfilter([1], [1, -coeff], x)
def griffin_lim(stft_matrix_,
n_fft,
... | [
{
"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 | utils/audio_utils.py | VitaNova1998/REP |
from __future__ import absolute_import, division, print_function
class GModelBackgroundExt(object):
"""An extension class implementing a robust GLM background algorithm."""
name = "gmodel"
@classmethod
def phil(cls):
from libtbx.phil import parse
phil = parse(
"""
... | [
{
"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 | extensions/gmodel_background_ext.py | jbeilstenedmands/dials |
class Stream:
"""
Stream is abstract stream for string and list
"""
EOF = (-1)
def __init__(self, src):
if not isinstance(src, (str, list, tuple)):
raise TypeError('invalid type of source in absstream.stream.Stream')
self._src = src
self._limit = len(src)
... | [
{
"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 | absstream/stream.py | narupo/absstream |
# This sample tests support for callback protocols (defined in PEP 544).
from typing import Optional, List, Protocol
class TestClass1(Protocol):
def __call__(self, *vals: bytes, maxlen: Optional[int] = None) -> List[bytes]:
return []
def good_cb(*vals: bytes, maxlen: Optional[int] = None) -> List[bytes... | [
{
"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": "more_functions_than_classes",
"question": "Does this file define more functions than class... | 3 | packages/pyright-internal/src/tests/samples/callbackProtocol1.py | sasano8/pyright |
#!/usr/bin/env python
# encoding: utf-8
"""
@author: Alfons
@contact: alfons_xh@163.com
@file: 07-01-decorator.py
@time: 18-2-26 下午9:27
@version: v1.0
"""
# python 装饰器
# 1.能把被装饰的函数替换成其他函数。
# 2.装饰器在加载模块时立即执行。
# 3.装饰器的强大在于它能够在不修改原有业务逻辑的情况下对代码进行扩展,
# 权限校验、用户认证、日志记录、性能测试、事务处理、缓存等都是装饰器的绝佳应用场景,
# 能够最大程度地对代码进行复用。
print("... | [
{
"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 | 07-Decorator/07-01-decorator.py | xiaohui100/FluentPython |
import time
from src import log_setup
LOGGER = log_setup.get_logger(__name__)
def monitor(func):
def wrapped_function(*args, **kwargs):
start = time.monotonic_ns()
return_value = func(*args, **kwargs)
LOGGER.info(
f'function {func.__name__} took {(time.monotonic_ns() - start)... | [
{
"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/monitoring.py | jagadeesh6jaga/vakyansh-realtime-server |
import maskgen.video_tools
"""
Save Audio channels to a WAV file
"""
def transform(img, source, target, **kwargs):
maskgen.video_tools.toAudio(source, outputName=target)
return None, None
def operation():
return {'name': 'OutputWAV',
'category': 'Output',
'description': 'Extract... | [
{
"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 | plugins/OutputWAV/__init__.py | spongezhang/maskgen |
"""
Tests for yamelish.cli.
"""
import os
import pytest
from yamelish.cli import *
# pylint: disable=C0111
@pytest.fixture
def json_file_path(tmp_path):
filepath = os.path.join(tmp_path, 'example.json')
with open(filepath, 'w') as filedesc:
filedesc.write('{"foo": "bar"}')
return filepath
def test_load_json(jso... | [
{
"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 | tests/test_cli.py | xavierog/yamelish |
'''
Created on 17.03.2015
@author: vvladych
'''
from forecastmgmt.dao.db_connection import get_db_connection
import psycopg2.extras
from MDO import MDO
class FCTextModel(MDO):
sql_dict={"get_all":"SELECT sid, textmodel_date, textmodel_uuid, forecast_sid FROM fc_textmodel",
"delete":"DELET... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self... | 3 | src/forecastmgmt/model/fc_textmodel.py | vvladych/forecastmgmt |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.