source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
#@+leo-ver=5-thin
#@+node:edream.110203113231.734: * @file ../plugins/quit_leo.py
""" Shows how to force Leo to quit."""
#@@language python
#@@tabwidth -4
from leo.core import leoGlobals as g
def init():
'''Return True if the plugin has loaded successfully.'''
ok = not g.app.unitTesting # Not for unit testing.... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"... | 3 | leo/plugins/quit_leo.py | ATikhonov2/leo-editor |
from typing import List
from os.path import join, dirname
from django.core.checks import register, CheckMessage, Error
from django.conf import settings
from fs.base import FS
from . import filesystem
def _create_check_file(fs: FS, path: str):
fs.makedirs(dirname(path), recreate=True)
fs.create(path, wipe=True... | [
{
"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 | src/imagetagger/base/checks.py | EKivutha/imagetagger |
import os
from pascal_voc_writer import Writer as PascalWriter
def test_1(results_dir):
pascal_writer = PascalWriter('test-image.png', 100, 100)
pascal_writer.addObject(name='triangle', xy_coords=[5, 5, 95, 5, 50, 95])
pascal_writer.save(os.path.join(results_dir,
'test-... | [
{
"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 | test.py | yiluheihei/pascal-voc-writer |
# package imports
import pytest
from earthdata.search import DataCollections, DataGranules
valid_single_dates = [
("2001-12-12", "2001-12-21", "2001-12-12T00:00:00Z,2001-12-21T00:00:00Z"),
("2021-02-01", "", "2021-02-01T00:00:00Z,"),
("1999-02-01 06:00", "2009-01-01", "1999-02-01T06:00:00Z,2009-01-01T00:00... | [
{
"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_queries.py | virdi/earthdata |
class Solution:
# @param path, a string
# @return a string
def simplifyPath(self, path):
root = self.node('')
root.previous = root
p = [i for i in path.split('/') if i != '']
temp = root
for i in p:
if i == '..':
temp = temp.previous
... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": fal... | 3 | tools/leetcode.071.Simplify Path/leetcode.071.Simplify Path.submission9.py | tedye/leetcode |
from rest_framework.serializers import ValidationError
from django.core.exceptions import ObjectDoesNotExist
from django.contrib.auth import get_user_model, authenticate
User = get_user_model()
def pwdExist(data):
try:
new_password = str(data['new_password'])
return data
except Key... | [
{
"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 | user/utils/validators.py | shoorday/IC |
"""
Define platform-specific functions with decorators
https://stackoverflow.com/a/60244993
"""
import platform
import sys
from typing import Union as U, List, Tuple
class _Not_Implemented:
def __init__(self, func_name):
self.func_name = func_name
def __call__(self, *args, **kwargs):
raise N... | [
{
"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_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
... | 3 | petra_viewer/widgets/breadcrumbsaddressbar/platform/common.py | yamedvedya/data_viewer |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals
from ckeditor.fields import RichTextField
from django.conf import settings
from django.db import models
from django.db.models import ImageField
from django.urls import reverse
from django.utils.encoding import python_2_uni... | [
{
"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_class_has_docstring",
"question": "Does every class in this file have a docstring?"... | 3 | dashboard/documents/models.py | yakky/channeled-dashboard |
import json
import re
from typing import List, Optional
from bs4 import BeautifulSoup, Tag
def _format_link(url: str) -> Optional[str]:
"""
Formats links on wiki page
:param url: href attribute of <a> element
:return: if correct internal link, returns formatted link; otherwise (external or... | [
{
"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 | wiki_parser/page_formatter.py | fossabot/wiki-race |
"""
Definitions of tasks executed by Celery
"""
import logging
from web_app.extensions import celery
from web_app.extensions import db
from web_app.models.example_table import ExampleTable
from web_app.scheduled_tasks.scheduled_task import example_scheduled_task
@celery.task(name="healthcheck_task")
def healthcheck... | [
{
"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 | web_app/tasks/tasks.py | MartykQ/flask-celery-postgres-template |
import os
import requests as rt
from pathlib import Path
"""
Recebe ano como inteiro e COD_ESC como string para determinar o endereço do
arquivo e definição do nome para ser salvo. Retorna o nome do arquivo.
"""
def download_pdf(ano, COD_ESC):
ano = str(ano)
url = 'http://idesp.edunet.sp.gov.br... | [
{
"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 | Download_pdf.py | andre8oli/MBA_PEIs |
from __future__ import absolute_import, print_function
import sys
def _verbose_message(message, *args, **kwargs):
"""Print the message to stderr if -v/PYTHONVERBOSE is turned on."""
verbosity = kwargs.pop('verbosity', 1)
if sys.flags.verbose >= verbosity:
if not message.startswith(('#', 'import '... | [
{
"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 | palimport/_utils.py | asmodehn/lark_import |
from MongoConnect import ConnectModule
my_con = ConnectModule.connect()
collection = my_con.db["Contacts"]
class UpdateContact:
def __init__(self, reg_id, uname, uemail, uphone):
self.uname = uname
self.uemail = uemail
self.uphone = uphone
self.reg_id = reg_id
def update(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": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding se... | 3 | lms_aaditya/ContactsModules/update_contacts.py | hcmuleva/personal-profile |
# SPDX-License-Identifier: Apache-2.0
# automatically generated by the FlatBuffers compiler, do not modify
# namespace: tflite
import flatbuffers
from flatbuffers.compat import import_numpy
np = import_numpy()
class LessOptions(object):
__slots__ = ['_tab']
@classmethod
def GetRootAs(cls, buf, offset=0... | [
{
"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 | tf2onnx/tflite/LessOptions.py | LoicDagnas/tensorflow-onnx |
import pandas as pd
import numpy as np
from threading import Thread
from multiprocessing import Queue
df = pd.DataFrame(data=np.random.rand(100).reshape(10, 10))
print(df.head())
rows = df.index
column = df.columns
que = Queue()
# long run
def long_run(row, col, pv):
for r in row:
for c in col:
... | [
{
"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 | multi_thread.py | maneeshdisodia/pythonic_examples |
from django.shortcuts import render
from wiki.models import Page
from django.views.generic.list import ListView
from django.views.generic.detail import DetailView
from django.shortcuts import get_object_or_404,render
class PageList(ListView):
"""
This view grabs all the pages out of the database
returns a... | [
{
"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 | wiki/views.py | ebonnecab/makewiki |
from .base_metric import BaseMetric
class ValueMetric(BaseMetric):
""" Base class for metrics that don't have state and just calculate a simple value """
def __init__(self, name):
super().__init__(name)
self._metric_value = None
def calculate(self, data_dict):
""" Calculate valu... | [
{
"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 | vel/api/metrics/value_metric.py | cclauss/vel |
_components = {}
def add_component(path, data):
_components[path] = data
def get_component(path):
try:
return _components[path]
except KeyError:
raise NameError('There is no component with path {}'.format(path))
| [
{
"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 | slaterify/utils.py | merindorium/slaterify |
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in... | [
{
"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 | triggerflow/libs/cloudevents/sdk/converters/base.py | Dahk/triggerflow-examples |
import operator
def execute(program):
registers = {}
m = 0
for instr in program:
if instr['reg_check'] not in registers:
registers[instr['reg_check']] = 0
if instr['reg'] not in registers:
registers[instr['reg']] = 0
if instr['op_check'](registers[instr['... | [
{
"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 | adventofcode2017/08.py | matslindh/codingchallenges |
import unittest
import numpy as np
from eventsearch.signals import SingleSignal, SmoothedSignal
from eventsearch.utils import Smoother
from .utils import TemporaryFolder
class TestSingleSingal(unittest.TestCase):
def test_create_object(self):
t = np.linspace(0, 5, 10)
y = t ** 2
test = ... | [
{
"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_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},... | 3 | tests/test_signals.py | Digusil/eventsearch |
"""Example to evaluate WAV files"""
import sys
from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser, FileType
from pathlib import Path
from scipy.io import wavfile
# This is to make the local vibromaf package available
try:
sys.path.append(str(Path(__file__).absolute().parents[1]))
except IndexErro... | [
{
"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 | examples/evaluate_wav.py | hofbi/vibromaf |
# Lemoneval Project
# Author: Abhabongse Janthong <6845502+abhabongse@users.noreply.github.com>
"""Decorator helpers."""
from functools import update_wrapper
from types import MethodType
class CallableWrapper(object):
"""Decorator which allows injection into decorated object method.
This class takes in an o... | [
{
"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 | lemoneval/utils/decorators.py | abhabongse/lemoneval |
#
# Copyright (c) 2019, Neptune Labs Sp. z o.o.
#
# 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 agr... | [
{
"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 | neptune/internal/hardware/metrics/metrics_container.py | neptune-ml/neptune-client |
import math, string, itertools, fractions, heapq, collections, re, array, bisect, copy, functools, random
import sys
from collections import deque, defaultdict, Counter; from heapq import heappush, heappop
from itertools import permutations, combinations, product, accumulate, groupby
from bisect import bisect_left, bis... | [
{
"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 | AtC_Beg_Con_161-170/ABC165/A.py | yosho-18/AtCoder |
import logging
import os
import platform
import shutil
import sys
from pathlib import Path
logger = logging.getLogger(__name__)
def ensure_wkhtmltopdf(): # pragma: no cover
if shutil.which("wkhtmltopdf") is None:
if platform.system() == "Windows":
wkhtmltopdf_path = _find_wkhtmltopdf_path()
... | [
{
"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 | enex2notion/cli_wkhtmltopdf.py | starplanet/enex2notion |
from django.test import TestCase, Client
from django.contrib.auth import get_user_model
from django.urls import reverse
class AdminSiteTests(TestCase):
def setUp(self):
self.client = Client()
self.admin_user = get_user_model().objects.create_superuser(
email = 'admin@mail.com',
... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answ... | 3 | app/core/tests/test_admin.py | LuisMota93/recipe-app-api |
from datetime import time
from pytz import timezone
from pandas import Timestamp
from pandas.tseries.offsets import DateOffset
from catalyst.utils.memoize import lazyval
from .trading_calendar import TradingCalendar
class OpenExchangeCalendar(TradingCalendar):
@property
def name(self):
return 'OPEN... | [
{
"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 | catalyst/utils/calendars/exchange_calendar_open.py | izokay/catalyst |
# Copyright (c) Facebook, Inc. and its affiliates.
import unittest
import torcharrow.dtypes as dt
from torcharrow import INumericalColumn
from torcharrow import Scope
from .test_numerical_column import TestNumericalColumn
class TestNumericalColumnCpu(TestNumericalColumn):
def setUp(self):
self.device = ... | [
{
"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 | torcharrow/test/test_numerical_column_cpu.py | bhuang3/torcharrow |
import socket
import numpy as np # pip install numpy
socketUDP = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
transmissor = ("127.0.0.1", 2020)
receptor = ("127.0.0.1", 3030)
socketUDP.bind(transmissor)
buff_size = 10000
next_sequence_number = 0
def calculate_checksum(data):
data_sum = np.ui... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fe... | 3 | transmissor.py | Julio-Felix/socket-python |
import whois
def get_whois(domain):
try:
query = whois.query(domain)
assert isinstance(query, whois._3_adjust.Domain)
return query.__dict__
except:
pass
return None
def get_scans(domain):
url = "http://" + domain
urls = [url]
scans = vt.get_url_reports([url])[ur... | [
{
"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 | intel_query.py | sudo-rushil/DGA_Intel |
# MIT License
#
# Copyright (C) The Adversarial Robustness Toolbox (ART) Authors 2020
#
# 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
# r... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding ... | 3 | tests/attacks/conftest.py | monshri/adversarial-robustness-toolbox |
# -*- coding: utf-8 -*-
"""
test_django-watchman
------------
Tests for `django-watchman` management commands.
"""
from __future__ import unicode_literals
from io import StringIO
import unittest
from django.core.management import call_command
class TestWatchman(unittest.TestCase):
def test_successful_manage... | [
{
"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/test_management.py | jbenua/django-watchman |
import requests
import json
class Api(object):
def ReturnContent(self, res):
return json.loads(res.content.decode('utf-8'))
def CreateNew(self, name):
if name is not None:
return Api.ReturnContent(0, requests.get('https://post-shift.ru/api.php?action=new&name='+name+'&type=json'))
... | [
{
"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 | postshiftapi.py | retart1337/PyTempMail |
import logging
from gensim.models import fasttext
from aidistillery import file_handling
class FastTextWrapper:
def __init__(self, sentences, use_bf = True, dimension=100, window=5, min_count=5, workers=4, sg=0, iterations=5,
type="fasttext", dataset = ""):
logging.info("FastText Wrapper I... | [
{
"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 | aidistillery/models/fasttext_wrapper.py | TheMTank/arxiv-summariser |
# -*- test-case-name: Cowrie Test Cases -*-
# Copyright (c) 2018 Michel Oosterhof
# See LICENSE for details.
"""
Tests for general shell interaction and cat command
"""
import os
from twisted.trial import unittest
from cowrie.shell import protocol
from cowrie.test import fake_server, fake_transport
os.environ["C... | [
{
"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 | src/cowrie/test/test_cat.py | ProjectZeroDays/cowrie |
# Author: Kevin Köck
# Copyright Kevin Köck 2017-2019 Released under the MIT license
# Created on 2017-10-30
"""
example config:
{
package: .switches.gpio
component: GPIO
constructor_args: {
pin: D5
active_high: true #optional, defaults to active high
# mqtt_topic: sometop... | [
{
"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 | pysmartnode/components/switches/gpio.py | dasTholo/pysmartnode |
import numpy as np
import torch
import torch.distributed as dist
def tensor(x, device):
if isinstance(x, torch.Tensor):
return x.to(device)
x = np.asarray(x, dtype=np.float)
x = torch.tensor(x, device=device, dtype=torch.float32)
return x
def input_preprocessing(x, device):
x = tensor(x... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding ... | 3 | procgen_adventure/utils/torch_utils.py | Laurans/procgen_adventure |
def return_status(code: int, message: str, **kwargs):
ret = {
"code": code,
"message": message
}
for k in kwargs:
ret[k] = kwargs[k]
return ret
def return_car(car_id, room_id, description, data_from, creator_id, more_info, add_time):
ret = {
"id": int(car_id),
... | [
{
"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 | ycm/ret_models.py | chinosk114514/ycm-api |
#Zeliha Döner 160401004
import socket
from ftplib import FTP
import os
import select
import time
buf=1024
def dosya_listele():
msg = "Liste getir komutu"
msgEn = msg.encode('utf-8')
s_s.sendto(msgEn, adres)
print("Sunucuda listeleniyor..")
F=os.listdir()
Lists = []
for ... | [
{
"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 | vize/160401004/sunucu.py | hasan-se/blm304 |
# 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": "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 | airflow/providers/cncf/kubernetes/backcompat/pod_runtime_info_env.py | ChaseKnowlden/airflow |
import datetime as dt
import pytest
from note_clerk import planning
@pytest.mark.parametrize(
"date, quarter",
[
(dt.datetime(2020, 1, 1), dt.datetime(2020, 1, 1)),
(dt.datetime(2020, 1, 2), dt.datetime(2020, 1, 1)),
(dt.datetime(2020, 4, 1), dt.datetime(2020, 4, 1)),
(dt.dat... | [
{
"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_params_annotated",
"question": "Does every function parameter in this file have a type annotation (exclu... | 3 | tests/test_planning.py | acjackman/note-clerk |
#!/usr/bin/env python3
import os
import pathlib
import sys
import subprocess
def has_cargo_fmt():
"""Runs a quick check to see if cargo fmt is installed."""
try:
c = subprocess.run(["cargo", "fmt", "--", "--help"], capture_output=True)
except OSError:
return False
else:
return ... | [
{
"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 | scripts/git-precommit-hook.py | AWSNB/relay |
from . import git
import os
from urllib.parse import quote_plus
from .utils import msg
_CACHE_FOLDER = os.path.expanduser('~/.glit/cache/git/')
_already_pulled = set()
class GitStoredFile(object):
def __init__(self, repository, filename):
self._repository = repository
self._relative_filename =... | [
{
"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 | glit/gitstorage.py | vandmo/glit |
import unittest
import zipfile
class DatasetMergeTest(unittest.TestCase):
def test_dataset(self):
with zipfile.ZipFile('tests/dataset_merge/dataset.zip') as zf:
self.assertEqual(
sorted(zf.namelist()),
['data1.in', 'data2.in', 'data3.ans', 'data3.in'])
def ... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},... | 3 | tests/dataset_merge/dataset_merge_test.py | nya3jp/rules_contest |
import logging
from brownie import web3 as w3
from eth_utils import encode_hex
from eth_utils import function_signature_to_4byte_selector as fourbyte
from requests import Session
from requests.adapters import HTTPAdapter
from web3 import HTTPProvider
from web3.middleware import filter
from yearn.cache import memory
... | [
{
"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 | yearn/middleware.py | scottincrypto/yearn-exporter |
# coding: utf-8
"""
KubeVirt API
This is KubeVirt API an add-on for Kubernetes.
OpenAPI spec version: 1.0.0
Contact: kubevirt-dev@googlegroups.com
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
import unittest
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": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": fals... | 3 | test/test_v1_block_size.py | ansijain/client-python |
# -*- coding: utf-8 -*-
from decimal import Decimal
import graphene
class PricefulType(graphene.ObjectType):
base_price = graphene.Float()
price = graphene.Float()
discount_amount = graphene.Float()
discount_rate = graphene.Float()
discount_percentage = graphene.Float()
taxful_price = graphen... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cl... | 3 | shuup_graphql/front/types/price.py | chessbr/shuup-graphql-api |
from typing import Tuple
import unittest
import numpy as np
from openml.tasks import get_task
from .test_task import OpenMLTaskTest
class OpenMLSupervisedTaskTest(OpenMLTaskTest):
"""
A helper class. The methods of the test case
are only executed in subclasses of the test case.
"""
__test__ = F... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
... | 3 | tests/test_tasks/test_supervised_task.py | hp2500/openml-python |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.11.1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
i... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
... | 3 | kubernetes/test/test_v1beta1_webhook_client_config.py | reymont/python |
import csv
import os
import copy
from scrapy.spider import BaseSpider
from scrapy.selector import HtmlXPathSelector
from scrapy.http import Request, HtmlResponse, FormRequest
from scrapy.utils.response import get_base_url
from scrapy.utils.url import urljoin_rfc
from scrapy.http.cookies import CookieJar
from product_... | [
{
"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": fals... | 3 | portfolio/Python/scrapy/hoptec/hoptec_tictactime.py | 0--key/lib |
import unittest
import ramda as R
"""
https://github.com/ramda/ramda/blob/master/test/props.js
"""
d = {
'a': 1,
'b': 2,
'c': 3,
'd': 4,
'e': 5,
'f': 6,
}
class TestPropsForDict(unittest.TestCase):
def test_returns_empty_array_if_no_properties_requested(self):
self.assertEqual([], R.... | [
{
"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 | test/test_props.py | zydmayday/pamda |
from django.db import models
from django.contrib import admin
class Product(models.Model):
product_text = models.CharField(max_length=200)
product_COD = models.FloatField()
def __str__(self):
return self.product_text
class ProductAdmin(admin.ModelAdmin):
# fields displayed on edit and add pa... | [
{
"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 | app/models.py | nickjstevens/eCIP |
from rest_framework.generics import ListAPIView
from rest_framework.views import APIView
from rest_framework.response import Response
from rest_framework.viewsets import ModelViewSet
from apps.contents.models import GoodsCategory
from apps.goods.models import SKU, SPU, SPUSpecification
from apps.meiduo_admin.serialize... | [
{
"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 | meiduo_mall/apps/meiduo_admin/views/sku.py | zhengcongreal/meiduo_project- |
from selenium import webdriver
from selenium.webdriver.support.ui import Select
from django.contrib.staticfiles.testing import StaticLiveServerTestCase
from django.core.urlresolvers import reverse
CHROMEDRIVER_PATH = '/usr/bin/chromedriver'
class BaseTestCase(StaticLiveServerTestCase):
fixtures = ['base.json']... | [
{
"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 | fts/_base.py | Camnooten/django-ban |
from django.db.models import Q
from .base import EntityType
TYPE_VIDEO = "video"
class VideoEntity(EntityType):
name = TYPE_VIDEO
@classmethod
def filter_date_lte(cls, qs, dt):
return qs.filter(publication_date__lte=dt)
@classmethod
def filter_date_gte(cls, qs, dt):
return qs.f... | [
{
"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 | backend/tournesol/entities/video.py | iamnkc/tournesol |
"""
A version of the standard Gtk.ColorButton tweaked towards Gaphor.
Gaphor is using color values from 0 to 1 (cairo standard), so that required some tweaks
on the color widget. The standard format is `(red, green, blue, alpha)`.
"""
from gi.repository import Gtk
class ColorButton(Gtk.ColorButton):
__gtype_na... | [
{
"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 | gaphor/misc/colorbutton.py | MarianelaSena/gaphor |
from smartva.rules import drowning_adult as drowning
from smartva.data.constants import *
VA = Adult
def test_pass():
row = {
VA.DROWNING: YES,
VA.INJURY_DAYS: 0,
}
assert drowning.logic_rule(row) is True
def test_fail_drowning():
row = {
VA.DROWNING: NO,
}
assert ... | [
{
"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 | test/rules/test_drowning_adult.py | rileyhazard/SmartVA-Analyze-1 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_miranda
----------------------------------
Tests for `miranda` module.
"""
import pytest
from contextlib import contextmanager
from click.testing import CliRunner
from miranda import miranda
from miranda import cli
@pytest.fixture
def response():
"""Samp... | [
{
"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_miranda.py | dokimastis/miranda |
"""Data Plans module."""
try:
from urllib.parse import urljoin # python 3
except ImportError:
from urlparse import urljoin # python 2
import requests
from furl import furl
class DataPlans(object):
"""DataPlans class.
The Data Plans endpoints return pricing and descriptions for the different
da... | [
{
"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 | python_hologram_api/data_plans.py | roekatz/python-hologram-api |
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
def lowestCommonAncestor(self, root: 'TreeNode', p: 'TreeNode', q: 'TreeNode') -> 'TreeNode':
# 介于二者之间
if p.val <= root.val <= q.val or q.val <= root.val <= p.val:
... | [
{
"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 | tree/0235-lowest-common-ancestor-of-a-binary-search-tree.py | ZHUANGHP/LeetCode-Solution-Python |
class Escritor:
def __init__(self, nome):
self.__nome = nome
self.__ferramenta = None
@property
def nome(self):
return self.__nome
@property
def ferramenta(self):
return self.__ferramenta
@ferramenta.setter
def ferramenta(self, ferramenta):
self.__... | [
{
"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 | 3-python-poo (programacao orientada a objeto)/aula07-associacao/classes.py | Leodf/projetos-python |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import os
import subprocess
import sys
from pathlib import Path
from setuptools import Ex... | [
{
"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 | setup.py | jspisak/tensorpipe |
from .Pipe import Pipe
import gc
class GarbageCollector(Pipe):
'''
Probably should be merged with the Dataset handler (?).
'''
def __init__(self):
gc.enable()
def after_epoch(self):
gc.collect() | [
{
"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": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answ... | 3 | setka/pipes/GarbageCollector.py | SlinkoIgor/setka |
import time
from tronx import app
from pyrogram import filters
from pyrogram.types import Message
@app.bot.on_message(filters.command("start"))
async def send_response(_, m: Message):
await m.reply("How can i help you ?")
@app.bot.on_message(filters.new_chat_members & filters.group)
async def added_to_group_m... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding ... | 3 | tronx/plugins/start.py | JayPatel1314/Tron |
import configparser
import psycopg2
from sql_queries import copy_table_queries, insert_table_queries
def load_staging_tables(cur, conn):
"""
Populates the staging tables with CPOY from S3 buckets.
"""
for query in copy_table_queries:
cur.execute(query)
conn.commit()
def insert_tables... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": tru... | 3 | etl.py | adzugaiev/Udacity-Data-Engineering-3 |
def decorate_lowercase(function):
def lowerfy():
funcaa = function()
string_lower = funcaa.lower()
return string_lower
return lowerfy
def splitfy(function):
def splitt():
s_value = function()
str_list = s_value.split()
return str_list
return splitt
@splitfy
@decorate_lowercase
def hello():
return "... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"... | 3 | BasicProgramming/decorator.py | manikantavasupalli/python-practice |
# -----------------------------------------------------------------------------
# Copyright (c) 2015-2021, NeXpy Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING, distributed with this software.
# -------------------------------------------------... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},... | 3 | src/nxrefine/plugins/refine/new_sample.py | rayosborn/nxpeaks |
from Recommender_System.algorithm.NeuMF.model import NeuMF_model
from Recommender_System.algorithm.train import train, test
import tensorflow as tf
def train_with_pretrain(n_user, n_item, train_data, test_data, topk_data, gmf_dim, mlp_dim, layers, l2):
neumf_model, gmf_model, mlp_model = NeuMF_model(n_user,... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding ... | 3 | Recommender_System/algorithm/NeuMF/train.py | Holldean/Recommender-System |
from math import ceil
def round_up(num):
''' expects a number
shifts the the number by 8 dp, discards the decimal places
shifts the number down by 6 place
takes the ceiling of this number
divides it by 100 and returns it.
So 43.000657543332 --> 4300065754.3332 --> 4300065754 --> 43.00065754
... | [
{
"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 | 2018/Q1.py | s-cork/BIO |
from web.msnotifier.example import add
def test_add_correct():
assert add(5, 7) == 12
def test_add_incorrect():
assert add(15, 8) != 21
| [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"ans... | 3 | tests/test_example.py | Luzkan/MessengerNotifier |
# -*- coding: utf-8 -*-
import py
try:
from jabberbot import capat
except ImportError:
py.test.skip("Skipping jabber bot tests - pyxmpp is not installed")
def test_ver_simple():
# example values supplied by the XEP
ident = (("client", "pc"), )
feat = ("http://jabber.org/protocol/disco#info",
... | [
{
"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 | jabberbot/_tests/test_capat.py | RealTimeWeb/wikisite |
import socket
import threading
from queue import Queue
target = "127.0.0.1"
queue = Queue()
open_ports = []
def portscan(port):
try:
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.connect((target, port))
return True
except:
return False
def fill... | [
{
"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 | portscanner.py | miaaf/port-scanner |
# twitter_app/iris_classifier.py
import os
import pickle
from sklearn.datasets import load_iris
from sklearn.linear_model import LogisticRegression
MODEL_FILEPATH = os.path.join(os.path.dirname(__file__), "..", "models", "latest_model.pkl")
def train_and_save_model():
print("TRAINING THE MODEL...")
X, y = ... | [
{
"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 | twitter_app/iris_classifier.py | Struth-Rourke/twitter_flask_app |
# -*- coding:utf-8; -*-
class SolutionV1:
def combinationSum(self, candidates, target):
# 1. 定义保存结果的组合
result = set()
# 2. 定义递归函数,i表示递归层数,但是具体含义还不知道
def helper(nums, candidates, target):
# 4. 编写递归模板
# 1) 定义递归终止条件
# 应该是从candidate选出来的数的sum=target就... | [
{
"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 | 39-combination-sum/solution.py | phenix3443/leetcode |
import pandas as pd
import cv2
import numpy as np
dataset_path = 'fer2013/fer2013/fer2013.csv'
image_size=(48,48)
def load_fer2013():
data = pd.read_csv(dataset_path)
pixels = data['pixels'].tolist()
width, height = 48, 48
faces = []
for pixel_sequence in pixels:
f... | [
{
"point_num": 1,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
... | 3 | load_and_process.py | ctiger34/BASIC-EMOTION-DETECTION |
from pathlib import Path
import jsons
class Params:
dataset = str('citation_citeseer')
data_root = str(str(Path(__file__).absolute().parent))
epoch_size = int(10)
lr = float(2e-4)
supervised = bool(False)
multiheads = bool(False)
hidden_c = int(128)
out_c = int(64)
da_coef = fl... | [
{
"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 | GCN/params.py | cross-domain-relation-adaptation/Cross-Domain-Relation-Adaptation |
# Shortest Menu driven program possible :)
def asc(l):
print("List in ascending order:",sorted(l)) #returns list in ascending order
def desc(l):
print("List in descending order:",sorted(l)[::-1]) # returns the reverse of the ascending ordered list
def menu():
while True:
print("""MENU :
1.Sort lis... | [
{
"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 | LHD Build Sort a list.py | Ananya2003Gupta/LHD-Build-Sort-a-list |
''' Testing bash apps
'''
import parsl
from parsl import *
import os
import time
import shutil
import argparse
#parsl.set_stream_logger()
workers = ThreadPoolExecutor(max_workers=4)
dfk = DataFlowKernel(workers)
@App('python', dfk)
def random():
import random
return random.randint(1,10)
@App('python', dfk)... | [
{
"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 | parsl/tests/test_aalst_patterns/test_python_XOR_SPLIT_P4.py | monicadlewis97/parsl |
import re
import api
class Module(api.Module):
'''A module for matching regular expressions and
forwarding the data to a nick or channel'''
def __init__(self, server):
super(Module, self).__init__(server)
api.hook_command('grepfwd', self.grepfwd, server, su = True)
self.fwds = {}
... | [
{
"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 | modules/grepfwd.py | xfix/BBot |
import graphene
from ..core.fields import PrefetchingConnectionField
from ..descriptions import DESCRIPTIONS
from ..translations.mutations import PageTranslate
from .bulk_mutations import PageBulkDelete
from .mutations import PageCreate, PageDelete, PageUpdate
from .resolvers import resolve_page, resolve_pages
from .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_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": ... | 3 | saleor/graphql/page/schema.py | acabezasg/urpi-master |
from django.http import HttpResponse
from django.shortcuts import render
# Create your views here.
def index(request):
return HttpResponse('{"response": "Synth is running!"}')
def test(request):
return HttpResponse('ANOTHER RESPONSE YO')
| [
{
"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 | nginx_router/backend/synth_app/views.py | BennettDixon/book_query_app |
from talon import Context, Module, actions, imgui, settings, ui, app
import os
ctx = Context()
mod = Module()
ctx.matches = r"""
app: windows_power_shell
app: windows_terminal
and win.title: /PowerShell/
"""
user_path = os.path.expanduser("~")
directories_to_remap = {}
directories_to_exclude = {}
@ctx.action_class... | [
{
"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 | apps/win/powershell/power_shell.py | cassaundra/knausj_talon |
import math
import os
from aiohttp import web
import imageio
from .. import dataset_dir
async def handle_preview(request):
path = dataset_dir + "/" + request.match_info.get("path")
gif_path = path + '/preview.gif'
if not os.path.isfile(gif_path):
with imageio.get_writer(gif_path, mode='I', fps=... | [
{
"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 | policy/openbot/server/preview.py | thias15/OpenBot-1 |
# --*-- coding: utf-8 --*--
# --------------------------------------------------------------------------------
# Description:
# search_spider负责将搜索结果扔进redis队列,提供给page_spider消费
# 两步爬虫分离,实现分布式,弹性扩展
# DATE:
# 2018/02/01
# BY:
# xiaoshicae
# --------------------------------------------------------... | [
{
"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 | JianShuSpider/spiders/search_spider.py | xiaoshicae/Others |
"""Program to make a peanut butter and jelly sandwich."""
def go_to_store():
"""Go to the store and buy sandwich ingredients."""
print("Buying bread...")
print("Buying peanut butter and jelly...\n")
def prepare_ingredients():
"""Prepare sandwich ingredients."""
print("Toasting bread...")
pri... | [
{
"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 | Examples/ControlFlowExamples/functions.py | AbdullahNoori/CS-1.1-Intro-to-Programming |
import string
import random
def generate_password():
chars = string.ascii_letters + string.digits + string.punctuation
return ''.join([random.choice(chars) for i in range(0, 15)])
def main():
print(generate_password())
if __name__ == '__main__':
main()
| [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answe... | 3 | src/password_generator.py | thiamsantos/python-labs |
import torch.nn as nn
cfg = {
'VGG11': [64, 'M', 128, 'M', 256, 256, 'M', 512, 512, 'M', 512, 512, 'M'],
'VGG13': [64, 64, 'M', 128, 128, 'M', 256, 256, 'M', 512, 512, 'M', 512, 512, 'M'],
'VGG16': [64, 64, 'M', 128, 128, 'M', 256, 256, 256, 'M', 512, 512, 512, 'M', 512, 512, 512, 'M'],
'VGG19': [64, ... | [
{
"point_num": 1,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/cls)?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fe... | 3 | models/VGG.py | dzwallkilled/pytorch-cifar10 |
"""empty message
Revision ID: 5b2f27493d7e
Revises: 1d17bfa8fe08
Create Date: 2018-06-14 14:54:29.224338
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '5b2f27493d7e'
down_revision = '1d17bfa8fe08'
branch_labels = None
depends_on = None
def upgrade():
# ... | [
{
"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 | migrations/versions/5b2f27493d7e_.py | NeverLeft/FLASKTPP |
import regex as re
def remove_article(text):
return re.sub('^l[ea] ', '', text)
def remove_feminine_infl(text):
text = re.sub('(?<=\w+)\(e\)(?!\w)', '', text)
text = re.sub('(?<=\w+)\(ne\)(?!\w)', '', text)
return text
| [
{
"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 | libpython/gary/french.py | longnow/panlex-tools |
from django import forms
class PermissionUpdateForm(forms.Form):
remove = forms.MultipleChoiceField()
add = forms.CharField(required=False, label='Grant access to')
def __init__(self, *args, **kwargs):
users = kwargs.pop('users', ())
user_choices = [(u,u) for u in users]
super().__i... | [
{
"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 | files/forms.py | danielchriscarter/part2-django |
import numpy as np
def confusion_matrix(y_true, y_hat, threshold=.5):
def _to_class(y):
return np.array([1 if i >= threshold else 0 for i in y])
n_classes = len(np.unique(y_true))
cm = np.zeros((n_classes, n_classes))
y_hat = _to_class(y_hat)
for a, p in zip(y_true, y_hat):
... | [
{
"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/utils.py | clabrugere/numpy-basics |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2020 CESNET.
#
# OARepo Micro API is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""Pytest fixtures and plugins for the API application."""
from __future__ import absolute_import, print_funct... | [
{
"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/api/conftest.py | oarepo/oarepo-micro-api |
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os
from spack import *
class Qtgraph(QMakePackage):
"""The baseline library used in the CUDA-centric Open|Sp... | [
{
"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 | var/spack/repos/builtin/packages/qtgraph/package.py | player1537-forks/spack |
"""Test the check command."""
# mypy: ignore-errors
# flake8: noqa
import argparse
from typing import Tuple
from unittest.mock import MagicMock, Mock, patch
import pytest
import dfetch
from dfetch.commands.update import Update
from dfetch.manifest.manifest import Manifest
from dfetch.manifest.project import ProjectE... | [
{
"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 | tests/test_update.py | Rohitth007/dfetch |
BLACKLIST_ENDPOINT = ["kms", "sts"]
def is_blacklist(endpoint_name):
"""Protecting the args sent to kms, sts to avoid security leaks
if kms disabled test_kms_client in test/contrib/botocore will fail
if sts disabled test_sts_client in test/contrib/boto contrib will fail
"""
return endpoint_name 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": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding se... | 3 | ddtrace/ext/aws.py | tophatmonocle/dd-trace-py |
#!/usr/bin/python3
import time
def count_5s(number):
counter = 0
while (number % 5 == 0):
counter += 1
number /= 5
return counter
def last_5_digits(number):
number = number % (10 ** 5)
return number
def factorial(number):
borrowed_2s = 0
product = 1
for i in range(1... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answ... | 3 | factorial-trailing-digits/factorial_trailing_digits.py | fatihcansu/kripton |
from pelican import readers
from pelican.readers import PelicanHTMLTranslator
from pelican import signals
from docutils import nodes
def register():
class HeaderIDPatchedPelicanHTMLTranslator(PelicanHTMLTranslator):
def depart_title(self, node):
close_tag = self.context[-1]
parent =... | [
{
"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 | blog/pelican-plugins/headerid/headerid.py | lemonsong/lemonsong.github.io |
# 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": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than cla... | 3 | aliyun-python-sdk-alidns/aliyunsdkalidns/request/v20150109/SetGtmMonitorStatusRequest.py | sdk-team/aliyun-openapi-python-sdk |
'''
Created on 2016/10/25
:author: hubo
'''
from vlcp.config import config
from vlcp.protocol.zookeeper import ZooKeeper
import vlcp.protocol.zookeeper
from random import random
from vlcp.event.core import syscall_clearqueue
from logging import getLogger
_logger = getLogger(__name__)
@config('protocol.zookeeper')... | [
{
"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 | misc/zkbreaker.py | hubo1016/vlcp |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.