source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
import sys
''' CONVERTERS
{ 0, 1 } convertToZeroOne( data )
{ -1, 1 } convertToPosNegOne( data )
'''
def convertToZeroOne( data ):
return( data[0], [ [ 1 if elem is 1 else 0 for elem in row ] for row in data[1] ] )
#
def convertToPosNegOne( data ):
return( data[0], [ [ 1 if elem is 1 else -1 for elem in... | [
{
"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 | Assignment3/logistic_regression/csv_utilities.py | CKPalk/MachineLearning |
from juriscraper.OpinionSite import OpinionSite
import time
from datetime import date
from lxml import html
class Site(OpinionSite):
def __init__(self, *args, **kwargs):
super(Site, self).__init__(*args, **kwargs)
self.url = 'http://www.ca10.uscourts.gov/opinions/new/daily_decisions.rss'
se... | [
{
"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 | juriscraper/opinions/united_states/federal_appellate/ca10.py | Alex-Devoid/juriscraper |
import pickle
import os.path
from googleapiclient.discovery import build
from google_auth_oauthlib.flow import InstalledAppFlow
from google.auth.transport.requests import Request
SCOPES = ['https://www.googleapis.com/auth/calendar.readonly']
CREDENTIALS_PATH = os.path.join(os.path.dirname(
__file__), '..', '..', ... | [
{
"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 | scripts/utils/api.py | tayutaedomo/google-calendar-tools |
import pyrealtime as prt
class CounterLayer(prt.InputLayer):
def __init__(self, target, *args, **kwargs):
self.target = target
super().__init__(*args, **kwargs)
def generate(self, counter):
if counter == self.target:
# can trigger a shutdown by returning stop signal or cal... | [
{
"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 | examples/stop_complex.py | ewhitmire/pyrealtime |
from django.db import models
from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
from django.conf import settings
from api.models.bigpicture import BigPicture
import datetime
import statistics
class Rating(models.Model):
target_bp = models.Fo... | [
{
"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 | back/api/models/vote.py | QLevaslot/TheBigPicture |
from docutils import nodes
from docutils.parsers.rst import Directive
class StOutput(Directive):
"""Insert Streamlit app into HTML doc.
The first argument is a URL to be iframed, and the second argument
(optional) is a string of inline styles to assign to the iframe.
Examples
--------
.... | [
{
"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 | docs/_ext/stoutput.py | pohlt/streamlit |
from torch import nn
import torch
class LogisticRegression(nn.Module):
def __init__(self,
theta_params: int):
super(LogisticRegression, self).__init__()
self.__linear = nn.Linear(theta_params, 1)
self.__sigmoid_layer = nn.Sigmoid()
def forward(self,
... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
}... | 3 | Classification/LogisticModel.py | govindansriram/CobraML |
# automatically generated by the FlatBuffers compiler, do not modify
# namespace: tflite
import flatbuffers
class ResizeNearestNeighborOptions(object):
__slots__ = ['_tab']
@classmethod
def GetRootAsResizeNearestNeighborOptions(cls, buf, offset):
n = flatbuffers.encode.Get(flatbuffers.packer.uof... | [
{
"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 | tflite/ResizeNearestNeighborOptions.py | FrozenGene/tflite |
# Copyright 2019-2021 ETH Zurich and the DaCe authors. All rights reserved.
""" Sums all the element of the vector with a reduce. """
import dace
import numpy as np
import argparse
from dace.fpga_testing import fpga_test
from dace.transformation.interstate import FPGATransformSDFG
N = dace.symbol('N')
@dace.program... | [
{
"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 | tests/fpga/vector_reduce_test.py | Walon1998/dace |
"""This module contains the general information for MacpoolUniverse ManagedObject."""
import sys, os
from ...ucsmo import ManagedObject
from ...ucscoremeta import UcsVersion, MoPropertyMeta, MoMeta
from ...ucsmeta import VersionMeta
class MacpoolUniverseConsts():
pass
class MacpoolUniverse(ManagedObject):
... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
}... | 3 | ucsmsdk/mometa/macpool/MacpoolUniverse.py | anoop1984/python_sdk |
# Copyright (c) 2021 PaddlePaddle 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 ... | [
{
"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 | EISeg/eiseg/util/language.py | Amanda-Barbara/PaddleSeg |
import argparse
import os
import xml.etree.ElementTree as ET
from multiprocessing.pool import ThreadPool
from gutenberg.query import get_metadata
CACHE_PATH = ""
def get_one_title_from_cache(book_id):
return (book_id, get_metadata("title", int(book_id)))
def get_one_title(book_id):
try:
title = (... | [
{
"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 | recipes/sota/2019/raw_lm_corpus/get_titles.py | Zilv1128/test1 |
# -*- coding: utf-8 -*-
from django.utils.translation import ugettext_lazy as _
from cms.models import Page
from cms.utils.page_permissions import user_can_add_page, user_can_add_subpage
from .wizards.wizard_pool import wizard_pool
from .wizards.wizard_base import Wizard
from .forms.wizards import CreateCMSPageForm,... | [
{
"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 | tech_project/lib/python2.7/site-packages/cms/cms_wizards.py | priyamshah112/Project-Descripton-Blog |
import scrapy
from selenium import webdriver
from mySpider.items import MyspiderItem
class FundSpider(scrapy.Spider):
name = 'wangyi'
#allowed_domains = ['www.xxx.com']
start_urls = ['http://news.163.com/']
modules_url = [] #存放五个版块的url
def __init__(self):
self.bro = webdriver.Chrome(execut... | [
{
"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_return_types_annotated",
"question": "Does every function in this file have a return ... | 3 | mySpider/spiders/wangyi.py | songw831/mySpider |
import torch
import numpy as np
import torch.nn.functional as F
from ..src.Conv1DT_6 import Conv1DT as NumpyConv1DT
class Tester:
conv1dt_numpy = NumpyConv1DT()
def y_torch(self, x, weight, bias, stride, padding):
x = torch.tensor(x)
weight = torch.tensor(weight)
bias = torch.tensor(b... | [
{
"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 | test/test_conv1dt_6.py | neblar/numpynn |
from json import dumps, loads
import re
from oauthlib.common import to_unicode
def plentymarkets_compliance_fix(session):
def _to_snake_case(n):
return re.sub("(.)([A-Z][a-z]+)", r"\1_\2", n).lower()
def _compliance_fix(r):
# Plenty returns the Token in CamelCase instead of _
... | [
{
"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 | GmailWrapper_JE/venv/Lib/site-packages/requests_oauthlib/compliance_fixes/plentymarkets.py | JE-Chen/je_old_repo |
def write_qs(qs):
with open("qs.txt", "w") as f:
for i in qs:
f.write(i + "\n")
def write_ans(ans):
with open("ans.txt", "w") as f:
for i in ans:
f.write(i + "\n")
def read_qs():
with open("qs.txt", "r") as f:
qs = f.readlines()
qs = [i.rstrip("\n") for ... | [
{
"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 | server/utils.py | shambu09/chat-bot |
#!/usr/bin/env python
import threading
mylock = threading.RLock()
num = 0
class WorkThread(threading.Thread):
def __init__(self, name):
threading.Thread.__init__(self)
self.t_name = name
def run(self):
global num
while True:
mylock.acquire()
print('\n%s locked, number: %d' %(self.t_name, num))
if... | [
{
"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 | py/t4/demo2.py | firekyrin/train-demo |
import torch.nn as nn
class Identity(nn.Module):
def __init__(self):
super(Identity, self).__init__()
def forward(self, x):
return x
| [
{
"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 | segmentify/model/layers/identity.py | kne42/segmentify |
import math
import array
import pyaudio
from random import randint
# Audio helper constants
_T = 11025
_q = 127
_p = -_q
_N = 255 * 4
class SoundFX:
# Defined sounds
NO_SOUND = ''
CRASH_SOUND = array.array('b', (max(_p, min(_q, int(_T * math.sin(i * 0.01))))
for i in ... | [
{
"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 | audio.py | iuliux/LunarLander |
from cloudmesh_base.util import path_expand
from cloudmesh_base.Shell import Shell
import os
__config_dir_prefix__ = os.path.join("~", ".cloudmesh")
__config_dir__ = path_expand(__config_dir_prefix__)
def config_file(filename):
"""
The location of the config file: ~/.cloudmesh/filename. ~ will be expanded
... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding se... | 3 | cloudmesh_base/locations.py | zaber-paul/base |
from pytezos import PyTezosClient
class Token(object):
def __init__(self, client: PyTezosClient):
self.client = client
def set_admin(self, contract_id, new_admin):
print(f"Setting fa2 admin on {contract_id} to {new_admin}")
call = self.set_admin_call(contract_id, new_admin)
r... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},... | 3 | src/token.py | AsmusAB/wrap-tz-contracts |
# Author
# Angelica ACOSTA ARTETA
import unittest
from balance import summing, stringarray, need, weighting
class TestBalance(unittest.TestCase):
def test_summing(self):
self.assertEqual(summing([]), 0)
self.assertEqual(summing([3]), 3)
self.assertEqual(summing([1,1,1,1,1]), 5)
se... | [
{
"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 | test_balance.py | angelicacosta/Ternary-Balance |
class Memcached(object):
def __init__(self, servers, username=None, password=None, timeout=0):
import pylibmc
self.conn = pylibmc.Client(servers, binary=True, username=username, password=password)
self.timeout = timeout
def __getitem__(self, key):
key = key.encode('utf-8', err... | [
{
"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": "more_functions_than_classes",
"question": "Does this file define more functions than clas... | 3 | cache.py | sunlightlabs/congress-web |
#!/usr/bin/env python
import unittest
from src.convert import kilometers_to_miles, miles_to_kilometers,\
years_to_minutes, minutes_to_years
class TestConvert(unittest.TestCase):
def test_km_to_miles(self):
actual = kilometers_to_miles(1)
expected = 0.621 #from google
self.assertA... | [
{
"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 | run_tests.py | joshuacw/unit_conversions |
# -*- coding: utf-8 -*-
"""
Created on Mon Feb 25 09:37:23 2019
@author: if715029
"""
# limpieza de base de datos y manejod de texto
import pandas as pd
import string
from datetime import datetime
#%% Importar tabla
dirty = pd.read_csv('../data//dirty_data_v3.csv', encoding='latin-1')
#%% Funcion para retirar signo... | [
{
"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 | code/p7.py | OscarFlores-IFi/CDINP19 |
from os.path import join, abspath
from pygame.mixer import Sound
def get_song(song: str) -> Sound:
return Sound(get_path(song))
def get_path(name: str):
return join(abspath(""), "source", "sounds", name)
| [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?... | 3 | source/sounds/manager.py | Mio-coder/clicer |
from rest_framework import permissions
class UpdateOwnProfile(permissions.BasePermission):
"""Allow users to edit their own profile"""
def has_object_permission(self, request, view, obj):
"""Check user is trying to edit their own profile"""
if request.method in permissions.SAFE_METHODS:
... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
... | 3 | profiles_api/permissions.py | kindise/profiles-rest-api |
"""Django static file storage backend for OpenEdX."""
from django.conf import settings
from pipeline.storage import PipelineCachedStorage
from openedx.core.storage import ProductionStorage
class CDNMixin(object):
"""Mixin to activate CDN urls on a static files storage backend."""
def url(self, name, force=... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": true
},... | 3 | releases/dogwood/3/fun/config/lms/storage.py | SergioSim/learning-analytics-playground |
import torch
import matplotlib.image as img
import cv2
import dlib
from imutils.face_utils import *
import numpy as np
# image = img.imread("extra//test.jpg")
# image = cv2.cvtColor(np.array(image), cv2.COLOR_RGB2BGR) # opencvImage
dlib_path = 'extra//shape_predictor_68_face_landmarks.dat'
def get_fac... | [
{
"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 | extra/face.py | Leyan529/ImageClassificationPL |
from django import template
from django.db.models import get_model
from oscar.apps.basket.forms import AddToBasketForm
register = template.Library()
product_model = get_model('product','item')
@register.tag(name="basket_form")
def do_basket_form(parse, token):
tokens = token.split_contents()
if len(token... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
... | 3 | oscar/apps/basket/templatetags/basket_tags.py | owad/django-oscar |
# -*- coding: utf-8 -*-
import torch
import torch.nn as nn
class ScalarMix(nn.Module):
def __init__(self, n_layers, dropout=0):
super(ScalarMix, self).__init__()
self.n_layers = n_layers
self.dropout = dropout
self.weights = nn.Parameter(torch.zeros(n_layers))
self.gamm... | [
{
"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 | dadmatools/models/flair/parser/modules/scalar_mix.py | njzr/DadmaTools |
"""Solution init
Revision ID: cb023cff5fc8
Revises: a240cc945c0b
Create Date: 2020-04-25 15:27:37.805075
"""
from alembic import op
from sqlalchemy import Column, Integer, String, ForeignKey, UniqueConstraint
# revision identifiers, used by Alembic.
revision = "cb023cff5fc8"
down_revision = "a240cc945c0b"
branch_la... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
... | 3 | backend/db_migrations/versions/cb023cff5fc8_solution_init.py | pixlie/buildgaga |
from snowddl.blueprint import ObjectType
from snowddl.converter.abc_converter import AbstractConverter, ConvertResult
from snowddl.parser.database import database_json_schema
class DatabaseConverter(AbstractConverter):
def get_object_type(self) -> ObjectType:
return ObjectType.DATABASE
def get_existi... | [
{
"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 | snowddl/converter/database.py | littleK0i/SnowDDL |
import time
import os
from flask import Flask, jsonify, make_response
from flask.ext.sqlalchemy import SQLAlchemy
from redis import Redis
from rq import Queue
from fetch import fetch_user_photos
app = Flask(__name__)
app.config.from_object(os.environ['APP_SETTINGS'])
db = SQLAlchemy(app)
request_queue = Queue(connec... | [
{
"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 | app.py | oosidat/pyphotoanalytics |
import pytest
import python_on_whales
from python_on_whales import DockerClient, DockerException
from python_on_whales.utils import PROJECT_ROOT
pytestmark = pytest.mark.skipif(
not python_on_whales.docker.compose.is_installed(),
reason="Those tests need docker compose.",
)
docker = DockerClient(
... | [
{
"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/python_on_whales/components/test_compose.py | N0K0/python-on-whales |
#Define a Point3D class that inherits from object
#Inside the Point3D class, define an __init__() function that accepts self, x, y, and z, and assigns these numbers to the member variables self.x, self.y, self.z
#Define a __repr__() method that returns "(%d, %d, %d)" % (self.x, self.y, self.z). This tells Pytho... | [
{
"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 | assets/Point3D.py | sanils2002/PYTHON-CODES |
from Module import AbstractModule
class Module(AbstractModule):
def __init__(self):
AbstractModule.__init__(self)
def run(
self, network, in_data, out_attributes, user_options, num_cores,
out_path):
import os
from genomicode import filelib
from genomicode import... | [
{
"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": "every_function_under_20_lines",
"question": "Is every function in this file shorter tha... | 3 | Betsy/Betsy/modules/run_fastqc.py | jefftc/changlab |
# 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.
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from dashboard import file_bug
from dashboard.a... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"ans... | 3 | dashboard/dashboard/api/new_bug.py | Mdlglobal-atlassian-net/catapult |
import importlib
from importlib.util import module_from_spec, spec_from_file_location
import os
from stp_core.common.log import Logger, getlogger
from stp_core.types import HA
from stp_core.loop.looper import Looper
from indy_common.config_helper import NodeConfigHelper
from indy_node.server.node import Node
def in... | [
{
"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_params_annotated",
"question": "Does every function parameter in this file have a t... | 3 | indy_node/utils/node_runner.py | rantwijk/indy-node |
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"ans... | 3 | tests/test_io.py | joaogui1/evoflow |
#!/usr/bin/env python
#-*- coding:utf-8; mode:python; indent-tabs-mode: nil; c-basic-offset: 2; tab-width: 2 -*-
from .criteria import criteria
class max_depth_criteria(criteria):
'make sure the file path depth is less than or equal to a max depth.'
def __init__(self, max_depth):
super(max_depth_criteria, se... | [
{
"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 | lib/bes/fs/find/max_depth_criteria.py | reconstruir/bes |
#!/usr/bin/python
import rospy
from std_srvs.srv import SetBool, SetBoolResponse
import subprocess
import os
import signal
'''
This is the main script for running Tensorflow inference. It a hacky
solution to the problem that tensorflow leaves loaded graphs inside the GPU,
even on 'session.close()'... And only clears it... | [
{
"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 | perception/sub8_perception/ml_classifiers/object_detection.py | ericgorday/SubjuGator |
# Copyright 2020 Xilinx Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cl... | 3 | tests/unit/frontend/onnx/test_onnx_2_xlayer_registry.py | pankajdarak-xlnx/pyxir |
# coding:utf-8
class Color(object):
RED = "\033[31m"
GREEN = "\033[32m"
YELLOW = "\033[33m"
BLUE = "\033[34m"
PURPLE = "\033[35m"
CYAN = "\033[36m"
WHITE = "\033[37m"
BOLD = "\033[1m"
END = "\033[0m"
@classmethod
def get_colored(cls, color, text):
return color + te... | [
{
"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/utils/color.py | nixiesquid/mf-dakoker |
from pprint import pprint as pp
from character_tracker.character import Character
from character_tracker.utils import validate_option_choice, get_int_input
class Initiate(Character):
def __init__(self):
super().__init__()
def get_me_some_gear(self):
pass
def show_me_the_moves(self):
... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": ... | 3 | character_tracker/initiate.py | llpk79/motw |
class Logger:
__environment = None
def __init__(self):
pass
def set_environment(self, environment: str):
"""
Log into the terminal.
:param environment:
:type environment: str
:return:
"""
self.__environment = environment
def log(self,... | [
{
"point_num": 1,
"id": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 lines?",
"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 | utils/logger.py | ravishdussaruth/deployer |
IS_TEST = True
REPOSITORY = 'cms-sw/cmssw'
def get_repo_url():
return 'https://github.com/' + REPOSITORY + '/'
CERN_SSO_CERT_FILE = 'private/cert.pem'
CERN_SSO_KEY_FILE = 'private/cert.key'
CERN_SSO_COOKIES_LOCATION = 'private/'
TWIKI_CONTACTS_URL = 'https://ppdcontacts.web.cern.ch/PPDContacts/ppd_contacts'
TWI... | [
{
"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 | config.py | jfernan2/PRInspector |
import pytest
from pytest_httpx import HTTPXMock
from coinpaprika_async import client as async_client, ResponseObject
client = async_client.Client()
@pytest.mark.asyncio
async def test_mock_async_price_conv(httpx_mock: HTTPXMock):
params = {"base_currency_id": "btc-bitcoin", "quote_currency_id": "usd-us-dollars... | [
{
"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 | test/test_client.py | DroidZed/coinpaprika-async-client |
"""empty message
Revision ID: 9c89305219d0
Revises:
Create Date: 2019-11-21 09:51:18.145990
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '9c89305219d0'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto gene... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": fals... | 3 | migrations/versions/9c89305219d0_.py | Selebinka/payment_services |
from __future__ import print_function, absolute_import
from google.protobuf import text_format
import argparse
import re
import sys
import math
sys.path.insert(0, '/Users/niekai/caffe-ssd/caffe/python')
caffe_flag = True
try:
import caffe
from caffe.proto import caffe_pb2
except ImportError:
caffe_flag = ... | [
{
"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 | mxnet2caffe.py | niekai1982/MobileNet-SSD |
class State(object):
def __init__(self, port=None, state_dict=None):
self.port = port
self.mode = state_dict['mode'] if state_dict is not None else None
self.direction = state_dict['direction'] if state_dict is not None else None
self.voltage = state_dict['voltage'] if state_dict i... | [
{
"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 | gesso/gesso/api/state.py | machineeeee/builder-python |
"""Test suite for Params object"""
from copy import deepcopy
from pycgp import Params
from pycgp.params import FUNSET
def test_arities_table():
def dummy_sin(x):
return x
funset = deepcopy(FUNSET)
funset[4] = dummy_sin
params = Params(3, 1, funset=funset)
assert params.... | [
{
"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 | tests/test_params.py | Jarino/pycgp |
"""This file is copied from pandas.doc.sphinxext.contributors
Sphinx extension for listing code contributors to a release.
Usage::
.. contributors:: v0.23.0..v0.23.1
This will be replaced with a message indicating the number of
code contributors and commits, and then list each contributor
individually.
"""
from ... | [
{
"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 | doc/sphinxext/contributors.py | odidev/bottleneck |
from abc import abstractmethod
from typing import List
from app.db.models import PostDB, OID
class DatabaseManager(object):
@property
def client(self):
raise NotImplementedError
@property
def db(self):
raise NotImplementedError
@abstractmethod
async def connect_to_database(s... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inherit... | 3 | app/db/database_manager.py | michaldev/fastapi-async-mongodb |
""" The Mail ServiceProvider for AppEngine Mail API """
from masonite.provider import ServiceProvider
from .driver import MailAppEngineDriver
class MailAppEngineProvider(ServiceProvider):
wsgi = False
def register(self):
self.app.bind('MailAppEngineDriver', MailAppEngineDriver)
def boot(self):... | [
{
"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 | appengine/provider.py | openfinch/masonite-appengine |
import torch
import torch.nn as nn
from model.modules.stage_backbone import StageBackbone
from model.modules.feature_pyramid_net import FeaturePyramidNet
from model.modules.polar_head import PolarHead
class PolarInst(nn.Module):
def __init__(self, num_polars, num_channels, num_classes):
super(PolarInst, ... | [
{
"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 | model/polar_inst.py | Tenvence/polar-inst |
from mycroft import MycroftSkill, intent_file_handler
import subprocess
class Fortune(MycroftSkill):
def __init__(self):
MycroftSkill.__init__(self)
@intent_file_handler('fortune.intent')
def handle_fortune(self, message):
result = subprocess.run("fortune", capture_output=True, text=True)
... | [
{
"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 | __init__.py | rogermoore6872/mycroft-fortune |
# -*- coding:UTF-8 -*-
class HtmlOutputer(object):
def __init__(self):
self.datas = []
def collect_data(self, data):
if data is None:
return
self.datas.append(data)
def output_html(self):
fout = open('output.html', 'w')
fout... | [
{
"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 | Old/baike_spider/html_outputer.py | exchris/Pythonlearn |
from typing import List
from aiogram.types import KeyboardButton, ReplyKeyboardMarkup
from keyboards import emojis
from repository import Repository
PART_NAMES: List[str] = ["head", "story", "essence", "proofs", "claims", "additions"]
def get_claim_parts_kb(user_id: int) -> ReplyKeyboardMarkup:
parts_status: d... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"an... | 3 | src/bot/keyboards/claim_parts.py | nchursin/claimant |
import io
import os
import sys
from pathlib import Path
from convpandas.__main__ import cli
# プロジェクトトップに移動する
os.chdir(os.path.dirname(os.path.abspath(__file__)) + "/../")
out_path = Path("./tests/out/")
out_path.mkdir(exist_ok=True, parents=True)
data_path = Path("./tests/data")
class Test_csv2xlsx:
def test_... | [
{
"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 | tests/test_main.py | yuji38kwmt/convert-fileformat-with-pandas |
from unittest import TestCase
from flask import Flask
import cvapi
class TestFlaskApp(TestCase):
def test_create_app_deve_existir(self):
self.assertEqual(
hasattr(cvapi, 'create_app'),
True,
'app factory não existe'
)
def test_create_app_deve_ser_invocavel(... | [
{
"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_factory.py | resumemakers/resume-maker-api |
from django.db import models
class Team(models.Model):
competition = models.CharField(max_length=40)
name = models.CharField(max_length=80)
city = models.CharField(max_length=80)
login = models.CharField(max_length=20)
password = models.CharField(max_length=20)
score = models.Positive... | [
{
"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 | app/teams/models.py | ugractf/ctfboard |
from getpass import getpass
from mysql.connector import connect, Error
from FakeDevices import *
from mfrc522 import SimpleMFRC522
import string
buzzer = 3
door_lock = 1;
pinMode(buzzer, "OUTPUT")
pinMode(door_lock, "OUTPUT")
reader = SimpleMFRC522()
def compact(txt):
return ''.join([c for c in txt i... | [
{
"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 | BAIT2123 Internet Of Things/Practical/RFID-Cards-AC/door_lock.py | loozixuan/SoftwareSystemsDevelopment-Y2S1 |
from singletask_sql.tests import DBTestCase
from sqlalchemy import orm
from sqlalchemy import func
from singletask_sql.tables import TasksTable
from singletask_sql.tables.utils import query as query_utils
# https://docs.sqlalchemy.org/en/14/orm/query.html
def create_task(description):
task = TasksTable()
ta... | [
{
"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 | singletask_sql/tests/task.py | lenaKuznetsova/singletask-sql |
class CalcController:
def __init__(self, model, view):
self.model = model
self.model.OnResult = self.OnResult
self.model.OnError = self.OnError
self.view = view
self.model.AllClear()
# interface for view
def command(self, command):
if command in ['0','1','2'... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (ex... | 3 | controller.py | AnotherStudent/MVC_Calculator |
# ==================================
# Author : fang
# Time : 2020/4/8 pm 8:55
# Email : zhen.fang@qdreamer.com
# File : play_db.py
# Software : PyCharm
# ==================================
import datetime
DB = {}
class PlayDB:
def __init__(self, inherited=False):
if inherited:
s... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cl... | 3 | libs/play_db.py | fangMint/django_web |
import random
import numpy as np
from rrtstar.geometry import Zone2d, Point2d
def generate_new_sample_uniform(planification_zone: Zone2d) -> Point2d:
x = np.random.uniform(planification_zone.x_min, planification_zone.x_max, 1)
y = np.random.uniform(planification_zone.y_min, planification_zone.y_max, 1)
... | [
{
"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 | rrtstar/sampling.py | rdesarz/rrtstar |
# ------------------------------------------------------------------------------
from . import database as db
# ------------------------------------------------------------------------------
def checkUser(username, passwd):
return db.checkUser(username, passwd)
# ------------------------------------------------... | [
{
"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_nested_function_def",
"question": "Does this file contain any function defined inside another function?",... | 3 | users/users.py | TRUFA-rnaseq/trufa-users-sqlite |
"""General configuration CLI."""
import click
from statue.cli.common_flags import config_path_option
from statue.cli.config.config_cli import config_cli
from statue.config.configuration import Configuration
from statue.runner import RunnerMode
@config_cli.command("set-mode")
@click.argument(
"mode",
type=cli... | [
{
"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/statue/cli/config/config_general.py | EddLabs/eddington-static |
import os
import pytest
pa = pytest.importorskip("pyarrow")
pd = pytest.importorskip("pandas")
import numpy as np # noqa
import pandas.util.testing as tm # noqa
from pymapd._parsers import _load_schema, _load_data # noqa
HERE = os.path.dirname(__file__)
def make_data_batch():
arrow_version = pa.__version__
... | [
{
"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 | tests/test_ipc.py | miiklay/pymapd |
# This Python file uses the following encoding: utf-8
from panflute import *
import pandoc_codeblock_include
def conversion(markdown, format='markdown'):
doc = convert_text(markdown, standalone = True)
doc.format = format
pandoc_codeblock_include.main(doc)
return doc
def verify_conversion(markdown, ... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined insid... | 3 | tests/helper.py | laszewsk/pandoc-codeblock-include |
def metade(x=0):
res = x / 2
return res
def dobro(x=0):
res = 2 * x
return res
def aumentar(x=0, y=0):
res = x * (1 + y / 100)
return res
def reduzir(x=0, y=0):
res = x * (1 - y / 100)
return res
def moeda(x=0, m='R$'):
res = f'{m}{x:.2f}'.replace('.', ',')
return res
| [
{
"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 | Curso-em-video-Python3-mundo3/ex108/moeda.py | bernardombraga/Solucoes-exercicios-cursos-gratuitos |
import unittest
import pathlib
import io
from igv_reports.feature import FeatureReader, _NonIndexed, parse_gff
from igv_reports import datauri
class FeatureFileTest(unittest.TestCase):
def test_query(self):
gff = str((pathlib.Path(__file__).parent / "data/minigenome/annotations.gtf.gz").resol... | [
{
"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 | test/test_datauri.py | azbard/igv-reports |
from django.test import TestCase
from django.contrib.auth import get_user_model
from django.urls import reverse
from django.test import Client
class AdminSiteTests(TestCase):
def setUp(self):
self.client = Client()
self.admin_user = get_user_model().objects.create_superuser(
email='ad... | [
{
"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 | app/core/tests/test_admin.py | pshrimal000/recipe-app-api |
from collections import defaultdict
class RunningAverage:
"""
Computes exponential moving averages averages.
"""
def __init__(self, mix_rate: float = 0.95):
self.mix_rate = mix_rate
self.avgs = defaultdict(lambda: None)
def record(self, name: str, value: float, ignore_nan=True):
... | [
{
"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 | wrangl/metrics/running_avg.py | vzhong/wrangl |
# Django Library
from django.db import models
from django.urls import reverse
from django.utils.translation import ugettext_lazy as _
# Localfolder Library
from .company import PyCompany
SHARE_PRODUCT_CHOICE = (
("no", "No Share"),
("yes_some", "Yes Some"),
('yes_all', 'Yes All')
)
class BaseConfig(mode... | [
{
"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 | apps/base/models/base_config.py | youssriaboelseod/pyerp |
import logging
import utils
from wrapper import *
logger = logging.getLogger(__name__)
# noinspection PyUnusedLocal
def get_orgs(url='', org='', account='', key='', timeout=60, **kwargs):
return get(utils.build_api_url(url, org, account, org_level=True),
headers={'Authorization': "Bearer " + key},... | [
{
"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 | dlcli/api/orgs.py | outlyerapp/dlcli |
import http.server
import socketserver
class TCPServer(socketserver.TCPServer):
allow_reuse_address = True
def serve(root, port):
class Handler(http.server.SimpleHTTPRequestHandler):
def __init__(self, *args, **kwargs):
super().__init__(*args, directory=root, **kwargs)
print("Listen... | [
{
"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": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answe... | 3 | void/serve.py | claymation/void |
from abc import ABC, abstractmethod
class Animal(ABC):
def __init__(self, name, weight):
self.name = name
self.weight = weight
self.food_eaten = 0
@abstractmethod
def make_sound(self):
pass
@abstractmethod
def feed(self, food):
pass
class Bird(Animal, AB... | [
{
"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 | Polymorphism_and_Magic_Methods/wild_farm_04E/project/animals/animal.py | MNikov/Python-OOP-October-2020 |
from __future__ import unicode_literals, absolute_import
from .dict import DictWriter
import json
class JsonWriter(DictWriter):
def serialize_content(self, data):
return json.dumps(data, ensure_ascii=False)
@property
def extension(self):
return 'json'
| [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer... | 3 | fbchat_archive_parser/writers/json.py | alvin-c/fbmessenger-visualizer |
load(
"@rules_mono//dotnet/private:providers.bzl",
"DotnetLibrary",
)
def _make_runner_arglist(dotnet, source, output):
args = dotnet.actions.args()
args.add("/useSourcePath")
if type(source) == "Target":
args.add_all(source.files)
else:
args.add(source)
args.add(output)
... | [
{
"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 | dotnet/private/actions/resx_net.bzl | nolen777/rules_mono |
from typing import List
from wai.common.geometry import Polygon as GeometricPolygon, Point
from wai.json.object import StrictJSONObject
from wai.json.object.property import ArrayProperty, NumberProperty
class Polygon(StrictJSONObject['Polygon']):
"""
Represents a polygon mask for an annotation.
"""
... | [
{
"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": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer"... | 3 | src/ufdl/json/object_detection/_Polygon.py | waikato-ufdl/ufdl-json-messages |
from unittest.mock import call
from sls.completion.complete import Completion
from sls.completion.context import CompletionContext
from sls.document import Document
import sls.sentry as sentry
def test_complete(magic, patch):
patch.init(Document)
patch.many(Document, ["line_to_cursor", "word_to_cursor"])
... | [
{
"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 | tests/unittests/completion/complete.py | wilzbach/storyscript-sls |
import youtube_dl,re, os, tkinter
def getUrlWindow(data=None):
root=tkinter.Tk()
root.withdraw()
data = root.clipboard_get()
if re.match('https://www.youtube.com/',data) != None:
print('Downloading as MP3')
return data
else: return None
def sendtoYDL(data):
ydl_opts... | [
{
"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 | PotatoTube2.0.py | mrthundergod/PotatoTube |
"""
MIT License
Copyright (c) 2019 tcdude
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 use, copy, modify, merge, publish, distri... | [
{
"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 | destruction/render.py | tcdude/destruction |
"""followers
Revision ID: 67a6906a0356
Revises: ae03466d7ace
Create Date: 2021-10-31 21:38:21.299029
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '67a6906a0356'
down_revision = 'ae03466d7ace'
branch_labels = None
depends_on = None
def upgrade():
# ### ... | [
{
"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 | migrations/versions/67a6906a0356_followers.py | QuiTran86/RestfulAPI |
from typing import Any, Dict
from shibgreen.wallet.key_val_store import KeyValStore
from shibgreen.wallet.settings.default_settings import default_settings
from shibgreen.wallet.settings.settings_objects import BackupInitialized
class UserSettings:
settings: Dict[str, Any]
basic_store: KeyValStore
@stat... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cl... | 3 | shibgreen/wallet/settings/user_settings.py | BTCgreen-Network/shibgreen-blockchain |
"""
Copyright (c) Facebook, Inc. and its affiliates.
"""
import unittest
from droidlet.lowlevel.minecraft.cuberite_process import CuberiteProcess, create_workdir, repo_home
from os import path
from droidlet.lowlevel.minecraft.craftassist_cuberite_utils.ping_cuberite import ping
class CuberiteBasicTest(unittest.TestCa... | [
{
"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 | droidlet/lowlevel/minecraft/tests/test_cuberite.py | colesbury/fairo |
import numpy as np
def R(theta):
"""
Returns the rotation matrix for rotating an object
centered around the origin with a given angle
Arguments:
theta: angle in degrees
Returns:
R: 2x2 np.ndarray with rotation matrix
"""
theta = np.radians(theta)
... | [
{
"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 | fcutils/maths/coordinates.py | FedeClaudi/fedes_utils |
import io
import pandas
class HourlyHydrogenCurves:
@property
def hourly_hydrogen_curves(self):
# get hourly hydrogen curves
if self._hourly_hydrogen_curves is None:
self.get_hourly_hydrogen_curves()
return self._hourly_hydrogen_curves
... | [
{
"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 | pyETM/curves/hourly_hydrogen_curves.py | robcalon/PyETM |
# Copyright 2018 Braxton Mckee
#
# 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 t... | [
{
"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 | object_database/service_manager/ServiceBase.py | braxtonmckee/nativepython |
import re
import datetime
def convertToDate(date:str):
return datetime.datetime.strptime(date, '%Y-%m-%d')
def convertFromDate(date:datetime.date):
return date.strftime('%Y-%m-%d')
def checkBatch(batch:str):
if re.match('\d\d\d\d[-]\d\d\d\d',batch):
return batch
raise ValueError('Invalid batc... | [
{
"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 | flask/app/utils.py | sreejeet/ams-api |
# -*- coding: utf-8 -*
import serial
import time
import threading
# 打开串口
ser = serial.Serial("/dev/ttyAMA0", 9600)
ser.flushInput()
def read_data():
count=ser.inWaiting()
if count:
recv=ser.read(count)
data=int(str(binascii.b2a_hex(s.read(n))))
print('recv data:',recv)
de... | [
{
"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 | jupyternotebook/piuartself.py | Carryma11/AQI-Monitoring-Playform-by-Raspi |
import math
from typing import Dict, Union, List
import torch
from torch import nn, Tensor
from .. import properties as p
def fix_msk(mol: Dict[str, Tensor], idx: Tensor):
_, atm, dim = mol[p.pos].size()
msk = torch.zeros([atm, dim], dtype=torch.bool, device=idx.device)
msk[idx, :] = True
return msk
... | [
{
"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_class_has_docstring",
"question": "Does every class in this file have a docstring?",... | 3 | torchfes/colvar/fix.py | AkihideHayashi/torchfes1 |
from dimagi.ext.jsonobject import JsonObject, StringProperty, ListProperty, DictProperty
from jsonobject.base import DefaultProperty
from corehq.apps.userreports.exceptions import BadSpecError
from corehq.apps.userreports.expressions.getters import getter_from_property_reference
from corehq.apps.userreports.operators i... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": ... | 3 | corehq/apps/userreports/filters/specs.py | johan--/commcare-hq |
import unittest
import requests_mock
from .. import client as hitbctf_client
TEST_DATA_TEAMS = {
"1": {
"id": 1,
"name": "Hackerdom",
"network": "10.60.1.0/24",
"logo": "https://ctf.hitb.org/logos/hackerdom.png",
"country": "RU"
},
}
def mock(f):
def wrapped_f(*... | [
{
"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 | hitb_client/tests/test_teams.py | ENOFLAG/HITB-client |
def read_input():
with open("input.txt", "r") as file:
return [int(p[28:]) for p in file.read().splitlines()]
mod = lambda i,j: ((i-1) % j) + 1
def main():
pos = read_input()
s = [0,0]
for i in range(1,1000,3):
pos[(i-1)%2] += sum([mod(j,100) for j in range(i,i+3)])
pos[(i-1)%2... | [
{
"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 | puzzles/day21/puzzle1.py | sbr075/advent2021 |
import unittest
from checkov.terraform.checks.resource.gcp.GoogleCloudSqlDatabasePublicallyAccessible import check
from checkov.terraform.models.enums import CheckResult
class GoogleCloudSqlDatabasePublicallyAccessible(unittest.TestCase):
def test_failure(self):
resource_conf = {'settings': [{'tier': ['... | [
{
"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/terraform/checks/resource/gcp/test_GoogleCloudSqlDatabasePublicallyAccessible.py | mgmt1pyro/Test-Theme |
from flask import Flask, render_template, request, get_template_attribute
from models.LogManager import LogManager
from models.XMLManager import XMLManager
from models.SPARQLEndpointManager import SPARQLEndpointManager
from models.VerbalizeManager import VerbalizeManager
import json
LogManager.init()
XMLManager.init()... | [
{
"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 | app.py | endrikacupaj/SPARQLANSWER2NL |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.