language string | code-snippit string | instruction string | flaws list | flaw_count int64 |
|---|---|---|---|---|
python | from typing import Dict, List
from schema import Schema, And, SchemaError
from torch.nn import Module
class CompressorSchema:
def __init__(self, data_schema: List[Dict], model: Module, logger: Logger):
assert isinstance(data_schema, list)
self.data_schema = data_schema
self.compressor_sch... | Review this code and list any quality issues. | [
{
"issue": "I think this line might not modify the `sub_schema` object in the list `data_schema`. Is that the expected behavior? Not sure because I haven't worked a lot with `Schema`",
"severity": "minor",
"line": 26
}
] | 1 |
python | n_threads=self._n_threads,
)
if self.verbose:
print(f"Inertia for init {init_idx + 1}/{self._n_init}: {inertia}")
if best_inertia is None or inertia < best_inertia:
init_centers = cluster_centers
best_inertia = inertia
centers... | Review this code and list any quality issues. | [
{
"issue": "There's actually an easy way to make MinibatchKMeans pass the scaled weights test: make n_steps independent of the weights as it was before (since max_iter doesn't take weights into account).\n\nThat is\n```\nn_steps = (self.max_iter * n_samples) // self._batch_size\n```\nnote that this is the same ... | 1 |
python | if with_higher_cost:
conditions.extend([[ConditionOpcode.CREATE_COIN, IDENTITY_PUZZLE_HASH, i] for i in range(3)])
actual_fee += 3
conditions.append([ConditionOpcode.CREATE_COIN, IDENTITY_PUZZLE_HASH, uint64(coin.amount - actual_fee)])
sb = spend_bundle_from_conditions(conditions, coin)
retu... | Review this code and list any quality issues. | [
{
"issue": "The highest fee per cost we consider here belongs to the mempool item that contains the spend, not the spend with the highest fee per cost, right?",
"severity": "minor",
"line": 26
}
] | 1 |
python | DATA_7, # input_data
240, # expected_result
]
FIND_SLICE_TEST_CASE = [
{"keys": "label", "sids": "sids"}, # arguments
DATA_6, # input_data
{"spleen": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9], "background": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]}, # expected_result
]
NormalizeLabelsDatasetd_TEST_CASE = [
{"keys... | Review this code and list any quality issues. | [] | 0 |
python | print(f"[P{self.producer_idx}] Send data {[(k, v.shape) for k, v in outputs.items()]}")
outputs = pre_send(outputs)
ray_broadcast_tensor_dict(
outputs, src=0, device=self.device, group_name=f"sync_data_{self.producer_idx}"
)
if (i + 1)... | Review this code and list any quality issues. | [
{
"issue": "I assume here is the same? we should count step from the training side?",
"severity": "minor",
"line": 26
}
] | 1 |
python | )
assert isinstance(self._executor, NestedExecutor)
self.report_dict: dict = {}
self.decisions: List[BaseTradeDecision] = []
self._collect_data_loop = collect_data_loop(
start_time=order.date,
end_time=order.date,
trade_strategy=strategy,
... | Review this code and list any quality issues. | [
{
"issue": "Why should it call `step` in the reset phase?",
"severity": "minor",
"line": 26
}
] | 1 |
python | item = self._download_json(
f'https://production-cdn.dr-massive.com/api/items/{item_id}', item_id,
note='Attempting to download backup item data', query={
'device': 'web_browser',
'expand': 'all',
'ff': 'idp,ldp,rpt',
... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n }, headers={'authorization': f'Bearer {self._TOKEN}'})\r\n```",
"severity": "critical",
"line": 26
}
] | 1 |
python | import json
import os
import random
import time
from datetime import datetime
from typing import List, Optional, Tuple, Dict
import openai
import asyncio
import logging
from transformers import PreTrainedTokenizerBase
from vllm.engine.arg_utils import EngineArgs
from vllm.utils import FlexibleArgumentParser
from be... | Review this code and list any quality issues. | [
{
"issue": "let's remove non English characters in github repo. the policy is a different bit different from our internal repo",
"severity": "minor",
"line": 26
}
] | 1 |
python | raise fastapi.HTTPException(status_code=400, detail="Only assistant messages can be streamed.")
if message.has_finished:
raise fastapi.HTTPException(status_code=204, detail=message.state)
async def event_generator(chat_id: str, message_id: str, worker_compat_hash: str | None):
redis_client = d... | Review this code and list any quality issues. | [
{
"issue": "could this be done in parallel like this? or is this a race condition?\r\n\r\n```python\r\n[qdeq, qenq, mpos] = await asyncio.gather(\r\n work_queue.get_deq_counter(),\r\n work_queue.get_enq_counter(),\r\n queueing.get_pos_value(redis_client, message_id)\r\n)\r\n```",
"severity": "critical",
... | 1 |
python | loading specs preserved for serialization. Custom or locally loaded components without Hub references will
have their `modular_model_index.json` entries updated automatically during `save_pretrained()`.
- ConfigMixin objects without weights (e.g., schedulers, guiders) can be passed directly.
... | Review this code and list any quality issues. | [
{
"issue": "IMO a bit easier to read. \n```suggestion\n elif current_component_spec.default_creation_method == \"from_pretrained\" and getattr(component, \"_diffusers_load_id\", None) is None\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | 'episode_id': 'POS_6225d1ca-a0d5-45e3-870b-e783ee6c8a3f',
'timestamp': 1695081600,
'upload_date': '20230919',
},
}, {
'url': 'https://www.3sat.de/gesellschaft/37-grad-leben/aus-dem-leben-gerissen-102.html',
'md5': 'a903eaf8d1fd635bd3317cd2ad87ec84',
'info_dict... | Review this code and list any quality issues. | [] | 0 |
python | label_mask_file = np.memmap(
str(output_dir / "label_mask.npy"), dtype=np.bool_, mode="w+", shape=(total_tokens,)
)
offset = 0
for ex in track(preprocessed):
ex_len = len(ex["input_ids"]) # type: ignore
input_ids_file[offset : offset + ex_len] = ex["input_ids"] # type: ignore
... | Review this code and list any quality issues. | [
{
"issue": "What special tokens does the olmo tokenizer add? There should be an eos token after every assistant message.",
"severity": "minor",
"line": 26
}
] | 1 |
python | process_info.process.wait(timeout=5)
except OSError:
# Process already dead
pass
except subprocess.TimeoutExpired:
logger.warning(
f"Redis server process {process_info.process.pid} did not exit within 5 seconds "
... | Review this code and list any quality issues. | [
{
"issue": "we should probably just let it raise if this happens to make the issue obvious, should never stay alive 5s after sigkill",
"severity": "minor",
"line": 26
}
] | 1 |
python | # General helper functions
# ======================================
SAFE_WEIGHTS_NAME = "model.safetensors"
WEIGHTS_NAME = "model.bin"
SAFE_WEIGHTS_INDEX_NAME = "model.safetensors.index.json"
WEIGHTS_INDEX_NAME = "model.bin.index.json"
# ======================================
# Function for check if safetensor availa... | Review this code and list any quality issues. | [
{
"issue": "This function is still used, why comment it out?",
"severity": "minor",
"line": 26
}
] | 1 |
python | ).simplify()
assert q._name == eq._name
@pytest.mark.parametrize("window", (1, 2))
@pytest.mark.parametrize("df", (1, 2), indirect=True)
def test_rolling_agg(df, pdf, window):
def my_sum(vals, foo=None, *, bar=None):
return vals.sum()
result = df.rolling(window).agg(my_sum, "foo", bar="bar")
... | Review this code and list any quality issues. | [] | 0 |
python | elif isinstance(message, ModelResponse): # pragma: no branch
message_events = message.otel_events(self)
for event in message_events:
event.attributes = {
'gen_ai.message.index': message_index,
**(event.attributes or {}),
... | Review this code and list any quality issues. | [
{
"issue": "there's no requirement to do this, i think what was there before was fine. ideally the role would match whatever is actually sent to the api. for google and anthropic, that's `user`, not `tool`. for openai responses, there isn't even a role. and i certainly don't like the role being tool if there ar... | 1 |
python | # Validate that we've considered every parameter
inter_params = decay & no_decay
union_params = decay | no_decay
assert decay
assert no_decay
assert len(inter_params) == 0, f"parameters {inter_params} made it into both decay/no_decay sets!"
assert (
len(all_params.keys() - union_params) ... | Review this code and list any quality issues. | [] | 0 |
python | class TestSerialContext(DistributedTest):
world_size = 1
init_distributed = False
set_dist_env = False
def test_subclass_param(self):
setup_serial_env()
with deepspeed.zero.Init(config=config):
model = ConvNet()
assert model.param.ds_status == ZeroParamStatus.NOT_AV... | Review this code and list any quality issues. | [] | 0 |
python | fig3.colorbar(im3_1) # should not warn
subfig3_1.colorbar(im3_1) # should not warn
subfig3_1.colorbar(im3_2) # should not warn
with pytest.warns(UserWarning, match="different Figure"):
subfig3_1.colorbar(im4_1)
def test_clf_subplotpars():
keys = ('left', 'right', 'bottom', 'top', 'wspace... | Review this code and list any quality issues. | [
{
"issue": "What are you testing here? Is this just that the not-given parameters are not modified? If so, I'd write this as\n\n```suggestion\ndef test_suplots_adjust_incremental():\n fig = plt.figure()\n fig.subplots_adjust(left=0)\n fig.subplots_adjust(right=1)\n assert fig.subplotpars.left == 0\n... | 1 |
python | return False
if user_to_delete.is_superuser and not current_user.is_superuser:
# ordinary users may not delete superusers
return False
return True
def get_gravatar_url(email, size=50, default_params={"d": "mp"}):
"""
See https://gravatar.com/site/implement/images/ for Gravatar image ... | Review this code and list any quality issues. | [
{
"issue": "move the note to outside the code example.\r\n\r\n\r\n````suggestion\r\n ```\r\n\r\n Note: If any parameter in `default_params` also exists in the provider URL,\r\n It will be overridden by the provider URL's query parameter.\r\n````\r\n\r\nAlso Markdown code examples will not work here, th... | 1 |
python | @ModelBase.register("UltravoxModel")
class UltravoxWhisperEncoderModel(WhisperEncoderModel):
has_vision_encoder = False # no vision encoder
has_audio_encoder = True
def set_gguf_parameters(self):
super().set_gguf_parameters()
self.gguf_writer.add_clip_projector_type(gguf.VisionProjectorType... | Review this code and list any quality issues. | [
{
"issue": "consider extending from existing class if it's not much different from the other:\n\n\n```suggestion\nclass AudioFlamingo3WhisperEncoderModel(WhisperEncoderModel):\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | 'currenttobest1exp': '_currenttobest1',
'best2exp': '_best2',
'rand2exp': '_rand2'}
__combined = _binomial | _exponential
__init_error_msg = ("The population initialization method must be one of "
"'latinhypercube' or 'random', or an array of shap... | Review this code and list any quality issues. | [
{
"issue": "Can you combine these three branches?\r\n\r\ne.g. replace\r\n\r\n```\r\n elif strategy in self._binomial:\r\n pass\r\n elif strategy in self._exponential:\r\n pass\r\n else:\r\n raise ValueError(\"Please select a valid mutation strategy\")\r\n```... | 1 |
python | from functools import reduce
from typing import Callable, List, Optional, Sequence, Tuple, TypeVar, Union
import numpy as np
from mapbox_earcut import triangulate_float32 as earcut
from .. import config
from ..constants import DOWN, OUT, PI, RIGHT, TAU
from ..utils.deprecation import deprecated
from ..utils.iterables... | Review this code and list any quality issues. | [
{
"issue": "this function returns `np.ndarray` and `List[float]` also `List[np.ndarray]`, the typing should be\r\n```suggestion\r\ndef quaternion_mult(*quats: Sequence[float]) -> Union[np.ndarray, List[Union[float, np.ndarray]]]:\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | 'title': 'ZAIKO STREAMING TEST',
'alt_title': '[VOD] ZAIKO STREAMING TEST_20210603(Do Not Delete)',
'uploader_id': '454',
'uploader': 'ZAIKO ZERO',
'release_timestamp': 1583809200,
'thumbnail': r're:^https://[\w.-]+/\w+/\w+',
'thumbnails': 'maxcoun... | Review this code and list any quality issues. | [
{
"issue": "The rest of the extractor seemed to be written to be non-fatal all the way down to the expected `raise_no_formats` call. Will making this line fatal have any ill effect? (I'm just asking a question, not requesting a change here)",
"severity": "major",
"line": 26
}
] | 1 |
python | h.update(nonce)
tmp = h.digest()
def mix_tmp(count):
nonlocal tmp
for i in range(count):
mix_once(tmp)
def mix_twist(nonce):
nonlocal tmp
mix_once(base64.urlsafe_b64encode(tmp).rstrip(b'=') + nonce)
mix_once(cls._SECR... | Review this code and list any quality issues. | [
{
"issue": "Why not just move the opener also up here?\r\n\r\n```suggestion\r\n AbemaTVBaseIE._DEVICE_ID = str(uuid.uuid4())\r\n add_opener(self._downloader, AbemaLicenseHandler(self))\r\n\r\n username, _ = self._get_login_info()\r\n AbemaTVBaseIE._USERTOKEN = username and self.cache... | 1 |
python | from cognee.infrastructure.databases.relational import get_relational_engine
from cognee.modules.users.models import User
from cognee.modules.data.models import Dataset
from cognee.modules.users.permissions.methods import give_permission_on_dataset
from cognee.modules.data.methods.get_unique_dataset_id import get_uniqu... | Review this code and list any quality issues. | [
{
"issue": "If we'll use this function for creation of authorized datasets could you also use it in the load_or_create_datasets function so authorized datasets will all be created in one function?",
"severity": "critical",
"line": 8
}
] | 1 |
python | # 1. Sanity check: the model's `prepare_inputs_for_generation` comes from `GenerationMixin`
self.assertTrue("GenerationMixin" in str(model.prepare_inputs_for_generation))
# 2. If we pass input ids by themselves, we should get back the same input ids
model_inputs = model.prepare_inputs_for_gener... | Review this code and list any quality issues. | [
{
"issue": "for this block of assertions I would use `assertEqual` so it if it fails we get the two values explicitely displayed",
"severity": "critical",
"line": 26
}
] | 1 |
python | finally:
test_redis_client.close()
def test_handshake_success_when_auto_and_command_not_supported(self):
"""Test that handshake is performed correctly."""
maint_notifications_config = MaintNotificationsConfig(
enabled="auto", endpoint_type=EndpointType.INTERNAL_IP
)
... | Review this code and list any quality issues. | [
{
"issue": "The docstring is generic and doesn't describe what this specific test is validating. It should explain that this test verifies enabled=True mode raises an exception when MAINT_NOTIFICATIONS command fails.\n```suggestion\n \"\"\"\n Test that when maintenance notifications are enabled (e... | 1 |
python | device_name=device_name,
device_type=device_type,
)
# For NVRs or devices with no detected events, try to fetch events from ISAPI
if device_type == "NVR" or not camera.current_event_states:
def fetch_and_inject_nvr_events() -> None:
"""Fetch and inject NVR events in a single ex... | Review this code and list any quality issues. | [
{
"issue": "I am still trying to figure out what this change actually does, but now we use the sensor map to create more entities? What does this code do? Why do we need to inject events?\r\n\r\nIn the end I think we should look to use translation keys for the entity names as that's more user friendly :)",
... | 1 |
python | return gmean(a, axis=axis, dtype=dtype, weights=weights)
elif math.isinf(p):
message = "Power mean only implemented for finite `p`"
raise NotImplementedError(message)
xp = array_namespace(a, weights)
dtype = (xp_result_type(a, p, weights, force_floating=True, xp=xp)
if dtype is... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n if abs(p) <= p_threshold:\r\n```\r\nMy mistake!",
"severity": "minor",
"line": 26
}
] | 1 |
python | f"'temperature={temperature}' should be a strictly positive float, less than or equal to 1.0 and greater than 0."
)
@register_logit_processor("top_k")
def top_k_logit_processor(logits, top_k: int):
"""
top_k logit processor
"""
indices_to_remove = logits < torch.topk(logits, top_k)[0][..., -1,... | Review this code and list any quality issues. | [
{
"issue": "Does it really make an explicit performance improvement?",
"severity": "major",
"line": 26
}
] | 1 |
python | ax.scatter(np.arange(10), np.arange(10)*1, label='#1', c='r')
ax.scatter(np.arange(10), np.arange(10)*2, label='#2', c='g')
ax.scatter(np.arange(10), np.arange(10)*3, label='#3', c='b')
leg = ax.legend(labelcolor='linecolor')
for text, color in zip(leg.get_texts(), ['r', 'g', 'b']):
assert mpl.... | Review this code and list any quality issues. | [] | 0 |
python | ):
if all(direction == ORIGIN):
line_vector = np.array(point_2) - np.array(point_1)
direction = np.array([line_vector[1], -line_vector[0], 0])
Brace.__init__(self, Line(point_1, point_2), direction=direction, **kwargs)
class ArcBrace(Brace):
"""Creates a :class:`~Brace` tha... | Review this code and list any quality issues. | [
{
"issue": "Optional is used when the value passed can be `None`, in this case None would break the scene, so Optional is not valid.\r\n```suggestion\r\n arc : :class:`~.Arc`\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | ) -> None:
"""Initialize the power sensor."""
VeraEntity.__init__(self, vera_device, controller_data)
self._attr_name = f"{self.vera_device.name} Power"
self._unique_id = f"{self._unique_id}_power"
def update(self) -> None:
"""Update the sensor state."""
super().upda... | Review this code and list any quality issues. | [
{
"issue": "The entity naming pattern doesn't follow modern Home Assistant standards. The class should set `_attr_has_entity_name = True` and use `_attr_translation_key` instead of manually constructing the name. The base entity class should handle the device name, and the sensor should only specify its specifi... | 1 |
python | import re
import urllib.parse
from .common import InfoExtractor
from ..utils import js_to_json, url_or_none
from ..utils.traversal import traverse_obj
_DOMAINS = (
'aloula.sba.sa',
'bahry.com',
'maraya.sba.net.ae',
'sat7plus.org',
)
_LANGUAGES = (
'ar',
'en',
'fa',
)
class FaulioBase(In... | Review this code and list any quality issues. | [
{
"issue": "- move `_LANGUAGES` inside baseclass\r\n- baseclass name must end in `IE`\r\n```suggestion\r\n\r\nclass FaulioBaseIE(InfoExtractor):\r\n```",
"severity": "major",
"line": 22
}
] | 1 |
python | 'url': 'https://weyyak.com/en/movie/233255/8-Seconds',
'md5': 'fe740ae0f63e4d1c8a7fc147a410c564',
'info_dict': {
'id': '233255',
'ext': 'm3u8',
'title': '8 Seconds',
'duration': 6490,
},
},
]
def _real_e... | Review this code and list any quality issues. | [
{
"issue": "- if we are not returning the `video_id` var in the info_dict, it's better to not use a var at all\r\n - if there is only 1 video/format URL, it can be fatal\r\n - do not do `re.sub`, we want to extract the master m3u8, not a single media playlist\r\n```suggestion\r\n video_details = self._do... | 1 |
python | # Copyright 2021-2024 Avaiga Private Limited
#
# 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 agree... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n accepts hashable parameters, the `\"mongodb_extra_args\"` should be converted into a frozenset beforehand.\r\n```",
"severity": "minor",
"line": 23
}
] | 1 |
python | assert_equal(vals[[1, 2]], [np.inf, 999])
assert_equal(type(vals), np.ndarray)
class TestRealIfClose:
def test_basic(self):
a = np.random.rand(10)
b = real_if_close(a + 1e-15j)
assert_all(isrealobj(b))
assert_array_equal(a, b)
b = real_if_close(a + 1e-7j)
a... | Review this code and list any quality issues. | [
{
"issue": "There's no need to check all inputs AFAIK. But I wouldn't mind if you want to do so anyway, although in that case it would be cleaner to refactor this as a parameterized test.",
"severity": "major",
"line": 26
}
] | 1 |
python | `b` parameter values of `gdtr(a, b, x)`. `b` is the "shape" parameter
of the gamma distribution.
x : array_like
Nonnegative real values, from the domain of the gamma distribution.
out : ndarray, optional
If a fourth argument is given, it must be a numpy.ndarray whose size
matches... | Review this code and list any quality issues. | [
{
"issue": "These should be double backticks as it is niether an argument nor a link to another function\r\n```suggestion\r\n ``gdtria(p, b, x) = gammaincinv(b, p)/x``.\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | """
NumericField is used to define a numeric field in a schema definition
"""
def __init__(self, name: str, **kwargs):
Field.__init__(self, name, args=[Field.NUMERIC], **kwargs)
class GeoField(Field):
"""
GeoField is used to define a geo-indexing field in a schema definition
"""
... | Review this code and list any quality issues. | [
{
"issue": "Maybe these args could be somewhere else, but referred to? Looks like duplication",
"severity": "minor",
"line": 26
}
] | 1 |
python | except socket.error:
have_ipv6 = False
return have_ipv6
def test_unix_socket():
'''Return True if UNIX sockets are available on this platform.'''
try:
socket.AF_UNIX
except AttributeError:
return False
else:
return True
def format_addr_port(addr, port):
'''Retur... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\n framework's static port range starting at TEST_RUNNER_PORT_MIN (default=11000). Using IP_PORTRANGE_HIGH avoids\n```\n\nnit: Could avoid hard-coding the upper range, which may change in the future.",
"severity": "minor",
"line": 26
}
] | 1 |
python | # Unparenthesized walruses are now allowed in set literals & set comprehensions
# since Python 3.9
{x := 1, 2, 3}
{x4 := x**5 for x in range(7)}
# We better not remove the parentheses here (since it's a 3.10 feature)
x[(a := 1)]
x[(a := 1), (b := 3)]
# don't remove the brackets here, it changes the meaning of the code... | Review this code and list any quality issues. | [
{
"issue": "This test seems like the wrong place, it's about PEP 572 (walrus expressions). Maybe move it to one of the `context_managers_*` tests.",
"severity": "critical",
"line": 9
}
] | 1 |
python | from unittest.mock import Mock
import py_markdown
class TestPyMarkdown:
def test_plugin_hooks(self, monkeypatch):
console_mock = Mock()
monkeypatch.setattr(py_markdown, "console", console_mock)
config = "just a config"
runtime = "just a runtime"
py_markdown.plugin.configu... | Review this code and list any quality issues. | [] | 0 |
python | "The cpu-offloading feature can only be used while also using 8-bit-quantization.\n"
"Use '--load-8bit' to enable 8-bit-quantization\n"
"Continuing without cpu-offloading enabled\n"
)
return False
if not "linux" in sys.platform:
warnings.warn(
... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n dtype: Optional[torch.dtype]=None,\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | height], or a list of [left, bottom] where the width and
height will be assumed to be zero. The bbox will be
transformed to display coordinate by the given transform.
"""
if bbox is None or isinstance(bbox, BboxBase):
self._bbox_to_anchor = bbox
else:
try:... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\n except TypeError:\n```\nBrackets are not needed if we only catch one exception.",
"severity": "minor",
"line": 26
}
] | 1 |
python | """The traceback."""
if self._traceback is None:
self._traceback = Traceback(self.tb)
return self._traceback
@traceback.setter
def traceback(self, value: Traceback) -> None:
self._traceback = value
def __repr__(self) -> str:
if self._excinfo is None:
... | Review this code and list any quality issues. | [
{
"issue": "Simpler implementation:\r\n```python\r\ndef _get_single_subexc(\r\n eg: BaseExceptionGroup[BaseException],\r\n) -> BaseException | None:\r\n if len(eg.exceptions) != 1:\r\n return None\r\n if isinstance(e := eg.exceptions[0], BaseExceptionGroup):\r\n return _get_single_subexc(... | 1 |
python | content = self._call_api(
'1.5', 'IN/CONTENT/VIDEOURL/VOD/' + video_id, video_id)
if not self.get_param('allow_unplayable_formats') and content.get('isEncrypted'):
raise ExtractorError('This video is DRM protected.', expected=True)
dash_url = content['videoURL']
headers =... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n subtitles.setdefault(sub.get('subtitleLanguageName', 'ENG'), []).append({\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | # Copyright 2015 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You
# may not use this file except in compliance with the License. A copy of
# the License is located at
#
# https://aws.amazon.com/apache2.0/
#
# or in the "license" file accomp... | Review this code and list any quality issues. | [
{
"issue": "I'm slightly leery about this if the user somehow ends up with an older version of Botocore on their system, but because it's constrained to the docs module we're probably alright.",
"severity": "minor",
"line": 15
}
] | 1 |
python | from uuid import UUID
from cognee.shared.logging_utils import get_logger
from cognee.infrastructure.databases.graph import get_graph_engine
from cognee.context_global_variables import set_database_global_context_variables
logger = get_logger("GraphDataFormatter")
async def get_formatted_graph_data(dataset_id: UUID, ... | Review this code and list any quality issues. | [
{
"issue": "I think this is used by the UI not by retrievers. @borisarzentar am I right?",
"severity": "minor",
"line": 10
}
] | 1 |
python | # ruff: noqa
import json
import random
import string
from vllm import LLM
from vllm.sampling_params import SamplingParams
# This script is an offline demo for running Pixtral.
#
# If you want to run a server/client setup, please follow this code:
#
# - Server:
#
# ```bash
# vllm serve mistralai/Mistral-7B-Instruct-v0... | Review this code and list any quality issues. | [
{
"issue": "Note that this is not a demo for Pixtral",
"severity": "minor",
"line": 9
}
] | 1 |
python | rollout_is_weights = rollout_is_weights * response_mask
# Compute IS weight metrics (BEFORE truncation to get accurate fraction_high/low)
metrics: dict[str, float] = compute_is_metrics(
rollout_is_weights=rollout_is_weights,
log_ratio_for_metrics=log_ratio_for_metrics,
response_mask=res... | Review this code and list any quality issues. | [
{
"issue": "why do we need distributed masked mean?",
"severity": "minor",
"line": 26
}
] | 1 |
python | )[0]
center_x, center_y = center_coordinates
return (
center_x - text_w // 2,
center_y - text_h // 2,
center_x + text_w // 2,
center_y + text_h // 2,
)
def annotate(
self, scene: ImageType, key_points: KeyPoints, labels: List[str] = No... | Review this code and list any quality issues. | [
{
"issue": "if labels are `None`, this fails with `TypeError: unsupported operand type(s) for *: 'NoneType' and 'int'`\r\n\r\nSomething basic would work, for example:\r\n```\r\nif labels is None:\r\n labels = [str(i) for i in range(K)]\r\n```\r\n\r\nI've checked - it produces the correct COCO IDs for both ul... | 1 |
python | ),
(
SERVICE_SET_MEALPLAN,
{
ATTR_DATE: "2023-10-21",
ATTR_ENTRY_TYPE: "lunch",
ATTR_RECIPE_ID: "recipe_id",
},
),
],
)
async def test_service_entry_availability(
hass: HomeAssistant,
mock_mealie_client: Asyn... | Review this code and list any quality issues. | [
{
"issue": "These assertions are matching the exception string against the translation key. `ServiceValidationError.__str__()` will generate the (English) translated message for `translation_key`, so this regex likely won’t match and the test will fail. Prefer capturing the exception (`as err`) and asserting `e... | 1 |
python | # Directly build these labels so that indexing can find them. Allow this to
# fail in case there are build errors in the client, and just warn the user
# that they may be missing generated files.
subprocess.check_call(
[bazel, "build", "--keep_going", "--remote_download_outputs=toplevel"]
+ ... | Review this code and list any quality issues. | [
{
"issue": "What's the purpose of the `str` on line 90? You seem to be doing string operations on it; if it's for mypy, maybe assert it's a string earlier, e.g.:\r\n\r\n```suggestion\r\n obj_file = arguments[-1]\r\n assert obj_file is str\r\n\r\n # The configuration is the name of the subdirectory of `... | 1 |
python | "message": "Writing all eligible user roles",
"user-agent": self.request.headers.get("User-Agent"),
"request_id": self.request_uuid,
}
log.debug(log_data)
self.write_error(501, message="Get role details")
async def put(self, account_id, role_name):
"""
... | Review this code and list any quality issues. | [
{
"issue": "Can you add some tests for this handler? Some cases that come to mind:\r\n- No user, 403\r\n- Unauthorized user, 403\r\n- Successful delete, 204\r\n- Successful delete of a role with a `Path`, 204\r\n\r\nThis will require mocking using [moto](https://github.com/spulec/moto). Have you used that befor... | 1 |
python | rl.GuiTextAlignmentVertical.TEXT_ALIGN_TOP: 0,
rl.GuiTextAlignmentVertical.TEXT_ALIGN_MIDDLE: (rect.height - text_size.y) / 2,
rl.GuiTextAlignmentVertical.TEXT_ALIGN_BOTTOM: rect.height - text_size.y,
}.get(alignment_vertical, 0)
# Draw the text in the specified rectangle
rl.draw_text_ex(font, display_te... | Review this code and list any quality issues. | [] | 0 |
python | return false if z else true
if isinstance(e, Boolean):
return e
raise TypeError('expecting bool or Boolean, not `%s`.' % e)
@sympify_method_args
class Boolean(Basic):
"""A Boolean object is an object for which logic operations make sense."""
__slots__ = ()
kind = BooleanKind
if TYPE... | Review this code and list any quality issues. | [
{
"issue": "I was wondering why the first overload here does not cover this but then I remember now that Mapping is not covariant in the key type:\nhttps://github.com/python/typing/issues/445\n\nFor now the overload you have added here is fine but in future this could lead to an explosion of overloads. We proba... | 1 |
python | def livekit_item_to_openai_item(item: llm.ChatItem) -> realtime.ConversationItem:
conversation_item: realtime.ConversationItem
if item.type == "function_call":
conversation_item = realtime.RealtimeConversationItemFunctionCall(
id=item.id,
type="function_call",
call_i... | Review this code and list any quality issues. | [] | 0 |
python | def __init__(
self, coordinator: WaterFurnaceCoordinator, description: SensorEntityDescription
) -> None:
"""Initialize the sensor."""
super().__init__(coordinator)
self.entity_description = description
# This ensures that the sensors are isolated per waterfurnace unit
... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\n device_info[\"name\"] = coordinator.device_metadata.awlabctypedesc\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | # self.resize_frame_shape(fixed_dimension=self.fixed_dimension)
def get_mobjects_indicating_movement(self):
"""
Returns all mobjects whose movement implies that the camera
should think of all other mobjects on the screen as moving
Returns
-------
list
""... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n If set to ``True``, only allows focusing on mobjects that are already in frame.\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | # Copyright 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
"""Performance benchmark for the jailer."""
import os
import shutil
import subprocess
import numpy as np
import pytest
from framework.jailer import DEFAULT_CHROOT_PATH, JailerContext
@pytest.mark.nonci
@... | Review this code and list any quality issues. | [
{
"issue": "doesn't really matter as perf tests are run sequentially, but you could use a tempdir from `mktemp` (iirc we have a util for that already that also takes care of cleaning up).",
"severity": "minor",
"line": 26
}
] | 1 |
python | # Copyright The PyTorch Lightning team.
#
# 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 i... | Review this code and list any quality issues. | [
{
"issue": "I am not very sure if we can introduce Mixins again, @williamFalcon",
"severity": "minor",
"line": 25
}
] | 1 |
python | f(k) = \binom{n}{k} \frac{B(k + a, n - k + b)}{B(a, b)}
for :math:`k \in \{0, 1, \dots, n\}`, :math:`n \geq 0`, :math:`a > 0`,
:math:`b > 0`, where :math:`B(a, b)` is the beta function.
`betabinom` takes :math:`n`, :math:`a`, and :math:`b` as shape parameters.
%(after_notes)s
References
----... | Review this code and list any quality issues. | [
{
"issue": "If the user were to pass a float before, they would have gotten a less specific error:\r\n\r\n```python3\r\nfrom scipy import stats\r\nstats.betabinom.rvs(n=10.5, a=1.2, b=1.9, size=10)\r\n# ValueError: Domain error in arguments. The `scale` parameter must be positive for all distributions, and many... | 1 |
python | @console_ns.route("/rag/pipelines/<uuid:pipeline_id>/workflows/draft/datasource/variables-inspect")
class RagPipelineDatasourceVariableApi(Resource):
@console_ns.expect(console_ns.models[DatasourceVariablesPayload.__name__])
@setup_required
@login_required
@account_initialization_required
@get_rag_p... | Review this code and list any quality issues. | [
{
"issue": "The import statement is placed in the middle of the file rather than at the top with other imports. Move this import to the top of the file with the other import statements to follow Python's standard import conventions.",
"severity": "major",
"line": 26
}
] | 1 |
python | 'url': data_json['vtt_url'],
'ext': 'vtt',
})
self._sort_formats(formats)
return {
'id': id,
'title': data_json.get('title'),
'view_count': data_json.get('views'),
'thumbnail': data_json.get('preview_url'),
'upload_d... | Review this code and list any quality issues. | [
{
"issue": "Why is title and description `feed`? Just dont return them if they are not meaningfull",
"severity": "minor",
"line": 26
}
] | 1 |
python | if interpolation is not None:
method = _check_interpolation_as_method(
method, interpolation, "quantile")
a = np.asanyarray(a)
if a.dtype.kind == "c":
raise TypeError("a must be an array of real numbers")
# Use dtype of array if possible (e.g., if q is a python int or float).
... | Review this code and list any quality issues. | [
{
"issue": "A general comment: I think these checks should happen inside `_weights_ar_valid` - this will ensure they are used for `percentile` as well.",
"severity": "minor",
"line": 26
}
] | 1 |
python | 'only_matching': True,
}]
_API_BASE = 'https://api.atresplayer.com/'
def _perform_login(self, username, password):
try:
self._download_webpage(
'https://account.atresplayer.com/auth/v1/login', None,
'Logging in', data=urlencode_postdata({
... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n metadata_url = self._download_json(\r\n self._API_BASE + 'client/v1/url', video_id, 'Downloading API endpoint data',\r\n query={'href': urllib.parse.urlparse(url).path})['href']\r\n metadata = self._download_json(metadata_url, video_id)\r\n```",
... | 1 |
python | return self._build_video_info(video)
class NebulaSubscriptionsIE(NebulaBaseIE):
IE_NAME = 'nebula:subscriptions'
_VALID_URL = r'https?://(?:www\.)?(?:watchnebula\.com|nebula\.app)/myshows'
_TESTS = [
{
'url': 'https://nebula.app/myshows',
'playlist_mincount': 1,
... | Review this code and list any quality issues. | [
{
"issue": "Keep consistency. It is called `myshows` below\r\n```suggestion\r\n channel = self._call_nebula_api(next_url, 'myshows', auth_type='bearer',\r\n```",
"severity": "critical",
"line": 26
}
] | 1 |
python | True,
0,
0,
)
# Now let's run the test
test_setup.fork_info.include_spends(conds, test_setup.test_block, test_setup.test_block.header_hash)
# Let's make sure the results are as expected
expected_same_parent_additions = (
{test_setup.child_coin.name()}
if eligible_for_... | Review this code and list any quality issues. | [
{
"issue": "isn't there supposed to be a check that `same_as_parent` is set correctly here?",
"severity": "minor",
"line": 26
}
] | 1 |
python | 'playlist_mincount': 29,
'info_dict': {
'id': '100719456',
},
}]
def _entries(self, uid):
for page in itertools.count(1):
vod_json = self._download_json('https://gql.trovo.live/', uid, query={
'query': '{getChannelClipVi... | Review this code and list any quality issues. | [
{
"issue": "too much duplicate code. If you move the base_url and query to class variables, both the extractors can share the same code",
"severity": "major",
"line": 26
}
] | 1 |
python | )
@classmethod
def from_multiclass_folder_structure(
cls, root_directory_path: str
) -> "ClassificationDataset":
"""
Load data from a multiclass folder structure into a ClassificationDataset.
Args:
root_directory_path (str): The path to the dataset directory.
... | Review this code and list any quality issues. | [
{
"issue": "We can do it simpler. Instead of:\r\n\r\n```python\r\nclasses = list(set(classes))\r\nclasses.sort()\r\n```\r\n\r\nYou can do:\r\n\r\n```python\r\nclasses = sorted(set(classes))\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | form_id: str
def __init__(self, proto: ButtonGroupProto, root: ElementTree) -> None:
super().__init__(proto, root)
self.type = "button_group"
# Store the formatted content strings, not the Option objects
self.options = [opt.content for opt in proto.options]
@property
def _i... | Review this code and list any quality issues. | [
{
"issue": "The return type annotation for `value` property is incomplete. According to the implementation, when `_is_single_select` is True and the value is None (line 773-774), it returns None. However, the current type annotation `T | list[T]` doesn't include None for the single-select case. The annotation s... | 1 |
python | return model, tokenizer
# In the normal case, load up the base model weights again.
base_adapter = get_model_adapter(base_model_path)
base_model, tokenizer = base_adapter.load_model(
base_model_path, from_pretrained_kwargs
)
model = PeftModel.from_pretrained(base_mod... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n \"Model adapter for Vicuna models (e.g., lmsys/vicuna-7b-v1.5)\" \"\"\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | """
def __init__(self, width=0.2, angle=0, **kwargs):
self.angle = angle
VMobject.__init__(self, **kwargs)
self.set_points_as_corners([UP, UP + RIGHT, RIGHT])
self.scale_to_fit_width(width, about_point=ORIGIN)
self.rotate(self.angle, about_point=ORIGIN)
class Arrow(Line):
... | Review this code and list any quality issues. | [
{
"issue": "No changes requested, just want to mention: very nice example, thank you!",
"severity": "minor",
"line": 26
}
] | 1 |
python | from ..base import ConfigBase
from ..training_service import TrainingServiceConfig
from .k8s_storage import K8sStorageConfig
@dataclass(init=False)
class KubeflowRoleConfig(ConfigBase):
replicas: int
command: str
gpu_number: Optional[int] = 0
cpu_number: int
memory_size: Union[str, int]
docker_... | Review this code and list any quality issues. | [
{
"issue": "If `null` has same effect as `\"default\"`, the type should be `str`.",
"severity": "minor",
"line": 26
}
] | 1 |
python | higher_tx_cost = uint64(20)
lower_tx_cost = uint64(10)
higher_tx_fee = uint64(5)
lower_tx_fee = uint64(1)
# 2 for a, 1 for b, 2 for c
peer_tx_a = [
get_transaction_queue_entry(peer_a, 0, {peer_a: PeerWithTx(str(peer_a), lower_tx_fee, higher_tx_cost)}),
get_transaction_queue_entry(pee... | Review this code and list any quality issues. | [
{
"issue": "what's the type error we're ignoring here?",
"severity": "minor",
"line": 26
}
] | 1 |
python | mypyc_targets = [
"src/black/__init__.py",
"src/blib2to3/pytree.py",
"src/blib2to3/pygram.py",
"src/blib2to3/pgen2/parse.py",
"src/blib2to3/pgen2/grammar.py",
"src/blib2to3/pgen2/token.py",
"src/blib2to3/pgen2/driver.py",
"src/blib2to3/pgen2/pgen.py",
... | Review this code and list any quality issues. | [] | 0 |
python | else:
if m.get_critical_point(LEFT)[0] < scene_critical_x_left:
scene_critical_x_left = m.get_critical_point(LEFT)[0]
if m.get_critical_point(RIGHT)[0] > scene_critical_x_right:
scene_critical_x_right = m.get_critical_point(RIGHT)[0]
... | Review this code and list any quality issues. | [
{
"issue": "Sorry, this is not quite what I meant -- this is now a weird mix between snake_casing and CamelCasing. Please use `new_width` and `new_height`, respectively.",
"severity": "minor",
"line": 26
}
] | 1 |
python | 'height': int_or_none(height),
'ext': ext,
})
self._sort_formats(formats)
thumbnails = []
for k, v in item.items():
if k.startswith('photo_') and v:
width = k.replace('photo_', '')
th... | Review this code and list any quality issues. | [
{
"issue": "Since the if block returns, else can be removed and the whole thing dedented",
"severity": "minor",
"line": 26
}
] | 1 |
python | }
for k, v in provider_tokens.items()
if v.token
}
response = await client.post(
f'{api_url}/api/add-git-providers',
json={
'provider_tokens': provider_tokens_json,
},
)
re... | Review this code and list any quality issues. | [
{
"issue": "Nice work!\n\nAny chance we could reduce the nesting here?",
"severity": "minor",
"line": 26
}
] | 1 |
python | while len(models) > 0:
model = models.pop()
if isinstance(model, type(unwrap_model(unet))):
unet_ = model
else:
raise ValueError(f"unexpected save model: {model.__class__}")
# returns a tuple of state dictionary and network alphas
lora... | Review this code and list any quality issues. | [
{
"issue": "We don't need to upcast when using Bfloat16.",
"severity": "minor",
"line": 26
}
] | 1 |
python | ]
async def ainvoke(
self, text: str | list[str] | Document | list[Document], *args, **kwargs
) -> list[DocumentWithEmbedding]:
input_ = self.prepare_input(text)
client = self.prepare_client(async_version=True)
resp = await self.openai_response(
client, input=[_.text... | Review this code and list any quality issues. | [] | 0 |
python | _alarm_unsubs: list[CALLBACK_TYPE] | None = None
_attr_color: RGBColor | None = None
@property
def color(self) -> RGBColor | None:
"""Return the color of the calendar entity as RGBColor."""
return self._attr_color
@property
def event(self) -> CalendarEvent | None:
"""Retur... | Review this code and list any quality issues. | [
{
"issue": "Please add a test for a case where there is no upcoming event but the calendar has a color.\r\n\r\nYou may just want to add another MockCalendarEntity to the list of entities to exercise this case. You can also pass a color in the constructor instead of changing the attributes in the middle of the t... | 1 |
python | 'ext': 'mp4',
'title': '【特別トーク番組アーカイブス】Merm4id×燐舞曲 2nd LIVE「VERSUS」',
'live_status': 'not_live',
'release_date': '20231201',
'thumbnail': str,
}
}, {
'url': 'https://mixch.tv/archive/1214',
'only_matching': True,
}]
def _real_extract(s... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n 'thumbnail': traverse_obj(info_json, ('archive', 'thumbnailURL', {url_or_none})),\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | 'linecolor': ['get_markerfacecolor',
'get_facecolor',
'get_markeredgecolor',
'get_edgecolor',
'get_color'],
'markerfacecolor': ['get_markerfacecolor', 'get_facecolor'],
... | Review this code and list any quality issues. | [
{
"issue": "Can that be the case? I would have though that this is not a valid color specification.",
"severity": "minor",
"line": 26
}
] | 1 |
python | async def async_setup_entry(
hass: HomeAssistant,
config_entry: SwitcherConfigEntry,
async_add_entities: AddConfigEntryEntitiesCallback,
) -> None:
"""Set up Switcher sensor from config entry."""
@callback
def async_add_sensors(coordinator: SwitcherDataUpdateCoordinator) -> None:
"""Add... | Review this code and list any quality issues. | [
{
"issue": "`elif coordinator.data.device_type.category in [DeviceCategory.WATER_HEATER, DeviceCategory.HEATER]`",
"severity": "minor",
"line": 26
}
] | 1 |
python | return graph.function(x)
else:
alpha = binary_search(
function=lambda a: self.point_to_coords(graph.point_from_proportion(a))[
0
],
target=x,
lower_bound=0,
upper_bound=1,
)
if... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n .. code-block:: pycon\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | prereq_tasks: Optional[List[UUID]] = None,
reboot_after_setup: bool = False,
rename_output: bool = False,
stats_file: Optional[str] = None,
stats_format: Optional[enums.StatsFormat] = None,
supervisor_env: Optional[Dict[str, str]] = None,
supervisor_exe: Optional[str] = N... | Review this code and list any quality issues. | [] | 0 |
python | _TESTS = [{
'url': 'http://www.rottentomatoes.com/m/toy_story_3/trailers/11028566/',
'info_dict': {
'id': '11028566',
'ext': 'mp4',
'title': 'Best Tom Hanks Movies',
'description': 'We look at the filmography of America\'s Dad, as we count down our list of... | Review this code and list any quality issues. | [
{
"issue": "We need to try to construct the `playlist_id` since /trailers/ URLs have different playlists than their non-trailers URL counterparts. `join_nonempty` can be imported from utils\r\n```suggestion\r\n playlist_id, trailers, video_id = self._match_valid_url(url).group('playlist', 'tr', 'id')\r\n... | 1 |
python | instrument_id=instrument_id,
bid_price=instrument.make_price(converted_bid_price),
ask_price=instrument.make_price(converted_ask_price),
bid_size=instrument.make_qty(bid_size),
ask_size=instrument.make_qty(ask_size),
ts_event=ts_event,
... | Review this code and list any quality issues. | [
{
"issue": "We should check for `None` here, log an error and return (common pattern in other adapters). This is clearer than an attribute error on a `NoneType` later.",
"severity": "minor",
"line": 26
}
] | 1 |
python | credential_plugins = dict((ep.name, ep.load()) for ep in iter_entry_points('awx_plugins.credentials'))
HIDDEN_PASSWORD = '**********'
def build_safe_env(env):
"""
Build environment dictionary, hiding potentially sensitive information
such as passwords or keys.
"""
hidden_re = re.compile(r'API|TOK... | Review this code and list any quality issues. | [
{
"issue": "good to rename gateway -> resource_server",
"severity": "minor",
"line": 26
}
] | 1 |
python | :param startup_nodes:
List of nodes from which initial bootstrapping can be done
:param host:
Can be used to point to a startup node
:param port:
Can be used to point to a startup node
:param require_full_coverage:
When set to False (default ... | Review this code and list any quality issues. | [
{
"issue": "Just an opinion, maybe it makes sense to use a phrase \"Eventually consistent data\" and not \"Stale data\". Eventual consistence is something that defined by replication mechanism itself and not something that our client affects",
"severity": "minor",
"line": 26
}
] | 1 |
python | @test.command()
@click.argument("server_address")
def reddit(server_address: str):
"""
Create an event graph
"""
from backend.usecases.reddit_marketing import create_test_graph
from backend.util.request import Requests
test_graph = create_test_graph()
url = f"{server_address}/graphs"
he... | Review this code and list any quality issues. | [] | 0 |
python | Args:
payload: The GitHub webhook payload dictionary
oh_label: The OpenHands label for issues (e.g., "openhands" or "openhands-exp")
inline_oh_label: The inline OpenHands mention (e.g., "@openhands" or "@openhands-exp")
enable_proactive_conversations: Whether proactive conversation start... | Review this code and list any quality issues. | [
{
"issue": "🟠 **Important**: This function does not handle `pull_request_review` events (when someone submits a review with a body comment containing @openhands).\n\nPR review events have a `review` field instead of `comment`:\n```json\n{\n \"action\": \"submitted\",\n \"review\": {\n \"body\": \"@openhan... | 1 |
python | if video_data.get('mpx_is_livestream') == '1':
live = True
player_id = traverse_obj(
video_data, 'mpx_m3upid', ('video', 'meta', 'mpx_m3upid'), 'mpx_pid',
('video', 'meta', 'mpx_pid'), 'pid_streaming_web_medium')
title = f'{channel} livestream'
... | Review this code and list any quality issues. | [
{
"issue": "Why not\r\n```suggestion\r\n info = {\r\n 'title': f'{channel} livestream'\r\n }\r\n```\r\nsame below",
"severity": "minor",
"line": 26
}
] | 1 |
python | horz = int((focal_point.x * 100) // self.width)
vert = int((focal_point.y * 100) // self.height)
return f"background-position: {horz}% {vert}%;"
else:
return "background-position: 50% 50%;"
@property
def background_position_x(self):
"""
Returns the ho... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n This can be passed as a data attribute to then be used in JavaScript to set the `background-position-x` CSS property instead of using inline styles.\r\n\r\n <div class=\"my-bg-image\" data-background-position-x=\"{{ image.background_position_x }}\">\r\n ... | 1 |
python | if spritesheets:
formats.append({
'format_id': 'spritesheets',
'format_note': 'storyboard',
'acodec': 'none',
'vcodec': 'none',
'ext': 'mhtml',
'protocol': 'mhtml',
'url': 'about:invalid',
... | Review this code and list any quality issues. | [] | 0 |
python | return rechunk_p2p(
x,
chunks,
threshold=threshold,
block_size_limit=block_size_limit,
balance=balance,
)
else:
raise NotImplementedError(f"Unknown rechunking method '{method}'")
def _choose_rechunk_method(old_chunks, new_chunks, thresho... | Review this code and list any quality issues. | [
{
"issue": "This corresponds to the threshold for multi-stage rechunking in `tasks`.",
"severity": "minor",
"line": 26
}
] | 1 |
python | 'age_limit': 18,
'availability': 'premium_only',
'duration': 2710,
'cast': 'count:3',
'tags': 'count:29',
'thumbnail': r're:^https?://cdn-image\.gtflixtv\.com.*\.jpg.*$',
'subtitles': 'count:6'
},
'params': {
'skip_downl... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n subtitles = {country_code: [{\r\n 'url': f'https://pornbox.com/contents/{video_id}/subtitles/{country_code}',\r\n 'ext': 'srt'\r\n }] for country_code in traverse_obj(public_data, ('subtitles', ..., {str}))}\r\n```",
"severity": "minor",
... | 1 |
python | }, {
'url': 'https://podcasts.apple.com/podcast/207-whitney-webb-returns?i=1000482637777',
'only_matching': True,
}, {
'url': 'https://podcasts.apple.com/podcast/id1135137367?i=1000482637777',
'only_matching': True,
}]
def _real_extract(self, url):
episode_id = self.... | Review this code and list any quality issues. | [
{
"issue": "Let's bring this up to date with the modern yt-dlp code style:\r\n```suggestion\r\n **traverse_obj(model_data, {\r\n 'title': ('title', {str}),\r\n 'url': ('streamUrl', {clean_podcast_url}),\r\n 'timestamp': ('releaseDate', {parse_iso8601}),\r\... | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.