source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
# -*- coding: utf-8 -*-
"""
demeter web page
name:work.py
author:rabin
"""
from .__load__ import *
class index_path(Load):
#权限控制,需要在Load类中自行做判断
#@Web.auth
#异步加载,增加执行效率
@Web.setting
def get(self):
self.view("index.html")
# 测试数据库 查询 /main/select
class select_path(Load):
@Web.settin... | [
{
"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 | demos/helloworld/front/page/main.py | shemic/demeter |
#!/usr/bin/env python2.7
# lt3.py -- HiLink network mode switcher
#
# Copyright (C) 2016 Damian Ziemba
#
# This software may be modified and distributed under the terms
# of the MIT license. See the LICENSE file for details.
#
import argparse
import BeautifulSoup
import requests
BASE_URL = "http://192.168.8.1/api/"... | [
{
"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 | lt3.py | nazriel/lt3 |
from .base import GenericDecorator
class use_self_property(GenericDecorator):
"""
for one argument class functions.
if non-self argument is missing, use a property from self
e.g.
@use_self_property("foobar")
def bar(self,foo):
print foo
if bar doesn't recieve foo... | [
{
"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_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},... | 3 | useful_decorator/property.py | ajparsons/useful-decorator |
import os
CUR_DIR = os.path.dirname(os.path.realpath(__file__))
PARENT_DIR = os.path.abspath(os.path.join(CUR_DIR, os.pardir))
DATA_DIR = os.path.join(PARENT_DIR, "input")
IMAGE_DIR = os.path.join(DATA_DIR, "image")
def predict_label(json_data, filename):
print(json_data)
drivename, fname = filename.split("/")
fna... | [
{
"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 | app/predict_label.py | hasanari/sane |
from csv import reader
from datetime import datetime
from sys import argv
import csv
# 1. 返回一天中的时间段,0~6*24-1
# 2. 返回周几的feature 1~7
# 3. 返回月份的feature 1~12
# 4. 返回周数 1~52
# 第一个参数为输入文件
# 第二个参数为输出文件
def normalize_time_stamp(x):
return 1 - ((143 - x) / 143)
def time_zone(h, m):
return h * 6 + m // 10
filename... | [
{
"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 | time_cluster/tc.py | SKZhao97/Data_Analysis_and_Visualization_Final_Project |
from typing import Tuple, Optional
import pandas as pd
import xarray as xr
from sklearn.preprocessing import StandardScaler
LEVELS = ["time", "lat", "lon"]
# @task # get reference cube
def get_reference_cube(data: xr.DataArray) -> pd.DataFrame:
"""Wrapper Function to get reference cube"""
return data.to_data... | [
{
"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 | src/features/preprocessing.py | jejjohnson/2019_rbig_rs |
from rest_framework import viewsets
from . import models
from . import serializers
from rest_framework import generics
class IdeaViewset(viewsets.ModelViewSet):
queryset = models.Idea.objects.all()
serializer_class = serializers.IdeaSerializer
class BlogViewset(viewsets.ModelViewSet):
queryset = models.... | [
{
"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 | backend/idea/viewset.py | www-norma-dev/idea-box-backend |
from django.db import models
from django.utils.translation import gettext_lazy as _
from taggit.managers import TaggableManager
class Article(models.Model):
title = models.CharField(
max_length=255
)
author = models.CharField(
max_length=255,
blank=True,
help_text="Suggesti... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
}... | 3 | tests/app/models.py | dldevinc/django-suggestions |
from dhooks import Webhook, Embed
import datetime
import os
def sendDiscordMessage(successOrFailure, timeTaken, totalClasses=0):
hook = Webhook(os.environ.get("DISC_HOOK"))
if successOrFailure:
now = datetime.datetime.now()
#hook.send("[" + str(now) + "] Successfully updated database wi... | [
{
"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 | Schedule Scraper/discordSender.py | scsewbh/Manhattan-College-Scheduler |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import simplejson as json
from alipay.aop.api.response.AlipayResponse import AlipayResponse
class AlipayDataDataexchangeDtmorseSyncResponse(AlipayResponse):
def __init__(self):
super(AlipayDataDataexchangeDtmorseSyncResponse, self).__init__()
self._r... | [
{
"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 | alipay/aop/api/response/AlipayDataDataexchangeDtmorseSyncResponse.py | articuly/alipay-sdk-python-all |
"""add ondelete set null to question_repyl, tabled_committee_report and call_for_comment tables
Revision ID: 122a38429a58
Revises: 29cf770ce19b
Create Date: 2015-02-10 10:13:58.437446
"""
# revision identifiers, used by Alembic.
revision = '122a38429a58'
down_revision = '29cf770ce19b'
branch_labels = None
depends_on... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": fals... | 3 | migrations/versions/122a38429a58_add_ondelete_set_null_to_question_repyl_.py | havanhuy1997/pmg-cms-2 |
from abc import ABCMeta, abstractmethod
class Strategy(object):
"""Strategy is an abstract base class providing an interface for
all subsequent (inherited) trading strategies.
The goal of a (derived) Strategy object is to output a list of signals,
which has the form of a time series indexed pandas Da... | [
{
"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 | backtesting/backtester/BackTest/backtest.py | SankaW/teamfx |
from Instrucciones.TablaSimbolos.Instruccion import Instruccion
from Instrucciones.TablaSimbolos.Simbolo import Simbolo
from datetime import datetime
class CurrentTime(Instruccion):
def __init__(self, strGram, linea, columna):
Instruccion.__init__(self,None,linea,columna,strGram)
def ejecuta... | [
{
"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 | parser/fase2/team08/Tytus_SQLPARSER_G8/Instrucciones/DateTimeTypes/CurrentTime.py | Gabriel-15/tytus |
import markdown
class EscapeHtml(markdown.Extension):
def extendMarkdown(self, md):
md.preprocessors.deregister('html_block')
md.inlinePatterns.deregister('html')
def makeExtension(*args, **kwargs):
return EscapeHtml(*args, **kwargs)
if __name__ == "__main__":
import doctest
doct... | [
{
"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 | virt/lib/python3.7/site-packages/martor/extensions/escape_html.py | Sergiogd112/notesapp |
import pandas as pd
import numpy as np
import sys
import matplotlib.pyplot as plt
import math
import Mesh_node
class Dis(object):
def __init__(self):
self.dis
@classmethod
def cal_dis(self, node1, node2):
self.dis = math.sqrt((node1.x_pos-node2.x_pos)**2+(node1.y_pos-node2.y_pos)**2)
return s... | [
{
"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 | Code/graph/node_distance.py | xiaoyanLi629/CSE_812 |
from sparknlp.annotator import *
class Roberta:
@staticmethod
def get_default_model():
return RoBertaEmbeddings.pretrained() \
.setInputCols("sentence", "token") \
.setOutputCol("roberta")
@staticmethod
def get_pretrained_model(name, language):
return RoBertaEmbeddings.... | [
{
"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 | nlu/components/embeddings/roberta/roberta.py | milyiyo/nlu |
#!/usr/bin/env python3
# Форматтер, приводящий fluent-файлы (.ftl) в соответствие стайлгайду
# path - путь к папке, содержащий форматируемые файлы. Для форматирования всего проекта, необходимо заменить значение на root_dir_path
import typing
from file import FluentFile
from project import Project
from fluent.syntax i... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false... | 3 | Tools/ss14_ru/fluentformatter.py | fineks/space-station-14 |
import torch
import torch.nn as nn
import torch.nn.functional as F
class Mine_estimator(nn.Module):
def __init__(self, input_dim=2048, hidden_dim=512):
super(Mine_estimator, self).__init__()
self.mine_model = Mine(input_dim, hidden_dim)
def forward(self, X, Y):
Y_shffle = Y[torch.randp... | [
{
"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 | code/deep/adarnn/base/loss/mutual_info.py | jiaruonan/transferlearning |
import sys
def isPython2():
version = sys.version
return version.startswith('2.')
import junit_xml
class Testcase (junit_xml.TestCase):
Count = 0
def __init__(self, description):
self.tcId = Testcase.Count
Testcase.Count += 1
self.description = description
... | [
{
"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 | junit-xml-demo.py | lehoang318/junit-xml-demo |
from hc.api.models import Channel, Check
from hc.test import BaseTestCase
class ApiAdminTestCase(BaseTestCase):
def setUp(self):
super(ApiAdminTestCase, self).setUp()
self.check = Check.objects.create(user=self.alice, tags="foo bar")
# Set Alice to be staff and superuser
self.ali... | [
{
"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 | hc/api/tests/test_admin.py | andela/hc-aces-kla- |
from textattack.shared.utils import default_class_repr
from textattack.constraints.pre_transformation import PreTransformationConstraint
from textattack.shared.validators import transformation_consists_of_word_swaps
import nltk
class StopwordModification(PreTransformationConstraint):
"""
A constraint disallow... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
... | 3 | textattack/constraints/pre_transformation/stopword_modification.py | fighting41love/TextAttack |
from enemies import Enemy
from player import Player
def setup():
global enemy, player
size(420, 420)
this.surface.setTitle("Rectangle Collision Detection")
enemy = Enemy(width/2 - 64, height/2 - 32)
player = Player(20, 20)
def draw():
global enemy, player
background("#95ee0f5")
if rect... | [
{
"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 | sketches/colldectrect/colldectrect.pyde | kantel/processingpy |
import torch
from facenet_pytorch import MTCNN, InceptionResnetV1
from torchvision import transforms
from Configs import Global_Config
IMAGE_SIZE = 220
mtcnn = MTCNN(
image_size=IMAGE_SIZE, margin=0, min_face_size=20,
thresholds=[0.6, 0.7, 0.7], factor=0.709, post_process=True,
device=Global_Config.device
... | [
{
"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 | Models/Encoders/ID_Encoder.py | YuGong123/ID-disentanglement-Pytorch |
from LinkedList import *
class Solution(LinkedList):
def reverse(self, head):
pre = None
while head:
next = head.next
head.next = pre
pre = head
head = next
return pre
def reorderList(self, head: ListNode) -> None:
... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
... | 3 | solution/143. reorder-list.py | sundaycat/Leetcode-Practice |
"""
Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy of this
software and associated documentation files (the "Software"), to deal in the Software
without restriction, including without limitation the rights to ... | [
{
"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": true
},... | 3 | test/rules/outputs/test_name.py | j0lly/cfn-python-lint |
import numpy as np
import gmpy2
import queue
# Code partially based on the great solution by *godarderik*
# https://www.reddit.com/r/adventofcode/comments/5i1q0h/2016_day_13_solutions/
def checkEmptySpace(node):
x, y = int(node[0]), int(node[1])
num1Bits = gmpy2.popcount(x*x + 3*x + 2*x*y + y + y*y + magicN... | [
{
"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 | 2016/day13-2.py | alvaropp/AdventOfCode2017 |
from django.dispatch.dispatcher import Signal
from location.models import LocationSnapshot
location_updated = Signal(providing_args=['user', 'from_', 'to'])
location_changed = Signal(providing_args=['user', 'from_', 'to'])
class watch_location(object):
def __init__(self, user):
self.user = user
de... | [
{
"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_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": fals... | 3 | env/lib/python3.8/site-packages/location/signals.py | angels101/practice-django-framework-api- |
#!/usr/bin/env python
"""
USAGE:
apache_log_parser_split.py some_log_file
This script takes one command line argument: the name of a log file
to parse. It then parses the log file and generates a report which
associates remote hosts with number of bytes transferred to them.
"""
import sys
def dictify_logline(line... | [
{
"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 | 3_text/apache_log_parser_split.py | lluxury/P_U_S_A |
from colosseum.constants import AUTO, INLINE
from colosseum.declaration import CSS
from ...utils import LayoutTestCase, TestNode
class WidthTests(LayoutTestCase):
def test_no_horizontal_properties(self):
node = TestNode(
name='span',
style=CSS(display=INLINE)
)
nod... | [
{
"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 | tests/engine/inline_layout/test_inline_non_replaced.py | jonboland/colosseum |
from runsuite import *
class DriverTestMysql(DriverTestBase):
def test_invalid_db(self):
with self.assertRaises((AuthenticationError, IOError)):
self.connect(database = self.options['_database'])
def test_invalid_user(self):
with self.assertRaises(AuthenticationError):
self.connect(user = self.options['_... | [
{
"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 | doctest/drivers/mysql.py | orbnauticus/silk |
import time
from zmqpc import Events
def simple_recv(topic='test_topic', data=None):
pub = Events()
sub = Events()
# set up subscriber connection
def fn(data):
fn.data = data
fn.data = None
time.sleep(0.1)
sub.connect(fn, topic)
time.sleep(0.1)
pub.publish(topic, data)
... | [
{
"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": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (exc... | 3 | tests/test_events_pubsub.py | aczh/zmqpc |
import os
from conans import ConanFile, CMake, tools
class FhSimTestConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
generators = "cmake_paths", "cmake_find_package"
def build(self):
cmake = self._configure_cmake()
cmake.configure()
cmake.build()
def impor... | [
{
"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 | test_package/conanfile.py | HerAmu/conan-qualisyssdk |
import sys
COLUMN_NAMES = ["a", "b", "c", "d", "e", "f", "g", "h"]
PIECE_ORDER = ["K", "Q", "R", "B", "N", "P"]
def compare(o):
c1 = PIECE_ORDER.index(o[0].upper()) * 100
if o[0].isupper():
c2 = o[2] * 10
else:
c2 = (8 - o[2]) * 10
c3 = COLUMN_NAMES.index(o[1])
return c1 + c2 + c3... | [
{
"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 | python/helpme.py | rystrauss/kattis-solutions |
#
# Copyright 2005-2018 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
#
# In applying this licence, ECMWF does not waive the privileges and immunities
# granted to it by virtue of its status as an intergovern... | [
{
"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/python/grib_set_missing.py | onyb/eccodes |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: v1.12.4
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import 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_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": ... | 3 | kubernetes_asyncio/test/test_v1_resource_field_selector.py | hubo1016/kubernetes_asyncio |
import numpy as np
import matplotlib
def to_hsv(numb):
hue = np.interp(numb, [0, 1024], [0, 1])
rgb = matplotlib.colors.hsv_to_rgb(np.array([hue, 0.5, 1]))
bgr = rgb[:, :, ::-1] # RGB -> BGR
return np.array(bgr)
def hsv_depth(depth):
depth = to_hsv(depth)
return depth
def pretty_depth(depth)... | [
{
"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 | python/frame_convert2.py | vinzdef/rorrim |
handle = '20141103\ All\ IRD'
def get_header(n_nodes):
header = '\
#!/bin/sh \n\
#$ -S /bin/sh \n\
#$ -cwd \n\
#$ -V\n\
#$ -m e\n\
#$ -M ericmjl@mit.edu \n\
#$ -pe whole_nodes {0}\n\
#$ -l mem_free=2G\n\
#############################################\n\n'.format(n_nodes)
return header
import os
import pickle as pkl... | [
{
"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 | source_pair_manual_sh.py | ericmjl/influenza-reassortment |
# -*- coding: utf-8 -*-
import pkg_resources
import platform
API_YOUTU_END_POINT = 'http://api.youtu.qq.com/'
API_TENCENTYUN_END_POINT = 'https://youtu.api.qcloud.com/'
API_YOUTU_VIP_END_POINT = 'https://vip-api.youtu.qq.com/'
APPID = 'xxx'
SECRET_ID = 'xxx'
SECRET_KEY = 'xx'
USER_ID = 'xx'
_config = {
'end_poin... | [
{
"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 | TencentYoutuyun/conf.py | walle13/Face_recognition |
import time
import numpy as np
from compute_overlap import compute_overlap
def compute_overlap_np(a: np.array, b: np.array) -> np.array:
"""
Args
a: (N, 4) ndarray of float [xmin, ymin, xmax, ymax]
b: (K, 4) ndarray of float [xmin, ymin, xmax, ymax]
Returns
overlaps: (N, K) ndarra... | [
{
"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 | cv-competition-1/pytorch_baseline/compute_overlaps_np.py | ipovalyaev/events |
import pytest
import numpy as np
from ebbef2p.structure import Structure
L = 2
E = 1
I = 1
def test_center_load():
P = 100
M_max = P * L / 4 # maximum moment
S_max = P/2 # max shearing force
w_max = -P * L ** 3 / (48 * E * I) # max displacement
tolerance = 1e-6 #set a tolerance of 0.00... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"ans... | 3 | tests/test_simple supported_beam.py | bteodoru/ebbef2p-python |
from .dispatch import Event
from .const import EVENT_TYPES as ETYPES
import re
class MessageEvent(Event):
type = ETYPES.MSG
@property
def text(self):
return self._get('text')
@property
def user(self):
return self._get('user')
@property
def channel(self):
return self._get('channel')
class CommandEvent(... | [
{
"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 | gygax/gygax/bot/events.py | tmacro/hitman |
class Solvers_Class():
def __init__(self):
pass
def ProperDistanceTabulate(self, Input_Param, z_max):
from Distance_Solver import Proper_Distance_Tabulate
Proper_Distance_Tabulate(Input_Param, z_max)
def LxTxSolver(self, Halos):
from LxTx_Solver import LxTx_Solver
... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/c... | 3 | source/Objects/XTRA_Solvers_Class.py | afarahi/XTRA |
import datetime
from django.utils import timezone
from ..utils import get_current_fiscal_year, get_fiscal_year_range
class TestUtils:
def test_get_current_fiscal_year(self):
now = timezone.now()
fiscal_year_end = timezone.make_aware(datetime.datetime(now.year, 6, 30))
current_fiscal_yea... | [
{
"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 | contratospr/contracts/tests/test_utils.py | jycordero/contratospr-api |
from aws_service_reserver.rds_helper import RdsHelper
from aws_service_reserver.reservable import Reservable
OFFERING_ID_FLAG = '--reserved-db-instances-offering-id'
INSTANCE_COUNT_FLAG = '--db-instance-count'
class RdsReservable(Reservable):
def format_cli_command(self, instance_count_string, offering_id_strin... | [
{
"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 | aws_service_reserver/rdsreservable.py | sean0/reservo |
from flask import Flask
from flask_restful import Api
from flask_sqlalchemy import SQLAlchemy
from flask_migrate import Migrate
from flask_session import Session
from datetime import timedelta
app = Flask(__name__)
###################### for testing #########################
@app.route('/')
def hello_world():
... | [
{
"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 | back/popo/__init__.py | supercilium/popoeshnick |
# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | [
{
"point_num": 1,
"id": "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 | src/appengine/handlers/testcase_detail/mark_fixed.py | urbanenomad/clusterfuzz |
"""Test util methods."""
from unittest.mock import MagicMock, patch
import pytest
from openpeerpower.components.recorder import util
from openpeerpower.components.recorder.const import DATA_INSTANCE
from tests.common import get_test_open_peer_power, init_recorder_component
@pytest.fixture
def opp_recorder():
"... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written... | 3 | tests/components/recorder/test_util.py | pcaston/Open-Peer-Power |
from django.db import models
# Create your models here.
class Books(models.Model):
name = models.CharField(max_length=255, blank=False, unique=True)
author = models.CharField(max_length=255, blank=False)
copies = models.IntegerField(blank=False, default=1)
status = models.BooleanField(blank=False, def... | [
{
"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 | lend/models.py | harshitanand/Libmgmt |
class InvalidBooleanValue(Exception):
def __init__(self, value):
self.value = value
def get_value(self):
return self.value
class UnknownMainCategory(Exception):
DEFAULT_MESSAGE = 'Main category was not specified.'
def __init__(self, message=DEFAULT_MESSAGE):
self.message = ... | [
{
"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 | ingest/importer/conversion/exceptions.py | rdgoite/hca-ingest-client |
from dataiku.customrecipe import get_input_names_for_role, get_output_names_for_role
import dataiku
from dku_config import DkuConfig
class DkuFileManager(DkuConfig):
def __init__(self, **kwargs):
super().__init__(**kwargs)
def add_file(self, side, type_, role, **kwargs):
file = DkuFileManager... | [
{
"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 | python-lib/dku_io_utils/dku_file_manager.py | dataiku/dss-plugin-timeseries-forecast |
import requests
from requests.auth import HTTPBasicAuth
from access_token import generate_access_token
import keys
def register_url():
my_access_token = generate_access_token()
api_url = "https://sandbox.safaricom.co.ke/mpesa/c2b/v1/registerurl"
headers = {"Authorization": "Bearer %s" % m... | [
{
"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 | samples/c2b.py | geoffreynyaga/daraja |
from abc import ABC, abstractmethod
from inflection import camelize
from config import Config
CONFIG_SEARCH_PATH = '/var/lib/misp_eventhandler/plugins/'
class Plugin(ABC):
def __init__(self, logger):
self.logger = logger
self._load_plugin_config()
super().__init__()
@abstractmethod
... | [
{
"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/plugins/plugin.py | dspautz/MISP_ZMQ_EventHandler |
# -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
try:
import unittest.mock as mock
except ImportError:
import mock
from gunicorn import sock
@mock.patch('os.stat')
def test_create_sockets_unix_bytes(stat):
conf = mock.Mock(add... | [
{
"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_sock.py | xxNB/gunicorn |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.14 on 2018-10-09 19:52
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
from cmsplugin_cascade.models import CascadeElement, CascadePage, IconFont
def forwards(apps, schema_editor):
for cascade_ele... | [
{
"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 | cmsplugin_cascade/migrations/0024_page_icon_font.py | aDENTinTIME/djangocms-cascade |
import numpy as np
from numpy import cos, sin
from astropy.time import Time
from ._jit import jit
@jit
def rotation_matrix(angle, axis):
c = cos(angle)
s = sin(angle)
if axis == 0:
return np.array([[1.0, 0.0, 0.0], [0.0, c, -s], [0.0, s, c]])
elif axis == 1:
return np.array([[c, 0.0... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than ... | 3 | bulk_lambert/util.py | pleiszenburg/bulk_lambert |
load("//scala:compile.bzl", "scala_proto_compile", "scala_grpc_compile")
load("@io_bazel_rules_scala//scala:scala.bzl", "scala_library")
def scala_proto_library(**kwargs):
name = kwargs.get("name")
deps = kwargs.get("deps")
visibility = kwargs.get("visibility")
name_pb = name + "_pb"
scala_proto_c... | [
{
"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 | scala/library.bzl | robfig/rules_proto |
from flask import current_app as app
from typing import List
from .abstracts.AbcHighscoreRankRepository import AbcHighscoreRankRepository
from .Repository import Repository
from ..models.highscore.HighscoreRank import HighscoreRank
class HighscoreRankRepository(Repository, AbcHighscoreRankRepository):
DEFAULT_RE... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"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 | web-app/src/repositories/HighscoreRankRepository.py | philipp-mos/iubh-quiz-app |
import numpy as np
from hypernet.src.thermophysicalModels.chemistry.reactions.reactionRate import Basic
class Arrhenius(Basic):
# Initialization
###########################################################################
def __init__(
self,
reactionsDatabase,
*args,
**kwa... | [
{
"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 | hypernet/src/thermophysicalModels/chemistry/reactions/reactionRate/arrhenius.py | christian-jacobsen/hypernet |
import os
import re
from theoops.utils import get_closest, replace_argument
from theoops.specific.brew import get_brew_path_prefix, brew_available
enabled_by_default = brew_available
def _get_formulas():
# Formulas are based on each local system's status
try:
brew_path_prefix = get_brew_path_prefix()... | [
{
"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 | theoops/rules/brew_install.py | samzhang111/oops |
def union(p,q):
for e in q:
if e not in p:
p.append(e)
def crawl_web(seed):
tocrawl = [seed]
crawled = []
index = {}
graph = {}
while tocrawl:
page = tocrawl.pop()
if page not in crawled:
content = get_page(page)
add_page_to_index(index,page,content)
outlinks = get_all_links... | [
{
"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 | web crawler functions/crawl_web_dict.py | akshaynagpal/python_web_crawler |
import joblib
import pickle
import os
import config
import pandas as pd
import click
def load_model_helper(file_path):
if os.path.split(".")[-1] == "pickle":
return pickle.load(open(file_path, 'wb'))
return joblib.load(file_path)
def fetch_artist_columns(df, artist_list):
return [artist for ... | [
{
"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 | sample_model/inference.py | Sayar1106/OTTPlatformRecommender |
#!/usr/bin/env python3
import torch
import unittest
from gpytorch.lazy import NonLazyTensor, DiagLazyTensor, AddedDiagLazyTensor
from test.lazy._lazy_tensor_test_case import LazyTensorTestCase
class TestAddedDiagLazyTensor(LazyTensorTestCase, unittest.TestCase):
seed = 0
should_test_sample = True
def cr... | [
{
"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 | test/lazy/test_added_diag_lazy_tensor.py | cdgreenidge/gpytorch |
"""
caches
From http://blog.seevl.fm/2013/11/22/simple-caching-with-redis/
"""
import cPickle
class RedisCache(object):
"""Redis cache"""
def __init__(self, redis, prefix='cache|', timeout=60*60):
"""Create Redis cache instance using a StrictRedis connection,
with prefix and timeout (or use ... | [
{
"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 | twitterdedupe/caches.py | cmheisel/twitter-dedupe |
from ic_20_largest_stack_item import MaxStackDouble, MaxStackIterate
def test_max_stack_iterate_middle():
st = MaxStackIterate()
st.push(1)
st.push(3)
st.push(5)
st.push(4)
st.push(10)
st.push(4)
st.push(9)
assert st.get_max() == 10
def test_max_stack_iterate_first():
st = MaxStackIterate()
st.push(3)
... | [
{
"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 | problems/test_ic_20_largest_stack_item.py | gregdferrell/algo |
from flask import Flask
from flask import Response
from flask import render_template
app = Flask(__name__)
@app.route('/')
def index():
#return render_template("index.html")
return "<h2>This works, which is surprising sometimes. Now with 140% more DevOps!</h2>"
@app.route("/healthz")
def healthz():
re... | [
{
"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 | app.py | discoposse/cloud-native-python-example-app |
import logging
import datetime
import json
import requests
from bs4 import BeautifulSoup
from twilio.rest import TwilioRestClient
from .config import twilio
logger = logging.getLogger(__name__)
def translate_timestamp(ts):
translation = {
'stycznia': 1,
'lutego': 2,
'grudnia': 12,
}... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
... | 3 | crawler/helpers.py | alatar-/sample-crawler |
import cell
from celery import current_app as celery
class BlenderActor(cell.Actor):
types = ('direct', 'round-robin')
def __init__(self, connection=None, *args, **kwargs):
# - use celery's connection by default,
# - means the agent must be started from where it has access
# - to the... | [
{
"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 | examples/clex.py | brennaheaps/cell |
# ------------------------------
# 230. Kth Smallest Element in a BST
#
# Description:
# Given a binary search tree, write a function kthSmallest to find the kth smallest element in it.
# Note:
# You may assume k is always valid, 1 ≤ k ≤ BST's total elements.
#
# Example 1:
# Input: root = [3,1,4,null,2], k = 1
# ... | [
{
"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 | Medium/230.py | Hellofafar/Leetcode |
#!/usr/bin/python3
import os
import argparse
from robotpkg_helpers import RobotpkgSrcIntrospection
class RpkghAnalyzeOrganization:
def __init__(self):
self.handle_options()
self.analyze_organization()
def analyze_organization(self):
# Reading rpkg_mng_root
# On line co... | [
{
"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_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": fals... | 3 | tools/rpkgh_analyze_organization.py | alexswerner/robotpkg_helpers |
import o3seespy as o3 # for testing only
import pytest
@pytest.mark.skip()
def test_pfem_element_bubble():
osi = o3.OpenSeesInstance(ndm=2)
coords = [[0, 0], [1, 0], [1, 1], [0, 1]]
ele_nodes = [o3.node.Node(osi, *coords[x]) for x in range(4)]
o3.element.PFEMElementBubble(osi, ele_nodes, rho=1.0, mu=... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": fals... | 3 | tests/commands/element/test_pfem.py | vijaypolimeru/o3seespy |
from django.contrib import admin
try:
# Django >= 1.10
from django.urls import reverse
except ImportError:
# Django < 2.0
from django.core.urlresolvers import reverse
from .models import Blind
class BlindAdmin(admin.ModelAdmin):
list_display = ('desc', 'thumbnail', 'name', 'child_safe')
list_e... | [
{
"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 | project/example_app/admin.py | lokeshatbigbasket/silk |
class Stack:
def __init__(self):
self.stack = []
self.top = 0
def is_empty(self):
return (self.top == 0)
def push(self, item):
if self.top < len(self.stack):
self.stack[self.top] = item
else:
self.stack.append(item)
self.top += 1
def pop(self):
... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
}... | 3 | data_structures/stacks/__init__.py | KirilBangachev/Python |
from .standard import Urllib2Transport
from .curl import PycurlTransport
import os
def get_transport(transport_type=None, os_module=os):
transport_type = __get_transport_type(transport_type, os_module)
if transport_type == 'urllib':
transport = Urllib2Transport()
else:
transport = PycurlTr... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside... | 3 | lib/galaxy/jobs/runners/lwr_client/transport/__init__.py | blankenberg/galaxy-data-resource |
#!/usr/bin/env python
# coding: utf-8
"""
create at 2017/11/5 by allen
"""
import time
from logging import Handler
from redis import StrictRedis, ConnectionPool
class RedisHandler(Handler):
DEFAULT_HOST = "127.0.0.1"
DEFAULT_PORT = 6379
DEFAULT_DB = 0
DEFAULT_KEY = "logger"
def __init__(sel... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than ... | 3 | tadpole/template/app/lib/logger/handlers/redis_handler.py | echoyuanliang/pine |
from pathlib import Path
from typing import Optional, Generator
from labml import lab
from labml.logger import inspect
def get_runs() -> Generator[Path, None, None]:
for exp_path in lab.get_experiments_path().iterdir():
if exp_path.name.startswith('_'):
continue
for run_path in exp_pa... | [
{
"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 | labml/internal/manage/runs.py | Asjidkalam/labml |
# diffhelpers.py - pure Python implementation of diffhelpers.c
#
# Copyright 2009 Matt Mackall <mpm@selenic.com> and others
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
def addlines(fp, hunk, lena, lenb, a, b):
while True... | [
{
"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 | mercurial/pure/diffhelpers.py | EnjoyLifeFund/py36pkgs |
import os
import pytest
import testinfra.utils.ansible_runner
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
os.environ['MOLECULE_INVENTORY_FILE']
).get_hosts('all')
@pytest.mark.skip(reason='Scenario tests not implemented yet')
def test_hostname(host):
assert 'instance' == host.check_outp... | [
{
"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 | test/scenarios/driver/linode/molecule/default/tests/test_default.py | dericcrago/molecule |
from os import system, name
def clear():
if name == 'nt':
_ = system('cls')
clear()
class Dog():
species = 'mammal'
def __init__(self, breed, name, spots):
self.breed = breed
self.name = name
self.spots = spots
def bark(self):
print('Woof! My name... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (exclud... | 3 | .history/Object Oriented Programming/Intro_20200510123929.py | EvanthiosPapadopoulos/Python3 |
from data_parsing import *
from postgres_db.bizThreads import *
from mongo_db.bizThreads import *
def FullMigration():
tickerDb = MongoDB_Biz_Ticker_Mentions()
Documents, Count = tickerDb.getAll()
# Get list of all coingecko
geckoCoinList = coinGeckoList()
print("Parsing biz coin data:")
t... | [
{
"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 | app/dash/biz_insights/db_migration.py | tinkerNamedFerro/5head.biz |
"""
Class to interface with the article multistream bzip2 file.
"""
import bz2
import xml.etree.ElementTree as ET
class ArticleMultistream:
def __init__(self, multistream_file):
self.__rawstream = open(multistream_file, 'rb')
def get_block(self, block_offset):
dc = bz2.BZ2Decompressor()
self.__rawst... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/c... | 3 | ArticleMultistream.py | genelkim/hanja-kanji-index |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Author: Bertrand256
# Created on: 2018-03
APP_NAME_SHORT = 'GhostnodeTool'
APP_NAME_LONG = 'Ghostnode Tool'
APP_DATA_DIR_NAME = '.ghostnode-tool'
PROJECT_URL = 'https://github.com/nixplatform/ghostnode-tool'
FEE_DUFF_PER_BYTE = 1
MIN_TX_FEE = 10000
SCREENSHOT_MODE = Fa... | [
{
"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 | src/app_defs.py | muteio/ghostnode-tool |
import os
import random
import time
from slackclient import SlackClient
from nflh.nfl_highlight_bot import get_highlight_list
from nflh.videos import Video
"""
Base logic taken from https://www.fullstackpython.com/blog/build-first-slack-bot-python.html
"""
BOT_ID = os.environ.get("BOT_ID")
AT_BOT = "<@" + BOT_ID +... | [
{
"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 | nflh/clients/slack.py | twbarber/nfl-highlight-slack-bot |
from bs4 import BeautifulSoup
import article
import requester
root_url = "http://www.nec-nijmegen.nl/"
source_url = "https://www.nec-nijmegen.nl/nieuws.htm"
def make_request():
html = requester.get_html(source_url)
return html
def get_articles():
print("Getting articles from: " + source_url)
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 | nec_sources/necnijmegen.py | midasvo/nec-bot |
from data_importers.github_importer import BaseGitHubImporter
class Command(BaseGitHubImporter):
srid = 27700
districts_srid = 27700
council_id = "EPS"
elections = ["2021-05-06"]
scraper_name = "wdiv-scrapers/DC-PollingStations-EpsomAndEwell"
geom_type = "gml"
seen = set()
def distri... | [
{
"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 | polling_stations/apps/data_importers/management/commands/import_epsom_and_ewell.py | smsmith97/UK-Polling-Stations |
# 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": "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 | isi_sdk_8_1_0/test/test_event_eventlist.py | mohitjain97/isilon_sdk_python |
import pylons.wsgiapp
from ddtrace import Pin
from ddtrace import config
from ddtrace import tracer
from ddtrace.vendor import wrapt
from ...utils.formats import asbool
from ...utils.formats import get_env
from ...utils.wrappers import unwrap as _u
from .middleware import PylonsTraceMiddleware
config._add(
"pyl... | [
{
"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 | ddtrace/contrib/pylons/patch.py | KDWSS/dd-trace-py |
import os
import logging
import asyncio
from aiohttp import web, web_request
from aioapp.app import Application
from aioapp import config
from aioapp.tracer import Span
from aioapp_http import Server, Handler
class Config(config.Config):
host: str
port: int
_vars = {
'host': {
'type': ... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",... | 3 | examples/http.py | inplat/aioapp_http |
# Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License").
# You may not use this file except in compliance with the License.
# A copy of the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... | [
{
"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 | src/gluonts/transform/dataset.py | lfywork/gluon-ts |
import click
import pandas as pd
from opensearchpy import OpenSearch
from opensearchpy.helpers import bulk
import logging
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)
logging.basicConfig(format='%(levelname)s:%(message)s')
def get_opensearch():
host = 'localhost'
port = 9200
auth =... | [
{
"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 | index_queries.py | fredriko/search_with_machine_learning_course |
# -*- coding: utf-8 -*-
"""
Enforce state for SSL/TLS
=========================
"""
# Import Python Libs
from __future__ import absolute_import, print_function, unicode_literals
import datetime
import logging
import time
__virtualname__ = "tls"
log = logging.getLogger(__name__)
def __virtual__():
if "tls.cert... | [
{
"point_num": 1,
"id": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 lines?",
"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 | salt/states/tls.py | springborland/salt |
from habit.habit_model import HabitHistory
from habit.complete_habit import complete
def test_overdue_habit(datasett):
"""
please note the 'double tt' for datasett. This stands to differentiate
the functional test data from the data used for unit tests.
habit 1 is the overdue habit since its added fir... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"... | 3 | tests/func/test_complete_habit.py | takavarasha-desire/habittracker1_1 |
import math
import numpy as np
import torch
def bitreversal_po2(n):
m = int(math.log(n)/math.log(2))
perm = np.arange(n).reshape(n,1)
for i in range(m):
n1 = perm.shape[0]//2
perm = np.hstack((perm[:n1],perm[n1:]))
return perm.squeeze(0)
def bitreversal_permutation(n):
m = int(ma... | [
{
"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 | datasets/utils.py | tarepan/HiPPO |
from typing import Dict, Generator
from psutil import process_iter, Process
def parse_cmdline_args(cmdline_args) -> Dict[str, str]:
cmdline_args_parsed = {}
for cmdline_arg in cmdline_args:
if len(cmdline_arg) > 0 and '=' in cmdline_arg:
key, value = cmdline_arg[2:].split('=')
... | [
{
"point_num": 1,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"an... | 3 | lcu_driver/utils.py | TheodorStraube/lcu-driver |
#!/usr/bin/env python
"""Unit tests for M2Crypto.threading.
Copyright (C) 2007 Open Source Applications Foundation. All Rights Reserved.
"""
import unittest
from M2Crypto import threading as m2threading, Rand
class ThreadingTestCase(unittest.TestCase):
def setUp(self):
m2threading.init()
def tear... | [
{
"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 | packages/M2Crypto-0.21.1/tests/test_threading.py | RaphaelPrevost/Back2Shops |
def minutes(_min):
return _min * 60
def secondes(_sec):
return _sec
def hsv_to_rgb(hue=0, saturation=1, value=1):
_H = hue
_S = saturation
_V = value
_C = _S * _V
_X = _C * (1 - abs((_H/60) % 2 - 1))
_m = _V - _C
if 0 <= _H < 60:
_Rp, _Gp, _Bp = _C, _X, 0
elif 60 <... | [
{
"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_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"ans... | 3 | src/Utils/Convert.py | VinceBro/TeamNumberOne |
# -*- coding: utf-8 -*-
from CuAsm.CuInsAssemblerRepos import CuInsAssemblerRepos
from CuAsm.CuInsFeeder import CuInsFeeder
def constructReposFromFile(sassname, savname=None, arch='sm_75'):
# initialize a feeder with sass
feeder = CuInsFeeder(sassname, arch=arch)
# initialize an empty repos
... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a ty... | 3 | Tests/test_CuInsAsmRepos_sm50.py | gxsaccount/CuAssembler |
# -*- coding: utf-8 -*-
# Copyright CERN since 2015
#
# 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": "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 | lib/rucio/db/sqla/migrate_repo/versions/b8caac94d7f0_add_comments_column_for_subscriptions_.py | fno2010/rucio |
import pytest
def test_get_sprite_names_nodata(parser):
result = parser.get_sprite_names(dict())
assert result == False
def test_get_sprite(parser, full_sb3):
result = parser.get_sprite_names(full_sb3)
assert type(result) == list
assert result == ["Scratch"]
| [
{
"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 | tests/parse/test_get_sprite_names.py | GSE-CCL/scratch-tools |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
.. py:currentmodule:: test_direct_metric_tensor
:synopsis: Tests for the module :py:mod:`direct_metric_tensor`
.. moduleauthor:: Hendrix Demers <hendrix.demers@mail.mcgill.ca>
Tests for the module :py:mod:`direct_metric_tensor`.
"""
##############################... | [
{
"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 | tests/crystallography/test_direct_metric_tensor.py | drix00/ElectronDiffraction |
import unittest
from datatypes.exceptions import DataDoesNotMatchSchemaException
from datatypes import postcode_validator
class TestPostcodeValidation(unittest.TestCase):
def test_can_validate_postcode(self):
try:
postcode_validator.validate("WC2B6SE")
postcode_validator.validate... | [
{
"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_postcode_validation.py | LandRegistry/datatypes-alpha |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.