source string | points list | n_points int64 | path string | repo string |
|---|---|---|---|---|
import unittest
from context import parser
class TVShowFileParserTests(unittest.TestCase):
def setUp(self):
self.filename = parser.Parser("test.(2018).s01E01.1080p.avi")
def tearDown(self):
self.filename = None
def testObjValuesSet(self):
self.assertEqual(self.filename.showName,... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer":... | 3 | tests/Parser/012SXEX(YEAR)_test.py | Bas-Man/TVShowFile |
#!/usr/bin/env python
# Copyright 2017 Google, Inc
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding self/... | 3 | video/cloud-client/analyze/analyze_test.py | spitfire55/python-docs-samples |
from typing import List
from fastapi import APIRouter, HTTPException, status
from models.user import User, UserCreate
from db import db
router = APIRouter()
@router.get("/")
async def all() -> List[User]:
return list(db.users.values())
@router.get("/{user_id}")
async def get(user_id: int) -> User:
try:
... | [
{
"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": "all_function_names_snake_case",
"question": "Are all function names in this file written i... | 3 | backend/fastapi/build_dsApp/RESTfulAPI/routers/users.py | spideynolove/Other-repo |
from abc import ABCMeta, abstractmethod
class KeyEncoder:
"""Base class that any encoding class for EC keys should derive from.
All overriding methods should be static.
"""
__metaclass__ = ABCMeta
@abstractmethod
def encode_public_key(Q):
pass
@abstractmethod
def encode_priv... | [
{
"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 | fastecdsa/encoding/__init__.py | 1200wd/fastecdsa |
# -*- coding: utf-8 -*-
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: https://doc.scrapy.org/en/latest/topics/item-pipeline.html
import scrapy
from scrapy.pipelines.images import ImagesPipeline
from scrapy.exceptions import DropItem
import cnanime.items as... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?... | 3 | scrapy/cnanime/pipelines.py | tx19980520/new-tech-stack |
#!/usr/bin/env python
from __future__ import absolute_import, print_function
import sys
import pytest
class Collector(object):
RUN_INDIVIDUALLY = ['tests/test_pex.py']
def __init__(self):
self._collected = set()
def iter_collected(self):
for collected in sorted(self._collected):
yield collect... | [
{
"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 | scripts/list_tests.py | hbmartin/pex |
from sgqlc.endpoint.http import HTTPEndpoint
import os
import json
url = 'https://api.smash.gg/gql/alpha'
class MissingAPIKeyError(Exception):
pass
SMASHGG_API_KEY = os.environ.get('SMASHGG_API_KEY', None)
if SMASHGG_API_KEY is None:
raise MissingAPIKeyError('''
All requests require an API key.
See https://d... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"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 | smashggAPI/client.py | keithrobichaud/smashgg-api-wrapper-python |
import os
import tensorflow as tf
from merge.model import Model
def run_model_on_random_input(model):
batch_size = 1
height = 100
width = 200
inputs = {
'image': tf.random.uniform(shape=(batch_size, height, width, 3), minval=0, maxval=256, dtype='int32'),
'horz_split_points_probs': tf... | [
{
"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 | merge/evaluation.py | matroshenko/SPLERGE_via_TF |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
from pyowm.commons.databoxes import ImageType, Satellite, SubscriptionType
class TestImageType(unittest.TestCase):
def test_repr(self):
instance = ImageType('PDF', 'application/pdf')
repr(instance)
class TestSatellite(unittest.TestC... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer":... | 3 | tests/unit/commons/test_databoxes.py | ahertz/pyowm |
from cmd import Cmd
from zigbear.custom_protocol.Coordinator import Coordinator
class CoordinatorCli(Cmd):
def __init__(self, connector):
self.prompt = 'Zigbear/coordinator> '
super().__init__()
self.coordinator = Coordinator(connector)
def do_devices(self, _):
pass # TODO p... | [
{
"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 | zigbear/custom_protocol/coordinatorcli.py | philippnormann/zigbear |
class QueryAsyncIterator:
def __init__(self, query, callback=None):
self.query = query
self.sequence = None
self._sequence_iterator = None
self._callback = callback
def __aiter__(self):
return self
async def fetch_sequence(self) -> None:
self.sequence = awai... | [
{
"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 | tortoise/utils.py | EtzelWu/tortoise-orm |
import torch
import torch.nn as nn
import math
import numpy as np
def weights_init(m):
if type(m) == nn.Linear:
nn.init.xavier_uniform_(m.weight)
def pate(data, teachers, lap_scale, device="cpu"):
"""PATE implementation for GANs.
"""
num_teachers = len(teachers)
labels = torch.Tensor(num... | [
{
"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 | synth/snsynth/pytorch/nn/privacy_utils.py | AprilXiaoyanLiu/whitenoise-system |
import numpy as np
from bokeh.plotting import figure, show, output_notebook
from bokeh.layouts import gridplot
from bokeh.io import push_notebook
#output_notebook()
import numpy as np
def local_regression(x0, X, Y, tau):
# add bias term
x0 = np.r_[1, x0] # Add one to avoid the loss in information
... | [
{
"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 | 10-regression.py | koushalkh/ML-LAB |
from flask_wtf import FlaskForm
from wtforms import StringField,PasswordField,SubmitField,BooleanField
from wtforms.validators import Required,Email,EqualTo
from ..models import User
from wtforms import ValidationError
class RegistrationForm(FlaskForm):
email = StringField('Your Email Address',validators=[Require... | [
{
"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/auth/forms.py | felkiriinya/Personal-blog |
#import OpenStack connection class from the SDK
from openstack import connection
# Create a connection object by calling the constructor and pass the security information
conn = connection.Connection(auth_url="http://192.168.0.106/identity",
project_name="demo",
username="admin",
password="manoj",
user_domain_id="defa... | [
{
"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 | _/chapter5-OpenStack/BlockStoreService/VolumeOperations.py | paullewallencom/hybrid-cloud-978-1-7888-3087-4 |
from abc import ABC
import numpy as np
from geomstats.geometry.grassmannian import GrassmannianCanonicalMetric
class GrassmannianChordal2NormMetric(GrassmannianCanonicalMetric, ABC):
def __init__(self, n, p):
super().__init__(n, p)
def dist(self, point_a, point_b):
"""Chordal 2-norm distance between two point... | [
{
"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 | mihaelanistor/metrics/grassmannian/chordal_distance_2norm.py | s-shailja/challenge-iclr-2021 |
#!/usr/bin/python3
import errno
import os
import shutil
import tempfile
from .ExceptionDefinitions import *
VERSION_NUMBER = "3.4.0"
HELP_EMAIL = 'help@opensciencegrid.org'
def atomic_write(filename, contents):
"""Write to a temporary file then move it to its final location
"""
temp_fd, temp_name = tem... | [
{
"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 | osgpkitools/utils.py | mtru32/osg-pki-tools |
import falcon
from ebl.corpus.application.corpus import Corpus
from ebl.corpus.web.text_utils import create_chapter_id
from ebl.corpus.web.chapter_schemas import ApiChapterSchema
from ebl.users.web.require_scope import require_scope
class ChaptersResource:
def __init__(self, corpus: Corpus):
self._corpus... | [
{
"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": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter tha... | 3 | ebl/corpus/web/chapters.py | BuildJet/ebl-api |
"""empty message
Revision ID: f6d196dc5629
Revises: fd5076041bff
Create Date: 2019-04-06 22:25:32.133764
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'f6d196dc5629'
down_revision = 'fd5076041bff'
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 | services/backend/migrations/versions/f6d196dc5629_.py | YA-androidapp/vuejs-flask-docker |
# coding: utf-8
"""
Cisco Intersight
Cisco Intersight is a management platform delivered as a service with embedded analytics for your Cisco and 3rd party IT infrastructure. This platform offers an intelligent level of management that enables IT organizations to analyze, simplify, and automate their environmen... | [
{
"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 | test/test_vnic_eth_adapter_policy_list.py | sdnit-se/intersight-python |
class Template(object):
def __init__(self, _px):
self.px = _px
def Core(self):
raise NotImplementedError()
| [
{
"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 | TradingSystem/Algorithm/Template.py | KazWong/Jon |
#!/usr/bin/env python
import unittest
from pyspark.sql import SparkSession
from mmtfPyspark.io.mmtfReader import download_mmtf_files
from mmtfPyspark.filters import ContainsDSaccharideChain
from mmtfPyspark.mappers import *
class ContainsDSaccharideChainTest(unittest.TestCase):
def setUp(self):
self.spa... | [
{
"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 | mmtfPyspark/tests/filters/test_containsDSaccharideChain.py | sbliven/mmtf-pyspark |
"""
Python module to initialize Server Extension (& Notebook Extension?)
"""
from .handlers import setup_handlers
def _jupyter_server_extension_paths():
"""
Function to declare Jupyter Server Extension Paths.
"""
return [{"module": "jupyterlab_lsstextensions",}]
# def _jupyter_nbextension_paths():
#... | [
{
"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 | jupyterlab_lsstextensions/__init__.py | lsst-sqre/jupyterlab-lsst-extensions |
# -*- coding: utf-8 -*-
# @Time : 2018/7/9 上午10:41
# @Author : waitWalker
# @Email : waitwalker@163.com
# @File : MTTAESHandler.py
# @Software: PyCharm
from Handlers import MTTBaseHandler
from Security import MTTSecurityManager
from Crypto.Cipher import AES
class MTTAESHandler(MTTBaseHandler.MTTBaseHandler):... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
... | 3 | Handlers/MTTAESHandler.py | waitwalker/PetAPI |
# Copyright 2020 gRPC authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | [
{
"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": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer"... | 3 | examples/python/helloworld/async_greeter_server.py | gmambro/grpc |
# (c) 2020, Australian Rivers Institute
# Author: Lindsay Bradford
# http://cloc.sourceforge.net/
import subprocess
def main():
showCountOfLinesOfCode()
visualiseRepositoryViaGource()
def showCountOfLinesOfCode():
rootRepositoryDirectory = "../../../"
clocArray = ['cloc-1.88.exe', rootRepositoryDi... | [
{
"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 | internal/app/visualiseRepository/visualiseRepository.py | LindsayBradford/crm |
import starlette
from starlette.middleware import Middleware
from starlette.routing import Match
from ddtrace import config
from ddtrace.contrib.asgi.middleware import TraceMiddleware
from ddtrace.internal.logger import get_logger
from ddtrace.internal.utils.wrappers import unwrap as _u
from ddtrace.vendor.wrapt impor... | [
{
"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 | ddtrace/contrib/starlette/patch.py | p7g/dd-trace-py |
# -*- coding: utf-8 -*-
"""
Created on Fri May 06 14:54:11 2016
@author: Alexander Weaver
"""
"""
Performs an affine (fully connected) operation on its input
An affine layer with out_dim neurons takes a data array of size Nx(in_dim), x
and returns a linearly transformed Nx(out_dim) data array
The transformation resul... | [
{
"point_num": 1,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)?",
"answer": true
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inherit... | 3 | LearnyMcLearnface/Layers/AffineLayer.py | alexweav/Deep-Learning |
import heapq
import sys
from itertools import product
def load_data(path):
with open(path) as f:
return {
(i, j): int(value)
for i, line in enumerate(f.readlines())
for j, value in enumerate(line.strip())
}
def get_neighbours(loc, n_rows, n_cols):
neighbou... | [
{
"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 | 2021/day15.py | tcbegley/advent-of-code |
import asyncio
import os
from os.path import join, dirname
import discord
from discord.ext import commands
from dotenv import load_dotenv
from movietime import tiktok_blur
from imgur import upload
from settings import *
# discord gateway intents
intents = discord.Intents.default()
allowed_mentions = discord.Allowed... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
... | 3 | bot.py | Vaughan-Esports/MovieTime |
from glob import glob
import os
import struct
import pvl
import spiceypy as spice
import numpy as np
from ale.base import Driver
from ale.base.type_distortion import NoDistortion
from ale.base.data_naif import NaifSpice
from ale.base.label_isis import IsisLabel
from ale.base.type_sensor import Framer
class NewHorizo... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
... | 3 | ale/drivers/nh_drivers.py | ladoramkershner/ale |
from unittest import TestCase
from app.secrets import validate_required_secrets, EXPECTED_SECRETS
class TestSecrets(TestCase):
def test_validate_required_secrets_fails_on_missing(self):
secrets = {"secrets": {}}
with self.assertRaises(Exception) as exception:
validate_required_secre... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
... | 3 | tests/app/test_secrets.py | ons-eq-team/eq-questionnaire-runner |
import json
import nltk
import tweepy
def read_params():
'''
Helper function to read param.json file
Output :
params : params dictionary
'''
with open("auth_params.json") as f:
params = json.loads(f.read())
return params
def get_scores(g_list, tf_dict):
ss = []... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
... | 3 | helper.py | Abhishek-08/Movie-Haiku-Bot |
from fastapi import FastAPI
import pickle
from SatImages import SatImage
import uvicorn
def load_models():
"""
load the models from disk
and put them in a dictionary
Returns:
dict: loaded models
"""
models = {
"knn": pickle.load(open("./model_weights/clf.bin", 'rb'))
}
p... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "all_params_annotated",
"question": "Does every function parameter in this file have a type annotation (excluding se... | 3 | main.py | MartimChaves/glcm_sat_img |
from .validator_error import ValidatorError
class BaseValidator:
def __init__(self, settings):
self._settings = settings
def validate_upload(self):
raise ValidatorError("Unsupported function call.")
def validate_download(self):
raise ValidatorError("Unsupported function call.")
def validate_firmware(sel... | [
{
"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 | octoprint_marlin_flasher/validation/base_validator.py | AvanOsch/OctoPrint-Marlin-Flasher |
import pathlib
import pkg_resources
from mopidy import config, ext
__version__ = pkg_resources.get_distribution(
"Mopidy-MusicBox-Webclient"
).version
class Extension(ext.Extension):
dist_name = "Mopidy-MusicBox-Webclient"
ext_name = "musicbox_webclient"
version = __version__
def get_default_... | [
{
"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 | mopidy_musicbox_webclient/__init__.py | sprinkle1502/mopidy-musicbox-webclient |
#!/user/bin/python
# -*- coding: utf-8 -*-
import threading
import time
# 假定这是你的银行存款:
balance = 0
lock = threading.Lock()
def change_it(n):
# 先存后取,结果应该为0:
global balance
balance = balance + n
balance = balance - n
def run_thread(n):
for i in range(100000):
# 先要获取锁:
lock.acquire... | [
{
"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 | demo/multiprocess/06_lock.py | tinghaoMa/python |
#!/usr/bin/env python
"""
Script to generate a PDF of desired sightline
"""
import pdb
try:
ustr = unicode
except NameError:
ustr = str
def parser(options=None):
import argparse
# Parse
parser = argparse.ArgumentParser(
description='Generate a PDF of the desired sightline (v1.0)')
p... | [
{
"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 | papers/I/Analysis/py/sightline_pdf.py | AhmedElshaarany/qso_lya_detection_pipeline |
from itertools import combinations_with_replacement as comb, product, combinations
def must_consistent(part):
must = []
for i in range(len(part)):
must += list(comb(part[i], 2))
must += [(j, i) for i, j in must if i != j]
return must
def cannot_consistent(part):
cannot = []
for 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_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"... | 3 | CEC/utils.py | gmum/ecml17 |
import sys
import glob
import re
def simplify_credits(html):
"""
Replace the credit part of the HTML footer. Return the new text.
"""
s = r'<a class="muted-link" href="https://pradyunsg\.me">@pradyunsg</a>\'s'
pattern = re.compile(s)
html = pattern.sub(r'', html)
s = r'Copyright © 20... | [
{
"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 | docs/process_html.py | agile-geoscience/snowfake |
# This file is a part of GrumpyWidgets.
# The source code contained in this file is licensed under the MIT license.
# See LICENSE.txt in the main project directory, for more information.
from pythonic_testcase import *
from grumpywidgets.testhelpers import assert_same_html, template_widget
from grumpywidgets.widgets ... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
... | 3 | grumpywidgets/tests/label_test.py | FelixSchwarz/grumpywidgets |
# coding: utf-8
"""
SendinBlue API
SendinBlue provide a RESTFul API that can be used with any languages. With this API, you will be able to : - Manage your campaigns and get the statistics - Manage your contacts - Send transactional Emails and SMS - and much more... You can download our wrappers at h... | [
{
"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 | test/test_get_extended_contact_details_statistics.py | Danilka/APIv3-python-library |
# -*- coding: utf-8 -*-
"""
@date: 2020/11/21 下午4:16
@file: test_resnest.py
@author: zj
@description:
"""
import torch
from zcls.config import cfg
from zcls.config.key_word import KEY_OUTPUT
from zcls.model.recognizers.resnet.resnet import ResNet
def test_data(model, input_shape, output_shape):
data = torch.r... | [
{
"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_model/test_recognizer/test_sknet.py | ZJCV/PyCls |
# AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from __future__ import unicode_literals
from ..dti import DTLUTGen
def test_DTLUTGen_inputs():
input_map = dict(
acg=dict(argstr='-acg', ),
args=dict(argstr='%s', ),
bingham=dict(argstr='-bingham', ),
environ=dict(
n... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": fal... | 3 | nipype/interfaces/camino/tests/test_auto_DTLUTGen.py | lucindasisk/nipype |
import os
import imp
import torch
import torch.nn as nn
current_path = os.path.abspath(__file__)
filepath_to_linear_classifier_definition = os.path.join(os.path.dirname(current_path), 'LinearClassifier.py')
LinearClassifier = imp.load_source('',filepath_to_linear_classifier_definition).create_model
class MClassifier... | [
{
"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 | pytorch_feature_decoupling/architectures/MultipleLinearClassifiers.py | anantalp/FeatureDecoupling |
#!/usr/bin/env python3
from gibson2.envs.igibson_env import iGibsonEnv
from gibson2.utils.utils import l2_distance
from utils import datautils
import numpy as np
import gym
class NavigateGibsonEnv(iGibsonEnv):
def __init__(
self,
config_file,
scene_id=None,
mode='headless',
... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
},
{
"point_num": 2,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
}... | 3 | src/tensorflow/igibson/utils/navigate_env.py | suresh-guttikonda/sim-environment |
import pandas as pd
def get_value(text):
return text.split("_")[0]
def load_results(path: str, params):
all_parameters = {}
file_name = path.split("/")[-1].split(".csv")[0]
file_name = file_name.split("=")[1:]
for i, f in enumerate(file_name):
all_parameters[params[i]] = get_value(f)
... | [
{
"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 | scripts/data_utils.py | robertjankowski/social-media-influence-on-covid-pandemic |
class ParameterDefinition(object):
def __init__(self, name, param_type=None, value=None):
self.name = name
self.param_type = param_type
self.value = value
class Parameter(object):
def __init__(self, definition):
self.definition = definition
self.value = definition.val... | [
{
"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 | parameter.py | Correct-Syntax/PyNodeEval |
from typing import Optional
from sqlalchemy import select
from sqlalchemy.ext.asyncio import AsyncSession
from Backend.crud.base import CRUDBase
from Backend.database.models import Roles
class CRUDRoles(CRUDBase):
async def upsert(self, db: AsyncSession, guild_id: int, role_name: str, role_id: int):
"""... | [
{
"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_function_has_docstring",
"question": "Does every function in this file have a docstr... | 3 | Backend/crud/discord/roles.py | LukasSchmid97/elevatorbot |
import ActividadVolcanica.JcampReader.fileHandler as handler
import numpy as np
def parser (filename):
ToParse = handler.read(filename)
ArgList = ToParse.split("##")
ArgList.remove("")
Parameters =dict()
for x in ArgList:
try:
y = x.split("=")
if y[0] != "XYDATA":
... | [
{
"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 | JcampReader/fileParser.py | aubravo/Clasificacion-de-actividad-volcanica |
import urllib.parse
import Constants.ApiPoints as ApiPoints
def getXML(accessToken, proxies={}):
import requests
return requests.post(ApiPoints.SERVERS, data={"accessToken": accessToken,
"game_net": "Unity", "play_platform": "Unity", "game_net_user_id": "... | [
{
"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 | Helpers/Servers.py | jeui123/pyrelay |
from typing import Tuple, Callable, Sequence, Any, List, TypeVar
from ..model import Model
from ..config import registry
from ..types import Array2d, List2d
ItemT = TypeVar("ItemT")
InT = Sequence[Sequence[ItemT]]
OutT = List2d
@registry.layers("with_flatten.v1")
def with_flatten(layer: Model) -> Model[InT, OutT]:... | [
{
"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 | thinc/layers/with_flatten.py | TheVinhLuong102/thinc |
#!/usr/bin/env python
# Copyright 2011 WebDriver committers
# Copyright 2011 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
... | 3 | py/test/selenium/webdriver/remote/test_remote_interactions.py | chromium-googlesource-mirror/selenium |
from __future__ import print_function
if 1:
# deal with old files, forcing to numpy
import tables.flavor
tables.flavor.restrict_flavors(keep=["numpy"])
import numpy
import sys, os, time
from optparse import OptionParser
import tables
import matplotlib.mlab as mlab
def convert(
infilename, outfilena... | [
{
"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 | flydra_analysis/flydra_analysis/a2/flydra_textlog2csv.py | elhananby/flydra |
# uri: https://adventofcode.com/2021/day/4
from typing import Optional
from base import get_input
file_path = get_input(4, ".txt")
INPUT = """7,4,9,5,11,17,23,2,0,14,21,24,10,16,13,6,15,25,12,22,18,20,8,19,3,26,1
22 13 17 11 0
8 2 23 4 24
21 9 14 16 7
6 10 3 18 5
1 12 20 15 19
3 15 0 2 22
9 18 13 17 ... | [
{
"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 | day4/day4.py | jberends/aoc2021 |
import os
import pytest
from sap.aibus.dar.client.data_manager_client import DataManagerClient
from sap.aibus.dar.client.inference_client import InferenceClient
from sap.aibus.dar.client.model_manager_client import ModelManagerClient
from sap.aibus.dar.client.util.credentials import OnlineCredentialsSource
from sap.a... | [
{
"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 | system_tests/conftest.py | Juliana-Morais/data-attribute-recommendation-python-sdk |
from __future__ import print_function
from oauth2client.client import OAuth2WebServerFlow
import gmusicapi
from mopidy import commands
class GMusicCommand(commands.Command):
def __init__(self):
super(GMusicCommand, self).__init__()
self.add_child('login', LoginCommand())
class LoginCommand(co... | [
{
"point_num": 1,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
"answ... | 3 | mopidy_gmusic/commands.py | jacobobryant/mopidy-gmusic |
from tkinter import *
myGui = Tk()
def Hello():
b = a.get()
myLabel3 = Label(text=b,fg='white',bg='black').pack()
def Bye():
d = c.get()
myLabel4 = Label(text='Bye, Bot!').pack()
a = StringVar()
c = StringVar()
myGui.title("Python-GUI")
myGui.geometry("500x500+100+50")
... | [
{
"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 | operations using tkinter/textBox.py | XORsalaria/python-GUI |
# -*- coding: utf-8 -*-
"""
LemonSoap - impute scent.
Determines which columns have potentially sequential data, and if so offers to
estimate values.
* Missing completely at random (MCAR)
* Missing at random (MAR)
* Not missing at random (NMAR)
1. If numerical:
1. If constant, then fill in with same values.
... | [
{
"point_num": 1,
"id": "every_function_has_docstring",
"question": "Does every function in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
... | 3 | lemonsoap/scent/impute_scent.py | Ekrekr/LemonSoap |
import numpy as np
from pymoo.core.survival import Survival
from pymoo.util.nds.non_dominated_sorting import NonDominatedSorting
from pymoo.util.randomized_argsort import randomized_argsort
# ---------------------------------------------------------------------------------------------------------
# Survival Selection... | [
{
"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 | evosoro_pymoo/Algorithms/RankAndNoveltySurvival.py | leguiart/MSc_Thesis |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
This file contains code to serve a web application to convert HTML to PDF.
This application uses a local install of the `wkhtmltopdf` binary for the conversion.
"""
import os
from subprocess import check_output
from tempfile import TemporaryDirectory
from starlette.a... | [
{
"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/app.py | mtik00/wkhtmltopdf-service |
from talon import Context, actions, Module
mod = Module()
ctx = Context()
# ctx.matches = r"""
# app.bundle: com.sublimetext.4
# """
# ctx.matches = r"""
# os: windows
# and app.name: Sublime Text
# """
ctx.matches = r"""
os: windows
and app.exe: sublime_text.exe
"""
@ctx.action_class("edit")
class edit_actions:
... | [
{
"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 | apps/win/sublime_text/sublime_text.py | PetrKryslUCSD/knausj_talon_pk |
#!/usr/bin/env python
# -*- coding: utf8 - *-
from __future__ import print_function, unicode_literals
from cihai.core import Cihai
from cihai.extend import Dataset
data = {} # any data source, internal, a file, on the internet, in a database...
class MyDataset(Dataset):
def bootstrap(self): # automatically ra... | [
{
"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 | examples/dataset.py | fossabot/cihai |
"""
Base class for losses.
Reduction mecanisms are implemented here.
"""
import torch.nn as tnn
from nitorch.core.math import nansum, nanmean, sum, mean
class Loss(tnn.Module):
"""Base class for losses."""
def __init__(self, reduction='mean'):
"""
Parameters
----------
redu... | [
{
"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 | nitorch/nn/losses/base.py | balbasty/nitorch |
import json
from ..utils import format_item_payload, validate_response
class ProfileEmbedding():
"""Manage embedding related profile calls."""
def __init__(self, api):
"""Init."""
self.client = api
def get(self, source_key, key=None, reference=None, email=None, fields={}):
"""
... | [
{
"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 | hrflow/hrflow/profile/embedding.py | Riminder/python-hrflow-api |
from grammar_productions.production import Production
from grammar_productions.integer import Integer
class MultiplyExpression(Production):
def __init__(self, left_element, right_element):
self.left_element = left_element
self.right_element = right_element
def __repr__(self):
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": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": ... | 3 | grammar_productions/multiply_expression.py | puskini33/Calculator |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
'''
Created on 2018年6月19日 @author: encodingl
'''
import time
import datetime
from apscheduler.schedulers.blocking import BlockingScheduler
from apscheduler.schedulers.background import BackgroundScheduler
def job1(f):
print(time.strftime('%Y-%m-%d %H:%M:%S', time.lo... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?",
... | 3 | lib/lib_apscheduler.py | ZhaoUncle/skstack |
import pytest
from localstack.utils.objects import SubtypesInstanceManager
def test_subtypes_instance_manager():
class BaseClass(SubtypesInstanceManager):
def foo(self):
pass
class C1(BaseClass):
@staticmethod
def impl_name() -> str:
return "c1"
def f... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": true... | 3 | tests/unit/utils/test_objects.py | matt-mercer/localstack |
def check_sort(arr):
prev = float('-inf')
for num in arr:
if num < prev:
return False
if num >= prev:
prev = num
return True
def merge_sort(arr):
if len(arr) > 1:
mid = len(arr)//2
left = arr[:mid]
right = arr[mid:]
merge_sort(left... | [
{
"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 | python/python/merge-sort/merge.py | iggy18/data-structures-and-algorithms |
import yaml
from basepy.config import Settings
def load_yaml(content_str):
ret = yaml.safe_load(content_str)
return ret
def load():
Settings.register_loader('.yaml', load_yaml)
Settings.register_loader('.yml', load_yaml) | [
{
"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 | basepy/more/yaml_config.py | pyflow/insightpy |
class Rocket():
def __init__(self, x, y):
self.x = x
self.y = y
print('I created a rocket')
def move_rocket(self, x_increment=0, y_increment=1):
self.x += x_increment
self.y += y_increment
print('Vroooommmm')
def print_rocket(self):
print... | [
{
"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 | python_exercises/30Rocket.py | Matheus-IT/lang-python-related |
import os
import unittest
from django.conf.urls import url
from django.http import HttpResponse
def task(*args, **kwargs):
print('*'*10)
def detail(request, question_id):
return HttpResponse("You're looking at question %s." % question_id)
urlpatterns = [
url(r'^/ssss/xxx/$', detail),
url(r'^/ssuuu... | [
{
"point_num": 1,
"id": "all_function_names_snake_case",
"question": "Are all function names in this file written in snake_case?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer":... | 3 | tests/test_rabbitmq_consumer_command.py | LaEmma/sparrow_cloud |
from pathlib import Path
from unittest.mock import MagicMock
import pytest
from gretel_client.config import configure_session
FIXTURES = Path(__file__).parent / "fixtures"
@pytest.fixture
def get_fixture():
def _(name: str) -> Path:
return FIXTURES / name
return _
@pytest.fixture(scope="function... | [
{
"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/gretel_client/conftest.py | gretelai/gretel-python-client |
from fastapi.testclient import TestClient
import pytest
import os
from ..main import app, session
from sqlmodel import SQLModel, Session, create_engine
from sqlmodel.pool import StaticPool
from ..api.epic_area import get_session
@pytest.mark.order(1)
def test_post_epic_area(client):
response = client.post(
... | [
{
"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 | backend/tests/test_epic_area_api.py | DaniilJSN/timeflow |
from ..base import BaseHistoryItem, GenericHistoryItem
from ..utils import PolymorphicBase
class ApprovedHistoryItem(BaseHistoryItem):
field = "approved"
field_name = "Resolvability assessment: Approval"
def get_value(self, value):
if value is True:
return "Approved"
elif valu... | [
{
"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 | barriers/models/history/assessments/resolvability.py | felix781/market-access-python-frontend |
class BaseFileGetter:
async def get_file(self, file_id: str):
raise NotImplementedError()
async def get_userpic(self, user_id: int):
raise NotImplementedError()
async def get_thumb(self, message):
"""
Тупой алгоритм,
который рекурсивно с конца ищет поле "thumb"
... | [
{
"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 | tgquote/filegetters/base.py | Forevka/tgquote |
# GNU MediaGoblin -- federated, autonomous media hosting
# Copyright (C) 2013 MediaGoblin contributors. See AUTHORS.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of... | [
{
"point_num": 1,
"id": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?",
"answer": false
},
{
"point_num": 2,
"id": "has_nested_function_def",
"question": "Does this file contain any function defined inside another function?... | 3 | mediagoblin/tests/resources.py | acidburn0zzz/mediagoblin |
from rest_framework import permissions
class UpdateOwnProfile(permissions.BasePermission):
"""Allow users to edit their own profile"""
def has_object_permission(self, request, view, obj):
"""Check user is trying to edit their own profile"""
if request.method in permissions.SAFE_METHODS:
... | [
{
"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": false... | 3 | profiles_api/permissions.py | hjquiroga/profiles-rest-api |
class Doer(object):
def __init__(self, frontend):
self.__frontend = frontend
async def do(self, action):
return await self.__frontend.do(action) | [
{
"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 | maxwell/doer.py | maxwell-dev/maxwell-client-python |
#!/usr/bin/env python
# coding: utf-8
# This notebook was prepared by [Donne Martin](http://donnemartin.com). Source and license info is on [GitHub](https://github.com/donnemartin/interactive-coding-challenges).
# # Challenge Notebook
# ## Problem: Maximizing XOR
#
# See the [HackerRank problem page](https://www.ha... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{... | 3 | online_judges/maximizing_xor/maximizing_xor_challenge.py | stephank007/python_challenges |
import os,sys
import cytnx as cy
class Hising(cy.LinOp):
def __init__(self,L,J,Hx):
cy.LinOp.__init__(self,"mv_elem",2**L,cy.Type.Double,cy.Device.cpu)
## custom members:
self.J = J
self.Hx = Hx
self.L = L
def SzSz(self,i,j,ipt_id):
return ipt_id,(1. - ... | [
{
"point_num": 1,
"id": "has_multiple_inheritance",
"question": "Does any class in this file use multiple inheritance?",
"answer": false
},
{
"point_num": 2,
"id": "any_function_over_40_lines",
"question": "Is any function in this file longer than 40 lines?",
"answer": false
},... | 3 | example/ED/ed_ising_mve.py | j9263178/Cytnx |
import random
def quick_sort(data):
left = 0
right = len(data) - 1
output = randomized_quick_sort(data, left, right)
return output
def randomized_quick_sort(data, left, right):
if left <= right:
temp = random.randint(left, right)
data[left], data[temp] = data[temp], data[left]
... | [
{
"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 | sorting.py | harsh793/Algorithms |
#!/usr/bin/env python3
# Copyright (c) 2017 The Eurodollar Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test deprecation of RPC calls."""
from test_framework.test_framework import EurodollarTestFramework
from ... | [
{
"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/functional/rpc_deprecated.py | watchdog1023/Eurodollar |
# -*- coding: utf-8 -*-
import codecs
import re
import sys
from distutils.core import setup
import os
if sys.version_info < (3, 5, 0):
raise RuntimeError("aio-space-track-api requires Python 3.5.0+")
PROJECT_DIR = os.path.abspath(os.path.dirname(__file__))
VERSION_REGEXP = re.compile(r"^__version__ = [\'\"](.+?... | [
{
"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 | setup.py | NikitaKoshelev/aio-space-track-api |
from mako.template import Template
import os
from importlib import import_module
import pathlib
import zipfile
# TODO: Replace with Python 3.9's importlib.resources.files() when it becomes min version
def files(package):
spec = import_module(package).__spec__
if spec.submodule_search_locations is None:
... | [
{
"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 | frc_characterization/logger_analyzer/__init__.py | CodingWithFusion/frc-characterization |
"""
html_generator.py
this module perform making result of backtest into HTML format.
"""
import os
from jinja2 import Environment, PackageLoader
from abc import *
class HtmlGenerator(metaclass=ABCMeta):
PACKAGE_PATH = os.path.basename(os.path.dirname(os.path.realpath(__file__)))
TEMPLATE_PATH = "templates... | [
{
"point_num": 1,
"id": "every_class_has_docstring",
"question": "Does every class in this file have a docstring?",
"answer": false
},
{
"point_num": 2,
"id": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding self/cls)... | 3 | kostock/html_generator.py | sanggong/test2 |
'''
Created on May 25, 2012
@author: Jason Huang
'''
def getV(a, i):
if(i < 0):
return -float('inf')
if(i >= len(a)):
return float('inf')
return a[i]
def findK(a, b, K):
'''binary search based approach
'''
def findKImpl(a, b, k):
lo = 0
... | [
{
"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": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (e... | 4 | seer_python/jason/KthElementInTwoSortedArray.py | jastination/software-engineering-excercise-repository |
from .data import Data
def tango(req):
words = Data.get_list()
words = list(map(lambda x: x['kanji'], words))
return ', '.join(words)
def hello_world(req):
return '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": "all_return_types_annotated",
"question": "Does every function in this file have a return type annotation?... | 3 | python/application/handlers.py | b-z/Tango |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function
from derrick.core.extension import ExtensionPoint
class Engine(ExtensionPoint):
# Return Engine class name as unique index
def __init__(self):
self.name = self.__class__.__name__.lower()
... | [
{
"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 | derrick/core/engine.py | PyCN/derrick |
# import riaps
from riaps.run.comp import Component
import logging
class Hello(Component):
def __init__(self):
super(Hello, self).__init__()
def on_clock(self):
now = self.clock.recv_pyobj() # Receive time.time() as float
self.logger.info('on_clock(): %s' % str(now))
| [
{
"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 | tests/Hello/Hello.py | timkrentz/riaps-pycom |
#! /usr/bin/env python
from tornado import httpserver
from tornado import gen
from tornado.ioloop import IOLoop
import tornado.web
import json
import single_eval as sev
class IndexHandler(tornado.web.RequestHandler):
def get(self):
self.write("Hello,This is TextCNN")
class ClassifyHandler(tornado.... | [
{
"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 | web/tex_cnn_rest.py | wbj0110/cnn-text-classification-tf-chinese |
from mpmath import *
def test_pslq():
mp.dps = 15
assert pslq([3*pi+4*e/7, pi, e, log(2)]) == [7, -21, -4, 0]
assert pslq([4.9999999999999991, 1]) == [1, -5]
assert pslq([2,1]) == [1, -2]
def test_identify():
mp.dps = 20
assert identify(zeta(4), ['log(2)', 'pi**4']) == '((1/90)*pi**4)'
mp.... | [
{
"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 | stats_scripts/mpmath/tests/test_identify.py | michalkouril/altanalyze |
import discord
import logging
from datetime import datetime
def dateformat(dtime=None):
"""Formats a date.
Args:
dtime: The datetime. If None, this will be the current time.
"""
if dtime is None:
dtime = datetime.now()
return dtime.strftime("%Y-%m-%d %H:%M:%S")
def init_logging(... | [
{
"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 | misc/util.py | LordKorea/BaseBot |
import requests
def main():
'''
先请求页面维持会话和取得页面隐藏字段token
'''
headers = {
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36',
}
session = requests.Session() #会话维持
data = {
'gotopage':'%2Fc4w9... | [
{
"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 | add/add2mysql/test.py | llcoolmxdx5/series |
import unittest
import pytest
import stomp
from stomp import logging
from stomp.listener import TestListener
from .testutils import *
@pytest.fixture()
def conn():
conn = stomp.Connection11(get_default_host())
conn.set_listener("testlistener", TestListener("123", print_to_log=True))
conn.connect(get_def... | [
{
"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/test_activemq.py | wordlesstruth/stomp.py |
class Selectors(object):
def setup_bot(self, settings, spec, items, extractors, logger):
self.logger = logger
self.selectors = {} # { template_id: { field_name: {..} }
for template in spec['templates']:
template_id = template.get('page_id')
self.selectors[template_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": "no_function_exceeds_5_params",
"question": "Does every function in this file take 5 or fewer parameters (excluding ... | 3 | slybot/slybot/plugins/selectors/__init__.py | DataKnower/dk-portia |
'''
Created by auto_sdk on 2015.12.17
'''
from top.api.base import RestApi
class TmcMessagesConfirmRequest(RestApi):
def __init__(self, domain='gw.api.taobao.com', port=80):
RestApi.__init__(self, domain, port)
self.f_message_ids = None
self.group_name = None
self.s_message_ids = N... | [
{
"point_num": 1,
"id": "every_function_under_20_lines",
"question": "Is every function in this file shorter than 20 lines?",
"answer": true
},
{
"point_num": 2,
"id": "more_functions_than_classes",
"question": "Does this file define more functions than classes?",
"answer": true
... | 3 | top/api/rest/TmcMessagesConfirmRequest.py | looio/jst |
from __future__ import print_function
import time
import mock
from asyncpushbullet import chat
class TestChats:
def setup_class(self):
self.contact_email = "test.chat@example.com"
chat_info = {
"active": True, "created": time.time(), "modified": time.time(),
"with": {
... | [
{
"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 | tests/test_chats.py | rharder/pushbullet.py |
"""
Capstone Project. Code to run on the EV3 robot (NOT on a laptop).
Author: Your professors (for the framework)
and Zhicheng Kai.
Winter term, 2018-2019.
"""
import rosebot
import mqtt_remote_method_calls as com
import time
import shared_gui_delegate_on_robot
def main():
"""
This code, which mu... | [
{
"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 | src/m1_run_this_on_robot.py | dandanT-T/99-CapstoneProject-201920 |
def default_transformer(results):
results_cleaned = results
return results_cleaned
class InvanaBotTranformerBase(object):
def __init__(self, cti_config=None,
transformer_name=None,
cit_id=None,
crawled_id=None,
job_id=None):
if ... | [
{
"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 | invana_bot/transformers/default.py | subhead/invana-bot |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.