source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
#!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from unittest import mock
import numpy as np
import pandas as pd
from ax.metrics.tensorboard import TensorboardCurve... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answe... | 3 | ax/metrics/tests/test_tensorboard.py | j-wilson/Ax |
# Name: VolumeExtractChannel
import inviwopy as ivw
import numpy as np
class VolumeExtractChannel(ivw.Processor):
def __init__(self, id, name):
ivw.Processor.__init__(self, id, name)
self.inport = ivw.data.VolumeInport("inport")
self.addInport(self.inport, owner=False)
self.outpor... | [
{
"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 | misc/pythontools/processors/VolumeExtractChannel.py | grassofsky/modules |
#!/usr/bin/venv python3
import threading
from time import sleep, ctime
loops = [4, 2]
def loop(nloop, nsec):
print('start loop', nloop, 'at:', ctime())
sleep(nsec)
print('loop', nloop, 'done at:', ctime())
def main():
print('starting at:', ctime())
threads = []
nloops = range(len(loops))
... | [
{
"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 | Thread/mtsleepC.py | AnatoleZho/Python3 |
"""
Experimental video player using pyglet.
This requires that you have ffmpeg installed
and you might need to tell pyglet where it's located.
"""
# import sys
import pyglet
import arcade
class VideoPlayer(arcade.Window):
def __init__(self) -> None:
super().__init__(800, 600, "Video Player", resizable=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": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answ... | 3 | arcade/experimental/video_player.py | DragonMoffon/arcade |
class ContextStaticAttribute(Attribute,_Attribute):
"""
Indicates that the value of a static field is unique for a particular context.
ContextStaticAttribute()
"""
def __init__(self,*args):
""" x.__init__(...) initializes x; see x.__class__.__doc__ for signaturex.__init__(...) initializes x; see x._... | [
{
"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 | release/stubs.min/System/__init___parts/ContextStaticAttribute.py | htlcnn/ironpython-stubs |
'''
https://www.geeksforgeeks.org/write-a-c-program-to-find-the-maximum-depth-or-height-of-a-tree/
https://practice.geeksforgeeks.org/problems/height-of-binary-tree/1
Height of Binary Tree
Medium Accuracy: 65.76% Submissions: 100k+ Points: 4
Given a binary tree, find its height.
Example 1:
Input:
1
/ \
... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false... | 3 | Competitive Programming/Binary Trees/Height of Binary Tree.py | shreejitverma/GeeksforGeeks |
r"""Integral condition.
This short example demonstrates the implementation of an integral boundary
condition
.. math::
\int_\Gamma \nabla u \cdot \boldsymbol{n} \, \mathrm{d}s = 1
on a part of the boundary of the domain :math:`\Gamma \subset \partial \Omega`
for the Laplace operator. In this example, :math... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (... | 3 | docs/examples/ex05.py | ahhuhtal/scikit-fem |
from operator import attrgetter, methodcaller
def create_getters_list(attributes=None, methods=None):
getters_list = []
if attributes is not None:
getters_list.extend(map(attrgetter, attributes))
if methods is not None:
getters_list.extend(map(methodcaller, methods))
return getters_lis... | [
{
"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 | hashable/tools.py | minmax/hashable |
import requests
from ddipy import constants
class FeedbackClient:
def __init__(self):
pass
@staticmethod
def save_feedback(search_query, satisfied, message, id, user_info):
request_params = {
"searchQuery": search_query,
"satisfied": satisfied,
"messag... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than clas... | 3 | ddipy/feedback_client.py | bedroesb/ddipy |
from django import forms
from django.contrib.auth.models import User
from .models import Profile
class LoginForm(forms.Form):
username = forms.CharField()
password = forms.CharField(widget=forms.PasswordInput)
class UserRegistrationForm(forms.ModelForm):
password = forms.CharField(label='Password', widg... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{... | 3 | django2/bookmarks/account/forms.py | Gozeon/code-collections |
from django.http.request import HttpRequest
from visitors.settings import VISITOR_SESSION_EXPIRY, VISITOR_SESSION_KEY
def stash_visitor_uuid(request: HttpRequest) -> None:
"""Store request visitor data in session."""
request.session[VISITOR_SESSION_KEY] = request.visitor.session_data
if request.user.is_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": true... | 3 | visitors/session.py | qk-i/candidate-test-5d69fbf4 |
class Winch:
compatString = ["teapot"]
motors_winch: dict
def on_enable(self):
"""
Sets up the winch
"""
self.upSpeed = 0
self.winchMotor = self.motors_winch["winchMotor"]
self.logger.info("Lifter Component Created")
def setRaise(self):
"""
... | [
{
"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": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 lines?",
"answer": false
... | 3 | components/Actuators/LowLevel/winch.py | Raptacon/Robot-2022 |
from python_dwd.additionals.functions import check_parameters, retrieve_time_resolution_from_filename,\
retrieve_parameter_from_filename, retrieve_period_type_from_filename, determine_parameters
from python_dwd.enumerations.period_type_enumeration import PeriodType
from python_dwd.enumerations.time_resolution_enume... | [
{
"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 | tests/additionals/test_functions.py | ikamensh/python_dwd |
from __future__ import absolute_import
from __future__ import unicode_literals
from mb.lib.memoize import memoize
class SomeClass:
def __init__(self):
self._x = 0
def _the_test(self, number):
self._x += 1
return number * self._x
@memoize
def TestCache1(self, number):
... | [
{
"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/memoize_test.py | silverbp/master-builder |
import json
import threading
import time
import websocket
from logging import getLogger
class RealtimeAPI(object):
"""
Realtime API (JSON-RPC 2.0 over WebSocket)
https://bf-lightning-api.readme.io/docs/realtime-api
"""
def __init__(self, channel, data_queue, is_daemon=False):
self.logger... | [
{
"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 | py_bitflyer/realtime_api.py | tapioka324/pybf |
'''Tests about the gzippy top-level functions.'''
import unittest
from test import scratch_file
import gzippy
class GzippyTest(unittest.TestCase):
'''Tests about the gzippy top-level functions.'''
def test_open_with_plus(self):
'''Opening with r+ is not allowed.'''
with scratch_file('exam... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true... | 3 | test/test_gzippy.py | seomoz/gzippy |
from datetime import datetime, timedelta, tzinfo
class JST(tzinfo):
def utcoffset(self, dt):
return timedelta(hours=9)
def dst(self, dt):
return timedelta(0)
def tzname(self, dt):
return 'JST'
def time_now():
return datetime.now(JST())
| [
{
"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 | app/modules/commons/timezone.py | hbui-self-hub/emr-deploy-template |
import csv
from osint_sources.tinder import *
from osint_sources.model import *
from osint_sources.google import *
from osint_sources.twitter import *
from osint_sources.facebook import *
from osint_sources.instagram import *
from osint_sources.boe import *
from osint_sources.yandex import *
def tinder(token):
#sta... | [
{
"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 | src/osint_sources/scraper.py | daed5/SpyScrap |
"""Unit tests for the :mod:`networkx.generators.expanders` module.
"""
import networkx as nx
from networkx import adjacency_matrix
from networkx import number_of_nodes
from networkx.generators.expanders import chordal_cycle_graph
from networkx.generators.expanders import margulis_gabber_galil_graph
import pytest
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": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answ... | 3 | networkx/generators/tests/test_expanders.py | Mackyboy12/networkx |
# coding: utf-8
"""
Isilon SDK
Isilon SDK - Language bindings for the OneFS API # noqa: E501
OpenAPI spec version: 5
Contact: sdk@isilon.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import unittest
import isi_sdk_8_1_0
from i... | [
{
"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 | isi_sdk_8_1_0/test/test_license_license_tier_entitlements_exceeded_alert.py | mohitjain97/isilon_sdk_python |
from os import path
import cv2
import vidgear
import time
from ndu_gate_camera.utility.ndu_utility import NDUUtility
try:
from vidgear.gears import CamGear
except ImportError:
if NDUUtility.install_package("vidgear") == 0:
from vidgear.gears import CamGear
from ndu_gate_camera.api.video_source import... | [
{
"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 | ndu_gate_camera/camera/video_sources/youtube_video_source.py | netcadlabs/ndu-gate |
import Queue
class binary_node(object):
def __init__(self, _value):
self.value = _value
self.left = None
self.right = None
'''
Breadth-First search
'''
def breadth_first(_tree):
if not _tree:
return False
result = []
queue = Queue.Queue()
queue.put(_tree)... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inherita... | 3 | binarytree.py | sanofi2104/algorithms |
import RPi.GPIO as GPIO
import time
HIN = 8
LIN = 10
freq = 500
class Motor:
def __init__(self, HIN=HIN, LIN=LIN, freq=freq):
GPIO.setmode(GPIO.BOARD)
GPIO.setup(HIN, GPIO.OUT)
GPIO.setup(LIN, GPIO.OUT)
self.high = GPIO.PWM(HIN, freq)
self.low = GPIO.PWM(LIN, freq... | [
{
"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 | line_follow/motor.py | ryentran/roadster |
from sqlalchemy import (
Column,
String,
ForeignKey,
Float,
Integer,
Boolean
)
from sqlalchemy.orm import relationship
from sqlalchemy.dialects import postgresql
from libs.database import Base, Stateful
class Model(Stateful):
'''Model table'''
__tablename__ = 'models'
... | [
{
"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 | apps/fithm-service/apps/model/models.py | sergio1221/flask-backend |
# 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": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer":... | 3 | aliyun-python-sdk-emr/aliyunsdkemr/request/v20160408/RunExecutionPlanRequest.py | xiaozhao1/aliyun-openapi-python-sdk |
#!/usr/bin/env python3
"""
transforms.py
Implementation of the forward and backward fourier-bessel
transforms (Hankel transform) using the discrete sine transform function via scipy.
"""
import numpy as np
from scipy.fftpack import dst, idst
def discrete_hankel_transform(
r: np.ndarray, k: np.ndarray, fr: np.n... | [
{
"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 | pyrism/Core/Transforms.py | 2AUK/pyrism |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
class Watchdog(object):
KEEP_ALIVE = '\n'
DEVICE = '/dev/watchdog'
# STOP = 'V' in bleaglebone black not works
def __init__(self):
pass
def notify(self, device, msg):
'''
/dev/watchdog is opened and will reboot un... | [
{
"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 | watchdog/usr/bin/watchdog.py | robinsonsantos/beaglebone_watchdog |
from dagster import ScheduleDefinition, job, op
@op(config_schema={"param": str})
def do_something(_):
...
config = {"solids": {"do_something": {"config": {"param": "some_val"}}}}
@job(config=config)
def do_it_all():
do_something()
do_it_all_schedule = ScheduleDefinition(job=do_it_all, cron_schedule="0 ... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"ans... | 3 | examples/docs_snippets/docs_snippets/guides/dagster/graph_job_op/graph_with_config_and_schedule.py | rpatil524/dagster |
# VMware vSphere Python SDK
# Copyright (c) 2008-2014 VMware, 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
#
# ... | [
{
"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/__init__.py | virtdevninja/pyvmomi-ce |
import os.path
import sys
SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__))
def get_include():
return os.path.abspath(os.path.join(SCRIPT_DIR, '..', 'include'))
def print_include():
sys.stdout.write(get_include())
def get_lib():
return os.path.abspath(os.path.join(SCRIPT_DIR, '..', 'lib'))
def p... | [
{
"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 | python/scannerpy/stdlib/build_flags.py | quanhua92/scanner |
from django.db import models
class Subject(models.Model):
name = models.CharField(max_length=256)
def __str__(self):
return self.name
class Tag(models.Model):
name = models.CharField(max_length=256)
subject = models.ForeignKey("Subject", on_delete=models.CASCADE)
def __str__(self):
... | [
{
"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 | unlockededu/worksheets/models.py | toonarmycaptain/website-1 |
from cytoolz.dicttoolz import (
assoc,
)
def construct_formatting_middleware(request_formatters=None,
result_formatters=None,
error_formatters=None):
if request_formatters is None:
request_formatters = {}
if result_formatters ... | [
{
"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 | webu/middleware/formatting.py | happyuc-project/webu.py |
from sys import maxsize
class Group:
def __init__(self, name=None, header=None, footer=None, id=None):
self.name = name
self.header = header
self.footer = footer
self.id = id
def __repr__(self):
return "%s:%s:%s:%s" % (self.id, self.name, self.header,self.footer)
... | [
{
"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 | model/group.py | winsok/pythonlearning |
from cv2 import cv2
import tello
import time
import numpy as np
import math
from enum import Enum
def get_coloser(drone, tvec, rvec, go_distance, idx):
up_down = tvec[idx][0][1] + 5
distance = tvec[idx][0][2] - go_distance
left_right = tvec[idx][0][0]
dst, jaco = cv2.Rodrigues(rvec[idx][0]... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": fal... | 3 | util.py | banne2266/UAV-autopilot-NCTU-2021 |
"""
Geometry and colour info.
@author Li Xiao-Tian
"""
class Point2d():
def __init__(self, x, y):
self.x = x;
self.y = y;
COLOURS = {
'u': '#A9A9A9',
'w': '#F9F9F9',
'r': '#D8251A',
'b': '#0194dd',
'g': '#2EFE2E',
'o': '#F0A226',
'y': '#FFFF00',
}
class Col... | [
{
"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 | utils_geometry_colour.py | x4Cx58x54/rubik-image |
# qubit number=4
# total number=31
import pyquil
from pyquil.api import local_forest_runtime, QVMConnection
from pyquil import Program, get_qc
from pyquil.gates import *
import numpy as np
conn = QVMConnection()
def make_circuit()-> Program:
prog = Program() # circuit begin
prog += H(3) # number=19
prog... | [
{
"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_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"a... | 3 | benchmark/startPyquil1983.py | UCLA-SEAL/QDiff |
def is_dark(wf):
if not wf.alfred_env.get('theme_background'):
return True
rgb = [int(x) for x in wf.alfred_env['theme_background'][5:-6].split(',')]
return (0.299 * rgb[0] + 0.587 * rgb[1] + 0.114 * rgb[2]) / 255 < 0.5
def get_icon(wf, name):
name = '%s-dark' % name if is_dark(wf) else name
return "ico... | [
{
"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 | src/helpers.py | r0x73/alfred-zebra |
#!/usr/bin/env python
from CraftProtocol.Protocol.Packet.BasePacket import BasePacket
from CraftProtocol.Protocol.Packet.PacketDirection import PacketDirection
from CraftProtocol.StreamIO import StreamIO
class KeepAliveServerPacket(BasePacket):
PACKET_ID = 0x0B
PACKET_DIRECTION = PacketDirection.SERVERBOUND
... | [
{
"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 | CraftProtocol/Protocol/v1_12_2/Packet/Play/KeepAliveServerPacket.py | Toranktto/CraftProtocol |
# Copyright (C) 2019 Bloomberg LP
#
# 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 writi... | [
{
"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": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?... | 3 | buildgrid/server/persistence/sql/alembic/versions/bbe7e36a3717_persist_cancellation_of_operations.py | antmicro/buildgrid |
"""empty message
Revision ID: 20479bdf1e77
Revises:
Create Date: 2021-03-15 06:57:55.526838
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '20479bdf1e77'
down_revision = None
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto gene... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": fals... | 3 | src/todoapp/migrations/versions/20479bdf1e77_.py | smorenburg/sql |
"""Utilities for optimization of a model"""
import gpflow
import tensorflow as tf
from tensorflow_probability import bijectors as tfb
from termcolor import colored
def get_kernel_instance(kern, name):
"""
Returns requested kernel instance of a combined kernel
Args:
kern: Combined kernel
n... | [
{
"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 | src/copa_map/model/model_utils.py | MarvinStuede/copa-map |
config = {}
def process_logic_message(message):
type = message.get("type", None)
if type == "initialize":
return __initialize__(message)
elif type == "turn_off":
return __set_state__("off")
elif type == "turn_on":
return __set_state__("on")
elif type == "toggle":
i... | [
{
"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 | wirehome.logical_devices.socket/1.0.0/script.py | pf56/Wirehome.Packages |
import logging
import os
import logstash
LOGLEVEL = os.getenv('LOGLEVEL', 'DEBUG')
LOG_HUMAN_READABLE = bool(os.getenv('LOG_HUMAN_READABLE', False))
LOG_FILE = bool(os.getenv('LOG_FILE', False))
LOG_FILE_NAME = str(os.getenv("LOG_FILE_NAME", "app.log"))
class AppLogger:
def __init__(self, logger_name):
gl... | [
{
"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 | logger.py | TeamWanari/outsource-status-zulip |
from oauthlib.common import UNICODE_ASCII_CHARACTER_SET
from oauthlib.common import generate_client_id as oauthlib_generate_client_id
from .settings import oauth2_settings
class BaseHashGenerator:
"""
All generators should extend this class overriding `.hash()` method.
"""
def hash(self):
ra... | [
{
"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 | oauth2_provider/generators.py | dqfort/django-oauth-toolkit |
import textwrap
from StringIO import StringIO
from pykit.p3json.test import PyTest
class TestIndent(object):
def test_indent(self):
h = [['blorpie'], ['whoops'], [], 'd-shtaeou', 'd-nthiouh', 'i-vhbjkhnth',
{'nifty': 87}, {'field': 'yes', 'morefield': False} ]
expect = textwrap.deden... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": true
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": f... | 3 | p3json/test/test_indent.py | wenbobuaa/pykit |
import pyrfc
connection_info = {
'user': 'demo',
'passwd': 'Welcome',
'ashost': '10.117.19.101',
'saprouter': '/H/203.13.155.17/W/xjkb3d/H/172.19.138.120/H/',
'sysnr': '00',
'lang': 'EN',
'client': '100',
'sysid': 'S16'
}
function_name = u'ZHHDEMO_STRUCT_MOD'
table_name = u'ZHHT_COL2'
... | [
{
"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 | material/issue40a.py | TheGreenToaster/PyRFC |
import os
from discord import Embed
from discord import Intents
from discord.ext import commands
from dotenv import load_dotenv
load_dotenv()
intents = Intents.default()
bot = commands.Bot(command_prefix=os.getenv('PREFIX'))
TOKEN = os.getenv('BOT_TOKEN')
@bot.event
async def on_ready():
print(f'{bot.user} has ... | [
{
"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 | src/bot.py | Shignum/ShiggyBot |
# -*- coding: utf-8 -*-
"""Logging Filters."""
from __future__ import unicode_literals
import logging
# logging levels from https://docs.python.org/2/library/logging.html#logging-levels
LEVELS = {
"CRITICAL": 50,
"ERROR": 40,
"WARNING": 30,
"INFO": 20,
"DEBUG": 10,
"NOTSET": 0,
}
class Exce... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answ... | 3 | h/util/logging_filters.py | julien-cheng/h |
from glad.lang.common.loader import BaseLoader
from glad.lang.d.loader import LOAD_OPENGL_DLL
_GLX_LOADER = \
LOAD_OPENGL_DLL % {'pre':'private', 'init':'open_gl',
'proc':'get_proc', 'terminate':'close_gl'} + '''
bool gladLoadGLX() {
bool status = false;
if(open_gl()) {
sta... | [
{
"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 | glad/lang/d/loader/glx.py | solarane/glad |
import colorpair_generator as color
from cable_colors import get_colorpair_names
"""
This function is implemented to create a reference manual with
color names and its corresponding codes for the wiring personnel
"""
def create_reference_manual():
reference_manual = []
pair_number_start_index = 1
pair_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": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": tru... | 3 | reference_manual_generator.py | clean-code-craft-tcq-1/modular-python-Aruna1396 |
#!/usr/bin/env python3
import logging
from logging.handlers import SysLogHandler
def getLogger():
return logging.getLogger('bedclock')
def initLogger():
logger = getLogger()
logger.setLevel(logging.DEBUG)
# Logs are normally configured here: /etc/rsyslog.d/*
syslog = SysLogHandler(address="/run... | [
{
"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 | bedclock/log.py | Tonio5978/bedclock |
from paddle.optimizer import lr
class WarmupPolyLR(object):
"""
Cosine learning rate decay
lr = 0.05 * (math.cos(epoch * (math.pi / epochs)) + 1)
Args:
lr(float): initial learning rate
step_each_epoch(int): steps each epoch
epochs(int): total training epochs
last_epoch ... | [
{
"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 | utils/lr_scheduler.py | WenmuZhou/DABNet_Paddle |
from abc import ABC, abstractmethod
from domain.errors.failure import Failure
from domain.errors.image_failure import ImageFailure
from domain.repositories.image_repository_abstraction import ImageRepositoryAbstraction
class GetAllGlaucomatousImagesPathsAbstraction(ABC):
@abstractmethod
def __init__(self, re... | [
{
"point_num": 1,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
... | 3 | src/domain/usecases/get_all_glaucomatous_images_paths.py | OzielFilho/ProjetoFinalPdi |
class Solution(object):
# def findKthLargest(self, nums, k):
# """
# :type nums: List[int]
# :type k: int
# :rtype: int
# """
# return sorted(nums, reverse=True)[k - 1]
# def findKthLargest(self, nums, k):
# # build min heap
# heapq.heapify(nums)
... | [
{
"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 | python/215_Kth_Largest_Element_in_an_Array.py | dvlpsh/leetcode-1 |
def decode(file_path):
import qrtools
qr = qrtools.QR()
qr.decode(file_path)
return qr.data
def encode(data, file_path):
import qrtools
qr = qrtools.QR(data.encode("utf-8"))
return qr.encode(filename=file_path)
def greetings(name):
return "Hello "+ 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": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/... | 3 | priv/python/qrcode.py | badubizzle/elixir_python_qrcode |
from fastapi import FastAPI
import logging
from .routers import routers
from .core.config import get_config, get_gunicorn_config
from .core.logger import setup_logger, StubbedGunicornLogger
import gunicorn.app.base
def createSimpleFastapi():
app = FastAPI()
app.include_router(routers.router)
return app
... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than... | 3 | manage-api/server/main.py | lisy09/spark-dev-box |
"""Logging feature to add information about a socket"""
from __future__ import absolute_import
import socket as _socket
# XXX these need robustification for non-TCP sockets, etc.
def socket(self, s):
"""Adds the following fields:
:ip_addr: numeric IP address
:port: port number
:host: pee... | [
{
"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 | twiggy/features/socket.py | tirkarthi/twiggy |
import time
from datetime import datetime
from . import utils
# Thanks to Dan Jacob and Sean Vieira for making the following snippet
# available at http://flask.pocoo.org/snippets/33/
@utils.app_template_filter('humanize')
def humanize_time(dt, past_='ago', future_='from now', default='just now'):
"""
Return... | [
{
"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 | app/utils/filters.py | ludolatin/ludolatin |
#-------------------------------------------------------------------------------
#
# Python GUI - Scrollable objects mixin - Cocoa
#
#-------------------------------------------------------------------------------
from GUI import export
from GUI.GScrollableBases import ScrollableBase as GScrollableBase
class Scrolla... | [
{
"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 | GUI/Cocoa/ScrollableBase.py | gcewing/PyGUI |
# vim: set ts=4 sw=4 et: coding=UTF-8
from .rpmsection import Section
class RpmCheck(Section):
"""
A class providing methods for %check section cleaning.
Replace various troublemakers in check phase.
"""
def add(self, line: str) -> None:
line = self._complete_cleanup(line)
# 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": "all_params_annotated",
"question": "Does every function parameter in this file have a ty... | 3 | spec_cleaner/rpmcheck.py | dcermak/spec-cleaner |
from typing import Union, List
class Entry:
def __init__(self, data: str) -> None:
self.name = ''
self.folder = ''
self.username = ''
fields = data.split('\t')
self.name = fields[1]
self.folder = fields[0]
self.length = len(self.name) + len(self.folder) + ... | [
{
"point_num": 1,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
... | 3 | src/rofi_rbw/entry.py | fdw/rofi-rbw |
from gui_version import App
from tests.gui.app_testing_bed import FracDimTestingBed
from tests.gui.common import check_report
def test_fracdim_wo_windows(qtbot):
window = App()
qtbot.addWidget(window)
test_app = FracDimTestingBed(qtbot=qtbot, window=window)
qtbot.waitForWindowShown(window)
tes... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
... | 3 | tests/gui/fracdim_isolated_test_e2e.py | demid5111/approximate-enthropy |
from violas_client.canoser.base import Base
class BoolT(Base):
@classmethod
def encode(self, value):
if value:
return b'\1'
else:
return b'\0'
@classmethod
def decode_bytes(self, value):
if value == b'\0':
return False
e... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inherita... | 3 | violas_client/canoser/bool_t.py | violas-core/violas-client |
import unittest
from zserio.hashcode import calc_hashcode, HASH_SEED
class HashCodeTest(unittest.TestCase):
def test_calc_hashcode(self):
array1 = [1, 2, 3, 4]
array2 = [1, 2, 3, 3]
array3 = [1, 2, 3, 4]
self.assertNotEqual(self._hashcode(array1), self._hashcode(array2))
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": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
... | 3 | compiler/extensions/python/runtime/tests/test_hashcode.py | dkBrazz/zserio |
# coding: utf-8
"""
App Center Client
Microsoft Visual Studio App Center API # noqa: E501
OpenAPI spec version: preview
Contact: benedetto.abbenanti@gmail.com
Project Repository: https://github.com/b3nab/appcenter-sdks
"""
from __future__ import absolute_import
import unittest
import appcente... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer... | 3 | sdks/python/test/test_DistributionGroupAppsDeleteRequest.py | Brantone/appcenter-sdks |
from DealData.FileOperation import FileOperation
import numpy as np
def test():
a=np.random.uniform(0,1,size=10)
b = np.random.uniform(0, 1, size=10)
print(a)
print(b)
print(np.corrcoef(a,b))
print(cal_corrcoef(a,b))
pass
def cal_corrcoef(X,Y):
# 均值
Xmean = np.mean(X)
Ymean = np... | [
{
"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 | DealData/__init__.py | yaoMYZ/ROP |
"""empty message
Revision ID: 2b46478eeb50
Revises: d7fc2abf989
Create Date: 2014-08-10 23:38:50.200231
"""
# revision identifiers, used by Alembic.
revision = '2b46478eeb50'
down_revision = 'd7fc2abf989'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - pl... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"ans... | 3 | migrations/versions/2b46478eeb50_.py | feasiblereplica/kindlebox |
import uuid
from django.db import models
from django.utils.translation import gettext_lazy as _
class Rating(models.Model):
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False,
help_text=_("ID único seguindo o padrão UUID4."))
note = models.ForeignK... | [
{
"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 | app/core/models/rating.py | Lontras-e-Preguicas/cnotes-server |
# -*- Python -*-
#
#
# Jiao Lin <jiao.lin@gmail.com>
#
from . import mcvine, click
@mcvine.group()
def bash():
return
@bash.command()
def complete():
"Instructions for bash complete support"
print("""
To enable bash auto complete for mcvine command, run
$ eval "$(_MCVINE_COMPLETE=source mcvine)"
""")
... | [
{
"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 | packages/mcvine/python/mcvine/cli/bash.py | mcvine/mcvine |
# Copyright (c) 2015 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | [
{
"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 | oslo_ovsdb_frontend/impl/native/helpers.py | salv-orlando/oslo_ovsdb_frontend |
from random import shuffle
class Deck(object):
CARD_VALUES = ['A', '2', '3', '4', '5', '6', '7', '8', '9', '10', 'J', 'Q', 'K']
CARD_SUITS = ['H', 'D', 'S', 'C']
@staticmethod
def get_shuffled_deck():
deck = Deck()
deck.shuffle()
return deck
def __init__(self):
se... | [
{
"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 | src/cards.py | tylernickr/cribbage |
###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013-2014, John McNamara, jmcnamara@cpan.org
#
import unittest
from ...compatibility import StringIO
from ...styles import Styles
from ...format import Format
class TestWriteFonts(unittest.Tes... | [
{
"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 | xlsxwriter/test/styles/test_write_fonts.py | sontek/XlsxWriter |
import komand
import json
import requests
from .schema import ShutdownDropletInput, ShutdownDropletOutput
class ShutdownDroplet(komand.Action):
def __init__(self):
super(self.__class__, self).__init__(
name="shutdown_droplet",
description="Shuts down the droplet from a specified im... | [
{
"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 | plugins/digitalocean/komand_digitalocean/actions/shutdown_droplet/action.py | lukaszlaszuk/insightconnect-plugins |
#!/usr/bin/env python
"""
Example code for properties
NOTE: if your getters and setters are this simple: don't do this!
"""
class C:
def __init__(self):
self._x = None
@property
def x(self):
print("in getter")
return self._x
@x.setter
def x(self, value):
print("i... | [
{
"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 | Examples/Session08/properties_example.py | Sharmila8/intropython2016 |
from urllib.request import FancyURLopener
from bs4 import BeautifulSoup
from random import choice
import csv
from time import sleep
from urllib.parse import quote,unquote
import json
user_agents = [
'Mozilla/5.0 (Windows; U; Windows NT 5.1; it; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11',
'Opera/9.25 (Windows NT 5.... | [
{
"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 | fetch_cast_html.py | nmaswood/tv_scraping |
import pandas as pd
from util.form import form
from numpy import nan
from util.KST import kst_time_for_file
class table():
def __init__(self):
self.DataFrame = pd.DataFrame(columns=list(form.keys()))
self.Chart = '''
| 지역 | 확진자 | 격리자 | 사망 | 의심환자 | 검사중 | 결과음성 | 자가격리자 | 감시중 | 감시해제 |... | [
{
"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": false... | 3 | util/table.py | jamakers19/SARS2-Stat-KR |
from __future__ import unicode_literals
import logging
from dvc.exceptions import CheckoutErrorSuggestGit, CheckoutError
from dvc.progress import Tqdm
logger = logging.getLogger(__name__)
def _cleanup_unused_links(self, all_stages):
used = [
out.fspath
for stage in all_stages
for out i... | [
{
"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 | dvc/repo/checkout.py | GeorgeSabu-mec/dvc |
import sys
from unittest import mock
from aiozipkin import utils
@mock.patch('aiozipkin.utils.binascii.hexlify', autospec=True)
def test_generate_random_64bit_string(rand):
rand.return_value = b'17133d482ba4f605'
random_string = utils.generate_random_64bit_string()
assert random_string == '17133d482ba4f6... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answ... | 3 | tests/test_utils.py | deejay1/aiozipkin |
class BinaryTreeNode:
def __init__(self, val):
self.val = val
self.left = None
self.right = None
def merge_binary_trees(t1, t2):
if t1 is None and t2 is None:
return None
if t1 is not None and t2 is None:
return t1
if t2 is not None and t1 is None:
retu... | [
{
"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 | algorithms/binary_tree/merge_binary_trees.py | emirot/algo-loco.blog |
#!/usr/bin/env python3
import os
import socketserver
from http.server import SimpleHTTPRequestHandler
class pyodideHttpServer(SimpleHTTPRequestHandler):
def __init__(self, request, client_address, server):
self.extensions_map.update(
{
".wasm": "application/wasm",
}... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/... | 3 | bin/test-server.py | phorward/flare |
import random
from deepspeed.utils import logger
from .base_tuner import BaseTuner
class RandomTuner(BaseTuner):
"""Explore the search space in random order"""
def __init__(self, exps: list, resource_manager, metric):
super().__init__(exps, resource_manager, metric)
def next_batch(self, sample_... | [
{
"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 | deepspeed/autotuning/tuner/index_based_tuner.py | ganik/DeepSpeed |
from typing import Dict
from typing import List
from botocore.paginate import Paginator
class ListDeploymentJobs(Paginator):
def paginate(self, filters: List = None, PaginationConfig: Dict = None) -> Dict:
pass
class ListFleets(Paginator):
def paginate(self, filters: List = None, PaginationConfig: D... | [
{
"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 | boto3_type_annotations/boto3_type_annotations/robomaker/paginator.py | cowboygneox/boto3_type_annotations |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_cli
----------------------------------
Tests for `fip` module.
"""
import pytest
from click.testing import CliRunner
from fip import cli
@pytest.fixture
def response():
"""Sample pytest fixture.
See more at: http://doc.pytest.org/en/latest/fixture.html... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
... | 3 | tests/test_cli.py | mattberjon/fip_music |
#!/usr/bin/env python
from PyQt5 import QtCore, QtWidgets
import pyqtgraph as pg
import numpy as np
class MyWidget(pg.GraphicsWindow):
def __init__(self, parent=None):
super().__init__(parent=parent)
self.mainLayout = QtWidgets.QVBoxLayout()
self.setLayout(self.mainLayout)
self... | [
{
"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 | examplePyqtgraph.py | raiv-toulouse/RPLidar |
from toil.common import Toil
from toil.job import Job
class HelloWorld(Job):
def __init__(self, message):
Job.__init__(self, memory="2G", cores=2, disk="3G")
self.message = message
def run(self, fileStore):
return "Hello, world!, here's a message: %s" % self.message
if __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_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
... | 3 | src/toil/test/docs/scripts/tutorial_invokeworkflow.py | thiagogenez/toil |
# -*- coding: utf-8 -*-
from model.contact_m import Contact
# загрузка данных из отдельного модуля
def test_add_user(app, data_contacts):
contact = data_contacts
old_users = app.contact.get_contacts_list()
app.contact.create_new_user(contact)
assert len(old_users) + 1 == app.contact.count()
new_us... | [
{
"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 | tests/test_add_contact.py | eugemak/python_for_testers_training |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for `rekon` package."""
import unittest
from rekon import rekon
class TestRekon(unittest.TestCase):
"""Tests for `rekon` package."""
def setUp(self):
"""setup test fixtures, if any."""
assert rekon.__name__ == 'rekon.rekon'
def t... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": true
}... | 3 | tests/test_rekon.py | rjdscott/rekon |
import requests
from lib2 import upload
from setting import server
import time
def stickerSave(user, name, url):
save=requests.get(f"{server}/uploadSticker", params={"pengguna":user[:-5], "nama":name, "konten":upload(url).get("id")}).json()
print(save)
if save.get("status") == False and save.get("tersimpan"... | [
{
"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 | lib2/Sticker.py | Dularazero/chappie-bot |
'''
File name: common/__init__.py
Author: Frank Zalkow
Date: 2020
License: MIT
This file is part of the following repository:
https://github.com/fzalkow/music_indexing
'''
import numpy as np
import librosa
CHROMA_DIMS = 12
def compute_features(fn_audio):
Fs = 22050
H = 2205
smooth = 41
downsample ... | [
{
"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 | common/__init__.py | fzalkow/music_indexing |
from django.http import Http404
from django.shortcuts import render
from rest_framework import status
from rest_framework.response import Response
from rest_framework.generics import ListCreateAPIView, RetrieveUpdateDestroyAPIView
from rest_framework.views import APIView
from time_entries.models import TimeEntry
from t... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"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 | django/tasks/views.py | trckr/trckr-backend |
from messagebird.base import Base
class Links(Base):
def __init__(self):
self.first = None
self.previous = None
self.next = None
self.last = None
class BaseList(Base):
def __init__(self, item_type):
"""When setting items, they are instantiated as objects of type ite... | [
{
"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_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false... | 3 | messagebird/base_list.py | victormb84/python-rest-api |
# coding:utf8
from fastweb.accesspoint import ioloop
from fastweb.component.rpc.tft import AsynTftRpc, SyncTftRpc
sync_setting = {'host': 'localhost', 'port': 7777, 'thrift_module': 'fastweb.test.fastweb_thrift_sync.HelloService.HelloService'}
asyn_setting = {'host': 'localhost', 'port': 7777, 'thrift_module': 'fastw... | [
{
"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 | fastweb/test/test_thrift.py | BSlience/fastweb |
import re
import mistune
from fluffy.app import app
from fluffy.component.highlighting import guess_lexer
from fluffy.component.highlighting import PygmentsHighlighter
class HtmlCommentsInlineLexerMixin:
"""Strip HTML comments inside lines."""
def enable_html_comments(self):
self.rules.html_comment... | [
{
"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_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?"... | 3 | fluffy/component/markdown.py | fawaf/fluffy |
import frappe, re
from renovation_service_provider_manager import invoke_mediator
@frappe.whitelist(allow_guest=True)
def get_service_provider_client_id(provider):
k = f"client_id_{re.sub('[^0-9a-zA-Z]+', '_', provider.lower())}"
client_id = frappe.cache().get_value(k)
if client_id:
return client_id
clien... | [
{
"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 | renovation_service_provider_manager/api/__init__.py | leam-tech/renovation_service_provider_manager |
from django.contrib.sites.shortcuts import get_current_site
from django.template.loader import get_template
from ...settings import STATIC_URL
from ...order.models import DeliveryGroup, Order
INVOICE_TEMPLATE = 'dashboard/order/pdf/invoice.html'
PACKING_SLIP_TEMPLATE = 'dashboard/order/pdf/packing_slip.html'
def g... | [
{
"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 | saleor/dashboard/order/utils.py | jslegend/python3-django-saleor |
import unittest
from list.palindrome import is_palindrome_1, is_palindrome_2
class TestIsPalindrome(unittest.TestCase):
def test_is_palindrome_1(self):
self.assertTrue(is_palindrome_1('abcdcba'))
self.assertTrue(is_palindrome_1('abcddcba'))
self.assertFalse(is_palindrome_1('acddcba'))
... | [
{
"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 | test/test_palindrome.py | sungheeyun/PythonLectures |
def moveDownRight(shift):
hero.moveXY(hero.pos.x + shift, hero.pos.y - shift)
def moveUpRight(shift):
hero.moveXY(hero.pos.x + shift, hero.pos.y + shift)
hunter = hero.findFriends()[0]
route = hunter.route
routeIndex = 0
while routeIndex < route.length:
direction = route[routeIndex]
r... | [
{
"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 | projects/code_combat/7_Sarven_Desert/264-Hunter_Valley/hunter_valley.py | only-romano/junkyard |
import pygame
from pygame.locals import *
from OpenGL.GL import *
from OpenGL.GLU import *
from sensor import Sensor
from madgwick import Madgwick
import numpy as np
import math
vertices = (
(1, -1, -1),
(1, 1, -1),
(-1, 1, -1),
(-1, -1, -1),
(1, -1, 1),
(1, 1, 1),
(-1, -1, 1),
(-1, 1, ... | [
{
"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 | main.py | jsgilberto/imu |
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from py_trace_event import trace_event
class NetworkController(object):
"""Control network settings and servers to simulate the Web.
Network changes i... | [
{
"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 | adb/windows/platform-tools/systrace/catapult/telemetry/telemetry/core/network_controller.py | llaske/sugarizer-deployment-tool-desktop |
import typing as t
__all__ = ("BaseObject", "SENTINEL")
SENTINEL = object()
class BaseObject:
"""
A base object for all the models in this directory. (except [DBStats](../dbstats/))
Note:
This class is not meant to be instantiated directly.
Attributes:
data (t.Mapping[str, t.Any]):... | [
{
"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 | azaka/objects/baseobject.py | mooncell07/Azaka |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.