source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
import json
import os
import discord
import asyncio
import datetime
from discord.ext import commands, tasks
with open('config.json') as e:
infos = json.load(e)
token = infos['token']
prefix = infos['prefix']
lara = commands.Bot(command_prefix=prefix, case_insensitive=True, intents=discord.Intents.all())
... | [
{
"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 | bot.py | HeitorDJAk47Gamer/B0TPYbeta |
# Copyright 2017 NeuStar, 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 by applicable law or a... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding se... | 3 | src/subnets.py | sbarbett/ssp-sdk-python |
# fileutils.py
import hashlib
import logging
import os.path
logger = logging.getLogger('omserver.fileutils')
def getHash(filename):
''' returns hash for a file content
empty string is files does not exist
Ready to use
'''
if not os.path.isfile(filename):
logger.error("File doesn'... | [
{
"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 | utils/fileutils.py | akirikmedus/omserver |
###############################################################################
# Version: 1.1
# Last modified on: 3 April, 2016
# Developers: Michael G. Epitropakis
# email: m_(DOT)_epitropakis_(AT)_lancaster_(DOT)_ac_(DOT)_uk
###############################################################################
from ... | [
{
"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 | NDBSCANjDE/CF3.py | krowck/ISDA-NCjDE-HJ |
'''
Created by auto_sdk on 2018.07.25
'''
from top.api.base import RestApi
class LocationRelationQueryRequest(RestApi):
def __init__(self, domain='gw.api.taobao.com', port=80):
RestApi.__init__(self, domain, port)
self.location_relation = None
def getapiname(self):
return ... | [
{
"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 | taobao-tianmao/top/api/rest/LocationRelationQueryRequest.py | ScottLeeF/python-example |
""" Extend basic agent to an emotional agent.
"""
#: Dependencies
import numpy
import random
from .base import Agent
class EmotionalAgent(Agent):
""" Create emotional agent by extending and overriding base class Agent.
"""
def __init__(self, unique_id, experiment, memory=0):
""" Extended subcl... | [
{
"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 | coaffect/agents/emotional.py | aridyckovsky/coaffect |
#retrieve_iamges.py
#Creator: Anthony Toribio and Robert Toribio
#Date: 10/30/2021
from apiclient.discovery import build
_API_KEY = "APIKeyHidden"
_CX = "CXHidden" #search_engine_id
_QUERY = "Justin Turner"
_SERVICE = build("customsearch","v1", developerKey=_API_KEY)
def getImage_url(query:str) -> st... | [
{
"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 | retrieve_images.py | anthonytoribio/MLBHomeRuns |
# title :shannon_entropy.py
# description :This uses the Shannon entropy equation to estimate the
# average minimum number of bits needed to encode a
# string of symbols, based on the frequency of the symbols.
# author :Gianni Perez
# date :20170901
# ... | [
{
"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 | shannon-entropy.py | ambron60/shannon-entropy-calculator |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from numpy.testing import assert_allclose
from astropy.time import TimeDelta, Time
from ..time import (
time_ref_from_dict,
time_ref_to_dict,
time_relative_to_ref,
absolute_time,
)
def test_time_ref_from_dict():
d = dict(MJDREFI=51910... | [
{
"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 | gammapy/utils/tests/test_time.py | watsonjj/gammapy |
from typing import List
from scripter.backend.note_text import NoteText
from scripter.io.writer_base import WriterBase
class FormatWriter(WriterBase):
def __init__(self, *, format:str=None, **kwargs):
super().__init__()
if format is None:
self.format = 'P.{page}\n{text}\n'
def dum... | [
{
"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 | scripter/io/format_writer.py | elda27/scripter |
"""
Actions of the `critic` app
"""
from django.core.mail import mail_admins
from critic import signals
def create_app_links():
"""
Creates links of the `critic` app
"""
signals.app_link_ready.send(
sender=None, # not specified
base_pattern=r'^critic/',
url_name='critic:revi... | [
{
"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": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 lines?",
"answer": false... | 3 | critic/actions.py | signaldetect/messity |
# "Lorenz-95" (or 96) model. For a deeper introduction, see
# "DAPPER/tutorials/T4 - Dynamical systems, chaos, Lorenz.ipynb"
#
# Note: implementation is ndim-agnostic.
import numpy as np
from tools.math import rk4, integrate_TLM, is1d
Force = 8.0
# Note: the model is unstable (blows up) if there are large peaks
# (a... | [
{
"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 | mods/Lorenz95/core.py | franktoffel/dapper |
# -*- coding: utf-8 -*-
from pyramid import httpexceptions
from pyramid.view import view_config
from h import models
from h.i18n import TranslationString as _ # noqa: N813
@view_config(
route_name="admin.staff",
request_method="GET",
renderer="h:templates/admin/staff.html.jinja2",
permission="admin... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excludi... | 3 | h/views/admin/staff.py | kevinjalbert/h |
from django.contrib import admin
from django.urls import reverse
from django.utils.html import format_html
from django import forms
from .models import News, Category
from tinymce.widgets import TinyMCE
class NewsForm(forms.ModelForm):
text = forms.CharField(widget=TinyMCE(attrs={"cols": 80, "rows": 100}))
... | [
{
"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 | news/admin.py | vigen-b/FakeNews |
#!/usr/bin/env python3
import abc
import inspect
import logging
from typing import List, Optional
from reagent.core.registry_meta import RegistryMeta
from reagent.core.result_registries import ValidationResult
from reagent.workflow.types import RLTrainingOutput
from reagent.workflow.types import TableSpec
logger = l... | [
{
"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 | reagent/validators/model_validator.py | mcx/ReAgent |
from django.db import models
from markdown import markdown
# Create your models here.
# Reference: http://www.yaconiello.com/blog/part-1-creating-blog-system-using-django-markdown/
class Category(models.Model):
"""Category Model"""
title = models.CharField(
verbose_name = (u'Title'),
help_text... | [
{
"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_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
... | 3 | tombomation/blog/models.py | tcuthbert/tombomation.net |
######################################################################
# Copyright
# John Holland <john@zoner.org>
# All rights reserved.
#
# This software is licensed as described in the file LICENSE.txt, which
# you should have received as part of this distribution.
#
##############################################... | [
{
"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 | pyx12/map_override.py | arenius/pyx12 |
from __future__ import division
import databench
import math
import random
class Dummypi(databench.Analysis):
"""A dummy analysis."""
@databench.on
def connected(self):
yield self.data.init({'samples': 100000})
@databench.on
def run(self):
"""Run when button is pressed."""
... | [
{
"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 | databench/analyses_packaged/dummypi/analysis.py | svenkreiss/databench |
# focal loss with multi label
def focal_loss(classes_num, gamma=2., alpha=.25, e=0.1):
# classes_num contains sample number of each classes
def focal_loss_fixed(target_tensor, prediction_tensor):
'''
prediction_tensor is the output tensor with shape [None, 100], where 100 is the number of c... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside... | 3 | 常用分割损失函数和指标/C_Focal_loss.py | 1044197988/TF.Keras-Commonly-used-models |
# -*- coding: utf-8 -*-
"""
Created on Fri Jun 5 14:44:49 2015
@author: feiwu
"""
class Point:
def __init__(self, lat, lon):
self.lat = lat
self.lon = lon
def make_key(self):
return '{},{}'.format(self.lat,self.lon)
class POI:
def __init__(self,name,pid,lat,lon,cat,checkin_count... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{... | 3 | python/query.py | thekingofkings/chicago-crime |
from PyQt5.QtCore import QThread
class IA(QThread):
def __init__(self, personalidad):
super().__init__()
self.personalidad = personalidad
self.start()
def run(self):
self.personalidad(self)
pass | [
{
"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 | Tareas/T05/scripts/IA.py | FarDust/FarDust-IIC2233 |
# -*- coding: utf-8 -*-
"""
chemdataextractor.tests.test_reader_els.py
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Test reader for Elsevier.
Juraj Mavračić (jm2111@cam.ac.uk)
"""
import unittest
import logging
import io
import os
from chemdataextractor import Document
from chemdataextractor.reader.elsevier import ElsevierXmlRe... | [
{
"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 | chemdataextractor_batteries/tests/test_reader_elsevier.py | ShuHuang/batterydatabase |
from elasticsearch_dsl.query import MultiMatch
from ..documents import OrderDocument, ProductDocument, UserDocument
def _search_products(phrase):
prod_query = MultiMatch(
fields=['name', 'title', 'description'],
query=phrase,
type='cross_fields')
return ProductDocument.search().query(... | [
{
"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 | saleor/search/backends/elasticsearch_dashboard.py | TysonRV/saleor |
"""
Revision ID: 0221_nullable_service_branding
Revises: 0220_email_brand_type_non_null
Create Date: 2018-08-24 13:36:49.346156
"""
from alembic import op
from app.models import BRANDING_ORG, BRANDING_GOVUK
revision = '0221_nullable_service_branding'
down_revision = '0220_email_brand_type_non_null'
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_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
... | 3 | migrations/versions/0221_nullable_service_branding.py | tlwr/notifications-api |
class ListBasedAuthorizer:
def __init__(self, allowed_users) -> None:
self.allowed_users = allowed_users
def is_allowed(self, username):
return username in self.allowed_users
class AnyUserAuthorizer:
@staticmethod
def is_allowed(username):
return True
| [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
... | 3 | src/auth/authorization.py | Guria/script-server |
#!/usr/bin/env python
__author__ = "Mark Nottingham <mnot@mnot.net>"
__copyright__ = """\
Copyright (c) 2008-2013 Mark Nottingham
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 restricti... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside... | 3 | redbot/message/headers/x_cache.py | thinkbox/redbot |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# thumbor imaging service
# https://github.com/thumbor/thumbor/wiki
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license
# Copyright (c) 2011 globo.com thumbor@googlegroups.com
import tornado.web
import tornado.ioloop
from thumbor.handlers.black... | [
{
"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 | thumbor/app.py | ravisaini1990S/thumbor |
import os
import smart_open
import json
import re
import urllib.request
def load_http_text(url):
with urllib.request.urlopen(url) as f:
return f.read().decode("utf-8")
def load_text(path):
if path.startswith("http://") or path.startswith("https://"):
return load_http_text(path)
else:
... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding sel... | 3 | lm_evaluation/utils.py | hristog/lm-evaluation |
import tablib
from impresario.song import Song, Songbook
def test_song_pinyin():
song = Song(name="歌曲")
assert song.pinyin == ["Ge", "Qu"]
def test_song_mixed_title():
song = Song(name="歌曲 some songs")
assert song.pinyin == ["Ge", "Qu", "Some", "Songs"]
def test_song_normalized_key():
song = ... | [
{
"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 | tests/test_song.py | kipyin/impresario |
import string
import random
class Robot:
def __init__(self):
self.name = self.generate_name()
def reset(self):
self.name = self.generate_name()
def generate_name(self):
random.seed()
return self.random_prefix(2) + self.random_suffix(3)
def random_prefix(self, n):
... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},... | 3 | python/robot-name/robot.py | rootulp/exercism |
# -*- coding: utf-8 -*-
#
# michael a.g. aïvázis
# orthologue
# (c) 1998-2020 all rights reserved
#
# packages
import time
# ancestor
from .AbstractTimer import AbstractTimer
# declaration
class PythonTimer(AbstractTimer):
"""
A simple timer implementation based on the facilities from the time module in t... | [
{
"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 | packages/pyre/timers/PythonTimer.py | rtburns-jpl/pyre |
import os
from ibm_watson import LanguageTranslatorV3
from ibm_cloud_sdk_core.authenticators import IAMAuthenticator
from dotenv import load_dotenv
load_dotenv()
apikey = os.environ['apikey']
url = os.environ['url']
authenticator = IAMAuthenticator(apikey)
language_translator = LanguageTranslatorV3(
version... | [
{
"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 | final_project/machinetranslation/translator.py | vbuendia/xzceb-flask_eng_fr |
import pytest
from spotty_search import create_app
@pytest.fixture
def app():
app = create_app()
yield app
@pytest.fixture
def client(app):
return app.test_client()
| [
{
"point_num": 1,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answe... | 3 | tests/conftest.py | haykkh/spotty-search |
from typing import Tuple
from context import Context
class SimpleFramebuffer:
def __init__(self, size: Tuple[int, int]):
ctx = Context.context
self.image = ctx.image(size, 'rgba8unorm')
self.depth = ctx.image(size, 'depth24plus')
self.framebuffer = [self.image, self.depth]
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": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
... | 3 | examples/example_project/simple_framebuffer.py | szabolcsdombi/zengl |
# Copyright 2017 Palantir Technologies, Inc.
import logging
import os
from mdls._utils import find_parents
from .source import ConfigSource
log = logging.getLogger(__name__)
CONFIG_KEY = 'mistune'
PROJECT_CONFIGS = []
OPTIONS = [
('mathjax', 'plugins.mistune.mathjax.enabled', bool),
#('wikilink', 'plugins.py... | [
{
"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 | mdls/config/mistune_conf.py | ompugao/mdls |
from abc import ABCMeta, abstractmethod
from frozendict import frozendict
class ResourceManager(metaclass=ABCMeta):
def __init__(self):
self.wv_filename = ""
self.parsed_filename = ""
@abstractmethod
def write(self):
"""
parse the raw file/files and write the data to disk... | [
{
"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 | utilities/ResourceManager.py | sanazb/datastories-semeval2017-task4 |
#!/usr/bin/env python3
# RosViewer.py = node that listens to a ROS image message topic,
# and displays the image using OpenCV.
import rospy
import cv2
from sensor_msgs.msg import Image
from cv_bridge import CvBridge, CvBridgeError
class image_viewer: # "/camera/color/image_raw" or "/camera/color... | [
{
"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 | RosViewer.py | MikeHallettUK/RosRobotics |
from os import error
from PIL import Image
def main():
try:
image = open_image('image1.jpg')
newImage = image.resize((200, 200))
newImage.save('image2.jpg')
print("done")
except:
print ("There was an error processing the image.")
def open_image(file_location):
image... | [
{
"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 | chigozie-oduah-012/project9/resizing.py | cornelia247/cil-internship-cohort-01 |
# encoding: utf-8
"""Utilities for working with data structures like lists, dicts and tuples.
"""
#-----------------------------------------------------------------------------
# Copyright (C) 2008-2011 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full license is in
# the f... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",... | 3 | IPython/utils/data.py | pyarnold/ipython |
import json
import os
import argparse
from cookiecutter.main import cookiecutter
def load_json(path_to_file) -> dict:
with open(path_to_file, "rb") as jfile:
context = json.load(jfile)
return context
def context_var_from_env_var(env_name: str) -> str:
var_name = env_name.split("_")[2:]
return... | [
{
"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 | gen_with_context.py | KernelA/cookiecutter-python |
import unittest
import ujson
from nanohttp import context, json, text, RestController, configure
from nanohttp.contexts import Context
from restfulpy.controllers import JsonPatchControllerMixin
class BiscuitsController(RestController):
@json
def put(self, id_: int = None):
result = {}
result... | [
{
"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 | restfulpy/tests/test_jsonpatch.py | maryayi/restfulpy |
import unittest
from linguine.corpus import Corpus
from linguine.ops.remove_stopwords import RemoveStopwords
from linguine.ops.word_tokenize import WordTokenizeWhitespacePunct
class RemoveStopwordsTest(unittest.TestCase):
def setUp(self):
self.op = RemoveStopwords()
def test_run(self):
test... | [
{
"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 | test/remove_stopwords_test.py | ritlinguine/linguine-python |
import os.path as osp
import sys
import torch
import torch.nn as nn
sys.path.append(osp.dirname(osp.dirname(osp.abspath(__file__))))
from criteria_comparing_sets_pcs.jsd_calculator import JsdCalculator
from metrics_from_point_flow.evaluation_metrics import compute_all_metrics
class AllMetricsCalculator(nn.Module):... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding s... | 3 | criteria_comparing_sets_pcs/all_metrics_calculator.py | VinAIResearch/PointSWD |
from domain.repositories import DebtRepository
from domain.useCases import GetAllDebts
from infra.controllers.contracts import HttpRequest, HttpResponse
class GetAllDebtsOperator:
def __init__(self, debt_repository: DebtRepository) -> None:
self.debt_repository = debt_repository
def operate(self, ht... | [
{
"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 | infra/controllers/operators/debt/GetAllDebtsOperator.py | JVGC/MyFinancesPython |
from bs4 import BeautifulSoup
import requests
URL = "https://www.instagram.com/{}/"
def get_data(a):
data = {}
a = a.split("-")[0]
a = a.split(" ")
data['Followers'] = a[0]
data['Following'] = a[2]
data['Posts'] = a[4]
return data
def scrape_data(username):
b = requests.get(URL.format(username))
a ... | [
{
"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 | main.py | mdarman187/insta-profile-stats |
# coding: utf-8
#
# Copyright 2019 Amazon.com, Inc. or its affiliates. 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. A copy of the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "lice... | [
{
"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 | ask-smapi-model/ask_smapi_model/v1/skill/status.py | alexa-labs/alexa-apis-for-python |
import gc
from unittest import TestCase, main, skip
from expects import expect, equal
from questions_three.event_broker import EventBroker
def foo(**kwargs):
pass
def bar(**kwargs):
pass
def baz(**kwargs):
pass
class TestGetSubscribers(TestCase):
def setUp(self):
EventBroker.reset()
... | [
{
"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/event_broker/test_get_subscribers.py | filfreire/questions-three |
from . import db
class Account(db.Model):
__tablename__ = 'account'
account_id = db.Column(db.Integer, primary_key=True)
account_name = db.Column(db.String(16), unique=True)
account_pwd = db.Column(db.String(16), unique=True)
account_nick = db.Column(db.String(16), unique=True)
account_email =... | [
{
"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 | firefly/app/models.py | Justyer/NightHeartDataPlatform |
class handler():
def __init__(self):
self.greeting = "Hello World"
def __repr__(self):
return self.greeting
if __name__ == "__main__":
pass | [
{
"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/projects/TestProject.py | cchernn/ProjectsWebsite |
"""Given a linked list, swap every two adjacent nodes and return its head.
Example 1:
Input: head = [1,2,3,4]
Output: [2,1,4,3]
Example 2:
Input: head = []
Output: []
Example 3:
Input: head = [1]
Output: [1]
Constraints:
The number of nodes in the list is in the range [0, 100].
0 <= Node.val <= 100
Follow up: Ca... | [
{
"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 | Swap Nodes in Pairs.py | H-isaac23/Data-Structures |
import unittest
from malcolm.modules.builtin.vmetas import StringMeta
class TestValidate(unittest.TestCase):
def setUp(self):
self.string_meta = StringMeta("test string description")
def test_given_value_str_then_return(self):
response = self.string_meta.validate("TestValue")
asser... | [
{
"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 | tests/test_modules/test_builtin/test_stringmeta.py | MattTaylorDLS/pymalcolm |
"""AyudaEnPython: https://www.facebook.com/groups/ayudapython
"""
from prototools import int_input, menu_input, banner, text_align
ADICIONAL = 1.5
IVA = 0.12
PRECIOS = {"pequeña": 6.5, "mediana": 12.35, "familiar": 22.5}
iva = lambda precio: precio * IVA
precio_con_iva = lambda precio, iva: precio + iva
precio_sin_iv... | [
{
"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 | soluciones/pizza/main.py | carlosviveros/Soluciones |
import tensorrt as trt
TRT_LOGGER = trt.Logger(trt.Logger.INTERNAL_ERROR)
def build_engine(onnx_path, shape = [1,224,224,3]):
"""
This is the function to create the TensorRT engine
Args:
onnx_path : Path to onnx_file.
shape : Shape of the input of the ONNX file.
"""
with trt.Builder(TRT_LO... | [
{
"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 | engine.py | riotu-lab/tf2trt_with_onnx |
import os
import sys
import logging
import unittest
from mock import Mock, patch
import predix.security.uaa
class TestUAA(unittest.TestCase):
def setUp(self):
self.uaa_uri = 'https://1234.predix-uaa.run.aws-usw02-pr.ice.predix.io'
os.environ['PREDIX_SECURITY_UAA_URI'] = self.uaa_uri
def te... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
}... | 3 | test/unit/test_uaa.py | Saifinbox/predix |
def helper(num):
return ''.join(sorted(str(num)))
def ans():
num = 100000
while True:
string = helper(num)
if all(helper(num * i) == string for i in range(2, 7)):
return num
num += 1
if __name__ == '__main__':
print(ans())
| [
{
"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 | src/052.py | mackorone/euler |
class LOG:
def info(message):
print("Info: " + message)
def error(message):
print("Error: " + message)
def debug(message):
print("Debug: " + message)
| [
{
"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 | monitoring/utils/logger.py | bruno-sartori/skill-monitoring |
import queue
import time
import numpy as np
class CameraInformation:
def __init__(self, cam_id: str):
self._frame_queue: queue.Queue = queue.Queue(maxsize=1)
self._frame_shape = None
self._last_frame_time = None
self.is_online = True
self.node_id = cam_id
def write_fra... | [
{
"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 | streaming_helpers.py | jaycosaur/spynet |
# This file is autogenerated. Do not edit it manually.
# If you want change the content of this file, edit
#
# spec/fixtures/responses/whois.afilias-grs.info/gi/status_available
#
# and regenerate the tests with the following script
#
# $ scripts/generate_tests.py
#
from nose.tools import *
from dateutil.parser 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 | test/record/parser/test_response_whois_afilias_grs_info_gi_status_available.py | huyphan/pyyawhois |
import settings
import pandas as pd
from loader.DWY_Neighbor import NeighborsLoader
from loader.DBP15k import DBP15kLoader
from script.preprocess.get_token import Token
from settings import *
import numpy as np
import torch
class NeighborToken(object):
def __init__(self, dbpToken, loader):
self.loader = lo... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excludi... | 3 | script/preprocess/DWY_neighbor_token.py | Yasuo-orphan/SelfKG |
with open("day_08_input.txt") as f:
txt = f.read()
# - - - Part 1 - - -
def acum(txt: str) -> int:
counter = 0
index = 0
memo = []
program = txt.split("\n")
while True:
ins, num = program[index].split()
num = int(num)
if index not in memo:
memo.append(ind... | [
{
"point_num": 1,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"an... | 3 | day_08.py | balcortex/advent_of_code_2020 |
# 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": "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 | openstack/tests/unit/test_format.py | teresa-ho/stx-openstacksdk |
###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013-2020, John McNamara, jmcnamara@cpan.org
#
from ..excel_comparison_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompareXLSXFiles(ExcelComparisonTest):
"""... | [
{
"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 | xlsxwriter/test/comparison/test_comment06.py | dthadi3/XlsxWriter |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import pulumi
import pulumi.runtime
class ReceiptRuleSet(pulumi.CustomResource):
"""
Provides an SES receipt rule set resource... | [
{
"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 | sdk/python/pulumi_aws/ses/receipt_rule_set.py | pulumi-bot/pulumi-aws |
from torch2trt.torch2trt import *
from torch2trt.module_test import add_module_test
@tensorrt_converter('torch.nn.BatchNorm1d.forward')
def convert_BatchNorm1d(ctx):
module = ctx.method_args[0]
input = ctx.method_args[1]
input_trt = trt_(ctx.network, input)
output = ctx.method_return
scale =... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": fal... | 3 | torch2trt/converters/BatchNorm1d.py | huliang2016/torch2trt_dynamic |
import win32service
import win32serviceutil
import win32api
import win32event
from ssh_cmd_manager import CmdManager
class aservice(win32serviceutil.ServiceFramework):
_svc_name_ = "ssh-shepherd-svc"
_svc_display_name_ = "SSH Shepherd"
_svc_description_ = "SSH tunnel manager for db-shepherd"
... | [
{
"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 | ssh-service.py | nokia-wroclaw/innovativeproject-dbshepherd |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
OpenAPI spec version: release-1.16
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import unittest
import... | [
{
"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 | kubernetes/test/test_v1alpha1_role_ref.py | L3T/python |
import OxygenRM as O
import OxygenRM.events as event
from functools import wraps, partial
def temporal_events(f):
""" Decorates a function so it is assured to fire the events (and deactivate the events
after if they were not active)
"""
@wraps(f)
def _uses_events(*args, **kwargs):
dea... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside... | 3 | OxygenRM/testing.py | Jexan/OxygenRM |
# test simple async with execution
class AContext:
async def __aenter__(self):
print('enter')
return 1
async def __aexit__(self, exc_type, exc, tb):
print('exit', exc_type, exc)
async def f():
async with AContext():
print('body')
o = f()
try:
o.send(None)
except StopIt... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": ... | 3 | tests/basics/async_with.py | sebastien-riou/micropython |
from typing import List, Tuple, Optional
from pydantic import Field, HttpUrl, BaseModel
class Intents(BaseModel):
guilds: bool = True
guild_members: bool = True
guild_messages: bool = False
guild_message_reactions: bool = True
direct_message: bool = False
message_audit: bool = False
forum... | [
{
"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 | nonebot/adapters/qqguild/config.py | nonebot/adapter-qqguild |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
... | 3 | sdk/resources/azure-mgmt-resource/azure/mgmt/resource/policy/v2018_05_01/models/_paged_models.py | iscai-msft/azure-sdk-for-python |
import home
from ws.handler.event.enum import Handler as Parent
class Handler(Parent):
KLASS = home.event.enable.Event
TEMPLATE = "event/enum.html"
LABEL = "Detach logic is"
ENABLED = "enabled"
DISABLED = "disabled"
def _get_str(self, e):
if e == home.event.enable.Event.On:
... | [
{
"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 | ws/handler/event/enum/enable.py | fabaff/automate-ws |
from torchtext import data
import spacy
import dill
BOS_WORD = '<s>'
EOS_WORD = '</s>'
BLANK_WORD = "<blank>"
spacy_en = spacy.load('en')
spacy_de = spacy.load('de')
def tokenizer_en(text):
return [tok.text for tok in spacy_en.tokenizer(text)]
def tokenizer_de(text):
return [tok.text for tok in spacy_de.tok... | [
{
"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 | data_loader.py | abhishek1907/transformer |
# coding: utf8
from __future__ import absolute_import
import datetime
from celery import shared_task
from celery.utils.log import get_task_logger
from django.utils.translation import ugettext as _
from django.core.mail import send_mail
from django.contrib.auth import get_user_model
from django.conf import settings
f... | [
{
"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 | challenges/tasks.py | bitblueprint/RunningCause |
from django.conf.urls import patterns, url
from django.contrib.admin.views.decorators import staff_member_required
from django.utils.translation import ugettext_lazy as _
from oscar.core.application import Application
from oscar.apps.dashboard.ranges import views
from oscar.apps.dashboard.nav import register, Node
no... | [
{
"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 | oscar/apps/dashboard/ranges/app.py | endgame/django-oscar |
from panther_base_helpers import deep_get
QUERIES = {"pack_incident-response_alf", "pack/mac-cis/ApplicationFirewall"}
def rule(event):
if event.get("name") not in QUERIES:
return False
if event.get("action") != "added":
return False
return (
# 0 If the firewall is disabled
... | [
{
"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 | osquery_rules/osquery_mac_application_firewall.py | panther-labs/panther-cli |
from __future__ import annotations
from typing import List
from stilio.crawler.dht.node import Node
class RoutingTable:
def __init__(self, max_size: int):
self.max_size = max_size
self.nodes: List[Node] = []
@property
def is_full(self) -> bool:
return len(self.nodes) > self.max_... | [
{
"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 | stilio/crawler/dht/routing.py | m4d3bug/stilio |
from typing import List
import numpy as np
class Normalize(object):
"""Normalize a image with mean and standard deviation.
This transform only test opencv Image.
Given mean: ``(mean[1],...,mean[n])`` and std: ``(std[1],..,std[n])`` for ``n``
channels, this transform will normalize each channel of the 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": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false... | 3 | transforms_deprecated/normalize.py | edificewang/imageclassification |
#!/usr/bin/env python
# -*- coding: utf-8
# Copyright 2017-2019 The FIAAS Authors
#
# 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
#
# U... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"ans... | 3 | tests/fiaas_skipper/web/test_metrics.py | eduramirezh/skipper |
import torch
import pandas as pd
class ESXDataset(torch.utils.data.Dataset):
def __init__(self, train_X, train_Y, train_T, train_E):
self.train_X = torch.from_numpy(train_X).float()
self.train_T = torch.from_numpy(train_T).float() # label of treatment status
self.train_Y = torch.from_nump... | [
{
"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 | model/dataset.py | kailiang-zhong/DESCN |
def bytesToIntArray(b, bytesPerInt, signed=True, endianness="little"):
if len(b) % bytesPerInt != 0:
raise Exception("Wrong number of bytes for conversion")
nums = [0] * int((len(b) / bytesPerInt))
for i in range(0, len(b), bytesPerInt):
nums[int(i / bytesPerInt)] = int.from_bytes(
... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside... | 3 | micromelon/_binary.py | timmyhadwen/mm-pymodule |
from flask import Flask, jsonify, json, Response, request
from flask_cors import CORS
import mysfitsTableClient
# A very basic API created using Flask that has two possible routes for requests.
app = Flask(__name__)
app.config['JSONIFY_PRETTYPRINT_REGULAR'] = False
CORS(app)
# The service basepath has a short respon... | [
{
"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 | module-3/app/service/mythicalMysfitsService.py | kpiljoong/aws-modern-application-workshop |
#!/usr/bin/env python3
import unittest
class MyTestSuite(unittest.TestCase):
def test_len_3(self):
self.assertTrue(is_palindrome("bob"))
def test_len_less_than_3_raises_ValueError(self):
with self.assertRaises(ValueError):
self.assertTrue(is_palindrome("aa"))
def test_basic(s... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
... | 3 | Informatik1/Actual Finals/Finals Solutions/4 Testing/testing.py | Queentaker/uzh |
import jsons
import pika
from pika.exchange_type import ExchangeType
class MQPublisher(object):
EXCHANGE = 'SatTrackerWorker'
QUEUE = 'WorkerIn'
ROUTING_KEY = 'In'
def __init__(self, amqp_url) -> None:
self._connection = None
self._channel = None
self._deliveries = None
... | [
{
"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 | MQPublisher.py | Navatalin/SatTrackerAPI |
import torch
import numpy as np
class EntityEmbedding(torch.nn.Module):
def __init__(self, vocab_size, hidden_size, input_size):
super(EntityEmbedding, self).__init__()
self.input_size = input_size
self.hidden_size = hidden_size
self.vocab_size = vocab_size
self.softmax = torch.nn.Softmax(dim=1)
weights ... | [
{
"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 | embedding_layer.py | AmanPriyanshu/entity-embeddings-from-scratch |
from django.http import HttpResponseRedirect, HttpResponse
from django.shortcuts import get_object_or_404, render
from django.core.urlresolvers import reverse
from .models import Choice, Question
def search_form(request):
return render(request, 'search_form.html')
def search(request):
request.encoding = 'utf-8'
m... | [
{
"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 | 0430/mysite/polls/views.py | killua4564/jellyfish |
# coding: utf-8
"""
@title A Python DEAP implementation of Genetic Algorithms with Cluster Averaging Method for Solving Job-Shop Scheduling Problems
@see https://www.jstage.jst.go.jp/article/jjsai/10/5/10_769/_article/-char/ja/
@see https://www.personal-media.co.jp/book/comp/173/
@author Shigeta Yosuke
@email shigeta@t... | [
{
"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 | logger/Logger.py | shigeta-technoface/public-jsp-cam |
import tensorflow as tf
def cov(x):
mean_x = tf.reduce_mean(x, axis=0, keepdims=True)
mx = tf.matmul(tf.transpose(mean_x), mean_x)
vx = tf.matmul(tf.transpose(x), x) / tf.cast(tf.shape(x)[0], tf.float64)
cov_xx = vx - mx
return cov_xx
def inv_cov(x):
return tf.linalg.inv(cov(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": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"ans... | 3 | src/emutils/tf/math.py | emanuele-albini/emutils |
import torch
import Constants
from Preprocess import translate2word, restore2Ori
from Parameter import device, maxLen
def generator(model, testData, SrcOriPath, index2word, DictPath, search_method, beam_size):
model.eval()
translate = lambda outputs: [translate2word(seq, index2word) for seq in ou... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": fal... | 3 | generate.py | L-Zhe/SDISS |
from django.db import models
class Appliance(models.Model):
name = models.CharField(max_length=100, null=False)
oid = models.UUIDField(unique=True)
pid = models.CharField(max_length=50)
appliance_type = models.CharField(max_length=30)
def __str__(self):
return self.name
class Sensor(mod... | [
{
"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 | project/adapter/models.py | vicinityh2020/vicinity-vas-energy-monitoring |
import pytest
from importtime_output_wrapper import Import
from importtime_output_wrapper import parse_import_time
from importtime_output_wrapper import InvalidInput
imp_a0 = Import(name="a0", t_self=4, t_cumu=5, depth=2, childs=[])
imp_a1 = Import(name="a1", t_self=3, t_cumu=4, depth=2, childs=[])
imp_b0 = Import(n... | [
{
"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 | tests/test_parse_import_time.py | Victor333Huesca/importtime-output-wrapper |
from textual.app import App
from textual import events
from textual.view import View
from textual.widgets import Placeholder
from textual.layouts.grid import GridLayout
class GridTest(App):
async def on_load(self, event: events.Load) -> None:
await self.bind("q,ctrl+c", "quit", "Quit")
async def on_s... | [
{
"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 | examples/grid_auto.py | lllama/textual |
import time
class Timer:
"""Simple Timer"""
def __init__(self):
self.start = time.perf_counter()
def end(self, precision: int = 3) -> str:
return '%.{}f'.format(precision) % (time.perf_counter() - self.start)
| [
{
"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 | python/homeflux/utils/timer.py | david2777/homeflux |
from math import sqrt
# function with int parameter
def my_function(a: str):
print(a)
my_function(3)
# function with type annotation
def my_function2(a: str) -> str:
return a
print(my_function2(3))
# import sqrt from math and use it
print(sqrt(9.4323))
# import alias from math
# from math import sqrt as square_... | [
{
"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 | lessons/functions.py | Friction-Log/learning_python_frictionlog |
from django.shortcuts import render
from django.http import HttpResponse
# Create your views here.
#login view
def login(request):
return render(request, 'base.html')
#Doctor Console
def doc_console(request):
return render(request, 'd_console.html')
#Client Consloe
def cli_console(request):
return rende... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excludi... | 3 | Web Services/playground/views.py | asana-Bhavesh/health-monitoring-system |
"""
Given two arrays, write a function to compute their intersection.
Example 1:
Input: nums1 = [1,2,2,1], nums2 = [2,2]
Output: [2,2]
Example 2:
Input: nums1 = [4,9,5], nums2 = [9,4,9,8,4]
Output: [4,9]
"""
import unittest
class Solution:
def intersect(self, nums1, nums2):
"""
:type nums1: List... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class 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": true... | 3 | coding_problems/intersection_of_two_arrays.py | NescobarAlopLop/miscellaneous |
from toontown.toonbase.ToonPythonUtil import Functor
from otp.level import LevelMgrBase
class LevelMgr(LevelMgrBase.LevelMgrBase):
def __init__(self, level, entId):
LevelMgrBase.LevelMgrBase.__init__(self, level, entId)
self.geom = loader.loadModel(self.modelFilename)
if not self.geom:
... | [
{
"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 | otp/level/LevelMgr.py | LittleNed/toontown-stride |
from pygame import mixer
import math
def init_sound():
mixer.init(channels=2)
mixer.set_num_channels(11)
def playSfx(track, channel=1, volume=1, loops=0):
# failsafe
if channel == 0:
print("WARNING: Channel 0 is reserved for BGM!")
# don't just quit the program due to a sound playing... | [
{
"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": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excl... | 3 | sound.py | arda-guler/SoundscapeMatrices |
# coding: utf-8
"""
Copyright 2016 SmartBear Software
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 l... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"ans... | 3 | test/test_settings_mapping_extended.py | Atomicology/isilon_sdk_python |
# import rospy
from math import atan2, pi, sqrt
from pid import PID
GAS_DENSITY = 2.858
ONE_MPH = 0.44704
class TwistController(object):
def __init__(self, max_angular_velocity, accel_limit, decel_limit):
self.max_angular_velocity = max_angular_velocity
self.accel_limit = accel_limit
self.... | [
{
"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 | ros/src/twist_controller/stability_controller.py | aero5566/Final-System-Integrated |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for `http_pipeline` package."""
import pytest
from http_pipeline import http_pipeline
@pytest.fixture
def response():
"""Sample pytest fixture.
See more at: http://doc.pytest.org/en/latest/fixture.html
"""
# import requests
# return reque... | [
{
"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_http_pipeline.py | Poorvak/http_pipeline |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.