max_stars_repo_path stringlengths 6 149 | max_stars_repo_name stringclasses 629
values | max_stars_count int64 2.02k 191k | id stringlengths 3 8 | content stringlengths 15 158k | violations stringclasses 51
values | bugs stringclasses 11
values | duplicated_lines_density stringclasses 46
values | cognitive_complexity stringclasses 117
values | vulnerabilities stringclasses 3
values | code_smells stringclasses 50
values | sqale_rating stringclasses 4
values | security_hotspots stringclasses 17
values | complexity stringclasses 112
values | issues listlengths 0 100 | __index_level_0__ int64 2 13.3k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
src/python/grpcio_tests/tests/unit/_cython/_server_test.py | warlock135/grpc | 36,552 | 8047522 | # Copyright 2017 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... | 5 | 0 | 0.0 | 1 | 0 | 5 | 1.0 | 0 | 2 | [
{
"impacts": [
{
"severity": "LOW",
"softwareQuality": "MAINTAINABILITY"
}
],
"line": 31,
"message": "Remove the unused local variable \"port\".",
"textRange": {
"endLine": 31,
"endOffset": 12,
"startLine": 31,
"startOffset": 8
},
"type... | 4,926 |
desktop/core/ext-py/nose-1.3.7/examples/plugin/plug.py | kokosing/hue | 5,079 | 3381786 | <filename>desktop/core/ext-py/nose-1.3.7/examples/plugin/plug.py
from nose.plugins import Plugin
class ExamplePlugin(Plugin):
pass
| null | null | null | null | null | null | null | null | null | [] | 2,918 |
tests/db_functions/math/test_log.py | Lord-Elrond/django | 61,676 | 140063 | <reponame>Lord-Elrond/django
import math
from decimal import Decimal
from django.db.models.functions import Log
from django.test import TestCase
from ..models import DecimalModel, FloatModel, IntegerModel
class LogTests(TestCase):
def test_null(self):
IntegerModel.objects.create(big=100)
obj = ... | 0 | 0 | 0.0 | 0 | 0 | 0 | 1.0 | 0 | 4 | [] | 863 |
sklearn/gaussian_process/tests/_mini_sequence_kernel.py | MaiRajborirug/scikit-learn | 50,961 | 91634 | from sklearn.gaussian_process.kernels import Kernel, Hyperparameter
from sklearn.gaussian_process.kernels import GenericKernelMixin
from sklearn.gaussian_process.kernels import StationaryKernelMixin
import numpy as np
from sklearn.base import clone
class MiniSeqKernel(GenericKernelMixin, StationaryKernelMixin, Kernel... | 3 | 0 | 0.0 | 5 | 0 | 3 | 1.0 | 0 | 11 | [
{
"impacts": [
{
"severity": "LOW",
"softwareQuality": "MAINTAINABILITY"
}
],
"line": 32,
"message": "Rename this parameter \"X\" to match the regular expression ^[_a-z][a-z0-9_]*$.",
"textRange": {
"endLine": 32,
"endOffset": 24,
"startLine": 32,
... | 585 |
python/tvm/relay/op/vm/vm.py | XiaoSong9905/tvm | 4,640 | 11348370 | # 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... | 0 | 0 | 0.0 | 0 | 0 | 0 | 1.0 | 0 | 4 | [] | 7,172 |
tests/sanic/conftest.py | TheVinhLuong102/Strawberry | 2,062 | 11458546 | <gh_stars>1000+
import pytest
from .app import create_app
@pytest.fixture
def sanic_client():
yield create_app()
| null | null | null | null | null | null | null | null | null | [] | 9,616 |
libs/boxes/roi.py | wesen/FastMaskRCNN | 3,509 | 11339840 | <gh_stars>1000+
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import functools
import numpy as np
import tensorflow as tf
import tensorflow.contrib.slim as slim
def roi_align(feat, boxes):
"""Given features and boxes, This function crops feature """
r... | 8 | 0 | 0.0 | 0 | 0 | 8 | 2.0 | 0 | 2 | [
{
"impacts": [
{
"severity": "MEDIUM",
"softwareQuality": "MAINTAINABILITY"
}
],
"line": 10,
"message": "Remove the unused function parameter \"feat\".",
"textRange": {
"endLine": 10,
"endOffset": 18,
"startLine": 10,
"startOffset": 14
},
... | 7,121 |
desktop/core/ext-py/repoze.who-2.3/repoze/who/plugins/auth_tkt.py | kokosing/hue | 5,079 | 1667072 | import datetime
from codecs import utf_8_decode
from codecs import utf_8_encode
import hashlib
import os
import time
from wsgiref.handlers import _monthname # Locale-independent, RFC-2616
from wsgiref.handlers import _weekdayname # Locale-independent, RFC-2616
try:
from urllib.parse import urlencode, parse_qs... | 3 | 0 | 0.0 | 48 | 0 | 3 | 1.0 | 0 | 44 | [
{
"impacts": [
{
"severity": "MEDIUM",
"softwareQuality": "MAINTAINABILITY"
}
],
"line": 106,
"message": "Remove the unused function parameter \"identity\".",
"textRange": {
"endLine": 106,
"endOffset": 38,
"startLine": 106,
"startOffset": 30
... | 1,454 |
bokeh/server/django/__init__.py | g-parki/bokeh | 15,193 | 6771486 | <filename>bokeh/server/django/__init__.py
# Bokeh imports
from bokeh.util.dependencies import import_required
# Bokeh imports
from .apps import DjangoBokehConfig
from .routing import autoload, directory, document
from .static import static_extensions
import_required("django", "django is required by bokeh.server.djang... | 0 | 0 | 0.0 | 0 | 0 | 0 | 1.0 | 0 | 0 | [] | 9,179 |
packages/python/plotly/plotly/tests/test_optional/test_px/test_colors.py | mastermind88/plotly.py | 11,750 | 4327666 | <gh_stars>1000+
import plotly.express as px
def test_reversed_colorscale():
fig1 = px.scatter(
x=[1, 2], y=[2, 3], color=[3, 4], color_continuous_scale="plasma_r"
)
fig2 = px.scatter(x=[1, 2], y=[2, 3], color=[3, 4], color_continuous_scale="plasma")
colors1 = [val[1] for val in fig1.layout.col... | 0 | 0 | 0.0 | 0 | 0 | 0 | 1.0 | 0 | 1 | [] | 13,235 |
apps/opencv_stitching_tool/opencv_stitching/image_handler.py | nowireless/opencv | 56,632 | 11523688 | <reponame>nowireless/opencv
import cv2 as cv
from .megapix_downscaler import MegapixDownscaler
from .stitching_error import StitchingError
class ImageHandler:
DEFAULT_MEDIUM_MEGAPIX = 0.6
DEFAULT_LOW_MEGAPIX = 0.1
DEFAULT_FINAL_MEGAPIX = -1
def __init__(self,
medium_megapix=DEFAULT_... | 0 | 0 | 0.0 | 8 | 0 | 0 | 1.0 | 0 | 23 | [] | 9,912 |
poem/cv_mim/pipelines.py | DionysisChristopoulos/google-research | 23,901 | 11274825 | # coding=utf-8
# Copyright 2021 The Google Research 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 applicab... | 1 | 0 | 0.0 | 7 | 0 | 1 | 1.0 | 0 | 8 | [
{
"impacts": [
{
"severity": "MEDIUM",
"softwareQuality": "MAINTAINABILITY"
}
],
"line": 29,
"message": "Function \"create_dataset_from_tables\" has 18 parameters, which is greater than the 13 authorized.",
"textRange": {
"endLine": 46,
"endOffset": 13,
... | 6,733 |
torch_geometric/nn/acts.py | NucciTheBoss/pytorch_geometric | 12,651 | 178744 | <reponame>NucciTheBoss/pytorch_geometric<gh_stars>1000+
def swish(x):
return x * x.sigmoid()
| 0 | 0 | 0.0 | 0 | 0 | 0 | 1.0 | 0 | 1 | [] | 1,099 |
recipes/Python/578535_lndirpy_short_pythversiBSDX11_lndir/recipe-578535.py | tdiprima/code | 2,023 | 4071122 | #!/usr/bin/env python
################################################################################
# #
# Copyright (c) 2013, Mike 'Fuzzy' Partin <<EMAIL>> #
# All rights reserved. ... | 1 | 0 | 0.0 | 39 | 0 | 1 | 1.0 | 0 | 10 | [
{
"impacts": [
{
"severity": "LOW",
"softwareQuality": "MAINTAINABILITY"
}
],
"line": 74,
"message": "Use `endswith` here.",
"textRange": {
"endLine": 74,
"endOffset": 26,
"startLine": 74,
"startOffset": 11
},
"type": "CODE_SMELL"
}
] | 12,834 |
tests/components/image_processing/test_init.py | MrDelik/core | 30,023 | 6472508 | <reponame>MrDelik/core<gh_stars>1000+
"""The tests for the image_processing component."""
from unittest.mock import PropertyMock, patch
import pytest
import homeassistant.components.http as http
import homeassistant.components.image_processing as ip
from homeassistant.const import ATTR_ENTITY_PICTURE
from homeassista... | 8 | 5 | 0.0 | 0 | 0 | 3 | 1.0 | 0 | 19 | [
{
"impacts": [
{
"severity": "HIGH",
"softwareQuality": "MAINTAINABILITY"
}
],
"line": 90,
"message": "Define a constant instead of duplicating this literal \"image_processing.test\" 4 times.",
"textRange": {
"endLine": 90,
"endOffset": 61,
"startLin... | 4,150 |
pipenv/patched/piptools/repositories/__init__.py | Enzime/pipenv | 18,636 | 9671823 | <gh_stars>1000+
# flake8: noqa
from .local import LocalRequirementsRepository
from .pypi import PyPIRepository
| 0 | 0 | 0.0 | 0 | 0 | 0 | 1.0 | 0 | 0 | [] | 5,906 |
torch/autograd/profiler.py | xiaohanhuang/pytorch | 60,067 | 11457937 | <gh_stars>1000+
from torch.autograd.profiler_util import (
EventList, FunctionEvent, MemRecordsAcc, MEMORY_EVENT_NAME,
_filter_name, _filter_stack_entry, _rewrite_name
)
from torch.autograd import (
DeviceType, ProfilerActivity, ProfilerConfig, ProfilerState,
kineto_available, _ProfilerResult, _disable... | null | null | null | null | null | null | null | null | null | [] | 9,615 |
tests/validation/tests/v1_api/test_deployment.py | ursinnDev/rancher_rancher | 18,697 | 9768808 | from .common import * # NOQA
import pytest
namespace = {"client": None, "ns": None}
def test_namespace_create():
template = read_yaml_from_resource_dir("namespace.yaml")
template["metadata"]["name"] = random_test_name()
client = namespace["client"]
res = client.create_namespace(template)
# valid... | null | null | null | null | null | null | null | null | null | [] | 6,232 |
tests/components/motion_blinds/__init__.py | tbarbette/core | 30,023 | 8241861 | <reponame>tbarbette/core
"""Tests for the Motion Blinds integration."""
| 0 | 0 | 0.0 | 0 | 0 | 0 | 1.0 | 0 | 0 | [] | 9,202 |
posthog/settings/cloud.py | dorucioclea/posthog | 7,409 | 9633711 | # Overridden in posthog-cloud
import sys
from posthog.settings.utils import get_from_env, print_warning, str_to_bool
# Early exit to avoid issues with cloud not being properly included
if get_from_env("MULTI_TENANCY", False, type_cast=str_to_bool):
print_warning(("️Environment variable MULTI_TENANCY is set, but ... | null | null | null | null | null | null | null | null | null | [] | 5,668 |
xirl/xirl/evaluators/reward_visualizer.py | xxdreck/google-research | 23,901 | 10173439 | # coding=utf-8
# Copyright 2021 The Google Research 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 applicab... | null | null | null | null | null | null | null | null | null | [] | 11,923 |
python/paddle/fluid/tests/unittests/test_conv2d_transpose_op_depthwise_conv.py | zmxdream/Paddle | 17,085 | 10185976 | # Copyright (c) 2018 PaddlePaddle Authors. 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 app... | null | null | null | null | null | null | null | null | null | [] | 12,003 |
homeassistant/components/unifiprotect/light.py | liangleslie/core | 30,023 | 515251 | <gh_stars>1000+
"""This component provides Lights for UniFi Protect."""
from __future__ import annotations
import logging
from typing import Any
from pyunifiprotect.data import Light
from homeassistant.components.light import ATTR_BRIGHTNESS, ColorMode, LightEntity
from homeassistant.config_entries import ConfigEntr... | 0 | 0 | 0.0 | 1 | 0 | 0 | 1.0 | 0 | 7 | [] | 10,391 |
tests_django/test_settings.py | gugux289/chatterbot | 13,200 | 10102852 | <gh_stars>1000+
"""
Django settings for when tests are run.
"""
import os
from chatterbot import constants
DEBUG = True
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
SECRET_KEY = 'fake-key'
INSTALLED_APPS = [
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.... | null | null | null | null | null | null | null | null | null | [] | 11,633 |
configs/paa/paa_r50_fpn_1.5x_coco.py | evgps/mmdetection_trashcan | 20,190 | 11287256 | <gh_stars>1000+
_base_ = './paa_r50_fpn_1x_coco.py'
lr_config = dict(step=[12, 16])
runner = dict(type='EpochBasedRunner', max_epochs=18)
| null | null | null | null | null | null | null | null | null | [] | 6,811 |
homeassistant/components/fastdotcom/sensor.py | MrDelik/core | 30,023 | 405011 | <reponame>MrDelik/core
"""Support for Fast.com internet speed testing sensor."""
from __future__ import annotations
from typing import Any
from homeassistant.components.sensor import SensorEntity
from homeassistant.const import DATA_RATE_MEGABITS_PER_SECOND
from homeassistant.core import HomeAssistant, callback
from ... | null | null | null | null | null | null | null | null | null | [] | 10,193 |
tests/nlu/featurizers/test_regex_featurizer.py | Next-Trends/rasa | 3,603 | 6565391 | <gh_stars>1000+
from typing import Text, List, Any, Tuple, Callable, Dict, Optional
import dataclasses
import numpy as np
import pytest
from rasa.engine.graph import ExecutionContext
from rasa.engine.storage.resource import Resource
from rasa.engine.storage.storage import ModelStorage
from rasa.nlu.featurizers.sparse... | null | null | null | null | null | null | null | null | null | [] | 4,471 |
tests/components/eafm/__init__.py | tbarbette/core | 30,023 | 3327514 | """Tests for eafm."""
| 0 | 0 | 0.0 | 0 | 0 | 0 | 1.0 | 0 | 0 | [] | 2,608 |
OpenCorePkg/Debug/Scripts/gdb_uefi.py | CEOALT1/RefindPlusUDK | 10,125 | 11351705 | <gh_stars>1000+
"""
Allows loading TianoCore symbols into a GDB session attached to EFI
Firmware.
This is how it works: build GdbSyms - it's a dummy binary that
contains the relevant symbols needed to find and load image symbols.
$ gdb /path/to/GdbSyms.dll
(gdb) target remote ....
(gdb) source Scripts/gdb_uefi.py
(gd... | 12 | 0 | 0.0 | 81 | 0 | 12 | 1.0 | 0 | 80 | [
{
"impacts": [
{
"severity": "HIGH",
"softwareQuality": "MAINTAINABILITY"
}
],
"line": 35,
"message": "Import only needed names or import the module and then use its members.",
"textRange": {
"endLine": 35,
"endOffset": 25,
"startLine": 35,
"st... | 7,187 |
code/2.7/7_decorators_args.py | suqi/suqi-interpy-zh | 6,594 | 10218124 | from functools import wraps
def logit(logfile='out.log'):
def logging_decorator(func):
@wraps(func)
def wrapped_function(*args, **kwargs):
log_string = func.__name__ + ' was called'
print log_string
with open(logfile, 'a') as opened_file:
opened_file.write(log_string + '\n')
return func(*args, *... | null | null | null | null | null | null | null | null | null | [] | 12,178 |
tests/integration/test_disabled_access_control_improvements/test_row_policy.py | mrk-andreev/ClickHouse | 8,629 | 9674883 | import os
import pytest
from helpers.cluster import ClickHouseCluster
from helpers.test_tools import TSV
cluster = ClickHouseCluster(__file__)
node = cluster.add_instance(
"node",
main_configs=["configs/config.d/disable_access_control_improvements.xml"],
user_configs=[
"configs/users.d/row_policy.x... | 23 | 0 | 0.0 | 0 | 0 | 23 | 1.0 | 0 | 8 | [
{
"impacts": [
{
"severity": "HIGH",
"softwareQuality": "MAINTAINABILITY"
}
],
"line": 74,
"message": "Define a constant instead of duplicating this literal \"another ON mydb.filtered_table1\" 5 times.",
"textRange": {
"endLine": 74,
"endOffset": 45,
... | 5,922 |
recipes/Python/576505_Sudoku_solvercreator/recipe-576505.py | tdiprima/code | 2,023 | 515289 | <reponame>tdiprima/code<gh_stars>1000+
#!/usr/bin/python
# TODO: Make solve function faster!!! Have it check for singles, doubles,
# triples, and quads both naked and hidden
from random import random
def rand(lst):
"returns a random element in list or integer"
if type(lst)==type([]):
return lst[int(random()*len(... | 19 | 0 | 0.0 | 71 | 0 | 19 | 1.0 | 2 | 55 | [
{
"impacts": [
{
"severity": "LOW",
"softwareQuality": "MAINTAINABILITY"
}
],
"line": 3,
"message": "Complete the task associated to this \"TODO\" comment.",
"textRange": {
"endLine": 3,
"endOffset": 73,
"startLine": 3,
"startOffset": 0
},
... | 10,392 |
algorithms/tree/traversal/__init__.py | Heart-throb-Rajnish/algorithms | 22,426 | 3220141 | <reponame>Heart-throb-Rajnish/algorithms<filename>algorithms/tree/traversal/__init__.py<gh_stars>1000+
from .preorder import *
from .postorder import *
from .inorder import *
| null | null | null | null | null | null | null | null | null | [] | 2,144 |
V3/server/cmdline.py | webpics/style2paints | 15,281 | 191101 | <reponame>webpics/style2paints<filename>V3/server/cmdline.py<gh_stars>1000+
#!/usr/bin/env python3
import os
import sys
for f in ['baby.net', 'head.net', 'neck.net', 'tail.net', 'reader.net', 'girder.net']:
if not os.path.exists(f):
print('Error: neural network models not downloaded!')
print('Down... | 9 | 0 | 0.0 | 24 | 0 | 9 | 1.0 | 0 | 26 | [
{
"impacts": [
{
"severity": "HIGH",
"softwareQuality": "MAINTAINABILITY"
}
],
"line": 19,
"message": "Import only needed names or import the module and then use its members.",
"textRange": {
"endLine": 19,
"endOffset": 20,
"startLine": 19,
"st... | 1,160 |
kivy/modules/__init__.py | yunus-ceyhan/kivy | 13,889 | 3289583 | '''
Modules
=======
Modules are classes that can be loaded when a Kivy application is starting. The
loading of modules is managed by the config file. Currently, we include:
* :class:`~kivy.modules.touchring`: Draw a circle around each touch.
* :class:`~kivy.modules.monitor`: Add a red topbar that indicates th... | 1 | 0 | 0.0 | 56 | 0 | 1 | 1.0 | 0 | 47 | [
{
"impacts": [
{
"severity": "HIGH",
"softwareQuality": "MAINTAINABILITY"
}
],
"line": 175,
"message": "Define a constant instead of duplicating this literal 'Modules: Module <%s> not found' 3 times.",
"textRange": {
"endLine": 175,
"endOffset": 59,
... | 2,574 |
recipes/Python/360698_Extending_pythprolog_syntax/recipe-360698.py | tdiprima/code | 2,023 | 3274523 | <reponame>tdiprima/code
#
# pythologic2.py
#
# Add logic programming (Prolog) syntax and *resolution* into Python.
#
# (c) 2004 <NAME>
# after (c) 2004 <NAME>
# and AIMA examples
#
import string
import copy
class Struct:
def __init__(self, database, head, subs):
"""
The head and subs are essenti... | 25 | 6 | 0.0 | 62 | 0 | 19 | 1.0 | 0 | 56 | [
{
"impacts": [
{
"severity": "LOW",
"softwareQuality": "MAINTAINABILITY"
}
],
"line": 96,
"message": "Rename this local variable \"factsStr\" to match the regular expression ^[_a-z][a-z0-9_]*$.",
"textRange": {
"endLine": 96,
"endOffset": 16,
"startL... | 2,456 |
autoregressive_diffusion/experiments/audio/arch/diff_wave.py | xxdreck/google-research | 23,901 | 78267 | <filename>autoregressive_diffusion/experiments/audio/arch/diff_wave.py
# coding=utf-8
# Copyright 2021 The Google Research 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
#
# htt... | 0 | 0 | 0.0 | 8 | 0 | 0 | 1.0 | 0 | 11 | [] | 498 |
rllib/models/tf/__init__.py | firebolt55439/ray | 21,382 | 11324006 | <gh_stars>1000+
from ray.rllib.models.tf.tf_modelv2 import TFModelV2
from ray.rllib.models.tf.fcnet import FullyConnectedNetwork
from ray.rllib.models.tf.recurrent_net import RecurrentNetwork
from ray.rllib.models.tf.visionnet import VisionNetwork
__all__ = [
"FullyConnectedNetwork",
"RecurrentNetwork",
"T... | null | null | null | null | null | null | null | null | null | [] | 7,001 |
tests/components/select/test_significant_change.py | MrDelik/core | 30,023 | 3272003 | <reponame>MrDelik/core
"""Test the select significant change platform."""
from homeassistant.components.select.significant_change import (
async_check_significant_change,
)
from homeassistant.core import HomeAssistant
async def test_significant_change(hass: HomeAssistant) -> None:
"""Detect select significant... | 0 | 0 | 0.0 | 0 | 0 | 0 | 1.0 | 0 | 1 | [] | 2,447 |
tests/logging/test_remote_handler.py | lukaslihotzki/synapse | 9,945 | 1019328 | # Copyright 2019 The Matrix.org Foundation C.I.C.
#
# 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 a... | null | null | null | null | null | null | null | null | null | [] | 13,205 |
zerver/management/commands/add_scim_client.py | dumpmemory/zulip | 17,004 | 6485693 | <reponame>dumpmemory/zulip<gh_stars>1000+
from argparse import ArgumentParser
from typing import Any
from zerver.lib.management import ZulipBaseCommand
from zerver.models import SCIMClient
class Command(ZulipBaseCommand):
help = """Create a SCIM client entry in the database."""
def add_arguments(self, parse... | 0 | 0 | 0.0 | 0 | 0 | 0 | 1.0 | 0 | 2 | [] | 4,227 |
crabageprediction/venv/Lib/site-packages/numpy/lib/tests/test_financial_expired.py | 13rianlucero/CrabAgePrediction | 20,453 | 1956008 | import sys
import pytest
import numpy as np
@pytest.mark.skipif(sys.version_info[:2] < (3, 7),
reason="requires python 3.7 or higher")
def test_financial_expired():
match = 'NEP 32'
with pytest.warns(DeprecationWarning, match=match):
func = np.fv
with pytest.raises(RuntimeError... | null | null | null | null | null | null | null | null | null | [] | 8,799 |
eeg_modelling/eeg_viewer/lookup_test.py | deepneuralmachine/google-research | 23,901 | 3363429 | # coding=utf-8
# Copyright 2021 The Google Research 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 applicab... | null | null | null | null | null | null | null | null | null | [] | 2,819 |
html/semantics/forms/form-submission-0/resources/file-submission.py | meyerweb/wpt | 14,668 | 9618385 | <filename>html/semantics/forms/form-submission-0/resources/file-submission.py
import json
from wptserve.utils import isomorphic_decode
def main(request, response):
headers = [(b"Content-Type", b"text/html")]
testinput = request.POST.first(b"testinput")
value = isomorphic_decode(testinput.value)
body =... | 1 | 0 | 0.0 | 0 | 0 | 1 | 1.0 | 0 | 1 | [
{
"impacts": [
{
"severity": "MEDIUM",
"softwareQuality": "MAINTAINABILITY"
}
],
"line": 5,
"message": "Remove the unused function parameter \"response\".",
"textRange": {
"endLine": 5,
"endOffset": 26,
"startLine": 5,
"startOffset": 18
},
... | 5,595 |
tests/validation/tests/v3_api/test_bkp_restore_s3_with_creds.py | ursinnDev/rancher_rancher | 18,697 | 10141581 | <filename>tests/validation/tests/v3_api/test_bkp_restore_s3_with_creds.py
import pytest
from .common import * # NOQA
from .test_rke_cluster_provisioning import rke_config, validate_rke_dm_host_2,\
node_template_linode
namespace = {"p_client": None, "ns": None, "cluster": None, "project": None,
"nodes... | 1 | 0 | 0.0 | 0 | 0 | 1 | 1.0 | 0 | 5 | [
{
"impacts": [
{
"severity": "HIGH",
"softwareQuality": "MAINTAINABILITY"
}
],
"line": 2,
"message": "Import only needed names or import the module and then use its members.",
"textRange": {
"endLine": 2,
"endOffset": 21,
"startLine": 2,
"start... | 11,760 |
sympy/matrices/decompositions.py | nashalex/sympy | 8,323 | 9778615 | import copy
from sympy.core import S
from sympy.core.function import expand_mul
from sympy.functions.elementary.miscellaneous import Min, sqrt
from sympy.functions.elementary.complexes import sign
from .common import NonSquareMatrixError, NonPositiveDefiniteMatrixError
from .utilities import _get_intermediate_simp, _... | null | null | null | null | null | null | null | null | null | [] | 6,283 |
recipes/Python/578505_The_Iota_language_in_Python/recipe-578505.py | tdiprima/code | 2,023 | 6592495 | # Iota
#
# http://semarch.linguistics.fas.nyu.edu/barker/Iota/
#
# S = λx.λy.λz.xz(yz)
# K = λx.λy.x
# i = λc.cSK
#
# i, *ii, *i*ii, **ii*ii
# 0 100 10100 1100100 Iota is the encoding.
#
## (let iota ()
## (if (eq? #\* (read-char)) ((iota)(iota))
## (lambda (c) ((c (lambda (x) (lambda (y) (lambda (z) ((x... | null | null | null | null | null | null | null | null | null | [] | 4,646 |
recipes/Python/577859_CLOSlike_aroundbeforeafter_auxiliary/recipe-577859.py | tdiprima/code | 2,023 | 87531 | #!/usr/bin/env python
#
# Copyright (c) 2011 <NAME> (zuo). All rights reserved.
# Licensed under the MIT License.
#
# Python 2.5+/3.x-compatibile.
#
# The newest version of this module should be downloadable from:
# https://github.com/zuo/Zuo-s-Recipes-and-Drafts/blob/master/auxmethods.py
from __future__ import with_s... | 0 | 0 | 0.0 | 36 | 0 | 0 | 1.0 | 0 | 44 | [] | 556 |
packages/grid/backend/grid/core/celery_app.py | vishalbelsare/PySyft | 8,428 | 3234056 | # future
from __future__ import annotations
# third party
from celery import Celery
# relative
from . import celery_config
from . import celery_serde # noqa: 401
# backend is required to persist tasks
celery_app = Celery(
"worker",
broker="amqp://guest@queue//",
)
celery_app.config_from_object(celery_config... | null | null | null | null | null | null | null | null | null | [] | 2,248 |
recipes/Python/521866_myspace_profile_parser/recipe-521866.py | tdiprima/code | 2,023 | 188768 | <reponame>tdiprima/code
#!/usr/bin/python
# -*- coding: utf-8 -*-
import urllib, urllib2
from re import *
class Profile(object):
""" parse profile information from a myspace.com account """
def __init__(self, uid):
self.uid = uid
self.profile_url = 'http://profile.myspace.com/'
self.... | 3 | 0 | 0.0 | 2 | 0 | 3 | 1.0 | 1 | 4 | [
{
"impacts": [
{
"severity": "HIGH",
"softwareQuality": "MAINTAINABILITY"
}
],
"line": 5,
"message": "Import only needed names or import the module and then use its members.",
"textRange": {
"endLine": 5,
"endOffset": 16,
"startLine": 5,
"start... | 1,148 |
tests/python/relay/utils/ref_funcs.py | XiaoSong9905/tvm | 4,640 | 5441692 | <reponame>XiaoSong9905/tvm<gh_stars>1000+
# 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, Ve... | 0 | 0 | 0.0 | 5 | 0 | 0 | 1.0 | 0 | 4 | [] | 12,088 |
tests/components/sensibo/test_update.py | liangleslie/core | 30,023 | 51626 | """The test for the sensibo update platform."""
from __future__ import annotations
from datetime import timedelta
from unittest.mock import patch
from pysensibo.model import SensiboData
from pytest import MonkeyPatch
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import STATE_OFF, STAT... | 0 | 0 | 0.0 | 0 | 0 | 0 | 1.0 | 0 | 1 | [] | 324 |
tests/components/cloud/test_tts.py | tbarbette/core | 30,023 | 6482044 | """Tests for cloud tts."""
from unittest.mock import Mock
from hass_nabucasa import voice
import pytest
import voluptuous as vol
from homeassistant.components.cloud import const, tts
@pytest.fixture()
def cloud_with_prefs(cloud_prefs):
"""Return a cloud mock with prefs."""
return Mock(client=Mock(prefs=clou... | 0 | 0 | 0.0 | 0 | 0 | 0 | 1.0 | 0 | 6 | [] | 4,207 |
recipes/Python/576635_whois/recipe-576635.py | tdiprima/code | 2,023 | 3388232 | <gh_stars>1000+
"""whois.py
simple whois client
"""
import sys
import socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(("whois.arin.net", 43))
s.send(sys.argv[1] + "\r\n")
response = ''
while True:
d = s.recv(4096)
response += d
if d == '':
break
s.close()
print
print respon... | 2 | 0 | 0.0 | 3 | 0 | 2 | 1.0 | 0 | 2 | [
{
"impacts": [
{
"severity": "MEDIUM",
"softwareQuality": "MAINTAINABILITY"
}
],
"line": 19,
"message": "Replace print statement by built-in function.",
"textRange": {
"endLine": 19,
"endOffset": 5,
"startLine": 19,
"startOffset": 0
},
... | 2,949 |
examples/images/network_in_network.py | jjpalacio/tflearn | 10,882 | 323218 | # -*- coding: utf-8 -*-
""" Network In Network.
Applying 'Network In Network' to CIFAR-10 classification task.
References:
Network In Network. <NAME>, <NAME> & <NAME>, 2014.
Links:
http://arxiv.org/pdf/1312.4400v3.pdf
"""
from __future__ import division, print_function, absolute_import
import tflearn
fro... | null | null | null | null | null | null | null | null | null | [] | 7,920 |
infra/config/PRESUBMIT.py | chromium/chromium | 14,668 | 65214 | <filename>infra/config/PRESUBMIT.py
# Copyright 2018 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Enforces luci-milo.cfg consistency.
See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
for m... | 9 | 0 | 0.0 | 25 | 0 | 9 | 1.0 | 0 | 29 | [
{
"impacts": [
{
"severity": "MEDIUM",
"softwareQuality": "MAINTAINABILITY"
}
],
"line": 22,
"message": "Rename function \"CheckFreeze\" to match the regular expression ^[a-z_][a-z0-9_]*$.",
"textRange": {
"endLine": 22,
"endOffset": 15,
"startLine":... | 397 |
tests/unit/utils/test_minion.py | tomdoherty/salt | 9,425 | 6562654 | <filename>tests/unit/utils/test_minion.py<gh_stars>1000+
import logging
import salt.utils.minion
from tests.support.mock import MagicMock, mock_open, patch
from tests.support.unit import TestCase
log = logging.getLogger(__name__)
class FakeThreadingClass:
name = "thread-name"
class MinionUtilTestCase(TestCase... | null | null | null | null | null | null | null | null | null | [] | 4,450 |
diagrams/outscale/__init__.py | analyticsftw/diagrams | 17,037 | 6959 | <reponame>analyticsftw/diagrams<filename>diagrams/outscale/__init__.py
from diagrams import Node
class _Outscale(Node):
_provider = "outscale"
_icon_dir = "resources/outscale"
fontcolor = "#ffffff"
| 0 | 0 | 0.0 | 0 | 0 | 0 | 1.0 | 0 | 0 | [] | 62 |
tests/unit/test_fingerprint.py | flovouin/dash | 17,143 | 2194014 | <reponame>flovouin/dash<gh_stars>1000+
from dash.fingerprint import build_fingerprint, check_fingerprint
version = 1
hash_value = 1
valid_resources = [
{"path": "react@16.8.6.min.js", "fingerprint": "react@16.v1m1.8.6.min.js"},
{
"path": "react@16.8.6.min.js",
"fingerprint": "react@16.v1_1_1m1... | 1 | 0 | 0.0 | 3 | 0 | 1 | 1.0 | 0 | 4 | [
{
"impacts": [
{
"severity": "HIGH",
"softwareQuality": "MAINTAINABILITY"
}
],
"line": 7,
"message": "Define a constant instead of duplicating this literal \"react@16.8.6.min.js\" 4 times.",
"textRange": {
"endLine": 7,
"endOffset": 34,
"startLine": ... | 10,831 |
venv/lib/python3.7/site-packages/pyasn1_modules/rfc7773.py | nicholasadamou/StockBird | 9,953 | 8450729 | <gh_stars>1000+
#
# This file is part of pyasn1-modules software.
#
# Created by <NAME> with some assistance from asn1ate v.0.6.0.
#
# Copyright (c) 2019, Vigil Security, LLC
# License: http://snmplabs.com/pyasn1/license.html
#
# Authentication Context Certificate Extension
#
# ASN.1 source from:
# https://www.rfc-edit... | 0 | 0 | 0.0 | 0 | 0 | 0 | 1.0 | 0 | 0 | [] | 10,967 |
torch/quantization/quantize_jit.py | xiaohanhuang/pytorch | 60,067 | 4016575 | <reponame>xiaohanhuang/pytorch<gh_stars>1000+
# flake8: noqa: F401
r"""
This file is in the process of migration to `torch/ao/quantization`, and
is kept here for compatibility while the migration process is ongoing.
If you are adding a new entry/functionality, please, add it to the
`torch/ao/quantization/quantize_jit.p... | 0 | 0 | 0.0 | 0 | 0 | 0 | 1.0 | 0 | 0 | [] | 12,511 |
basic/30_copy_deepcopy.py | subshine/tutorials | 10,786 | 11309112 | # View more python learning tutorial on my Youtube and Youku channel!!!
# Youtube video tutorial: https://www.youtube.com/channel/UCdyjiB5H8Pu7aDTNVXTTpcg
# Youku video tutorial: http://i.youku.com/pythontutorial
import copy
a = [1,2,3]
b = a
b[1]=22
print(a)
print(id(a) == id(b))
# deep copy
c = copy.deepcopy(a)
p... | null | null | null | null | null | null | null | null | null | [] | 6,919 |
dir_test.py | nicetone/Python | 28,321 | 3236300 | # Script Name : dir_test.py
# Author : <NAME>
# Created : 29th November 2011
# Last Modified : by- <NAME> 05 Oct 2020
# Version : 1.0
# Modifications :
# Description : Tests to see if the directory testdir exists, if not it will create the directory for you if you want it created.
from __future__ import... | null | null | null | null | null | null | null | null | null | [] | 2,265 |
homeassistant/components/limitlessled/__init__.py | domwillcode/home-assistant | 30,023 | 12856798 | """The limitlessled component."""
| null | null | null | null | null | null | null | null | null | [] | 7,583 |
tests/components/econet/__init__.py | tbarbette/core | 30,023 | 186790 | <gh_stars>1000+
"""Tests for the Econet component."""
| 0 | 0 | 0.0 | 0 | 0 | 0 | 1.0 | 0 | 0 | [] | 1,136 |
algorithms/tree/fenwick_tree/fenwick_tree.py | hbqdev/algorithms | 22,426 | 11275911 | """
Fenwick Tree / Binary Indexed Tree
Consider we have an array arr[0 . . . n-1]. We would like to
1. Compute the sum of the first i elements.
2. Modify the value of a specified element of the array arr[i] = x where 0 <= i <= n-1.
A simple solution is to run a loop from 0 to i-1 and calculate the sum of the elements... | 1 | 0 | 0.0 | 3 | 0 | 1 | 1.0 | 0 | 7 | [
{
"impacts": [
{
"severity": "LOW",
"softwareQuality": "MAINTAINABILITY"
}
],
"line": 22,
"message": "Rename class \"Fenwick_Tree\" to match the regular expression ^_?([A-Z_][a-zA-Z0-9]*|[a-z_][a-z0-9_]*)$.",
"textRange": {
"endLine": 22,
"endOffset": 18,
... | 6,738 |
recipes/Python/300304_Live_Object_Browser/recipe-300304.py | tdiprima/code | 2,023 | 6466906 | #!/usr/bin/env python
import pygtk
pygtk.require('2.0')
import gtk
class Browser:
def make_row( self, piter, name, value ):
info = repr(value)
if not hasattr(value, "__dict__"):
if len(info) > 80:
# it's a big list, or dict etc.
info = info[:80] + "..."... | 2 | 0 | 0.0 | 17 | 0 | 2 | 1.0 | 0 | 21 | [
{
"impacts": [
{
"severity": "MEDIUM",
"softwareQuality": "MAINTAINABILITY"
}
],
"line": 11,
"message": "Merge this if statement with the enclosing one.",
"textRange": {
"endLine": 11,
"endOffset": 14,
"startLine": 11,
"startOffset": 12
},
... | 4,123 |
tests/components/iotawatt/__init__.py | MrDelik/core | 30,023 | 1738332 | <gh_stars>1000+
"""Tests for the IoTaWatt integration."""
from iotawattpy.sensor import Sensor
INPUT_SENSOR = Sensor(
channel="1",
base_name="My Sensor",
suffix=None,
io_type="Input",
unit="Watts",
value=23,
begin="",
mac_addr="mock-mac",
)
OUTPUT_SENSOR = Sensor(
channel="N/A",
... | 0 | 0 | 0.0 | 0 | 0 | 0 | 1.0 | 0 | 0 | [] | 1,867 |
recipes/Python/277600_one_liner_frequency_count/recipe-277600.py | tdiprima/code | 2,023 | 3209145 | >>> from itertools import groupby
>>> [(k, len(list(g))) for k, g in groupby(sorted(myList))]
[('1', 4), ('2', 1), ('3', 2), ('4', 1)]
| 0 | 0 | 0.0 | null | 0 | 0 | 1.0 | 0 | null | [] | 2,049 |
utils/python_lint.py | jerodji/swift | 72,551 | 8977665 | <reponame>jerodji/swift
#!/usr/bin/env python3
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2014 - 2020 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library Exception
#
# See https://swift.org/LICENSE.txt for license information
# See h... | 0 | 0 | 0.0 | 4 | 0 | 0 | 1.0 | 0 | 5 | [] | 13,109 |
manimlib/scene/three_d_scene.py | OrKedar/geo-manimgl-app | 45,280 | 1679092 | from manimlib.scene.scene import Scene
class ThreeDScene(Scene):
CONFIG = {
"camera_config": {
"samples": 4,
"anti_alias_width": 0,
}
}
def begin_ambient_camera_rotation(self, rate=0.02):
pass # TODO
def stop_ambient_camera_rotation(self):
pas... | null | null | null | null | null | null | null | null | null | [] | 1,537 |
examples/pxScene2d/external/libnode-v10.15.3/deps/v8/tools/testrunner/outproc/test262.py | madanagopaltcomcast/pxCore | 2,151 | 1022155 | <gh_stars>1000+
# Copyright 2018 the V8 project authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import re
from . import base
class ExceptionOutProc(base.OutProc):
"""Output processor for tests with expected exception."""
def __i... | null | null | null | null | null | null | null | null | null | [] | 13,218 |
tools/make_dist_html.py | libcat/libuv | 20,206 | 11593868 | #!/usr/bin/python3
import itertools
import os
import re
import subprocess
HTML = r'''
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="http://libuv.org/styles/vendor.css">
<link rel="stylesheet" href="http://libuv.org/styles/main.css">
<style>
table {{
border-spacing: 0;
}}
b... | null | null | null | null | null | null | null | null | null | [] | 10,116 |
superset/dashboards/filter_sets/filters.py | razzius/superset | 18,621 | 6474850 | <reponame>razzius/superset
# 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
... | 0 | 0 | 0.0 | 2 | 0 | 0 | 1.0 | 0 | 3 | [] | 4,162 |
recipes/Python/82345_pykill/recipe-82345.py | tdiprima/code | 2,023 | 556028 | <reponame>tdiprima/code
#!/usr/bin/env python
import commands
import os,sys,string
import re
def pkill():
if len(sys.argv) <= 1:
print "usage: " + sys.argv[0] + " process_name"
sys.exit(1)
rip = sys.argv[1]
me = commands.getoutput("whoami")
p = commands.getoutput("ps -u %s -o fname -o p... | null | null | null | null | null | null | null | null | null | [] | 10,662 |
recipes/Python/576370_Weighted_random_choice/recipe-576370.py | tdiprima/code | 2,023 | 189115 | <reponame>tdiprima/code<filename>recipes/Python/576370_Weighted_random_choice/recipe-576370.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import division
import random, bisect
class ItemGenerator(object):
'''Choices randomly an element from a list.
It does it not uniformly, but using a g... | 1 | 0 | 0.0 | 4 | 0 | 1 | 1.0 | 1 | 5 | [
{
"impacts": [
{
"severity": "MEDIUM",
"softwareQuality": "MAINTAINABILITY"
}
],
"line": 48,
"message": "Replace print statement by built-in function.",
"textRange": {
"endLine": 48,
"endOffset": 9,
"startLine": 48,
"startOffset": 4
},
... | 1,150 |
tests/components/minio/__init__.py | domwillcode/home-assistant | 30,023 | 12862327 | <reponame>domwillcode/home-assistant<gh_stars>1000+
"""Tests for the minio component."""
| null | null | null | null | null | null | null | null | null | [] | 7,607 |
Lib/encodings/cp737.py | shawwn/cpython | 52,316 | 11594412 | """ Python Character Mapping Codec cp737 generated from 'VENDORS/MICSFT/PC/CP737.TXT' with gencodec.py.
"""#"
import codecs
### Codec APIs
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_map)
def decode(self,input,errors='strict... | null | null | null | null | null | null | null | null | null | [] | 10,120 |
homeassistant/util/color.py | andersop91/core | 22,481 | 6562871 | <gh_stars>1000+
"""Color util methods."""
from __future__ import annotations
import colorsys
import math
from typing import NamedTuple, cast
import attr
# mypy: disallow-any-generics
class RGBColor(NamedTuple):
"""RGB hex values."""
r: int
g: int
b: int
# Official CSS3 colors from w3.org:
# http... | null | null | null | null | null | null | null | null | null | [] | 4,451 |
tests/components/aladdin_connect/test_model.py | liangleslie/core | 30,023 | 11331742 | """Test the Aladdin Connect model class."""
from homeassistant.components.aladdin_connect.model import DoorDevice
from homeassistant.core import HomeAssistant
async def test_model(hass: HomeAssistant) -> None:
"""Test model for Aladdin Connect Model."""
test_values = {
"device_id": "1",
"door_... | null | null | null | null | null | null | null | null | null | [] | 7,062 |
examples/old/map_reduce.py | nicolasiltis/prefect | 8,633 | 546199 | <reponame>nicolasiltis/prefect<gh_stars>1000+
from prefect import Flow, task
# ------------------------------------
# define some tasks
@task
def numbers_task():
return [1, 2, 3]
@task
def map_task(x):
return x + 1
@task
def reduce_task(x):
return sum(x)
# ------------------------------------
# bui... | null | null | null | null | null | null | null | null | null | [] | 10,609 |
diagrams/openstack/workloadprovisioning.py | abdulkaderjeelani/diagrams | 17,037 | 6476450 | # This module is automatically generated by autogen.sh. DO NOT EDIT.
from . import _OpenStack
class _Workloadprovisioning(_OpenStack):
_type = "workloadprovisioning"
_icon_dir = "resources/openstack/workloadprovisioning"
class Magnum(_Workloadprovisioning):
_icon = "magnum.png"
class Sahara(_Workload... | 0 | 0 | 0.0 | 0 | 0 | 0 | 1.0 | 0 | 0 | [] | 4,173 |
samples/python/tutorial_code/imgProc/match_template/match_template.py | thisisgopalmandal/opencv | 56,632 | 4924342 | <gh_stars>1000+
from __future__ import print_function
import sys
import cv2 as cv
## [global_variables]
use_mask = False
img = None
templ = None
mask = None
image_window = "Source Image"
result_window = "Result window"
match_method = 0
max_Trackbar = 5
## [global_variables]
def main(argv):
if (len(sys.argv) < 3... | null | null | null | null | null | null | null | null | null | [] | 3,526 |
examples/pxScene2d/external/libnode-v0.12.7/deps/v8/tools/ll_prof.py | madanagopaltcomcast/pxCore | 2,494 | 74950 | #!/usr/bin/env python
#
# Copyright 2012 the V8 project authors. All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# noti... | 79 | 0 | 0.0 | 231 | 0 | 79 | 1.0 | 2 | 160 | [
{
"impacts": [
{
"severity": "LOW",
"softwareQuality": "MAINTAINABILITY"
}
],
"line": 114,
"message": "Rename method \"AddName\" to match the regular expression ^[a-z_][a-z0-9_]*$.",
"textRange": {
"endLine": 114,
"endOffset": 13,
"startLine": 114,
... | 473 |
tests/testing_config/custom_components/test/binary_sensor.py | domwillcode/home-assistant | 30,023 | 3218482 | """
Provide a mock binary sensor platform.
Call init before using it in your tests to ensure clean test data.
"""
from homeassistant.components.binary_sensor import DEVICE_CLASSES, BinarySensorEntity
from tests.common import MockEntity
ENTITIES = {}
def init(empty=False):
"""Initialize the platform with entiti... | null | null | null | null | null | null | null | null | null | [] | 2,126 |
tests/pyb/i2c_accel.py | sebastien-riou/micropython | 4,538 | 9610447 | # use accelerometer to test i2c bus
import pyb
from pyb import I2C
if not hasattr(pyb, "Accel"):
print("SKIP")
raise SystemExit
accel_addr = 76
pyb.Accel() # this will init the MMA for us
i2c = I2C(1, I2C.MASTER, baudrate=400000)
print(i2c.scan())
print(i2c.is_ready(accel_addr))
print(i2c.mem_read(1, ac... | 0 | 0 | 0.0 | 1 | 0 | 0 | 1.0 | 0 | 1 | [] | 5,548 |
tests/test_lazy_hyperlinks.py | scratchmex/django-rest-framework | 17,395 | 8112240 | <reponame>scratchmex/django-rest-framework<filename>tests/test_lazy_hyperlinks.py
from django.db import models
from django.test import TestCase, override_settings
from django.urls import path
from rest_framework import serializers
from rest_framework.renderers import JSONRenderer
from rest_framework.templatetags.rest_... | null | null | null | null | null | null | null | null | null | [] | 5,102 |
tests/components/recorder/test_statistics_v23_migration.py | mib1185/core | 30,023 | 8449169 | <filename>tests/components/recorder/test_statistics_v23_migration.py
"""The tests for sensor recorder platform migrating statistics from v23.
The v23 schema used for these tests has been slightly modified to add the
EventData table to allow the recorder to startup successfully.
"""
# pylint: disable=protected-access,i... | 6 | 0 | 68.5 | 9 | 0 | 6 | 1.0 | 0 | 14 | [
{
"impacts": [
{
"severity": "HIGH",
"softwareQuality": "MAINTAINABILITY"
}
],
"line": 55,
"message": "Define a constant instead of duplicating this literal \"test_run_info.db\" 4 times.",
"textRange": {
"endLine": 55,
"endOffset": 65,
"startLine": 5... | 10,955 |
recipes/Python/577172_writepath_loadpath_methods_file/recipe-577172.py | tdiprima/code | 2,023 | 6592001 | <gh_stars>1000+
def _write_path(path, text, encoding, create_backup=False, log=None):
"""Write content to a path.
@param path {str}
@param text {unicode}
@param encoding {str} The file encoding to use.
@param create_backup {bool} Default False. Whether to create a backup
file. The path ... | null | null | null | null | null | null | null | null | null | [] | 4,645 |
recipes/Python/576543_Prime_Number_Generator_Checker/recipe-576543.py | tdiprima/code | 2,023 | 11576 | <reponame>tdiprima/code<gh_stars>1000+
#
# prime number generator
# This program gets two number as input
# and prints
# Prime numbers in the range
# Actual number of primes in the range
# and Estimation based on formula
# n
# pi(n)= -------
# log(n)
# ... | 6 | 1 | 0.0 | 7 | 0 | 5 | 3.0 | 0 | 8 | [
{
"impacts": [
{
"severity": "HIGH",
"softwareQuality": "MAINTAINABILITY"
}
],
"line": 14,
"message": "Import only needed names or import the module and then use its members.",
"textRange": {
"endLine": 14,
"endOffset": 18,
"startLine": 14,
"st... | 100 |
test/nn/functional/test_bro.py | NucciTheBoss/pytorch_geometric | 2,350 | 1816381 | <filename>test/nn/functional/test_bro.py
import torch
from torch_geometric.nn.functional import bro
def test_bro():
batch = torch.tensor([0, 0, 0, 0, 1, 1, 1, 2, 2])
g1 = torch.tensor([
[0.2, 0.2, 0.2, 0.2],
[0.0, 0.2, 0.2, 0.2],
[0.2, 0.0, 0.2, 0.2],
[0.2, 0.2, 0.0, 0.2],
... | null | null | null | null | null | null | null | null | null | [] | 8,219 |
project_euler/problem_074/sol2.py | NavpreetDevpuri/Python | 145,614 | 1882791 | """
Project Euler Problem 074: https://projecteuler.net/problem=74
Starting from any positive integer number
it is possible to attain another one summing the factorial of its digits.
Repeating this step, we can build chains of numbers.
It is not difficult to prove that EVERY starting number
wi... | 0 | 0 | 0.0 | 15 | 0 | 0 | 1.0 | 0 | 14 | [] | 8,579 |
platformio/debug/process/client.py | franzbischoff/platformio-core | 4,744 | 10165323 | # Copyright (c) 2014-present PlatformIO <<EMAIL>>
#
# 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 ag... | null | null | null | null | null | null | null | null | null | [] | 11,879 |
jumpy/jumpy/ndarray.py | rghwer/testdocs | 13,006 | 6072 | ################################################################################
# Copyright (c) 2015-2018 Skymind, Inc.
#
# This program and the accompanying materials are made available under the
# terms of the Apache License, Version 2.0 which is available at
# https://www.apache.org/licenses/LICENSE-2.0.
#
# Unless... | 29 | 12 | 0.0 | 112 | 0 | 17 | 1.0 | 0 | 79 | [
{
"impacts": [
{
"severity": "HIGH",
"softwareQuality": "MAINTAINABILITY"
}
],
"line": 18,
"message": "Import only needed names or import the module and then use its members.",
"textRange": {
"endLine": 18,
"endOffset": 27,
"startLine": 18,
"st... | 56 |
maint/test/cython/cythonapp_test.py | DengJackNo1/tornado | 15,056 | 10101175 | <filename>maint/test/cython/cythonapp_test.py
from tornado.testing import AsyncTestCase, gen_test
from tornado.util import ArgReplacer
import unittest
import cythonapp
class CythonCoroutineTest(AsyncTestCase):
@gen_test
def test_native_coroutine(self):
x = yield cythonapp.native_coroutine()
s... | null | null | null | null | null | null | null | null | null | [] | 11,617 |
tests/integration/optimizers/test_optimizer_pod_choice.py | Rohitpandit021/jina | 15,179 | 114236 | import os
import pytest
from jina import Document
from jina.optimizers import FlowOptimizer, EvaluationCallback
from jina.optimizers.flow_runner import SingleFlowRunner
cur_dir = os.path.dirname(os.path.abspath(__file__))
@pytest.fixture
def config(tmpdir):
os.environ['JINA_OPTIMIZER_WORKSPACE_DIR'] = str(tmpd... | 0 | 0 | 0.0 | 2 | 0 | 0 | 1.0 | 0 | 7 | [] | 699 |
tests/components/speedtestdotnet/test_config_flow.py | MrDelik/core | 30,023 | 10198206 | <filename>tests/components/speedtestdotnet/test_config_flow.py
"""Tests for SpeedTest config flow."""
from datetime import timedelta
from unittest.mock import MagicMock
from homeassistant import config_entries, data_entry_flow
from homeassistant.components import speedtestdotnet
from homeassistant.components.speedtest... | null | null | null | null | null | null | null | null | null | [] | 12,071 |
youtube_dl/extractor/iqiyi.py | hackarada/youtube-dl | 66,635 | 3349350 | # coding: utf-8
from __future__ import unicode_literals
import hashlib
import itertools
import re
import time
from .common import InfoExtractor
from ..compat import (
compat_str,
compat_urllib_parse_urlencode,
)
from ..utils import (
clean_html,
decode_packed_codes,
get_element_by_id,
get_elem... | null | null | null | null | null | null | null | null | null | [] | 2,729 |
homeassistant/components/flux_led/switch.py | learn-home-automation/core | 22,481 | 4824441 | """Support for Magic Home switches."""
from __future__ import annotations
from typing import Any
from flux_led import DeviceType
from flux_led.aio import AIOWifiLedBulb
from flux_led.const import MODE_MUSIC
from homeassistant import config_entries
from homeassistant.components.switch import SwitchEntity
from homeass... | 0 | 0 | 0.0 | 10 | 0 | 0 | 1.0 | 0 | 23 | [] | 3,113 |
src/tools/vttests/template.py | Ghosty141/Terminal | 34,359 | 188124 | ################################################################################
# #
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
# #
####... | 1 | 0 | 0.0 | 1 | 0 | 1 | 1.0 | 0 | 1 | [
{
"impacts": [
{
"severity": "HIGH",
"softwareQuality": "MAINTAINABILITY"
}
],
"line": 10,
"message": "Import only needed names or import the module and then use its members.",
"textRange": {
"endLine": 10,
"endOffset": 20,
"startLine": 10,
"st... | 1,145 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.