source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
# Copyright 2021 Huawei Technologies Co., Ltd
#
# 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... | [
{
"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 | tests/ut/cpp/python_input/gtest_input/pre_activate/all_to_all_unify_mindir_test.py | PowerOlive/mindspore |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cl... | 3 | aliyun-python-sdk-ons/aliyunsdkons/request/v20170918/OnsMqttQueryClientByTopicRequest.py | DataDog/aliyun-openapi-python-sdk |
from abc import ABCMeta, abstractmethod
class Scene(object):
__metaclass__ = ABCMeta
@abstractmethod
def enter(self):
"""
Enter method to every scene
:return:
"""
pass
class Engine(object):
__metaclass__ = ABCMeta
def __init__(self, scene_map):
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": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?... | 3 | design_patterns/oop/alien_game/__init__.py | JASTYN/pythonmaster |
class ElementIntersectsElementFilter(ElementIntersectsFilter, IDisposable):
"""
A filter to find elements that intersect the solid geometry of a given element.
ElementIntersectsElementFilter(element: Element,inverted: bool)
ElementIntersectsElementFilter(element: Element)
"""
def Dispose(se... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"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 | release/stubs.min/Autodesk/Revit/DB/__init___parts/ElementIntersectsElementFilter.py | YKato521/ironpython-stubs |
def title(t):
print('\033[36m'+str(t)+'\033[90m')
def info(i):
print('\033[90m'+str(i))
def error(e):
print('\033[91m'+str(e)+'\033[90m')
| [
{
"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 | console.py | Frank-Mayer/yule |
from toontown.dna import DNALandmarkBuilding
from toontown.dna import DNAError
from toontown.dna import DNAUtil
class DNAAnimBuilding(DNALandmarkBuilding.DNALandmarkBuilding):
__slots__ = (
'animName')
COMPONENT_CODE = 16
def __init__(self, name):
DNALandmarkBuilding.DNALandmarkBu... | [
{
"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 | toontown/dna/DNAAnimBuilding.py | LittleNed/toontown-stride |
"""
Wrapper for classes like `Paginator`.
"""
import inspect
from mypy_boto3_builder.import_helpers.import_record import ImportRecord
from mypy_boto3_builder.import_helpers.import_string import ImportString
from mypy_boto3_builder.type_annotations.fake_annotation import FakeAnnotation
class TypeClass(FakeAnnotation)... | [
{
"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 | mypy_boto3_builder/type_annotations/type_class.py | benesch/mypy_boto3_builder |
from benchmarkstt.helpers import make_printable
from benchmarkstt.deferred import DeferredCallback
import pytest
def cb(txt):
def _():
_.cb_count += 1
return '[%s]' % (txt,)
_.cb_count = 0
return _
class ToDefer:
def __init__(self, value):
self.value = value
self.cb_c... | [
{
"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 | tests/benchmarkstt/test_benchmarkstt.py | ebu/benchmarkstt |
import numpy as np
from ..base.mixins import RandomStateMixin
from ..policies.base import BasePolicy
from ..utils import argmax
__all__ = (
'EpsilonGreedy',
# 'BoltzmannPolicy', #TODO: implement
)
class EpsilonGreedy(BasePolicy, RandomStateMixin):
"""
Value-based policy to select actions using eps... | [
{
"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": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/... | 3 | keras_gym/policies/value_based.py | KristianHolsheimer/keras-gym |
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution:
def bstToGst(self, root: TreeNode) -> TreeNode:
self.sum = 0
def dfs(node):
if node:
... | [
{
"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 | src/tree/1038.binary-search-tree-to-greater-sum-tree/binary-search-tree-to-greater-sum-tree.py | lyphui/Just-Code |
import os
import shutil
import numpy as np
import tensorflow as tf
def path_exists(path, overwrite=False):
if not os.path.isdir(path):
os.mkdir(path)
elif overwrite == True :
shutil.rmtree(path)
return path
def remove_dir(path):
os.rmdir(path)
return True
def relu_init(shape, dtyp... | [
{
"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/utils.py | MahdiSajedei/Searching-for-activation-functions |
"""
PyDraw-after: simple canvas paint program and object mover/animator
use widget.after scheduled events to implement object move loops, such
that more than one can be in motion at once without having to use threads;
this does moves in parallel, but seems to be slower than time.sleep version;
see also canvasDraw in To... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self... | 3 | PP4E-Examples-1.4/Examples/PP4E/Gui/MovingPics/movingpics_after.py | AngelLiang/PP4E |
import re
import time
from pyquery import PyQuery as pq
from policy_crawl.common.fetch import get,post
from policy_crawl.common.save import save
from policy_crawl.common.logger import alllog,errorlog
def parse_detail(html,url):
alllog.logger.info("天津市教育厅: %s"%url)
doc=pq(html)
data={}
data["title"]=d... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docs... | 3 | spiders/moe/all/tianjin.py | JJYYYY/policy_crawl |
class carro:
pass
NORTE = 'Norte'
LESTE = 'Leste'
SUL = 'Sul'
OESTE = 'Oeste'
class direcao:
rotacao_a_direita_dct = {NORTE: LESTE, LESTE: SUL, SUL: OESTE, OESTE: NORTE}
rotacao_a_esquerda_dct = {NORTE: OESTE, OESTE: SUL, SUL: LESTE, LESTE: NORTE}
def __init__(self):
self.valor = NORTE
d... | [
{
"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 | oo/carro.py | cadica/pythonbirds |
# -*- coding: utf-8 -*-
import re
from osgeo import ogr
class ShpToGDALFeatures(object):
def __init__(self, shpFilePath=None):
if shpFilePath is None:
raise Exception('No shapefile path provided')
if re.search(r'(\.shp)$', shpFilePath) is None:
raise TypeError(
... | [
{
"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 | forge/lib/shapefile_utils.py | Pandinosaurus/3d-forge |
#!/usr/bin/env python
import sys
import agate
from csvkit.cli import CSVKitUtility
class CSVPy(CSVKitUtility):
description = 'Load a CSV file into a CSV reader and then drop into a Python shell.'
def add_arguments(self):
self.argparser.add_argument('--dict', dest='as_dict', action='store_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 | csvkit/utilities/csvpy.py | felixbuenemann/csvkit |
from unittest import TestCase
from chatterbot.adapters.logic import LogicAdapter
class LogicAdapterTestCase(TestCase):
"""
This test case is for the LogicAdapter base class.
Although this class is not intended for direct use,
this test case ensures that exceptions requiring
basic functionality are... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"ans... | 3 | tests/logic_adapter_tests/test_logic_adapter.py | arnauddelaunay/ChatterBot |
from ascetic.contrib.versioning.exceptions import AlreadyRegistered, NotRegistered
from ascetic.contrib.versioning.interfaces import IRegistry
class Registry(IRegistry):
def __init__(self):
self._fields_mapping = dict()
self._object_accessor_mapping = dict()
def register(self, model, fields, ... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (exclu... | 3 | ascetic/contrib/versioning/registry.py | emacsway/ascetic |
from flying_ioc import IocManager
class TSingleton1:
def __init__(self):
pass
def test_singleton_container():
ioc = IocManager(stats=True)
ioc.set_class(name='singleton1', cls=TSingleton1, singleton=True)
assert ioc.singleton1 is ioc.singleton1
ioc.print_stats()
| [
{
"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 | tests/test_singleton_container.py | ClanPlay/Python_IoC |
import flask
from flask import Flask,jsonify,request
import json
from data_input import data_in
import numpy as np
import pickle
def load_models():
file_name = './models/model_file.p'
with open(file_name,'rb') as pickled:
data = pickle.load(pickled)
model = data['model']
return model
app = Flask(__name__)
@... | [
{
"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 | Data Science salary prediction/FlaskAPI/app.py | negiaditya/PROJECTS-Data_Science |
import pytest
from test_fixtures.scenarios.basic import * # noqa
from organizations.tests.conftest import organization_random # noqa - used by local tests
from logs.tests.conftest import flexible_slicer_test_data, report_type_nd # noqa
@pytest.fixture
def root_platform(platforms):
return platforms['root']
@... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answe... | 3 | apps/api/tests/conftest.py | techlib/czechelib-stats |
import unittest
from ebird.api.validation import is_subnational1
class IsSubnational1Tests(unittest.TestCase):
"""Tests for the is_subnational1 validation function."""
def test_is_subnational1(self):
self.assertTrue(is_subnational1("US-NV"))
def test_invalid_code_is_not_subnational1(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": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"ans... | 3 | tests/validation/test_is_subnational1.py | StuartMacKay/ebird-api |
from logging import getLogger
import slack
logger = getLogger(__name__)
class ChannelListNotLoadedError(RuntimeError):
pass
class ChannelNotFoundError(RuntimeError):
pass
class FileNotUploadedError(RuntimeError):
pass
class SlackAPI(object):
def __init__(self, token, channel: str, to_user: st... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
... | 3 | gokart/slack/slack_api.py | skmatz/gokart |
class Calls(object):
def __init__(self):
self.calls = []
def addCall(self, call):
self.calls.append(call)
def endCall(self, call):
for c in self.calls:
if call.ID == c.ID:
self.calls.remove(call)
def searchCall(self, call_id):
for c in 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": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fe... | 3 | basic/calls.py | Mateuskim/call-center |
from datetime import datetime
from django.core import mail
from django.core.mail import EmailMessage
from src.rooms.models import Donation, Room
def send_email(data):
message = EmailMessage(data['subject'], data['message'], to=data['to'])
return message.send()
def send_mass_email(email_message_list):
... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written... | 3 | src/notifications/tasks.py | Bounty1993/my-blog |
# Copyright 2019. ThingsBoard
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | [
{
"point_num": 1,
"id": "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 | thingsboard_gateway/storage/event_storage_reader_pointer.py | xinge-ok/thingsboard-gateway |
from django.apps import AppConfig
from django.db import connections as djcs
from django.core.exceptions import ImproperlyConfigured
class ExplorerAppConfig(AppConfig):
name = 'explorer'
def ready(self):
from explorer.schema import build_async_schemas
_validate_connections()
build_asy... | [
{
"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 | explorer/apps.py | vrjbvishnu/django-sql-explorer |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
from base import BaseObject
class SiblingsDictGenerator(BaseObject):
def __init__(self, some_df):
BaseObject.__init__(self, __name__)
self.df = some_df
@staticmethod
def normalize(some_dict):
the_normalized_dict = {}
for key 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 | python/taskmda/mda/dmo/siblings_dict_generator.py | jiportilla/ontology |
from flask import Blueprint, render_template, session, redirect, url_for, request, flash
import sys
sys.path.append("../..")
import user_database as db
import views.posts.post_database as pdb
from auth import auth
from user import User
import app_settings
posts = Blueprint("posts", __name__, static_folder='static', te... | [
{
"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 | views/posts/posts.py | samg11/slakr |
# -*- coding: utf-8 -*-
#
# michael a.g. aïvázis <michael.aivazis@para-sim.com>
# (c) 1998-2022 all rights reserved
# externals
import merlin
# declaration
class About(merlin.shells.command, family='merlin.cli.about'):
"""
Display information about this application
"""
@merlin.export(tip="print th... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (exclu... | 3 | packages/merlin/cli/About.py | PyreFramework/pyre |
#!/usr/bin/python3
"""Student module.
Contains a Student class and some methods.
"""
class Student():
"""Defines a Student."""
def __init__(self, first_name, last_name, age):
"""Sets the necessary attributes for the Student object.
Args:
first_name (str): first name of the stude... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/c... | 3 | 0x0B-python-input_output/10-student.py | malu17/alx-higher_level_programming |
import sys
import cro_mapper
import os
import unicodedata
import numpy as np
from scipy import misc
def _get_all_file_paths(path):
file_paths = []
for root, dirs, files in os.walk(path):
for file_ in files:
full_path = os.path.join(root, file_)
if os.path.isfile(full_path) and f... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": fals... | 3 | source/clcd.py | fgulan/masters-seminar |
from rest_framework.generics import ListAPIView, RetrieveAPIView
from api.serializers import ChallengeSerializer
from challenges.models import Challenge
class ChallengeListAPIView(ListAPIView):
""" Lists all challenges. """
serializer_class = ChallengeSerializer
def get_queryset(self):
return Ch... | [
{
"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 | gesund_projekt/api/views/challenges.py | asis2016/gesund-projekt |
from kay.utils import url_for
from kay_sitemap import Sitemap
from przepisy import VISIBILITY
from przepisy.models import Category, Recipe
class StaticSitemap(Sitemap):
changefreq = 'weekly'
def items(self):
items = [url_for('index/index', _external=True)]
for cat in Category.all().fetch(20):
i... | [
{
"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 | index/sitemaps.py | gluwer/przepisymm |
# This file is part of the Extra-P software (http://www.scalasca.org/software/extra-p)
#
# Copyright (c) 2020, Technical University of Darmstadt, Germany
#
# This software may be modified and distributed under the terms of a BSD-style license.
# See the LICENSE file in the base directory for details.
class Recoverable... | [
{
"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 | extrap/util/exceptions.py | arima0714/extrap |
class Calculator:
__result = 0
def __init__(self):
pass
def add(self, i: int):
self.__result = self.__result + i
def subtract(self, i: int):
self.__result = self.__result - i
def getResult(self):
return self.__result
| [
{
"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 | snippets/URL parameters/calculator.py | keremkoseoglu/Python-Library |
import ipaddress
from aiohttp import web
def register_routes(app: web.Application):
app.add_routes(
[
web.get("/echo", echo),
web.get("/endpoints", list_endpoints),
web.post("/endpoints", add_endpoints),
web.delete("/endpoints", delete_endpoints),
]... | [
{
"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 | perwez/perwez/server/routes.py | sosp2021/Reth |
from django.core.urlresolvers import reverse
from django.conf import settings
from django.db import models
class List(models.Model):
owner = models.ForeignKey(settings.AUTH_USER_MODEL, blank=True, null=True)
shared_with = models.ManyToManyField(
settings.AUTH_USER_MODEL, related_name='shared_lists'
... | [
{
"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 | lists/models.py | danrneal/superlists |
import jieba
import jieba.posseg as pseg
def user_dict():
from sagas.conf import resource_path
dictf = resource_path('dict_zh.txt')
jieba.load_userdict(dictf)
seg_list = jieba.cut("列出所有的采购订单") # 默认是精确模式
print(", ".join(seg_list))
def user_words():
jieba.add_word('寄账单地址', tag='typ')
jieba... | [
{
"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 | sagas/tests/langs/jieba_procs.py | samlet/stack |
"""Standardized service-level logger utils."""
import logging
from termcolor import colored
def configure_logger():
"""Configure the built-in root Python logger."""
logger = logging.getLogger()
handler = logging.StreamHandler()
formatter = logging.Formatter('%(asctime)s %(levelname)-8s %(message)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_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"... | 3 | services/common/python/logger.py | uavaustin/orchestra |
# -*- coding: utf-8 -*-
from .context import tatsumaki
from motor import MotorClient
from tatsumaki.base import Document
from tatsumaki.connection import connect, Connection
# Importing testing libraries for async tests
from tornado.testing import gen_test
from tornado.testing import AsyncTestCase
class DocumentTest... | [
{
"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/test_base.py | plasmashadow/tatsumaki |
import getpass, platform, sys, threading
from .. util import log
from . control import ExtractedControl
# See https://stackoverflow.com/questions/42603000
DARWIN_ROOT_WARNING = """
In MacOS, pynput must to be running as root in order to get keystrokes.
Try running your program like this:
sudo %s <your commands h... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written ... | 3 | bibliopixel/control/keyboard.py | rec/leds |
def count_matches(s1, s2):
''' (str, str) -> int
Return the number of positions in s1 that contain the
same character at the corresponding position of s2.
Precondition: len(s1) == len(s2)
>>> count_matches('ate', 'ape')
2
>>> count_matches('head', 'hard')
2
'''
nu... | [
{
"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 | University-of-Toronto-The Fundamentals/week6/parallel_list_str.py | Sam-Gao-Xin/Courses- |
import pytest
import os
from polyglotdb.io import inspect_maus
from polyglotdb import CorpusContext
from polyglotdb.exceptions import ParseError
def test_load_aus(maus_test_dir, graph_db):
with CorpusContext('test_mfa', **graph_db) as c:
c.reset()
testFilePath = os.path.join(maus_test_dir, "maus... | [
{
"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 | tests/test_io_maus.py | michaelhaaf/PolyglotDB |
import sqlite3
from my_config import DB_CONNECTION_STR
class SqliteUtil():
def __init__(self):
self.db_connection_str = DB_CONNECTION_STR
self.con = sqlite3.connect(self.db_connection_str, check_same_thread=False)
self.con.row_factory = sqlite3.Row
self.cursorObj = self.con.cursor... | [
{
"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 | sql_util.py | hoaipham97/togo |
# This is the object-based adapter pattern
# It allows us to take an outside class 'StrangeCreature' with a different interface,
# and squeeze that SOB into another hierachy.
# The good thing about the object version of this pattern is that if StrangeCreature had
# a lot of subtypes, we would not need to write an adapt... | [
{
"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 | Structural/object_adapter.py | TheVikingGent/DesignPatterns4Python |
# system imports
import os, json
basedir = os.path.abspath(os.path.dirname(__file__))
class Config:
"""
Class used to hold configurations that are used in both website and admin applications
"""
MONGO_HOST = "localhost"
MONGO_DBNAME = "panoptes"
THREADS_PER_PAGE = 8
mailcfg = json.loa... | [
{
"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 | panoptes/webapp/config.py | lesingerouge/Panoptes |
"""A ApiController Module."""
from masonite.request import Request
from masonite.view import View
from masonite.controllers import Controller
class ApiController(Controller):
"""ApiController Controller Class."""
def __init__(self, request: Request):
"""ApiController Initializer
Arguments:
... | [
{
"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/http/controllers/ApiController.py | krishotte/env_data2 |
# Definition for singly-linked list.
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
class Solution:
def rotateRight(self, head: ListNode, k: int) -> ListNode:
if not (head and head.next and k) :
return head
fast = head
cnt = 1
whi... | [
{
"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 | 61. Rotate List.py | XinchaoGou/MyLeetCode |
import matplotlib.pyplot as plt
def plot_data(first_path, best_path, distances_plot_data, temperatures_plot_data):
first_path_xs = []
first_path_ys = []
for city in first_path:
first_path_xs.append(city[0])
first_path_ys.append(city[1])
first_path_xs.append(first_path_xs[0])
first... | [
{
"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 | lab4_simulated_annealing/task_1/plotter.py | j-adamczyk/Numerical-Algorithms |
from marshmallow import fields
from .field_set import FieldSet, FieldSetSchema
class Destination(FieldSet):
def __init__(self,
address: str = None,
bytes: int = None,
domain: str = None,
ip: str = None,
mac: str = None,
... | [
{
"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 | kubi_ecs_logger/models/fields/destination.py | kumina/kubi_ecs_logger |
""" ELBO """
import oneflow.experimental as flow
class ELBO(flow.nn.Module):
def __init__(self, generator, variational):
super(ELBO, self).__init__()
self.generator = generator
self.variational = variational
def log_joint(self, nodes):
log_joint_ = None
for n_name in n... | [
{
"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 | zhusuan_of/variational/elbo.py | Oneflow-Inc/Zhusuan-Oneflow |
#!/usr/bin/env python3
import sys
# Functions
def sumup():
''' Iterative '''
numbers = []
for argument in sys.argv[1:]:
try:
numbers.append(int(argument))
except ValueError:
pass
print(f'The sum of {numbers} is {sum(numbers)}')
def sumup_fp():
''' Functi... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true... | 3 | lecture09/sumup.py | nd-cse-20289-sp22/cse-20289-sp22-examples |
"""
GENERATED FILE - DO NOT EDIT (created via @build_stack_rules_proto//cmd/depsgen)
"""
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
def _maybe(repo_rule, name, **kwargs):
if name not in native.existing_rules():
repo_rule(name = name, **kwargs)
def prebuilt_protoc_deps():
pre... | [
{
"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 | deps/prebuilt_protoc_deps.bzl | heartless-clown/rules_proto |
from __future__ import print_function
from __future__ import division
from . import _C
import numpy as np
###################################################################################################################################################
def get_random_time_mesh(ti, tf, min_dt):
if tf<=ti:
return ... | [
{
"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 | synthsne/generators/time_meshs.py | opimentel-github/sne-lightcurves-synthetic |
# Copyright 2015 Jared Rodriguez (jared.rodriguez@rackspace.com)
# 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/LICENS... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true... | 3 | mercury_agent/procedures/inspector.py | jr0d/mercury-agent |
import asyncio
import base64
import threading
import cv2
import numpy as np
from flask_socketio import SocketIO, emit
from flask import Flask, render_template
import multiprocessing
class Streamer():
def __init__(self) -> None:
"""Constructor
"""
@staticmethod
async def stream_s... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answe... | 3 | mvfy/visual/utils/streamer.py | erwingforerocastro/mvfy_visual_py |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @Date : Feb-09-21 22:23
# @Author : Kelly Hwong (dianhuangkan@gmail.com)
import numpy as np
import tensorflow as tf
class XOR_Dataset(tf.keras.utils.Sequence):
"""XOR_Dataset."""
def __init__(
self,
batch_size=1,
shuffle=False,
... | [
{
"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 | xor_gate_nn/datasets/keras_fn/datasets.py | AI-Huang/XOR_Gate_NN |
class Side:
def __init__(self, border_style='SOLID', color='FF000000', width=1):
self._border_style = border_style
self._color = color
self._width = width
@property
def border_style(self):
return self._border_style.upper()
@property
def color(self):
return 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 | gspread2/styles/borders.py | futuereprojects/gspread2 |
from django.db import models
from pygments.lexers import get_all_lexers
from pygments.styles import get_all_styles
from pygments.lexers import get_lexer_by_name
from pygments.formatters.html import HtmlFormatter
from pygments import highlight
LEXERS = [item for item in get_all_lexers() if item[1]]
LANGUAGE_CHOICES = s... | [
{
"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 | snippets/models.py | miritih/snippetsApi |
from django.db import models
from django.core.urlresolvers import reverse
from django.conf import settings
class List(models.Model):
owner = models.ForeignKey(settings.AUTH_USER_MODEL, blank=True, null=True)
def get_absolute_url(self):
return reverse('view_list', args=[self.id])
@property
d... | [
{
"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 | lists/models.py | bgroveben/TDDWithPython |
r"""Setup fixtures for testing :py:class:`lmp.model.LSTMModel`."""
import pytest
import torch
from lmp.model import LSTMModel
from lmp.tknzr import BaseTknzr
@pytest.fixture
def lstm_model(
tknzr: BaseTknzr,
d_emb: int,
d_hid: int,
n_hid_lyr: int,
n_pre_hid_lyr: int,
... | [
{
"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 | test/lmp/model/_lstm/conftest.py | a868111817/language-model-playground |
import file_hasher as f
import unittest
import sys
import os
testdir = os.path.dirname(__file__)
srcdir = '../lib'
sys.path.insert(0, os.path.abspath(os.path.join(testdir, srcdir)))
class TestFileHasher(unittest.TestCase):
def setUp(self):
self.file_hasher = f.FileHasher("./test_file.txt", "sha1")
d... | [
{
"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 | hash_generator_cli/tests/test_file_hasher.py | clemdep/hash-generator-cli |
# -*- coding: utf-8 -*-
"""
CredentialsStoreInterface Interface
This class describes a shared interface for accessing user credentials
"""
# Builtins
import abc
# Internals
from conjur.data_object import CredentialsData, ConjurrcData
class CredentialsStoreInterface(metaclass=abc.ABCMeta): # pragma: no cover
"... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/c... | 3 | conjur/interface/credentials_store_interface.py | jdumas/conjur-api-python3 |
import numpy as np
from tensorflow.keras import backend as K
def extract_image_patches(X, ksizes, strides,
padding='valid',
data_format='channels_first'):
raise NotImplementedError
def depth_to_space(input, scale, data_format=None):
raise NotImplementedErr... | [
{
"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 | keras_contrib/backend/numpy_backend.py | HaemanthSP/keras-contrib |
from py4j.java_gateway import JavaGateway
from py4j.protocol import Py4JNetworkError
# TODO: ugly stuff! makes a copy of the array to separate result from Py4J (java gateway)
def pythonify(gateway_obj):
res_copy = []
for res in gateway_obj:
res_copy.append(res)
return res_copy
class PrismHandler... | [
{
"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 | prismhandler/prism_handler.py | KTH-RPL-Planiacs/least-limiting-advisers |
from random import randint
import pytest
from round_robin_generator.matchup_generation_circle import apply_offset
@pytest.mark.parametrize(
"p,expected", [(2, 7), (3, 8), (4, 2), (5, 3), (6, 4), (7, 5), (8, 6)]
)
def test_apply_offset(p, expected):
assert apply_offset(p, 8, 2) == expected
@pytest.mark.par... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer":... | 3 | tests/test_generate_matchups.py | avadavat/round_robin_generator |
import json
from symro.src.automenu import Command
class SpecialCommand(Command):
def __init__(self,
symbol: str,
line_index: int = -1):
super(SpecialCommand, self).__init__()
self.symbol: str = symbol
self.line_index: int = line_index
def __str__(s... | [
{
"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 | src/scripting/specialcommand.py | ari-bou/symro |
from typing import List
from celery import shared_task
from mipengine.node_tasks_DTOs import TableInfo
from mipengine.node.monetdb_interface import remote_tables
@shared_task
def get_remote_tables(context_id: str) -> List[str]:
"""
Parameters
----------
context_id : str
The id of the experiment
... | [
{
"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 | mipengine/node/tasks/remote_tables.py | madgik/MIP-Engine |
# O(1) time | O(1) space - assuming a 9x9 input board
def solveSudoku(board):
solvePartialSudoku(0, 0, board)
return board
def solvePartialSudoku(row, col, board):
currentRow = row
currentCol = col
if currentCol == len(board[currentRow]):
currentRow += 1
currentCol =... | [
{
"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 | Recursion/Solve Sudoku/SolveSudoku.py | joydeepnandi/Algo |
import os
import logging
import pandas as pd
from pathlib import Path
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
DIR_PATH = Path(os.path.dirname(os.path.abspath(__file__)))
SINCE_PATH = DIR_PATH / Path('data/since.txt')
ARTICLES_PATH = DIR_PATH / Path('data/articles.csv')
def reco... | [
{
"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 | storage.py | cgrinaldi/pocket_analytics |
from vulnman.api.viewsets import ProjectRelatedObjectViewSet
from api.v1 import generics
from api.v1.serializers import vulnerability as serializers
from api.v1.serializers.proofs import ImageProofSerializer, TextProofSerializer
from apps.findings import models
class AgentVulnerabilityViewSet(generics.AgentModelViewS... | [
{
"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 | api/v1/viewsets/vulnerability.py | vulnman/vulnman |
import json
class Timeout(Exception):
"""
Used when a timeout occurs.
"""
pass
class HTTPException(Exception):
def __init__(self, response, *args, **kwargs):
try:
errors = json.loads(response.content.decode('utf8'))['errors']
message = '\n'.join([error['message'] f... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false... | 3 | oura/exceptions.py | kevingoldsmith/python-ouraring |
"""empty message
Revision ID: 455970924ed2
Revises: ab6b56596f03
Create Date: 2021-05-28 18:10:58.753066
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = '455970924ed2'
down_revision = 'ab6b56596f03'
branch_labels = None... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answe... | 3 | migrations/versions/455970924ed2_.py | mattj241/Fyyur |
def validateSubSequence(array, sequence):
"""
### Description
validateSubSequence -> validates if a sequence of elements is a subsequence of a list.
### Parameters
- array: the list where it will validate the subsequence.
- sequence: the potential subsequence of elements
... | [
{
"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 | valid_subsequence.py | GerardCod/algoexpert-python |
# EG11-02 Stock Item class failed
class StockItem(object):
'''
Stock item for the fashion shop
'''
def __init__(self, stock_ref, price, color):
self.stock_ref = stock_ref
self.__price = price
self.__stock_level = 0
self.color = color
@property
def price(self)... | [
{
"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 | chapter11/02 Stock Item class failed.py | munnep/begin_to_code_with_python |
#!/usr/bin/env python
import requests
import json
import logging
logger = logging.getLogger(__name__)
class TuLing():
def __init__(self):
self.__key__ = '2f1446eb0321804291b0a1e217c25bb5'
self.__appid__ = 137762
def __build_req_url(self, content):
return 'http://www.tuling123.com/op... | [
{
"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 | servermanager/Api/commonapi.py | mtuktarov/mtuktarov.com |
# -*- coding: utf-8 -*-
import binascii
import hashlib
import hmac
from urllib.parse import quote
def mk_soucrce(method, url_path, params):
str_params = quote("&".join(k + "=" + str(params[k]) for k in sorted(params.keys())), '')
source = '%s&%s&%s' % (
method.upper(),
quote(url_path, ''),
... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fe... | 3 | python/sign.py | unbiased-tech/sdk |
class Trainer():
def __init__(self, name):
self.name = name
self.pokemon = []
def add_pokemon(self, pokemon):
if pokemon not in self.pokemon:
self.pokemon.append(pokemon)
return f'Caught {pokemon.name} with health {pokemon.health}'
return f'This pokemon ... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self... | 3 | defining_classes/pokemon_battle/trainer.py | PetkoAndreev/Python-OOP |
import sqlite3
from flask import Flask, jsonify, request
app = Flask(__name__)
app.debug = True
api_key = "RANDOM ACCESS KEY HERE"
def CheckAPIKey(key):
if key == api_key:
return True
else:
return False
@app.route('/')
def HomeDir():
return jsonify({'msg': "invalid_endpoi... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 lines?",
"answer": false
}... | 3 | Flask Server.py | Dropout1337/HWID-Authentication-API |
import os
from fitnick.base.base import introspect_tokens
def refresh_authorized_client():
import requests
with requests.session() as session:
with open('fitnick/base/fitbit_refresh_token.txt', 'r') as f:
refresh_token = f.read().strip()
with open('fitnick/base/fitbit_refresh_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": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer"... | 3 | refresh_token.py | kcinnick/fitnick |
from durable.lang import *
with ruleset('replacetoken'):
# antecedent
@when_all(count(1), m.word.imatches(".*today.*"))
def match_today(c):
c.s.replace_str = "today"
c.s.replace_with = datetime.datetime.now().strftime('%d:%m:%Y')
# consequent
print('Hello {0}'.format(c.m.wor... | [
{
"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 | testpy/xpms_dynamic.py | prade/rules-debug |
import subprocess
import time
from selenium.webdriver import Chrome
import pywebio
import template
import util
from pywebio.input import *
from pywebio.platform.flask import start_server
from pywebio.utils import to_coroutine
async def target():
template.basic_output()
await template.coro_background_output(... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer":... | 3 | test/6.flask_coroutine.py | Floboy/PyWebIO |
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community
Edition) available.
Copyright (C) 2017-2020 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in co... | [
{
"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_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": ... | 3 | pipeline/engine/utils.py | springborland/bk-sops |
import json
import os
import re
from typing import Any
from ikea_api.endpoints import Cart, OrderCapture
token = os.environ["TOKEN"]
payloads = {
"add_items": {"90428328": 1},
"update_items": {"90428328": 5},
"remove_items": ["90428328"],
}
class_args = {"OrderCapture": ("101000")}
functions_to_skip = ... | [
{
"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 | response_examples/update_response_examples.py | sqr/ikea-api-client |
from tkinter import *
from tkinter import ttk
class MainTkinter:
def __init__(self, master):
master.title('Play Game')
master.config(relief = RIDGE)
frame = ttk.Frame(master)
frame.config(padding = (30, 15))
frame.pack()
playButton = ttk.Frame(master)
... | [
{
"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/MainTkinter.py | nugusha/Tic-Tac-Toe |
"""Support for Pocket Casts."""
from datetime import timedelta
import logging
from pycketcasts import pocketcasts
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA, SensorEntity
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME
import homeassistant.helpers.config_validati... | [
{
"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 | homeassistant/components/pocketcasts/sensor.py | learn-home-automation/core |
def print_line(numbers):
line = ""
for i in numbers:
line = line + str(i) + "\t"
print(line)
def grade_school_multiplication_table(n=3):
for i in range(1, n+1):
numbers = list(range(1*i, (n+1)*i,i))
#print(numbers)
print_line(numbers)
# range(start,end,increment... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 lines?",
"answer": false
}... | 3 | 2021/lab-solutions-2021-10-29/grade_school_multiplication_table.py | ati-ozgur/course-python |
from django.views.generic.edit import UpdateView
from django.urls import reverse_lazy
from django.utils.decorators import method_decorator
from django.contrib.auth.decorators import login_required
from user.models import User
from user.forms import UpdateUserForm
class EditProfileView(UpdateView):
model = User
... | [
{
"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 | medical_prescription/user/views/editprofile.py | ristovao/2017.2-Receituario-Medico |
from jadi import interface
class Package(object):
def __init__(self, manager):
self.manager = manager
self.id = None
self.name = None
self.version = None
self.description = None
self.is_installed = None
self.is_upgradeable = None
self.installed_versi... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)... | 3 | plugins/packages/api.py | lllanos/InfraDocker_Ajenti |
# -*- coding: utf-8 -*-
"""
Created on Mon Feb 18 02:43:27 2019
@author: z
"""
import numpy as np
import scipy.stats as ss
import matplotlib.pyplot as plt
from sklearn.linear_model import LogisticRegression
from sklearn.model_selection import train_test_split
h = 1
sd = 1
n = 50
n_n = 1000
def gen... | [
{
"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 | Python/Courese/Linear Regression/Logistic Regression.py | linghtiin/test |
from fractions import Fraction
def left_rect(f,x,h):
return f(x)
def mid_rect(f,x,h):
return f(x + h/2)
def right_rect(f,x,h):
return f(x+h)
def trapezium(f,x,h):
return (f(x) + f(x+h))/2.0
def simpson(f,x,h):
return (f(x) + 4*f(x + h/2) + f(x+h))/6.0
def cube(x):
return x*x*x
def reciprocal(x):
re... | [
{
"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 | lang/Python/numerical-integration-1.py | ethansaxenian/RosettaDecode |
from urllib import urlencode
from django.test import TestCase
from django.core.urlresolvers import reverse
class DefaultTestCase(TestCase):
def test_challenge(self):
response = self.client.get(
'%s?%s' % (reverse('challenge'), urlencode({
'hub.challenge': 'challenge',
... | [
{
"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 | vxmessenger/webapp/tests/test_webapp.py | praekeltfoundation/vumi-messenger |
import discord
from discord.ext import commands
bot = commands.Bot(command_prefix='-')
def inteam(ctx):
guild = bot.get_guild(GUILDID)
role = bot.get_role(ROLEID)
role in ctx.author.roles # GUILDID = The GuildID from the Support Server and RoleID is the Support RoleID.
@bot.event
async 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": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding ... | 3 | main.py | InvalidLenni/discordpymodmail |
from flask import Blueprint, request, jsonify, render_template
from apps.home.models import News, Classify
count = Blueprint('count', __name__)
@count.route('/admin/newcount/', methods=['POST', 'GET'])
def news_count():
if request.method == 'GET':
data = {}
title = []
count = []
... | [
{
"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 | apps/admin/admin_count.py | zcd1997/flask_news_projects |
from CoolProp.CoolProp import PropsSI
import pandas as pd
class State:
self.fluid = T
self.T = T
self.p = p
self.h = PropsSI('H', 'T', T, 'P', p, fluid)
self.s = PropsSI('S', 'T', T, 'P', p, fluid)
self.D = PropsSI('D', 'T', T, 'P', p, fluid)
class Flow(State):
self.m_dot = T
def def_st... | [
{
"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 | estorage/archive/state.py | EnergyModels/estorage |
from django.apps import AppConfig
from django.utils.translation import ugettext_lazy
class PluginApp(AppConfig):
name = 'pretix_fsp_mail_template'
verbose_name = 'FSP Mail Template'
class PretixPluginMeta:
name = ugettext_lazy('FSP Mail Template')
author = 'Felix Gohla'
descriptio... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
}... | 3 | pretix_fsp_mail_template/__init__.py | felix-gohla/pretix-fsp-mail-template |
from flask import request, Response
import DbInteractions.userLogin as ul
import DbInteractions.dbhandler as dbh
import json
# Delete endpoint, takes in a login token, upon success it deletes row from user session table(logs user out). If success returns true, return a response of None.
def delete():
success = F... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": fals... | 3 | Endpoints/login.py | Schollar/arktracker_backend |
"""Core Model"""
from django.db import models
from django.contrib.auth.models import AbstractBaseUser, BaseUserManager, \
PermissionsMixin
class UserManager(BaseUserManager):
"""User Manager"""
def create_user(self, email, password=None, **extra_fields):
"""Cre... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answe... | 3 | application/core/models.py | DanishDanialZurkanain/recipe-app-api |
from rtamt.operation.abstract_operation import AbstractOperation
class NotOperation(AbstractOperation):
def __init__(self):
self.input = []
def update(self, *args, **kargs):
out = []
input_list = args[0]
for in_sample in input_list:
out_time = in_sample[0]
... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": tru... | 3 | rtamt/operation/stl_ct/not_operation.py | BentleyJOakes/rtamt |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.