language
string
code-snippit
string
instruction
string
flaws
list
flaw_count
int64
python
'https://api.bilibili.com/x/player/wbi/playurl', bvid, query=self._sign_wbi(params, bvid), headers=headers, note=f'Downloading video formats for cid {cid} {qn or ""}')['data'] def json2srt(self, json_data): srt_data = '' for idx, line in enumerate(json_data.get('body') or []...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n self.report_warning(\r\n f'Subtitles are only available when logged in. {self._login_hint()}', only_once=True)\r\n```", "severity": "minor", "line": 26 } ]
1
python
def translate(self, text, needprint=True): print("=================================================") start_time = time.time() # todo: Determine whether to print according to the cli option if needprint: print(re.sub("\n{3,}", "\n\n", text)) try: t_text =...
Review this code and list any quality issues.
[ { "issue": "There are some `print` statements that are used for debugging purposes, but I agree with your point that the `logging` module can be used instead. Users are primarily interested in the original text, translation, and progress, which are the original output.\r\nWhat's your opinion? @yihong0618", ...
1
python
'skip_download': True, }, }, { 'url': 'https://radiocomercial.pt/podcasts/tnt-todos-no-top/2023/t-n-t-29-de-outubro', 'md5': '91d32d4d4b1407272068b102730fc9fa', 'info_dict': { 'id': 't-n-t-29-de-outubro', 'ext': 'mp3', 'title': 'T.N.T 29 de outubro...
Review this code and list any quality issues.
[ { "issue": "it's fine to inline all of the date code\r\n```suggestion\r\n\r\n return {\r\n 'id': video_id,\r\n 'title': self._html_extract_title(webpage),\r\n 'description': self._og_search_description(webpage, default=None),\r\n 'release_date': unified_strdate...
1
python
timeout = 1000.0 # 1000 milliseconds async def async_routine(): ctx, mining = await self.make_mining_ctx() async with AsyncExitStack() as stack: self.log.debug("createNewBlock() should wait if tip is still updating") self.disconnect_nodes(0, 1) ...
Review this code and list any quality issues.
[]
0
python
for tc in test_cases: result = get_actions_for_resource(tc["arn"], tc["statement"]) self.assertListEqual(tc["expected"], result, tc["description"]) @patch("consoleme.lib.aws.redis_hgetall", mock_s3_bucket_redis) def test_get_resources_from_events(self): policy_changes = [ ...
Review this code and list any quality issues.
[]
0
python
@staticmethod def _build_profile_url(path): return format_field(path, None, 'https://bsky.app/profile/%s', default=None) def _extract_videos(self, root, video_id, embed_path='embed', record_path='record', record_subpath='embed'): embed_path = variadic(embed_path, (str, bytes, dict, set)) ...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n 'url': update_url_query(\r\n self._BLOB_URL_TMPL % endpoint, {'did': did, 'cid': video_cid}),\r\n```", "severity": "minor", "line": 26 } ]
1
python
namespace : module Namespace shared by array objects. If any of the `arrays` are not arrays, the namespace defaults to the NumPy namespace. is_array_api_compliant : bool True if the arrays are containers that implement the array API spec (see https://data-apis.org/array-api/latest/i...
Review this code and list any quality issues.
[ { "issue": "I believe this is now handled in `_remove_non_arrays`.\r\n\r\n```suggestion\r\n if not arrays:\r\n```", "severity": "minor", "line": 26 } ]
1
python
return False try: if col_type == "any": # when a property is not found, return True only if action is not equals if not is_dn and not hasattr(ent, "properties") or not ent.properties.get(col_fn or col): return action == "!=" if op := _operators.get(action): ...
Review this code and list any quality issues.
[]
0
python
# these literals are used to check if the flavor # of a rule is correct. STATIC_SCOPES = ( FILE_SCOPE, GLOBAL_SCOPE, FUNCTION_SCOPE, BASIC_BLOCK_SCOPE, INSTRUCTION_SCOPE, ) DYNAMIC_SCOPES = ( FILE_SCOPE, GLOBAL_SCOPE, PROCESS_SCOPE, THREAD_SCOPE, DEV_SCOPE, ) @dataclass class S...
Review this code and list any quality issues.
[ { "issue": "im not comfortable overriding `__eq__` like this, because it allows very different types to appear to be the same, like `(Scopes(\"function\", \"thread\") == \"function\") is True` which is pretty surprising.\r\n\r\nperhaps you can introduce an accessor, like `has_scope(str) -> bool` to express this...
1
python
surface=surface, uvs=uvs, ) @classmethod def from_morph_surface(cls, morph, surface=None): """ Create a genesis.Mesh from morph and surface options. If the morph is a Mesh morph (morphs.Mesh), it could contain multiple sub-meshes, so we return a list. """ ...
Review this code and list any quality issues.
[ { "issue": "I think it is still worth to make configurable. I found some assets that has been made z up already.\r\nAdding this conversion by default makes sense though.", "severity": "minor", "line": 26 } ]
1
python
num_processes=self.args.world_size, process_index=self.args.process_index, ) return DataLoader( train_dataset, batch_size=self.args.per_device_train_batch_size, collate_fn=data_collator, num_workers=self.args...
Review this code and list any quality issues.
[]
0
python
) from ..utils import ( ExtractorError, bytes_to_intlist, extract_attributes, float_or_none, format_field, intlist_to_bytes, int_or_none, join_nonempty, lowercase_escape, merge_dicts, qualities, remove_end, sanitized_Request, traverse_obj, try_get, xpath_t...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n _LOGIN_URL = 'https://www.crunchyroll.com/welcome/login'\r\n _API_BASE = 'https://api.crunchyroll.com'\r\n```", "severity": "minor", "line": 26 } ]
1
python
im = ax.imshow(Z, cmap=cmap, origin='lower', extent=[-3, 3, -3, 3], norm=norm) # === Inset Histogram – Positioning adjusted === cax = ax.inset_axes([1.18, 0.02, 0.25, 0.95]) # left, bottom, width, height # === Plot Histogram === midpoints = bins[:-1] + np.diff(bins) / 2 height = np.medi...
Review this code and list any quality issues.
[ { "issue": "`set_major_locator` annihilates the effect of `set_yticks`. You can only have one. - Though I think the defaults are fine and you don't need to customize anything.", "severity": "minor", "line": 26 } ]
1
python
def __init__(self, config: ModelConfig, size: Optional[int] = None, elementwise_affine: Optional[bool] = None): super().__init__(config) self.normalized_shape = (size or config.d_model,) self.eps = 1e-05 if elementwise_affine is None: elementwise_affine = self.config.layer_n...
Review this code and list any quality issues.
[ { "issue": "`_cast_if_autocast_enabled` tells me this will never cast, because we disable it above. Since we want this to be in 32 bits all the time, don't we just cast all the time?", "severity": "minor", "line": 26 } ]
1
python
'source': 'Web', 'username': username, })) or {}).get('accessToken') if access_token: self._HEADERS = {'authorization': 'Bearer ' + access_token} except ExtractorError as e: message = None if isinstance(e.cause, HTTPError) a...
Review this code and list any quality issues.
[ { "issue": "Are these values unix timestamps? And if so, should we rely on `currentDate` instead of `time.time()`? IMO we should do this a bit more safely (and use snake_case):\r\n```suggestion\r\n start_date = traverse_obj(options, ('video', 'startDate', {int}))\r\n current_date = traverse_obj(op...
1
python
"global_chart_configuration", {} ) scope_excluded = cross_filter_global_config.get("scope", {}).get("excluded", []) if scope_excluded: cross_filter_global_config["scope"]["excluded"] = [ id_map[old_id] for old_id in scope_excluded if old_id in id_map ] if "chart_configuratio...
Review this code and list any quality issues.
[ { "issue": "Thinking out loud here, if we already found the \"top/key-level ID\", can't we just do `chart_config[\"id\"] = new_id` directly (without checking if `chart_config` has an `id` property and that its value is in the map)?\r\n\r\nNot sure if all `chart_configuration` values would have an ID, but I imag...
1
python
Body=part_data.tobytes(), ) parts.append({"PartNumber": part_number, "ETag": part["ETag"]}) part_number += 1 finally: view.release() # Compact the buffer if the consumed offset has grown large en...
Review this code and list any quality issues.
[ { "issue": "The Key parameter should use `self._with_prefix(tar_filename)` instead of just `tar_filename` to maintain consistency with the prefix functionality. Unlike IDrive e2, the Cloudflare R2 integration supports custom prefixes (CONF_PREFIX), and this change would break that feature. The `create_multipart...
1
python
prompt = confirm if isinstance(analysers, list) and len(analysers): self.logger.info(f"selected analysers: {analysers}", plain=True) workflow_config = ( self._context_manager.get_context("workflow_config") if self._context_manager.get_context("workflow_c...
Review this code and list any quality issues.
[ { "issue": "Why is workspace necessary if we already passed the recorder?", "severity": "minor", "line": 26 } ]
1
python
# Coordinator is used to centralize the data updates PARALLEL_UPDATES = 0 async def async_setup_entry( hass: HomeAssistant, entry: UptimeRobotConfigEntry, async_add_entities: AddConfigEntryEntitiesCallback, ) -> None: """Set up the UptimeRobot sensors.""" coordinator = entry.runtime_data def ...
Review this code and list any quality issues.
[ { "issue": "this would be a breaking change, I think we should map it to just return `pause`", "severity": "minor", "line": 26 } ]
1
python
video, (('baseUrl', 'base_url'), {self._FORMAT_ID_RE.search}, 1), ('id', {str_or_none}), get_all=False), 'format': format_names.get(video.get('id')), } for video in traverse_obj(play_info, ('dash', 'video', ...))) if formats: self.check_missing_formats(play_info,...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n 'duration': ('timelength', {functools.partial(float_or_none, scale=1000)}),\r\n```", "severity": "minor", "line": 26 } ]
1
python
while len(reversed_challenge_hashes) < challenges_to_look_for: if curr.first_in_sub_slot: assert curr.finished_challenge_slot_hashes is not None reversed_challenge_hashes += reversed(curr.finished_challenge_slot_hashes) if len(reversed_challenge_hashes) >= cha...
Review this code and list any quality issues.
[ { "issue": "a doc-string explaining what this function does would be nice", "severity": "minor", "line": 26 } ]
1
python
poles = get_poles(denom) if poles is None: return None int_roots, nonint_roots = poles if int_roots: return None residue_factor = get_residue_factor(numer, denom, alternating) residues = [residue(residue_factor, z, root) for root in nonint_roots] ...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n # an even function from the origin.\r\n```", "severity": "minor", "line": 26 } ]
1
python
from azure.ai.ml import MLClient except ImportError as e: if pkg_name is not None: error_msg = f"Please install '{pkg_name}' to use Azure related features." else: error_msg = ( "Please install Azure extension (e.g. `pip install promptflow-azure`) to use Azure ...
Review this code and list any quality issues.
[ { "issue": "note we need to add some reference doc for this feature", "severity": "minor", "line": 26 } ]
1
python
async def test_handles_redirects( crawler: HttpCrawler, mock_request_handler: AsyncMock, server: respx.MockRouter ) -> None: await crawler.add_requests(['https://test.io/redirect']) await crawler.run() mock_request_handler.assert_called_once() assert mock_request_handler.call_args[0][0].request.loa...
Review this code and list any quality issues.
[ { "issue": "I think this would warrant using a single dataclass param so that it's obvious which value is which (additional vs ignored)", "severity": "minor", "line": 26 } ]
1
python
embed_page = self._download_webpage( embed_url, video_id, 'Downloading embed webpage', headers={'Referer': url}) glob_params = self._parse_json(self._search_regex( r'<script id="globParams">[^<]*window.globParams = ([^;]+);[^<]+</script>', embed_page, 'Global Parameters'), v...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n height_extra_key = traverse_obj(glob_params, ('video', 'partial', 'quality', height))\r\n if height_extra_key:\r\n formats.append({\r\n 'format_id': f'{height}p',\r\n```", "severity": "minor", "line": 26 } ]
1
python
# Python import logging # AWX from awx.main.analytics.subsystem_metrics import Metrics from awx.main.dispatch.publish import task from awx.main.dispatch import get_local_queuename logger = logging.getLogger('awx.main.scheduler') @task(queue=get_local_queuename) def send_subsystem_metrics(): logger.debug("Sendin...
Review this code and list any quality issues.
[ { "issue": "I like that the local node stats live in a different key and that this part basically creates a copy on the local node into a different hash & sends to remove nodes.", "severity": "minor", "line": 14 } ]
1
python
} }, { 'url': 'https://thumbs2.redgifs.com/SqueakyHelplessWisent-mobile.mp4#t=0', 'info_dict': { 'id': 'squeakyhelplesswisent', 'ext': 'mp4', 'title': 'Hotwife Legs Thick', 'timestamp': 1636287915, 'upload_date': '20211107', 'up...
Review this code and list any quality issues.
[ { "issue": "Dont use +\r\n\r\n```suggestion\r\n raise ExtractorError(f'RedGifs said: {video_info[\"error\"]}, expected=True)\r\n```\r\nor\r\n```py\r\n raise ExtractorError('RedGifs said: %s' % video_info['error'], expected=True)\r\n```", "severity": "major", "line": 26 } ]
1
python
**self._hidden_inputs(password_form), }), note='Logging in with video password') except ExtractorError as e: if isinstance(e.cause, HTTPError) and e.cause.status == 418: raise ExtractorError('Wrong video password', expected=True) raise ...
Review this code and list any quality issues.
[ { "issue": "probably should break this line up", "severity": "minor", "line": 26 } ]
1
python
# See the License for the specific language governing permissions and # limitations under the License. """Job that removes hanging story references from TopicModel canonical_story_references and logs removed ones only.""" from __future__ import annotations from core.jobs import base_jobs from core.jobs.io import ndb...
Review this code and list any quality issues.
[ { "issue": "Can we write an Audit job for this?", "severity": "minor", "line": 26 } ]
1
python
#!/usr/bin/env python3 import argparse import functools import os import re import subprocess import sys from pathlib import Path IE_TEST_PATTERN = re.compile(r'IE(_all|_\d+)?$') fix_test_name = functools.partial(IE_TEST_PATTERN.sub, r'\1') def parse_args(): parser = argparse.ArgumentParser(description='Run se...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\nfix_test_name = functools.partial(re.compile(r'IE(_all|_\\d+)?$').sub, r'\\1')\r\n```\r\nnitpick", "severity": "minor", "line": 13 } ]
1
python
compat_b64decode, compat_cookiejar_Cookie, ) from .utils import ( expand_path, Popen, YoutubeDLCookieJar, ) try: import sqlite3 SQLITE_AVAILABLE = True except ImportError: # although sqlite3 is part of the standard library, it is possible to compile python without # sqlite support. See:...
Review this code and list any quality issues.
[ { "issue": "might be best to capture all Exception as we did for keyring", "severity": "minor", "line": 26 } ]
1
python
from __future__ import annotations import warnings from datetime import timedelta from pathlib import Path from typing import TYPE_CHECKING, Any, cast from sqlalchemy.exc import IntegrityError, OperationalError from sqlalchemy.ext.asyncio import AsyncEngine, async_sessionmaker, create_async_engine from sqlalchemy.sql...
Review this code and list any quality issues.
[ { "issue": "I believe we can now remove these changes (and the test). I don't see a good reason to support deep-copying a storage client.", "severity": "minor", "line": 1 } ]
1
python
yield { 'id': str(item['id']), 'title': item.get('title'), 'description': item.get('description'), 'formats': formats, 'subtitles': subtitle, 'duration': parse_duration(item.get('duration')), ...
Review this code and list any quality issues.
[ { "issue": "Conventionally, the name `_entries` is used", "severity": "minor", "line": 26 } ]
1
python
self.disconnect_nodes(1, 2) self.connect_nodes(0, 2) # Send a tx to be unconfirmed later txid = self.nodes[0].sendtoaddress(self.nodes[0].getnewaddress(), Decimal("10")) tx = self.nodes[0].gettransaction(txid) self.generate(self.nodes[0], 4, sync_fun=self.no_op) self.syn...
Review this code and list any quality issues.
[ { "issue": "> This issue blocks any future spending and results in an incorrect balance display.\r\n\r\nTechnically correct but since the block was supposed to be invalidated and with the assumption that the likelihood for it to be invalidated again (successfully this time) is high, this immature unspent will ...
1
python
if cipher_type == 'xor': return bytes( a ^ b for a, b in zip(ciphertext.encode(), itertools.cycle(self._XOR_KEY))).decode() if cipher_type == 'rot13': return codecs.decode(ciphertext, cipher_type) self.report_warning(f'Skipping format "{format_id...
Review this code and list any quality issues.
[ { "issue": "Perhaps should actually be a generator, say a `class` with a `next()` method to replace `get_next_byte`...:\r\n<details><summary>..., s/t like this</summary>\r\n\r\n```py\r\n...\r\n class prng:\r\n def __init__(self, algo_id: int, seed: int)\r\n try:\r\n ...
1
python
@auto_refresh.setter def auto_refresh(self, interval: float | None) -> None: if self._auto_refresh_timer is not None: self._auto_refresh_timer.stop() self._auto_refresh_timer = None if interval is not None: self._auto_refresh_timer = self.set_interval( ...
Review this code and list any quality issues.
[ { "issue": "The documentation should clarify that focus trapping only takes effect when the container (or one of its descendants) currently has focus. This is an important behavior constraint that's demonstrated in the test but not mentioned in the docstring.", "severity": "minor", "line": 26 } ]
1
python
>>> ds = Dataset.from_text('path/to/dataset.txt') ``` """ # Dynamic import to avoid circular dependency from .io.text import TextDatasetReader return TextDatasetReader( path_or_paths, split=split, features=features, cache_dir=cache...
Review this code and list any quality issues.
[ { "issue": "Maybe mention here that the file writing is distributed ?", "severity": "minor", "line": 26 } ]
1
python
decrypt_info = parse_m3u8_attributes(line[11:]) if decrypt_info['METHOD'] == 'AES-128': if 'IV' in decrypt_info: decrypt_info['IV'] = binascii.unhexlify(decrypt_info['IV'][2:].zfill(32)) if not re.match(r'^https?://', decryp...
Review this code and list any quality issues.
[ { "issue": "Hardcoding `aria2c` everywhere is not the best idea. I'll think of how to implement this better (in a way that makes it is easier to extend the functionality later) and let you know", "severity": "minor", "line": 26 } ]
1
python
raise RuntimeError(f"{self.__class__.__name__} LOGIC ERROR!") yield begin, end def _iter_fexpr_slices(self, string: str) -> Iterator[Tuple[Index, Index]]: """ Yields: All ranges of @string which, if @string were to be split there, would result in the splitting of...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n illegal_indices.update(range(begin, end + 1))\r\n```", "severity": "minor", "line": 26 } ]
1
python
pd.Timestamp("2014-01-06", tz='UTC') + delta, pd.Timestamp("2014-01-31", tz='UTC') ) if type == 'week_start': rule = NthTradingDayOfWeek # Expect to trigger on the first trading day of the week, plus the # offset trigger_periods = [ ...
Review this code and list any quality issues.
[]
0
python
assert is_generic(py_type) return convert_to_type_reference_node(py_type) if is_python_type_or_alias(py_type): return convert_to_type_reference_node(py_type) if isinstance(py_type, TypeVar): return convert_to_type_reference_node(py_type) errors.append(f"'{p...
Review this code and list any quality issues.
[ { "issue": "There could be multiple annotations on a type and the comment not guaranteed to be at index 0. The previous implementation looked through all the metadata entries and found the first one that was either a Doc or a str. We probably want to keep that behavior", "severity": "minor", "line": 26...
1
python
if ( sleep_period == BLOCK_WRONG_SLEEP_PERIOD and entry.data[CONF_MODEL] in MODELS_WITH_WRONG_SLEEP_PERIOD ): LOGGER.warning( "Updating stored sleep period for %s: from %s to %s", entry.title, sleep_period, BLOCK_EXPECTED_SLEEP_PERIOD, ...
Review this code and list any quality issues.
[]
0
python
if entry.get('href'): yield self.url_result( urljoin(url, entry['href']), PolskieRadioLegacyIE, entry_id, entry.get('title')) for a_entry in re.findall(r'<span data-media=({[^ ]+})', content): yield traverse_obj(self._parse_json(a_entry, category_i...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n ), params))).encode())['d']\r\n```", "severity": "minor", "line": 26 } ]
1
python
from django.utils.timezone import now from wagtail.coreutils import accepts_kwarg, safe_md5 from .exceptions import EmbedUnsupportedProviderException from .finders import get_finders from .models import Embed def get_finder_for_embed(url, max_width=None, max_height=None): for finder in get_finders(): if...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n```\r\n\r\nNo need to add this reference, we can see the commits in the history if needed, especially as this is just an 'internal' clean up.", "severity": "major", "line": 26 } ]
1
python
H = np.array( [ [ 3.67335930e01, -2.52334820e02, 1.15477558e01, -1.19933725e-03, -2.06408851e03, -2.05821411e00, -2.52334820e02, -6.52076924e02, -2.71362566...
Review this code and list any quality issues.
[ { "issue": "We probably don't want to format like `black` here as it produces a lot of empty space. I would say something along the lines of \r\n```python\r\n H = np.array([\r\n [3.67335930e01, -2.52334820e02, 1.15477558e01, -1.19933725e-03,\r\n -2.06408851e03, -2.05821411e00, -2.52334820e02, ...
1
python
Callable to test *args : Arguments Arguments for `func`. **kwargs : Kwargs Keyword arguments for `func`. Returns ------- The value returned by `func`. Examples -------- >>> import warnings >>> def deprecated_func(num): ... warnings.warn("Please upgrade", Dep...
Review this code and list any quality issues.
[ { "issue": "Other libraries might have done the same thing we did in SciPy, thinking that `assert_warns` processed `match` like `pytest.warns`. If so, they may be confused when they start getting this error. Not sure what the best thing to do is, but one possibility is to check whether `'match' in kwargs`, and ...
1
python
result['token'] = response.json().get('access_token', None) result['token_type'] = response.json().get('token_type', None) return result def run(self, tmp=None, task_vars=None): self._supports_check_mode = False result = super(ActionModule, self).run(tmp, task_vars) in...
Review this code and list any quality issues.
[ { "issue": "Extra Credit.\r\n\r\nInstead of explicitly passing `headers=` everywhere, save headers to the session. Looks like missed passing headers in a get below.\r\n\r\n```\r\nsession.headers.update({\r\n 'Content-Type': 'application/json',\r\n 'User-Agent': '{} {} ({})'.format('AWX' if license == 'ope...
1
python
clean_html, determine_ext, format_field, int_or_none, join_nonempty, parse_codecs, parse_iso8601, url_or_none, urljoin, ) from ..utils.traversal import traverse_obj class FloatplaneBaseIE(InfoExtractor): def _base_extract(self, url, base_url, do_impersonate): post_id = self...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n post_data, [('creator', 'urlname')], f'{self._BASE_URL}/channel/%s/home') or None\r\n```", "severity": "minor", "line": 26 } ]
1
python
### No errors # A parameter with multiple `Depends()` has undefined behaviour. # https://github.com/astral-sh/ruff/pull/15364#discussion_r1912551710 @app.get("/things/{thing_id}") async def single(other: Annotated[str, Depends(takes_thing_id)]): ... @app.get("/things/{thing_id}") async def double(other: Annotated[str, ...
Review this code and list any quality issues.
[]
0
python
from tests.kit.model_zoo import model_zoo from tests.test_shardformer.test_model._utils import build_model, run_forward def check_forward_backward(org_model, sharded_model, data_gen_fn, output_transform_fn, loss_fn): # check forward org_output, org_loss, shard_output, shard_loss = run_forward(org_model, shard...
Review this code and list any quality issues.
[]
0
python
_TESTS = [{ 'url': ':ytnotif', 'only_matching': True, }, { 'url': ':ytnotifications:2', 'only_matching': True, }] @staticmethod def _extract_notification_menu(response, continuation_list): notification_list = traverse_obj( response, ('actions', 0, 'op...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n continuation_list[0] = None\r\n for item in notification_list:\r\n renderer = item.get('notificationRenderer')\r\n if renderer:\r\n yield renderer\r\n continuation = item.get('continuationItemRenderer')\r\n if...
1
python
"""Alias for ``adjacent_n_tuples(objects, 2)``. See Also -------- adjacent_n_tuples Examples -------- .. code-block:: pycon >>> list(adjacent_pairs([1, 2, 3, 4])) [(1, 2), (2, 3), (3, 4), (4, 1)] """ return adjacent_n_tuples(objects, 2) def all_elements_are_instances...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n items: Iterable[T], property_func: Callable[[T], U]\r\n) -> list[tuple[list[T], U]]:\r\n```\r\n\r\nI think it would also be great to deprecate this function, it is equivalent to [`itertools.groupby`](https://docs.python.org/3/library/itertools.html#itertools.groupby) (but way sl...
1
python
view.perform_destroy(organization) @pytest.mark.django_db def test_disallowed_http_update_methods(put, patch, post, inventory, project, admin_user): jt = JobTemplate.objects.create(name='test_disallowed_methods', inventory=inventory, project=project) job = jt.create_unified_job() post(url=reverse('api:job...
Review this code and list any quality issues.
[ { "issue": "a job is created with `job_type` \"run\" by default, so changing from \"run\" to \"run\" doesn't test changing from \"run\" to \"check\".\r\nMaybe here we can create a job with the opposite value. That is, if the pytest parameter is \"run\", create job with job_type \"check\", and if \"check\", star...
1
python
def save_unsharded_model(self, model: GeminiDDP, checkpoint: str, gather_dtensor: bool, use_safetensors: bool): """ Save model to checkpoint but only on master process. """ # the model should be unwrapped in self.load_model via ModelWrapper.unwrap # as there is communication when...
Review this code and list any quality issues.
[ { "issue": "If only saving on master process, `only_rank_0` should be `True`. This saves memory for other processes.", "severity": "major", "line": 26 } ]
1
python
@lru_cache(maxsize=1) def get_dnfile_extractor(path: Path): import capa.features.extractors.dnfile.extractor extractor = capa.features.extractors.dnfile.extractor.DnfileFeatureExtractor(path) # overload the extractor so that the fixture exposes `extractor.path` setattr(extractor, "path", path.as_posix...
Review this code and list any quality issues.
[ { "issue": "```suggestion\n bv = binaryninja.load(str(path))\n```", "severity": "minor", "line": 26 } ]
1
python
return tools def _map_tool_definition(self, f: ToolDefinition) -> responses.FunctionToolParam: return { 'name': f.name, 'parameters': f.parameters_json_schema, 'type': 'function', 'description': f.description, 'strict': bool( f.str...
Review this code and list any quality issues.
[ { "issue": "Why the `type: ignore`? That looks like we're hiding a potential real issue", "severity": "minor", "line": 26 } ]
1
python
IE_NAME = 'mildom' IE_DESC = 'Record ongoing live by specific user in Mildom' _VALID_URL = r'https?://(?:(?:www|m)\.)mildom\.com/(?P<id>\d+)' def _real_extract(self, url): video_id = self._match_id(url) webpage = self._download_webpage(f'https://www.mildom.com/{video_id}', video_id) ...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n body={'host_id': video_id, 'type': 'hls'})\r\n```", "severity": "minor", "line": 26 } ]
1
python
duration = float_or_none(try_get( ptmd, lambda x: x['attributes']['duration']['value']), scale=1000) return { 'extractor_key': ZDFIE.ie_key(), 'id': content_id, 'duration': duration, 'formats': formats, 'subtitles': self._extract_subtitles...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n _VALID_URL = r'https?://www\\.zdf\\.de/(?:[^/]+/)*(?P<id>[^/?#&]+)\\.html'\r\n _TESTS = [{\r\n```", "severity": "minor", "line": 26 } ]
1
python
), ) ########################## entities ########################## plane = scene.add_entity( gs.morphs.Plane(), ) franka = scene.add_entity( gs.morphs.MJCF(file="xml/franka_emika_panda/panda.xml"), visualize_contact=True, ) ########################## cameras ######...
Review this code and list any quality issues.
[]
0
python
'union': True, }).encode(), ) if ttwid := self._get_cookies(urlh.url)['ttwid'].value: self._set_cookie('.toutiao.com', 'ttwid', ttwid) return self.raise_login_required(method='cookies') def _real_extract(self, url): video_id = self._match_id(url...
Review this code and list any quality issues.
[ { "issue": "Why `str_or_none` instead of `str` here? (I am actually curious; not necessarily saying you should change it)", "severity": "minor", "line": 26 } ]
1
python
self, *, toolset: OutputToolset[Any] | None, text_processor: BaseOutputProcessor[OutputDataT] | None = None, allows_deferred_tools: bool, allows_image: bool, ): super().__init__( toolset=toolset, allows_deferred_tools=allows_deferred_tools, ...
Review this code and list any quality issues.
[ { "issue": "Let's have a default of `None`", "severity": "minor", "line": 26 } ]
1
python
VectorStoresProtocolPrivate, ) from llama_stack_api.internal.kvstore import KVStore from .config import PGVectorVectorIOConfig log = get_logger(name=__name__, category="vector_io::pgvector") VERSION = "v3" VECTOR_DBS_PREFIX = f"vector_stores:pgvector:{VERSION}::" VECTOR_INDEX_PREFIX = f"vector_index:pgvector:{VERSIO...
Review this code and list any quality issues.
[ { "issue": "does the `CREATE EXTENSION IF NOT EXISTS vector` syntax not work?", "severity": "minor", "line": 26 } ]
1
python
"application/x-zip-compressed", "application/zip-compressed", ): protocol = "zip" else: protocol = "file" fs = fsspec.filesystem(protocol=protocol, fo=conf_source) return fs, protocol def _merge_configs( self, config: dict[str, Any...
Review this code and list any quality issues.
[ { "issue": "Shall we go even further and move merging strategies outside to the `Enum` and create a mapping of symbolic names to the implementations? Then all the possible values and implementations will be in one place, so it's easier to navigate and compare them, and additionally, we will get rid `if else` lo...
1
python
clf.fit(np.dot(X, Xt), Y) with pytest.raises(ValueError): clf.predict(X) clf = svm.SVC() clf.fit(X, Y) with pytest.raises(ValueError): clf.predict(Xt) def test_svc_nonfinite_params(global_random_seed): # Check SVC throws ValueError when dealing with non-finite parameter values ...
Review this code and list any quality issues.
[ { "issue": "This test is really weird:\r\n\r\n- \"unicode\" is the old name for the `str` class in Python 2, I think it refers to passing the name of a kernel rather than a callable;\r\n- we alreay test this behavior many times elsewhere.\r\n- it is just a smoke test and makes no assertions on the returned valu...
1
python
None (or "null" in YAML) means do not optimize. This is the default behavior in legacy version. How each liar works is explained in paper's section 6.1. In general "best" suit for small trial number and "worst" suit for large trial number. n_startup_jobs: int (default: 20) The first N hype...
Review this code and list any quality issues.
[ { "issue": "do not understand... could you explain more?", "severity": "minor", "line": 26 } ]
1
python
path_arc_centers The center of the circular arcs along which the points of ``mobject`` are moved by the transformation. If this is set and ``path_func`` is not set, then a ``path_along_circles`` path will be generated using the ``path_arc`` parameters and stored in ``path_func``. If ``p...
Review this code and list any quality issues.
[ { "issue": "100 points per curve actually seems somewhat excessive, something on the order of 5-10 should be sufficient. Also, the upper bound is not included in `range(a, b)`, so you'll want to either increase this by one ...", "severity": "minor", "line": 26 } ]
1
python
result = MyDataset.from_config( name="my_dataset", config={"type": "SomeDataset"}, load_version=None, save_version=None, ) mock_parse_ds_definition.assert_called_once_with( {"type": "SomeDataset"}, None, None ) assert result ==...
Review this code and list any quality issues.
[]
0
python
ca_cert: Path, ca_key: Path, cert_path: Path, key_path: Path, *, check_permissions: bool = True, log: logging.Logger | None = None, ) -> ssl.SSLContext: if check_permissions: verify_ssl_certs_and_keys([ca_cert, cert_path], [ca_key, key_path], log) ssl_context = ssl._create_unver...
Review this code and list any quality issues.
[ { "issue": "This is a special case of creating new user config parameters and setting default values to use default parameters for ones are missing from a legacy config file. Is there a way to do this in a more \"config\"-based file? Is seems a bit specific to have this config-override stuff at this level.", ...
1
python
default=['deno'], help=( 'Additional JavaScript runtime to enable, with an optional path to the runtime location. ' 'This option can be used multiple times to enable multiple runtimes. ' 'Supported runtimes: deno, node, quickjs, bun. By default, only "deno" runtime is enabled...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n 'Remote components to allow yt-dlp to fetch when required. '\r\n 'This option is currently not needed if you are using an official executable '\r\n 'or have the yt-dlp-ejs library installed in your Python environment. '\r\n 'You can use t...
1
python
expect(heading_element).to_be_visible() return heading_element def expect_prefixed_markdown( locator: FrameLocator | Locator | Page, expected_prefix: str, expected_markdown: str | re.Pattern[str], exact_match: bool = False, ) -> None: """Find the markdown with the prefix and then ensure that t...
Review this code and list any quality issues.
[]
0
python
c = C() with dask.config.set({"tokenize.ensure-deterministic": False}): # Not idempotent assert tokenize(c) != tokenize(c) # You can call normalize_token directly assert normalize_token(c) != normalize_token(c) with dask.config.set({"tokenize.ensure-deterministic": True}): ...
Review this code and list any quality issues.
[ { "issue": "Should this be nested within the block above?", "severity": "minor", "line": 26 } ]
1
python
lmcache_cached_tokens - request.load_spec.vllm_cached_tokens ) if num_retrieved_tokens < num_expected_tokens: logger.error( "The number of retrieved tokens is less than the " "expected number of tokens! This should not h...
Review this code and list any quality issues.
[ { "issue": "Can we have this function return an explicit list of `invalid_block_ids`? Otherwise, it's not clear to other developers what the \"side effect\" of this function is.", "severity": "minor", "line": 26 } ]
1
python
assert g == original_list def test_repr(self): def die(): raise AssertionError("Generator died") yield None # Confirm that `regen()` instances are not concretised when represented g = regen(die()) assert "..." in repr(g) @pytest.mark.xfail(raises=StopIt...
Review this code and list any quality issues.
[ { "issue": "whoops, this needs to be uncommented and the pass removed", "severity": "minor", "line": 26 } ]
1
python
def get_input_format_from_cli(args) -> str: """ Determine the format of the input file. Note: this may not be the same as the format of the sample. Cape, Freeze, etc. formats describe a sample without being the sample itself. args: args: The parsed command line arguments from `install_common...
Review this code and list any quality issues.
[]
0
python
# coding: utf-8 from __future__ import unicode_literals from .common import InfoExtractor from ..utils import ( smuggle_url, str_or_none, traverse_obj, ) class TVerIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?tver\.jp/(?P<path>corner|episodes?|feature|lp|tokyo2020/video)/(?P<id>[a-zA-Z0-9]+)...
Review this code and list any quality issues.
[ { "issue": "Is `tver.jp/lp/{video_id}` still a valid pattern?\r\n\r\nIn the `api_response` I saw it being used like a shortcut `tver.jp/lp/episodes/{video_id}`.\r\n\r\nPerhaps:\r\n`r'https?://(?:www\\.)?tver\\.jp/(?:lp/)?(?P<path>corner|episodes?|feature|tokyo2020/video)/(?P<id>[a-zA-Z0-9]+)'`?", "severity"...
1
python
await signals.request_started.asend(sender=self.__class__, scope=scope) # Get the request and check for basic issues. request, error_response = self.create_request(scope, body_file) if request is None: body_file.close() await self.send_response(error_r...
Review this code and list any quality issues.
[ { "issue": "Wouldn't simply cancelling the background task achieve the same result, without triggering the exception handling mechanism. It would also make this code more readable, since it seems like the exception is being raised only to cancel the task.\r\n\r\n```python\r\n async with async...
1
python
# Copyright 2025 - Oumi # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, softw...
Review this code and list any quality issues.
[ { "issue": "if we care about the last occurrence, should it be something like this `\\d+$` ? (not 100% sure about exact regex syntax for this)", "severity": "minor", "line": 22 } ]
1
python
This method is for backward compatibility only: do not use. .. deprecated:: 1.20.0 This method has been advised against since numpy 1.8.0, but only started emitting DeprecationWarning as of this version. """ # NumPy 1.20.0, 2020-09-08 warnings.warn( "...
Review this code and list any quality issues.
[ { "issue": "this should help with the test failures\r\n\r\n```suggestion\r\n return next(self._iter)\r\n```", "severity": "critical", "line": 26 } ]
1
python
installed_something = self.install_non_gstreamer_dependencies(force) return installed_something def install_non_gstreamer_dependencies(self, force: bool) -> bool: install = False pkgs = [] if self.distro in ["Ubuntu", "Debian GNU/Linux", "Raspbian GNU/Linux"]: command = ...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n print(\"Skipping the following required packages as they don't exist in this OS version:\", missing_pkgs)\r\n```\r\n\r\nShould we skip the print if missing_pkgs is empty?", "severity": "minor", "line": 26 } ]
1
python
self._logger.exception( 'An exception occurred during handling of failed request. This places the crawler ' 'and its underlying storages into an unknown state and crawling will be terminated.', exc_info=secondary_error, ) context.request.state = Re...
Review this code and list any quality issues.
[ { "issue": "Shouldn't we do the same with error handler?", "severity": "minor", "line": 26 } ]
1
python
# # Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or # http://www.apache.org/licenses/LICENSE-2.0> or the MIT license # <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your # option. This file may not be copied, modified, or distributed # except according to those terms. # A simple script to ...
Review this code and list any quality issues.
[ { "issue": "Hmm, can you explain why `git clean` over e.g. `git status` or `git diff`? We'd mostly run this in CI, so it probably doesn't matter too much, but I expect one also wouldn't want any changed files.", "severity": "minor", "line": 26 } ]
1
python
def unified_strdate(date_str, day_first=True): """Return a string with the date in the format YYYYMMDD""" if date_str is None: return None upload_date = None # Replace commas date_str = date_str.replace(',', ' ') # Remove AM/PM + timezone date_str = re.sub(r'(?i)\s*(?:AM|PM)(?:\s+[A...
Review this code and list any quality issues.
[]
0
python
# Compare brightness (mean pixel value) viewer_brightness = viewer_rgb.mean() add_cam_brightness = add_cam_rgb.mean() brightness_ratio = add_cam_brightness / viewer_brightness assert 0.99 <= brightness_ratio <= 1.01, ( f"add_camera brightness ({add_cam_brightness:.2f}) should match " f"...
Review this code and list any quality issues.
[ { "issue": "`viewer_options=gs.options.ViewerOptions(run_in_thread=False),`", "severity": "minor", "line": 26 } ]
1
python
has not yet been registered. Example: :: >>> import pandas as pd >>> >>> from kedro_datasets.pandas import CSVDataset >>> >>> cars = CSVDataset(filepath="cars.csv", >>> load_args=None, >>> ...
Review this code and list any quality issues.
[ { "issue": "Same as for save, let's keep it `name`.", "severity": "minor", "line": 26 } ]
1
python
'skip': 'livestream', }, { 'url': 'https://live2.nicovideo.jp/watch/lv339533123', 'only_matching': True, }, { 'url': 'https://sp.live.nicovideo.jp/watch/lv339533123', 'only_matching': True, }, { 'url': 'https://sp.live2.nicovideo.jp/watch/lv339533123', 'only_m...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n embedded_data = traverse_obj(webpage, (\r\n {find_element(tag='script', id='embedded-data', html=True)},\r\n {extract_attributes}, 'data-props', {json.loads}))\r\n frontend_id = traverse_obj(embedded_data, ('site', 'frontendId', {str_or_none}), d...
1
python
.. code-block:: python import numpy as np from monai.data import ITKWriter np_data = np.arange(48).reshape(3, 4, 4) # write as 3d spatial image no channel writer = ITKWriter(output_dtype=np.float32) writer.set_data_array(np_data, channel_dim=None) # optionally ...
Review this code and list any quality issues.
[ { "issue": "We should warn that the default value has changed here (with deprecated decorator?).", "severity": "minor", "line": 26 } ]
1
python
assert result["type"] is FlowResultType.CREATE_ENTRY assert result["title"] == "Saunum" assert result["data"] == TEST_USER_INPUT @pytest.mark.parametrize( ("side_effect", "error_base"), [ (SaunumConnectionError("Connection failed"), "cannot_connect"), (SaunumException("Read error"), "c...
Review this code and list any quality issues.
[ { "issue": "You likely want to change the `mock_saunum_client` to not return the `client.return_value` but just the `client`.\r\n\r\nI'd recommend:\r\n1. rename `mock_saunum_client` and make it just return the raw mock (the one assigned in `with patch(...) as client`)\r\n2. Create a new fixture that imports `mo...
1
python
del sys.modules[module] def _find_kedro_project(current_dir: Path) -> Any: # pragma: no cover while current_dir != current_dir.parent: if _is_project(current_dir): return current_dir current_dir = current_dir.parent return None @typing.no_type_check @magic_arguments() @argument...
Review this code and list any quality issues.
[ { "issue": "This is now function and a function call, right?", "severity": "minor", "line": 26 } ]
1
python
'id': '1' } ws_client.send(obj) with pytest.raises(queue.Empty): ev = ws_client.get_ws_event(3) def test_start_after_stop(self, ws_client): self.test_start(ws_client) self.test_stop(ws_client) ''' Refer: https://github.com/apollographql/subscriptions...
Review this code and list any quality issues.
[]
0
python
else: return to_deref def find_memory_references_from_insn(insn, max_depth: int = 10): """yield memory references from given instruction""" for reference in insn.getReferencesFrom(): if not reference.isMemoryReference(): # only care about memory references continue ...
Review this code and list any quality issues.
[ { "issue": "is the yield only per reference intended here?\r\n\r\nwhere we expect multiple references from an instruction?", "severity": "minor", "line": 26 } ]
1
python
from __future__ import unicode_literals import re from .common import InfoExtractor from ..compat import ( compat_str ) from ..utils import ( int_or_none, str_to_int, try_get, url_or_none, unified_strdate, parse_duration, ) class TEDIE(InfoExtractor): IE_NAME = 'ted' _VALID_URL =...
Review this code and list any quality issues.
[ { "issue": "Since u r rewriting the whole thing anyway, change it to just `str`", "severity": "minor", "line": 8 } ]
1
python
return requests[0] self._record_request_size_prometheus(requests) params = self._parse_params(requests[0].parameters, self._executor.metas.name) docs = WorkerRequestHandler.get_docs_from_request( requests, field='docs', ) # executor logic return...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n self._record_response_size_monitoring(requests)\r\n```", "severity": "minor", "line": 26 } ]
1
python
#!/usr/bin/env python3 import os import sys import subprocess import webbrowser import argparse from pathlib import Path from openpilot.common.basedir import BASEDIR DIFF_OUT_DIR = Path(BASEDIR) / "selfdrive" / "ui" / "tests" / "diff" / "report" def extract_framehashes(video_path): cmd = ['ffmpeg', '-i', video_pat...
Review this code and list any quality issues.
[ { "issue": "The framehash output format is a fixed set of columns (stream#, dts, pts, duration, size, hash). The current `len(parts) < 4` check is too loose and can silently accept unexpected output; tightening this to the expected column count (and/or validating the hash looks like an MD5) would make parsing f...
1
python
try: runtime = await self._get_runtime(stored_sandbox.id) if runtime and runtime.get('session_api_key') == session_api_key: return await self._to_sandbox_info(stored_sandbox, runtime) except Exception: # Continue checking other sandboxes if...
Review this code and list any quality issues.
[]
0
python
} fragment ImageDetails on AssetImage { id url }''' def _get_media_data(self, media_id): # NOTE In the web app, the "locale" header is used to switch between languages, # However this doesn't seem to take effect when passing the header here. response ...
Review this code and list any quality issues.
[ { "issue": "use `yt_dlp.utils.parse_qs` instead, then you won't need to `urlsplit`\r\n\r\nwe should probably error gracefully here (`raise ExtractorError`) if an `id_token` value is not present in the query instead of KeyErroring\r\n\r\nalso you need to set `_id_token` as a class variable outside of this method...
1
python
'creator': 'Virginie Vota', 'release_year': 2018, 'upload_date': '20230318', 'uploader': 'admin@altcensored.com', 'description': 'md5:0b38a8fc04103579d5c1db10a247dc30', 'timestamp': 1679161343, 'track': 'k0srjLSkga8', 'duration': 926.09...
Review this code and list any quality issues.
[ { "issue": "could keep the `IE_NAME` scheme consistent\r\n```suggestion\r\nclass AltCensoredChannelIE(InfoExtractor):\r\n IE_NAME = 'altcensored:channel'\r\n _VALID_URL = r'https?://(?:www\\.)?altcensored\\.com/channel/(?!page|table)(?P<id>[^/?#]+)'\r\n```", "severity": "major", "line": 26 } ]
1
python
from collections.abc import Awaitable from typing import Callable from ...job import get_job_context from ...llm import Tool, Toolset, function_tool from ...log import logger from ...voice.events import CloseEvent, RunContext END_CALL_INSTRUCTIONS = """ Ends the current call and disconnects immediately. Call when: -...
Review this code and list any quality issues.
[ { "issue": "```suggestion\nEND_CALL_DESCRIPTION = \"\"\"\n```", "severity": "minor", "line": 9 } ]
1
python
m.update(b'1') m.update(b'#' * gil_minsize) m.update(b'1') m = cons(b'x' * gil_minsize, usedforsecurity=False) m.update(b'1') def test_sha256_gil(self): gil_minsize = hashlib_helper.find_gil_minsize(['_sha2', '_hashlib']) data = b'1' + b'#' * gil_min...
Review this code and list any quality issues.
[ { "issue": "Not sure that we need this guard here. Or do we?", "severity": "minor", "line": 26 } ]
1
python
def set_session(self, session: Session | None) -> None: self.session = session self._session_paths_checked = False # Indirection so we can mock calls to find_spec originated from the hook during testing _find_spec = importlib.machinery.PathFinder.find_spec def find_spec( self, ...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n # With --import-mode=importlib, PathFinder cannot find spec without modifying `sys.path`,\r\n```", "severity": "minor", "line": 26 } ]
1
python
# Check that disabled_agent was filtered out triggered_agents = call_args['triggered_agents'] assert len(triggered_agents) == 2 agent_names = [agent.name for agent in triggered_agents] assert 'test_agent' in agent_names assert 'another_agent' in agent_names assert 'disabled_agent' not in agent_n...
Review this code and list any quality issues.
[]
0