language
string
code-snippit
string
instruction
string
flaws
list
flaw_count
int64
python
Refer to the documentation for more information. Parameters ---------- path_to_video : :class:`str` Path to the video to extract information from. name : :class:`str` Name of the test. The .json file will be named with it. See Also -------- tests/utils/video_tester.py : re...
Review this code and list any quality issues.
[ { "issue": "You seem to have taken the migration a bit too seriously I suppose.\r\n\r\nMake sure you aren't doing things like this where you make a `Path` and then immediately cast to a `str`.\r\nMake `Path`s at places only where you can see it makes sense to do so.", "severity": "minor", "line": 26 }...
1
python
# coding: utf-8 from __future__ import unicode_literals from .common import InfoExtractor from ..utils import ( ExtractorError, int_or_none, qualities, ) class RedGifsIE(InfoExtractor): _VALID_URL = r'https?://(?:(?:www|thumbs2?)\.)?redgifs\.com/(?:watch/)?(?P<id>[^-/?#\.]+)' _TESTS = [{ ...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n\r\nfrom .common import InfoExtractor\r\nfrom ..utils import (\r\n ExtractorError,\r\n int_or_none,\r\n qualities,\r\n)\r\n\r\n```", "severity": "major", "line": 12 } ]
1
python
"Annulus", "Line", "DashedLine", "TangentLine", "Elbow", "Arrow", "Vector", "DoubleArrow", "CubicBezier", "Polygon", "RegularPolygon", "ArcPolygon", "ArcPolygonFromArcs", "Triangle", "ArrowTip", "Rectangle", "Square", "RoundedRectangle", "Cutout", ...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\nfrom typing import Sequence,Type\r\n```", "severity": "minor", "line": 26 } ]
1
python
'view_count': ('video_aggregate_info', 'total_views', {int_or_none}), 'tags': ('video_tags', ..., 'tag', {str}), }), '__post_extractor': self.extract_comments( content_code=content_code, comment_group_id=traverse_obj(data_json, ('video_comment_sett...
Review this code and list any quality issues.
[ { "issue": "to ensure user input is a number\r\n```suggestion\r\n 'limit': int_or_none(self._configuration_arg('max_comments', [''])[0]) or 120,\r\n```", "severity": "minor", "line": 26 } ]
1
python
"""Extensive argparser module for logging""" def mixin_suppress_root_logging_parser(parser): parser.add_argument( '--suppress_root_logging', action='store_true', default=False, help='If set, then no root handlers will be suppressed from logging.', )
Review this code and list any quality issues.
[ { "issue": "CLI args are separated by `-` instead of underscore. The python variable name will be available with underscores.", "severity": "minor", "line": 6 } ]
1
python
lang = traverse_obj(subs, ('srclang', {str.lower})) or 'ja' subtitles.setdefault(lang, []).append({'url': subs['src']}) return { 'id': streaks_id, 'display_id': media_id, 'formats': formats, 'live_status': live_status, 'subtitles': subtitl...
Review this code and list any quality issues.
[]
0
python
message: str """Description of the unexpected behavior.""" body: str | None """The body of the response, if available.""" def __init__(self, message: str, body: str | None = None): self.message = message if body is None: self.body: str | None = None else: ...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n \"\"\"Raised when content filtering is triggered by the model provider resulting in an empty response.\"\"\"\r\n```", "severity": "minor", "line": 26 } ]
1
python
_CONFIG_DEFINITIONS: dict[str, dict[str, Any]] = { # Basic configurations "chunk_size": {"type": int, "default": 256, "env_converter": int}, "local_cpu": { "type": bool, "default": True, "env_converter": lambda x: x.lower() in ["true", "1"], }, "max_local_cpu_size": {"type": ...
Review this code and list any quality issues.
[ { "issue": "@Shaoting-Feng As this code duplicated so much time, would you like to abstract this into a `bool_converter` ?\r\n\r\nYou can referent to `_to_int_list`", "severity": "major", "line": 26 } ]
1
python
def execute( self, dag: PhysicalOperator, initial_stats: Optional[DatasetStats] = None ) -> OutputIterator: """Executes the DAG using a streaming execution strategy. We take an event-loop approach to scheduling. We block on the next scheduling event using `ray.wait`, updating operat...
Review this code and list any quality issues.
[ { "issue": "Can we use `log_once` here to ensure that it's only logged once?", "severity": "minor", "line": 26 } ]
1
python
settings = self._download_json( 'https://www.hidive.com/play/settings', video_id, data=urlencode_postdata({ 'Title': title, 'Key': key, 'PlayerId': 'f4f895ce1ca713ba263b91caeb1daa2d08904783', 'Version': versi...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n m3u8_url = url_or_none(try_get(rendition, lambda x: x['bitrates']['hls']))\r\n```", "severity": "minor", "line": 26 } ]
1
python
except KeyError: pass try: self.pending = data['pending'] except KeyError: pass self.premium_since = utils.parse_time(data.get('premium_since')) self.timed_out_until = utils.parse_time(data.get('communication_disabled_until')) self._roles = u...
Review this code and list any quality issues.
[ { "issue": "dict comparisons like this are a bit iffy, we should probably compare a key in the dict instead", "severity": "minor", "line": 26 } ]
1
python
) setattr(self.object, field.attname, value) self.save() def build_instance(Model, data, db): """ Build a model instance. If the model instance doesn't have a primary key and the model supports natural keys, try to retrieve it from the database. """ default_manager = M...
Review this code and list any quality issues.
[ { "issue": "Maybe less complex if the value passed into to_python is processed first and then passed in?\r\n\r\n```\r\nobj = default_manager.db_manager(db).get_by_natural_key(*natural_key)\r\ndata[Model._meta.pk.attname] = Model._meta.pk.to_python(obj.pk)\r\n```", "severity": "minor", "line": 26 } ]
1
python
""" command = create_command(command_name) options = command.parser.get_default_values() options.disable_pip_version_check = disable_pip_version_check options.no_index = no_index command.handle_pip_version_check(options) if expected_called: mock_version_check.assert_called_once() el...
Review this code and list any quality issues.
[ { "issue": "Instead of a hard-coded list, consider using `set(commands_dict).symmetric_difference({some, specific, commands})`? That way, only the commands which need network support would need to be listed (i.e. opt-in) and it'll protect against typos in this listing as well.", "severity": "minor", "li...
1
python
i = adX() i(2, 4, x=3) check.assert_called_with(i, 2, 4, x=3) i.annotate() i.annotate() def test_apply_async_adds_children(self): from celery._state import _task_stack @self.app.task(bind=True, shared=False) def a3cX1(self): pass @self....
Review this code and list any quality issues.
[]
0
python
return wrapper async def consume_from_queue_async(queue: Queue): while True: if queue.qsize() == 0: # If the queue is empty, wait for a while and try again. await asyncio.sleep(0.1) continue item = queue.get_nowait() if item is None: break ...
Review this code and list any quality issues.
[ { "issue": "I suspect if this async for could guarantee the output sequence.\r\n\r\nFor example currently in the queue there is two element 1,2\r\nasync for doesn't guarantee the output sequence is exactly 1,2 2,1 is also valid output.", "severity": "minor", "line": 26 } ]
1
python
def extract_name(path): special_chars = re.compile(r'[-\\?\'".]') return special_chars.sub('_', os.path.splitext(os.path.basename(path))[0]) def reduce_code(code): code = re.sub(re.compile(r"/\*.*?\*/", re.DOTALL), "", code) # remove all occurance streamed comments code = re.sub(re.compile(r"//.*?\n"...
Review this code and list any quality issues.
[ { "issue": "If we are using the `\"\"\"... \"\"\"` notation there is no need to escape the `\"` character(s)", "severity": "critical", "line": 26 } ]
1
python
from typing import override, TYPE_CHECKING import numpy as np from pyglet.event import EVENT_HANDLE_STATE from genesis.ext.pyrender.interaction.ray import Plane, Ray, RayHit from genesis.ext.pyrender.interaction.vec3 import Vec3 from genesis.ext.pyrender.interaction.viewer_interaction_base import ViewerInteractionBa...
Review this code and list any quality issues.
[ { "issue": "Could you switch to relative import?", "severity": "minor", "line": 7 } ]
1
python
np.array(tensor.int32_data, dtype=np.int32) .view(np.uint32) .astype(np.uint8) .view(np_dtype) .reshape(dims) ) if tensor_dtype in { onnx.TensorProto.UINT4, onnx.TensorProto.INT4, onnx.TensorProto.FLOAT4E2M1, }: data = ( ...
Review this code and list any quality issues.
[ { "issue": "For this to be more robust, we may need to check the current byte order of the array. For example, what happens if the array is already in small endian on a big endian system?", "severity": "minor", "line": 26 } ]
1
python
# Meta / Notification bar / Closable # Display a notification bar #notification_bar and detect when it's closed. #meta # --- from h2o_wave import main, app, Q, ui @app('/demo') async def serve(q: Q): if not q.client.initialized: # Create an empty meta_card to hold the notification bar q.page['meta...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n# Display a #notification_bar and detect when it's closed. #meta\r\n```", "severity": "minor", "line": 2 } ]
1
python
from typing import Tuple, Iterator from pathlib import Path from elftools.elf.elffile import ELFFile, SymbolTableSection import capa.features.extractors.common from capa.features.file import Export, Import, Section from capa.features.common import OS, FORMAT_ELF, Arch, Format, Feature from capa.features.address impor...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n for symbol in section.iter_symbols():\r\n```", "severity": "minor", "line": 26 } ]
1
python
if urllib.request._parse_proxy(proxy_url)[0] is None: raise UnsupportedRequest(f'Proxy "{proxy_url}" missing scheme') scheme = urllib.parse.urlparse(proxy_url).scheme.lower() if scheme not in self._SUPPORTED_PROXY_SCHEMES: raise UnsupportedRequest(f'Unsupported p...
Review this code and list any quality issues.
[ { "issue": "We need `_validate_` cause we don't want people overriding `validate()`, since we need `wrap_request_errors` to apply.", "severity": "minor", "line": 26 } ]
1
python
r"(with) special", "$1", True, ["* * text", "$1\n * chars **etc...?$"], ), ( r"\((with)\) special", ":$1:", False, ["* * text", ":with:\n * chars **etc...?$"], ), ( r"(\b)[\w\s]{2,}(\b)", ...
Review this code and list any quality issues.
[]
0
python
def tops(self): """ Return the values at the upper end of the bars. .. versionadded:: 3.11 """ if self.orientation == 'vertical': return [p.get_y() + p.get_height() for p in self.patches] elif self.orientation == 'horizontal': return [p.get_x() + ...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n raise ValueError(\"orientation is not 'vertical' or 'horizontal'.\")\r\n```", "severity": "minor", "line": 26 } ]
1
python
def test_hidden_by_system(self, pytester: Pytester, monkeypatch) -> None: self.create_file(pytester) monkeypatch.setenv("PYTHONWARNINGS", "once::UserWarning") result = pytester.runpytest_subprocess() assert WARNINGS_SUMMARY_HEADER not in result.stdout.str() def test_invalid_regex_in...
Review this code and list any quality issues.
[ { "issue": "I think you need to escape this star or it will treat it as a wildcard/fnmatch syntax. I'm not sure how to escape it though\r\n\r\n\r\n```suggestion\r\n r\"Invalid regex '\\*': nothing to repeat at position 0\",\r\n```", "severity": "critical", "line": 26 } ]
1
python
message: A message object """ _rich_traceback_guard = True if message.no_dispatch: return try: message_hook = message_hook_context_var.get() except LookupError: pass else: message_hook(message) with self.prevent(*m...
Review this code and list any quality issues.
[ { "issue": "This goes to the textual console, which doesn't support Markdown syntax. Suggest simply \"Consider using a worker.\"", "severity": "minor", "line": 26 } ]
1
python
# coding: utf-8 from __future__ import unicode_literals from .common import InfoExtractor from ..utils import ( traverse_obj, ExtractorError, unified_timestamp, ) class PixivSketchBaseIE(InfoExtractor): def _call_api(self, video_id, path, referer): response = self._download_json(f'https://ske...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n ExtractorError,\r\n traverse_obj,\r\n unified_timestamp,\r\n```", "severity": "major", "line": 8 } ]
1
python
'title': 'ef - a tale of memories Original Soundtrack 2 ~fortissimo~', 'release_year': 2008, 'thumbnail': 'https://www.musicdex.org/storage/album/2rSHkyYBYfB7sbvElpEyTMcUn6toY7AohOgJuDlE.jpg', }, }] def _real_extract(self, url): id = self._match_id(url) data_json...
Review this code and list any quality issues.
[ { "issue": "can't this be:\r\n```suggestion\r\nclass MusicdexPageIE(MusicdexBaseIE):\r\n```", "severity": "minor", "line": 26 } ]
1
python
camera = scene.add_sensor(gs.sensors.RasterizerCameraOptions(res=(64, 64))) scene.build() camera.read() shared_metadata = camera._shared_metadata renderer = shared_metadata.renderer offscreen_renderer = renderer._renderer offscreen_renderer_ref = weakref.ref(offscreen_renderer) scene.dest...
Review this code and list any quality issues.
[ { "issue": "I would rather add a single destroy test that will combine this one and the previous one.", "severity": "minor", "line": 26 } ]
1
python
# (c) 2020 Ansible Project # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import absolute_import, division, print_function __metaclass__ = type DOCUMENTATION = """ name: controller_api author: John Westcott IV (@john-westcott-iv) short_description: Search ...
Review this code and list any quality issues.
[ { "issue": "@tvo318 and @gundalow Maybe I missed some of the convo here about the `awx_collection` but I feel like it would be much better to avoid sending folks to `docs.ansible.com` for any platform / controller content. In fact the linked `docs.ansible.com` url here basically tells you to go to `redhat.com` ...
1
python
# if input_obj is not None: if not isinstance(input_obj, torch.Tensor): tree_map(require_grad, input_obj) # Also requires_grad_ for micro_batch in stage 0 chunk 0 fwd, # tree_map(torch.Tensor.requires_grad_, micro_batch) # Step2: fwd step output_obj = self.forward_s...
Review this code and list any quality issues.
[ { "issue": "Is this wrong? We clone outputs and then deallocate. What do we get?", "severity": "critical", "line": 26 } ]
1
python
input (str): Boolean expression defining the input keys needed from the state. output (List[str]): List of output keys to be updated in the state. node_config (dict): Additional configuration for the node. node_name (str): The unique identifier name for the node, defaulting to "GenerateAnswer". ...
Review this code and list any quality issues.
[]
0
python
'wisteriaProperties': { 'platform': 'desktop', 'product': self._PRODUCT, }, }).encode('utf-8'))['data']['attributes']['streaming'] def _real_extract(self, url): return self._get_disco_api_info(url, self._match_id(url), **self._DISCO_API_PA...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n 'url': 'https://discovery.com/video/dirty-jobs-discovery-atve-us/rodbuster-galvanizer',\r\n```", "severity": "minor", "line": 26 } ]
1
python
'El contenido sólo está disponible dentro de', ]: if message in webpage: self.raise_geo_restricted() player_config = self._search_json(r'window\.MDSTRM\.OPTIONS\s*=', webpage, 'metadata', video_id) formats, subtitles = [], {} for video_format in player_confi...
Review this code and list any quality issues.
[ { "issue": "If you provide a default, `_search_regex` is non-fatal anyway.\r\n```suggestion\r\n version = self._search_regex(r'window\\.VERSION\\s*=\\s*[\"\\']([^\"\\']+)[\"\\'];', webpage, 'version', default=None)\r\n```\r\nAlso change for the other instances", "severity": "minor", "line...
1
python
self.log.info("Test reorg") # Split network into two self.split_network() # send to nodes[0] from nodes[2] senttx = self.nodes[2].sendtoaddress(self.nodes[0].getnewaddress(), 1) # generate on both sides nodes1_last_blockhash = self.generate(self.nodes[1], 6, sync_fun=l...
Review this code and list any quality issues.
[ { "issue": "nit: Could phrase this a little clearer:\r\n`'Test the RPC error \"Can't read block from disk\"'`", "severity": "minor", "line": 26 } ]
1
python
def _get_comments(self, video_id, video_type): for i in itertools.count(0): comment_api_raw_data = self._download_json( 'https://api.bilibili.tv/reply/web/root', video_id, note=f'Downloading comment page {i}', query={ 'platform': 'w...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n if replies.get('count'):\r\n```\r\nNone > 0 throws", "severity": "minor", "line": 26 } ]
1
python
# # 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...
Review this code and list any quality issues.
[]
0
python
signin_page = self._download_webpage(self._LOGIN_URL, video_id=id, note='Getting authenticity token') authenticity_token = self._html_search_regex( r'name=["\']authenticity_token["\'] value=["\'](.+?)["\']', signin_page, 'authenticity_token') ...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n self._logout()\r\n```", "severity": "minor", "line": 26 } ]
1
python
with assert_raises(ValueError): np.add.outer(deep, deep) def test_bad_legacy_ufunc_silent_errors(): # legacy ufuncs can't report errors and NumPy can't check if the GIL # is released. So NumPy has to check after the GIL is released just to # cover all bases. `np.power` uses/used to use this. ...
Review this code and list any quality issues.
[ { "issue": "if you're editing anyway, just `np.arange(3.0)`? The `.astype()` is distracting here.", "severity": "minor", "line": 26 } ]
1
python
if p.suffix == ".ipynb" and not jupyter_dependencies_are_installed( verbose=verbose, quiet=quiet ): continue sources.add(p) elif p.is_dir(): if exclude is None: if _exclude is None: _exclude = re_compile_may...
Review this code and list any quality issues.
[ { "issue": "Instead of casting, we should assert that _exclude is not None. cast is unsafe.", "severity": "minor", "line": 26 } ]
1
python
# coding: utf-8 from __future__ import unicode_literals from .common import InfoExtractor import re from ..utils import ( clean_html, determine_ext, get_element_by_class, urljoin, parse_qs as compat_parse_qs, ExtractorError) class WikimediaIE(InfoExtractor): IE_NAME = 'wikimedia.org' ...
Review this code and list any quality issues.
[ { "issue": "_NETRC_MACHINE must only be set of the extractor has login support", "severity": "major", "line": 19 } ]
1
python
) assert len(ds_out) == 99 for index in range(1, 100): np.testing.assert_array_equal( ds_out[index - 1].image.numpy(), 2 * index * np.ones((index, index)) ) np.testing.assert_array_equal( ds_out[index - 1].label.numpy(), 2 * index * np.ones((1,)) ) as...
Review this code and list any quality issues.
[]
0
python
def out(msg: str, **kwargs: Any) -> None: out_lines.append(msg) def err(msg: str, **kwargs: Any) -> None: err_lines.append(msg) with patch("black.out", out), patch("black.err", err): report.done(Path("f1"), black.Changed.NO) self.assertEqual(len(out_line...
Review this code and list any quality issues.
[]
0
python
def arrlen( self, name: str, path: Optional[str] = Path.root_path() ) -> List[Optional[int]]: """Return the length of the array JSON value under ``path`` at key``name``. For more information see `JSON.ARRLEN <https://redis.io/commands/json.arrlen>`_. """ # noqa retu...
Review this code and list any quality issues.
[ { "issue": "I'm sorry, I have missed this one - it should be List[Optional[int]]", "severity": "minor", "line": 26 } ]
1
python
logger = logging.get_logger(__name__) class Url(str): pass class EmptyDatasetError(FileNotFoundError): pass SPLIT_PATTERN_SHARDED = "data/{split}-[0-9][0-9][0-9][0-9][0-9]-of-[0-9][0-9][0-9][0-9][0-9]*.*" SPLIT_KEYWORDS = { Split.TRAIN: ["train", "training"], Split.VALIDATION: ["validation", "val...
Review this code and list any quality issues.
[ { "issue": "With the current behavior (double asterisk only between slashes meaning zero or more path segments) I find confusing several patterns here:\r\n- why do we add the slash to the sep characters here: `[{sep}/]`? I think it would be clearer to remove it as we already prefix the pattern with `**/`\r\n- a...
1
python
for dest_name, dest_data in dest: # mergekit-extract-lora add these layernorm to the adapter if "_norm" in dest_name: assert dest_data.dim() == 1 yield (dest_name, dest_data) continue # o...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n model_instance = LoraModel(\r\n```", "severity": "minor", "line": 26 } ]
1
python
query_url = ( 'https://www.khanacademy.org/api/internal/graphql/FetchContentData?fastly_cacheable=' + fastly_cacheable + '&hash=' + str(query_hash) + '&lang=' + query_lang + '&variables=%7B%22path%22%3A%22' + display_id ...
Review this code and list any quality issues.
[ { "issue": "Use query parameter of _download_json", "severity": "minor", "line": 26 } ]
1
python
# The short X.Y version. version = re.match(r"^([0-9]+\.[0-9]+).*", release).group(1) # -- General configuration --------------------------------------------------- # If your documentation needs a minimal Sphinx version, state it here. # # needs_sphinx = '1.0' # Add any Sphinx extension module names here, as strings...
Review this code and list any quality issues.
[ { "issue": "<img width=\"442\" alt=\"image\" src=\"https://github.com/kedro-org/kedro/assets/316517/eca09f89-0ecc-43b3-9f02-fc526e8df014\">\r\n\r\nBetter than nothing. Not very visible, but I understand that, to place this information wherever we want, we'd need https://github.com/jdillard/sphinx-gitstamp + a b...
1
python
})), }) for sub_data in traverse_obj(root, ( *record_path, *record_subpath, 'captions', lambda _, v: v['file']['ref']['$link'])): subtitles.setdefault(sub_data.get('lang') or 'und', []).append({ 'url': update_url_query(self._BLOB_URL % endp...
Review this code and list any quality issues.
[ { "issue": "could use `orderedSet` from utils\r\n```suggestion\r\n 'tags': ('labels', ..., 'val', {str}, all, {orderedSet}),\r\n```", "severity": "minor", "line": 26 } ]
1
python
s3_errors_formatted.append( S3Error( count=error.get("count", ""), bucket_name=error.get("bucket_name", ""), request_prefix=error.get("request_prefix", ""), error_call=error.get("error_call", ""), status_code=error.get("status_c...
Review this code and list any quality issues.
[]
0
python
# Copyright 2025 The HuggingFace Team. 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 applicabl...
Review this code and list any quality issues.
[ { "issue": "Could we add a `is_kornia_available` to `diffusers.utils.import_utils` and import only if user already has it downloaded? A check could exist in `__init__` as well so that if user tries to instantiate FDG guider, it fails if kornia isn't available", "severity": "critical", "line": 18 } ]
1
python
>>> trainer = Trainer(checkpoint_callback=checkpoint_callback) # save epoch and val_loss in name # saves a file like: my/path/sample-mnist-epoch=02-val_loss=0.32.ckpt >>> checkpoint_callback = ModelCheckpoint( ... monitor='val_loss', ... dirpath='my/path/', ... ...
Review this code and list any quality issues.
[ { "issue": "this will break compatibility for positional init only...\r\nLet's move the two new arguments at the end...", "severity": "critical", "line": 26 } ]
1
python
'longmapsto' : 0x27fc, 'longrightarrow' : 0x27f6, 'looparrowleft' : 0x21ab, 'looparrowright' : 0x21ac, 'lq' : 0x2018, 'lrcorner' : 0x231f, 'ltimes' : 0x22c9, 'macron' : 0xaf, 'maltese' ...
Review this code and list any quality issues.
[]
0
python
from .const import CONF_ACCESS_KEY_ID, CONF_BUCKET, CONF_SECRET_ACCESS_KEY, DOMAIN from .coordinator import S3ConfigEntry from .helpers import async_list_backups_from_s3 TO_REDACT = (CONF_ACCESS_KEY_ID, CONF_SECRET_ACCESS_KEY) async def async_get_config_entry_diagnostics( hass: HomeAssistant, entry: S3Config...
Review this code and list any quality issues.
[ { "issue": "`async_list_backups_from_s3` is called with `prefix=entry.data[CONF_BUCKET]`, which uses the bucket name as the prefix. This will filter S3 listing to `<bucket>/...` and likely return an empty/incorrect backup list unless the user also configured their prefix to match the bucket. Use the configured ...
1
python
# GH 19732: Timestamps imported from sas will incur floating point errors # See GH#56014 for discussion of the correct "expected" results # We are really just testing that we are "close". This only seems to be # an issue near the implementation bounds. df[df.columns[3]] = df.iloc[:, 3].dt.round("us")...
Review this code and list any quality issues.
[]
0
python
yield token else: break def finish(self, reason: Literal["length", "eos_token", "stop_sequence"]) -> Iterable[interface.Token]: if reason == "stop_sequence": end_sequence = "" end_tokens = [] while self.tokens: token = self.tok...
Review this code and list any quality issues.
[ { "issue": "I think this function name is slightly misleading", "severity": "minor", "line": 26 } ]
1
python
}, help=( 'Time to sleep between retries in seconds (optionally) prefixed by the type of retry ' '(http (default), fragment, file_access, extractor) to apply the sleep to. ' 'EXPR can be a number, linear=START[:END[:STEP=1]] or exp=START[:END[:BASE=2]]. ' 'This option can...
Review this code and list any quality issues.
[]
0
python
from io import BytesIO from os import getenv, path from pathlib import Path from typing import Any, Iterator, List, Literal, Optional, Union from uuid import uuid4 from agno.agent import Agent from agno.media import Audio from agno.team.team import Team from agno.tools import Toolkit from agno.tools.function import To...
Review this code and list any quality issues.
[ { "issue": "Let's not use `logger` at all here", "severity": "minor", "line": 12 } ]
1
python
query = { 'query': '''{ getSubredditPost(url:"/%s"){ id title subredditTitle subredditUrl redditPath isNsfw mediaSources{ ...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n for source in video.get(\"mediaSources\") or []:\r\n```", "severity": "minor", "line": 26 } ]
1
python
from monai.networks.blocks import CrossAttentionBlock, MLPBlock, SABlock class TransformerBlock(nn.Module): """ A transformer block, based on: "Dosovitskiy et al., An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale <https://arxiv.org/abs/2010.11929>" """ def __init__( ...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n hidden_size (int): dimension of hidden layer.\r\n mlp_dim (int): dimension of feedforward layer.\r\n```", "severity": "minor", "line": 26 } ]
1
python
ENABLE_VSYNC = os.getenv("ENABLE_VSYNC", "1") == "1" SHOW_FPS = os.getenv("SHOW_FPS") == '1' STRICT_MODE = os.getenv("STRICT_MODE") == '1' SCALE = float(os.getenv("SCALE", "1.0")) DEFAULT_TEXT_SIZE = 60 DEFAULT_TEXT_COLOR = rl.WHITE ASSETS_DIR = files("openpilot.selfdrive").joinpath("assets") FONT_DIR = ASSETS_DIR.jo...
Review this code and list any quality issues.
[ { "issue": "can `FontWeight` just be a strenum and map to font files?", "severity": "minor", "line": 26 } ]
1
python
from typing import Any, Literal, Optional, cast import prisma from prisma import Json from prisma.enums import SubmissionStatus from prisma.models import AgentGraph, AgentNode, AgentNodeLink, StoreListingVersion from prisma.types import ( AgentGraphCreateInput, AgentGraphWhereInput, AgentNodeCreateInput, ...
Review this code and list any quality issues.
[ { "issue": "I kinda wish we could avoid importing this here.. feels like importing high level stuff into a low level module. Wdyt? Could just be me.", "severity": "minor", "line": 26 } ]
1
python
skipna=skipna, axis=axis, ) return self._wrap_reduction_result("min", result, skipna=skipna, axis=axis) def max(self, *, skipna: bool = True, axis: AxisInt | None = 0, **kwargs): nv.validate_max((), kwargs) result = masked_reductions.max( self._data, ...
Review this code and list any quality issues.
[ { "issue": "This code will preserve the type if it can be preserved.", "severity": "minor", "line": 26 } ]
1
python
assert_equal(self.nodes[0].scantxoutset("start", ["combo([abcdef88/1/2'/3/4h]tpubD6NzVbkrYhZ4WaWSyoBvQwbpLkojyoTZPRsgXELWz3Popb3qkjcJyJUGLnL4qHHoQvao8ESaAstxYSnhyswJ76uZPStJRJCTKvosUCJZL5B/1/1/1)"])['total_amount'], Decimal("8.192")) assert_equal(self.nodes[0].scantxoutset("start", ["combo(tpubD6NzVbkrYhZ4WaWSy...
Review this code and list any quality issues.
[ { "issue": "Can you also add an assert checking that the blockhash is correct?", "severity": "minor", "line": 26 } ]
1
python
): sampling_msgs.append(mcp_types.SamplingMessage(role=role, content=content)) system_prompt: list[str] = [] for pai_message in pai_messages: if isinstance(pai_message, messages.ModelRequest): if pai_message.instructions is not None: system_prompt.append(pai_message....
Review this code and list any quality issues.
[ { "issue": "I thought `b64decode` was wrong here, because we generally use `BinaryContent.data` to store arbitrary bytes, not base64-encoded bytes. On closer look it's actually right, there are some tests setting `BinaryContent.data = base64_bytes`, for example, in `test_anthropic` and `test_mistral`.\r\n\r\nSo...
1
python
}] def _extract_subtitle(self, webpage, video_id): captions = traverse_obj( self._search_json(r'const\s+captionsConfiguration\s*=', webpage, 'captions', video_id, default=None), ('languageList', ..., { 'url': ('src', {url_or_none}), 'tag': ('srclang',...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n return {\r\n 'id': video_id,\r\n 'title': self._og_search_title(webpage),\r\n 'description': self._og_search_description(webpage),\r\n 'formats': self._extract_ism(\r\n self._search_regex(r'StreamUrl\\s*=\\s*\"([^\"]...
1
python
from XAgent.ai_functions.request.openai import chatcompletion_request import importlib.metadata as metadata openai_version = metadata.version("openai") def test_1106_model_openai(): if openai_version >= "1.0.0": # Mock the OpenAI client and response with mock.patch("openai.OpenAI") as mock_openai...
Review this code and list any quality issues.
[]
0
python
jt = job_template_factory('test', organization=objs.organization, inventory='test_inv', project='test_project', credential='test_cred') workflow_job_template_factory('test') models.Team(organization=objs.organization).save() models.Host(inventory=jt.inventory).save() models.Schedule(rrule='DTSTART;TZID=...
Review this code and list any quality issues.
[]
0
python
] SPATIAL_CROP_GUIDANCE_TEST_CASE_3 = [ {"keys": ["image"], "guidance": "guidance", "spatial_size": [3, 3], "margin": 0}, DATA_8, np.array( [ [ [[47, 48, 49], [57, 58, 59], [67, 68, 69]], [[147, 148, 149], [157, 158, 159], [167, 168, 169]], ...
Review this code and list any quality issues.
[ { "issue": "I don't think changing this dictionary affects anything, it just adds the default values for these parameters. The addition here I think can be omitted.\r\n```suggestion\r\n {\"keys\": [\"pred\"], \"ref_image\": \"image\", \"mode\": \"nearest\"},\r\n```", "severity": "minor", "line": 26 ...
1
python
self._attr_name = name if name is not None else f"{source_entity} derivative" self._attr_extra_state_attributes = {ATTR_SOURCE_ID: source_entity} self._string_unit_prefix: str | None = None self._string_unit_time: str | None = None if unit_of_measurement is None: self._string...
Review this code and list any quality issues.
[ { "issue": "Why not just 'if not' return None?", "severity": "minor", "line": 26 } ]
1
python
) from .niconico import ( NiconicoIE, NiconicoPlaylistIE, NiconicoUserIE, NicovideoSearchDateIE, NicovideoSearchIE, NicovideoSearchURLIE, ) from .ninecninemedia import NineCNineMediaIE from .ninegag import NineGagIE from .ninenow import NineNowIE from .nintendo import NintendoIE from .nitter im...
Review this code and list any quality issues.
[]
0
python
import pytest from manim import * from ..utils.GraphicalUnitTester import GraphicalUnitTester from ..utils.testing_utils import get_scenes_to_test class BraceSharpnessTest(Scene): def construct(self): line = Line(LEFT * 3, RIGHT * 3).shift(UP * 4) for sharpness in [0, 0.25, 0.5, 0.75, 1, 2, 3, ...
Review this code and list any quality issues.
[]
0
python
import argparse import os from argparse import RawTextHelpFormatter import torch from tqdm import tqdm from TTS.config import load_config from TTS.tts.datasets import load_tts_samples from TTS.tts.utils.speakers import SpeakerManager from TTS.tts.utils.managers import save_file parser = argparse.ArgumentParser( ...
Review this code and list any quality issues.
[ { "issue": "To me, this is counter-intuitive but can live with it :)", "severity": "minor", "line": 26 } ]
1
python
import multiprocessing import pathlib import random from time import sleep from .fixtures import upsert_random_points, create_collection from .utils import * N_PEERS = 3 N_SHARDS = 3 N_REPLICA = 1 COLLECTION_NAME = "test_collection" def update_points_in_loop(peer_url, collection_name, num_points=None, num_cities=No...
Review this code and list any quality issues.
[ { "issue": "I vote to keep this function as-is here, copy it to the other place we use it, and make the changes there.\n\nAs it's becoming quite specialized.", "severity": "minor", "line": 15 } ]
1
python
sequence_lengths=sequence_lengths[:batch_size], fd_inter_tensor=fd_inter_tensor, batch_size=batch_size, is_prompts=False, use_cuda_graph=True, high_precision=False, kv_seq_len=sequence_lengths[:batch_size].max().item(), ...
Review this code and list any quality issues.
[ { "issue": "This assert here is duplicated with line 131.", "severity": "major", "line": 26 } ]
1
python
self.function = func self.min_depth = min_depth self.max_quads = max_quads self.use_smoothing = use_smoothing self.x_range = x_range or [ -config.frame_width / 2, config.frame_width / 2, ] self.y_range = y_range or [ -config.frame_heigh...
Review this code and list any quality issues.
[ { "issue": "As above: please pass as keyword arguments.", "severity": "minor", "line": 26 } ]
1
python
.. _`boto3-powered`: https://boto3.readthedocs.io .. _awscli: https://aws.amazon.com/cli .. _`AWS Batch User Guide`: http://docs.aws.amazon.com/AmazonECS/latest/developerguide/ECS_GetStarted.html """ import json import logging import random import string import time import luigi logger = logging.getLogger(__name__) ...
Review this code and list any quality issues.
[ { "issue": "Thoughts on making this\r\n* configurable in `luigi.cfg` or\r\n* override-able parameter?", "severity": "minor", "line": 26 } ]
1
python
name=self.name, ) if existing_queue_by_id is None: raise_on_non_existing_storage(StorageTypes.REQUEST_QUEUE, self.id) async with existing_queue_by_id.file_operation_lock: await existing_queue_by_id.update_timestamps(has_been_modified=False) requests: list[R...
Review this code and list any quality issues.
[ { "issue": "Maybe we can use `internal_request` identifier to distinguish between `Request` and `InternalRequest`?", "severity": "minor", "line": 26 } ]
1
python
self.timeout = float(timeout or DEFAULT_TIMEOUT) self.proxies = proxies or {} self.source_address = source_address self.verbose = verbose self.prefer_system_certs = prefer_system_certs self._client_cert = client_cert or {} self.verify = verify self.legacy_ssl_supp...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n cookiejar = request.extensions.get('cookiejar')\r\n return self.cookiejar if cookiejar is None else cookiejar\r\n```", "severity": "minor", "line": 26 } ]
1
python
for output_name, output_data in self.run( self.input_schema(**input_data), **kwargs ): if output_name == "error": raise RuntimeError(output_data) if error := self.output_schema.validate_field(output_name, output_data): raise ValueError(f"Block ...
Review this code and list any quality issues.
[ { "issue": "I assume `Block` constructor will never need any arguments but maybe add some static method or const in the `Block` class and avoid creating instances from generic `Type` altogether?", "severity": "minor", "line": 26 } ]
1
python
}] @classmethod def _extract_embed_urls(cls, url, webpage): for mobj in re.finditer( rf'''(?x)<div\s+\bid=["']Player-Attributes-JWID[^>]+\b data-request-url=["']{cls._VALID_URL_BASE_RE}["'][^>]+\b data-asset-id=["']{cls._VALID_URL_ID_RE}["']''', webpage ): ...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n asset, 'palyoutPathAudio', 'playoutpathaudio', expected_type=str)\r\n```\r\n\r\nget_all is not doing anything here:\r\n```\r\ntraverse_obj(obj, A, B) => dict_get(obj, ('A', 'B')) => obj.get('A') or obj.get('B')\r\n```", "severity": "minor", "line": 26 } ]
1
python
If the value is a dictionary, it may have the following items, with default values used for entries which aren't present. endpoints : tuple, default: (-inf, inf) A tuple defining the lower and upper endpoints of the domain of the parameter; allowable values are f...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n having the ``parameters`` attribute be a tuple of dictionaries with\r\n the structure described above. In this case, ``dist``\\'s class must also\r\n```", "severity": "minor", "line": 26 } ]
1
python
def __init__( self, key: str, rows: int | None = None, ) -> None: self._key = key self._rows = rows def validate(self) -> None: if not results_backend: raise SupersetErrorException( SupersetError( message=__("Result...
Review this code and list any quality issues.
[ { "issue": "should we log as warning instead since you're logging the error in `superset/sql_lab.py` -> `...if not write_success:` ?", "severity": "minor", "line": 26 } ]
1
python
) st.write(f"value: {value}") if st.button("Toggle bounds"): st.session_state["update_bounds"] = not st.session_state["update_bounds"] at = AppTest.from_function(script).run() assert at.number_input[0].value == 50 # Set value to 25 (valid with min_value=0) at = at.number_i...
Review this code and list any quality issues.
[ { "issue": "This import of module streamlit is redundant, as it was previously imported [on line 22](1).", "severity": "minor", "line": 26 } ]
1
python
__all__ = ['CallbackQueueDispatcher'] # use a custom JSON serializer so we can properly handle !unsafe and !vault # objects that may exist in events emitted by the callback plugin # see: https://github.com/ansible/ansible/pull/38759 class AnsibleJSONEncoder(json.JSONEncoder): def default(self, o): if get...
Review this code and list any quality issues.
[ { "issue": "In my testing, this per-event inc *really* seems to drastically slow down event insertion.", "severity": "major", "line": 26 } ]
1
python
self, method: str, model: Type[A], *, data: Optional[BaseModel] = None, as_params: bool = False, alternate_endpoint: Optional[str] = None, ) -> List[A]: endpoint = self.endpoint if alternate_endpoint is None else alternate_endpoint if as_params: ...
Review this code and list any quality issues.
[ { "issue": "No need for this I think since we are overwriting this variable later?", "severity": "minor", "line": 26 } ]
1
python
if asset: return JSONResponse( { 'id': asset.get('id'), 'created_at': asset.get('created_at').isoformat(), 'expires_at': asset.get('expires_at').isoformat(), 'type': asset.get('type'), 'media': asset.get('media'), 'name': asset.get('name'), 'format': asset.get('format'), 'size': as...
Review this code and list any quality issues.
[ { "issue": "replace `if asset` with `remove_file(asset.get('path'))`", "severity": "minor", "line": 26 } ]
1
python
pass if all(version.is_python2() for version in target_versions): # Python 2-only code, so try Python 2 grammars. return [ # Python 2.7 with future print_function import pygram.python_grammar_no_print_statement, # Python 2.7 pygram.python_grammar, ...
Review this code and list any quality issues.
[]
0
python
file_format (`str`, defaults to `"arrow"`): The file format to use when writing the cache. Must be either `"arrow"` or `"parquet"`. """ # Dynamic import to avoid circular dependency from .io.spark import SparkDatasetReader return SparkDatasetReader( df, ...
Review this code and list any quality issues.
[ { "issue": "Maybe let's add an example here ?\r\n```suggestion\r\n Example:\r\n \r\n ```python\r\n >>> from datasets import Dataset\r\n >>> data = [[1, \"Elia\"], [2, \"Teo\"], [3, \"Fang\"]]\r\n >>> columns = [\"id\", \"name\"]\r\n >>> df = spark.createDataFrame...
1
python
# r'#EXT-X-PLAYLIST-TYPE:EVENT', # media segments may be appended to the end of # # event media playlists [4] # r'#EXT-X-MAP:', # media initialization [5] # 1. https://tools.ietf.org/html/draft-pantos-http-live-streaming-17#section-4.3.2.4 ...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n s = info_dict.get('hls_media_playlist_data')\r\n```", "severity": "minor", "line": 26 } ]
1
python
}) mature = metadata.get('adult') if mature is None: age_limit = None else: age_limit = 18 if mature is True else 0 return { 'id': channel_id, 'title': title.strip(), 'is_live': True, 'channel': channel_id, ...
Review this code and list any quality issues.
[ { "issue": "does this test pass?\r\n\r\nif not, add `skip` to it and make your new `only_matching` test into a proper test", "severity": "minor", "line": 26 } ]
1
python
Index: [] output (expected) str_value float_value int_value 2014-01-01 Equity(65 [A]) None NaN 0 Equity(66 [B]) None NaN 0 Equity(67 [C]) None NaN 0 ...
Review this code and list any quality issues.
[ { "issue": "We should just put this in pandas_utils as like, `empty_dataframe`.", "severity": "minor", "line": 26 } ]
1
python
def resize_background_array_to_match(self, background_array, pixel_array): """Resizes the background array to match the passed pixel array. Parameters ---------- background_array : np.array The prospective pixel array. pixel_array : np.array The pixel arr...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n The background image or its file name.\r\n```", "severity": "minor", "line": 26 } ]
1
python
@staticmethod def get_rocm_gpu_arch(): if OpBuilder._rocm_gpu_arch: return OpBuilder._rocm_gpu_arch rocm_info = Path("/opt/rocm/bin/rocminfo") if (not rocm_info.is_file()): rocm_info = Path("rocminfo") rocm_gpu_arch_cmd = str(rocm_info) + " | grep -o -m 1 'gfx...
Review this code and list any quality issues.
[ { "issue": "This should become available in `torch.cuda.get_device_properties` with https://github.com/pytorch/pytorch/pull/128449", "severity": "minor", "line": 26 } ]
1
python
NiconicoIE, NiconicoPlaylistIE, NiconicoUserIE, NicovideoSearchDateIE, NicovideoSearchIE, NicovideoSearchURLIE, ) from .ninecninemedia import ( NineCNineMediaIE, CPTwentyFourIE, ) from .ninegag import NineGagIE from .ninenow import NineNowIE from .nintendo import NintendoIE from .nitter impo...
Review this code and list any quality issues.
[]
0
python
from urllib import parse from .common import InfoExtractor from ..networking import HEADRequest from ..utils import ( UserNotLive, determine_ext, float_or_none, int_or_none, merge_dicts, parse_iso8601, str_or_none, traverse_obj, unified_timestamp, url_or_none, ) class KickBase...
Review this code and list any quality issues.
[ { "issue": "`from` imports go against the project's coding conventions\r\n```suggestion\r\nimport urllib.parse\r\n```", "severity": "minor", "line": 2 } ]
1
python
meta = { "name": "DNSDumpster", "summary": "Passive subdomain enumeration using HackerTarget's DNSDumpster", "useCases": ["Investigate", "Footprint", "Passive"], "categories": ["Passive DNS"], "dataSource": { "website": "https://dnsdumpster.com/", "model":...
Review this code and list any quality issues.
[ { "issue": "This should not be overridden since technically the data source is DNSDumpster, not DNS directly.", "severity": "minor", "line": 26 } ]
1
python
parser.add_argument("--no-deepspeed", dest="deepspeed", action="store_false") parser.add_argument("--wandb-entity", type=str, default="open-assistant") parser.add_argument("--rng_seed", type=int, help="rng seed") parser.set_defaults(deepspeed=False) if notebook: args, remaining = parser.parse_k...
Review this code and list any quality issues.
[ { "issue": "I don't think this logic is correct, but I can correct it after merge in the improve_small_rm branch..", "severity": "minor", "line": 26 } ]
1
python
_VALID_URL = r'https?://(?:www\.)?1tv\.ru/live/?' _GEO_BYPASS = False _GEO_COUNTRIES = ['RU'] _TESTS = [ { 'url': 'https://www.1tv.ru/live', 'info_dict': { 'id': 'live', 'ext': 'mp4', 'title': 'ПЕРВЫЙ КАНАЛ ПРЯМОЙ ЭФИР СМОТРЕТЬ...
Review this code and list any quality issues.
[ { "issue": "- We shouldn't require both DASH and HLS. One or the other\r\n- We can't download live subs\r\n- extend `formats`\r\n```suggestion\r\n mpd_url = traverse_obj(streams_list, ('mpd', ..., {url_or_none}, any))\r\n formats = self._extract_mpd_formats(mpd_url, display_id, mpd_id='dash', fata...
1
python
msg += f"[pypy-{verinfo}-{pypy_version_info[3]}]" msg += f", pytest-{_pytest._version.version}, pluggy-{pluggy.__version__}" if ( self.verbosity > 0 or self.config.option.debug or getattr(self.config.option, "pastebin", None) ): ...
Review this code and list any quality issues.
[]
0
python
webpage, 'video link') video_link_url = self._search_regex( r"src=\'([^\']+)\'", urllib.parse.unquote(video_link_url), 'unquoted video link') release_date = self._search_regex( r'<span\s+class=["\']title-yakov["\']>(\d{4}-\d{2}-\d{2})</span>', webpage, 'timestamp', fatal=False) ...
Review this code and list any quality issues.
[ { "issue": "You sure this shouldn't be `upload_date`?", "severity": "minor", "line": 26 } ]
1