language
string
code-snippit
string
instruction
string
flaws
list
flaw_count
int64
python
@classmethod def init_class_fixtures(cls): super(WithEquityDailyBarData, cls).init_class_fixtures() if cls.EQUITY_DAILY_BAR_USE_FULL_CALENDAR: days = cls.trading_calendar.all_sessions else: if cls.trading_calendar.is_session( cls.EQUITY_DAILY_BAR_S...
Review this code and list any quality issues.
[ { "issue": "@yankees714 that refactoring has been squashed in, the new function is here https://github.com/quantopian/zipline/pull/1372/files#diff-64eeb1b15a7a2ce1ec06af6c9a2f4b47R24", "severity": "major", "line": 26 } ]
1
python
import sentry_sdk from pydantic import SecretStr from sentry_sdk.integrations.anthropic import AnthropicIntegration from sentry_sdk.integrations.asyncio import AsyncioIntegration from sentry_sdk.integrations.logging import LoggingIntegration from backend.util.settings import Settings settings = Settings() class Dis...
Review this code and list any quality issues.
[ { "issue": "How does this help us?\r\n\r\nI have no idea what they do, and we need to have a common understanding so we dont replicate effort", "severity": "minor", "line": 26 } ]
1
python
def _real_extract(self, url): playlist_id = self._match_id(url) if playlist_id.endswith('/'): playlist_id = playlist_id[:-1] webpage = self._download_webpage(url, playlist_id) static_assets_base = self._search_regex(r'staticAssetsBase:\"(.*?)\"', webpage, 'staticAssetsBase'...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n category = next((cat for cat in game['subcategories'] if cat['slug'].lower() == category_slug),\r\n game['subcategories'][0])\r\n category_slug = category.get('slug', '').lower() or category_slug\r\n```", "severity": "minor", "line": 26 ...
1
python
from flask import request from flask_restx import Resource, fields, marshal_with from pydantic import BaseModel, Field from constants import HIDDEN_VALUE from fields.api_based_extension_fields import api_based_extension_fields from libs.login import current_account_with_tenant, login_required from models.api_based_ext...
Review this code and list any quality issues.
[ { "issue": "The CodeBasedExtensionQuery model lacks validation for the 'module' field. Consider adding Field constraints to ensure the module parameter is not empty and follows expected naming patterns, e.g., Field(min_length=1, description=\"Extension module name\").\n```suggestion\n module: str = Field(min...
1
python
timedelta_ms, Field( validation_alias=AliasChoices( 'apify_persist_state_interval_millis', 'crawlee_persist_state_interval_millis', ) ), ] = timedelta(minutes=1) """Interval at which `PersistState` events are emitted. The event ensures the ...
Review this code and list any quality issues.
[]
0
python
self.pyscript_run( """ <py-script> print('hello pyscript') raise Exception('this is an error') </py-script> """ ) assert self.console.log.lines[0] == self.PY_COMPLETE assert "hello pyscript" in self.console.log.lines ...
Review this code and list any quality issues.
[ { "issue": "Why is this test commented out? @FabioRosado", "severity": "minor", "line": 26 } ]
1
python
response = [{"role": Role.ASSISTANT.value, "content": example[self.dataset_attr.response]}] else: # unsupervised response = [] output = { "_prompt": prompt, "_response": response, "_system": example[self.dataset_attr.system] if self.dataset_attr.system e...
Review this code and list any quality issues.
[]
0
python
# MappingProxy is scene-caching nightmare. It contains all of the object methods and attributes. We skip it as the mechanism will at some point process the object, but instantiated. # Indeed, there is certainly no case where scene-caching will receive only a non instancied object, as this is never used in t...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n def _iter_check_list(lst: Sequence[Any]) -> list[Any]:\r\n```\r\n\r\nIt's also technically pretty easy to rewrite this function to allow any iterables, but I'm not so sure about allowing potentially infinite iterables:\r\n```py\r\n def _iter_check_list(lst: Iterable[A...
1
python
} }, { 'url': 'https://vt.tiktok.com/ZSe4FqkKd', 'only_matching': True, }] def _real_extract(self, url): new_url = self._request_webpage( HEADRequest(url), self._match_id(url), headers={'User-Agent': 'facebookexternalhit/1.1'}).geturl() if self.suitable(new_url):...
Review this code and list any quality issues.
[ { "issue": "it's fine to match `uploader` from the URL here\r\n\r\nit looks like the project in the comment uses a 3rd party web API for signing URLs; that's not a viable solution for yt-dlp. it's better to omit the comment.\r\n```suggestion\r\n uploader = self._match_id(url)\r\n webpage = self._d...
1
python
return backend.server.v2.store.model.ProfileDetails( name=profile.name, username=profile.username, description=profile.description, links=profile.links, avatar_url=profile.avatarUrl, ) except Exception as e: logger.error("Error getting user...
Review this code and list any quality issues.
[ { "issue": "I don't see HTTPException is used at all, can we remove this ?", "severity": "major", "line": 26 } ]
1
python
This can be changed through ScalarAggregateOptions. Parameters ---------- array : Array-like Argument to compute function. skip_nulls : bool, default True Whether to skip (ignore) nulls in the input. If False, any null in the input forces the output t...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n Using ``skip_nulls`` to handle null values.\r\n```", "severity": "minor", "line": 26 } ]
1
python
content_to_add = ( user_prompt_content[0] if len(user_prompt_content) == 1 and isinstance(user_prompt_content[0], str) else user_prompt_content ) builder.add(UserPrompt...
Review this code and list any quality issues.
[ { "issue": "These methods really shouldn't be part of the public interface, so please make them private, either has class methods, or if that doesn't work, as private functions in the module, outside of the class", "severity": "minor", "line": 26 } ]
1
python
# Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """...
Review this code and list any quality issues.
[ { "issue": "same as other review, better named it as deepspeed engine.", "severity": "minor", "line": 26 } ]
1
python
'ext': 'mp4', 'categories': ['FIFA Tournaments', 'Highlights'], 'thumbnail': 'https://digitalhub.fifa.com/transform/d8fe6f61-276d-4a73-a7fe-6878a35fd082/FIFAPLS_100EXTHL_2014BRAvGER_TMB', 'duration': 901, 'release_timestamp': 1404777600, 'release_date': '20140...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n video_id, locale = self._match_valid_url(url).group('id', 'locale')\r\n```", "severity": "minor", "line": 26 } ]
1
python
] async_add_entities(entities) class StarlineSwitch(StarlineEntity, SwitchEntity): """Representation of a StarLine switch.""" _attr_assumed_state = True def __init__( self, account: StarlineAccount, device: StarlineDevice, description: SwitchEntityDescription, ) -...
Review this code and list any quality issues.
[ { "issue": "The `engine_attrs` method in `account.py` (lines 183-190) is now orphaned code and should be removed as part of this PR. Since the `extra_state_attributes` property that called this method has been removed from `switch.py`, this method is no longer used anywhere in the codebase.", "severity": "m...
1
python
track_info = tralbum.get('trackinfo') if not track_info: raise ExtractorError('The page doesn\'t contain any tracks') # Only tracks with duration info have songs entries = [ self.url_result( urljoin(url, t['title_link']), BandcampIE.ie_key(), ...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n _VALID_URL = r'https?://(?:www\\.)?bandcamp\\.com/radio/?\\?(?:[^#]+&)?show=(?P<id>\\d+)'\r\n```", "severity": "minor", "line": 26 } ]
1
python
else: WEBSOCKET_CONNECTIONS.dec(abs(delta)) def record_database_query(operation: str, table: str, duration: float): """Record a database query with duration.""" DATABASE_QUERIES.labels(operation=operation, table=table).observe(duration) def record_rabbitmq_message(queue: str, status: str): """Re...
Review this code and list any quality issues.
[ { "issue": "The function accepts a `user_id` parameter but doesn't use it. This creates a misleading API where callers might expect the user_id to be tracked. Either remove the unused parameter or add a comment explaining why it's not used for cardinality control.\n```suggestion\ndef record_rate_limit_hit(endpo...
1
python
from datetime import datetime import base64 from .common import InfoExtractor from ..networking import HEADRequest from ..utils import int_or_none, urlencode_postdata class TenPlayIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?10play\.com\.au/(?:[^/]+/)+(?P<id>tpv\d{6}[a-z]{5})' _NETRC_MACHINE = '10pla...
Review this code and list any quality issues.
[ { "issue": "Do not subclass from concrete IE; move common code into a baseclass and subclass both concrete IEs from the baseclass", "severity": "minor", "line": 26 } ]
1
python
@property def __array_interface__(self) -> dict[str, Any]: ... @property def __array_priority__(self) -> float: ... @property def __array_struct__(self) -> CapsuleType: ... # builtins.PyCapsule def __array_namespace__(self, /, *, api_version: _ArrayAPIVersion | None = None) -> ModuleType: ... ...
Review this code and list any quality issues.
[ { "issue": "This should fix the mypy failures I think\r\n\r\n```suggestion\r\n ) -> NDArray[Any]: ...\r\n```", "severity": "critical", "line": 26 } ]
1
python
title = self._html_search_regex(r'<title>(.+?)</title>', webpage, 'Title', fatal=False) or self._og_search_title(webpage) entryid = self._search_regex(r'data-entry-id=["\']([^"\']+)', webpage, 'entryID') session_json = self._download_session_json(video_id, entry...
Review this code and list any quality issues.
[ { "issue": "too long. the URL can be seperated out\r\n```py\r\n formats, subtitles = self._extract_m3u8_formats_and_subtitles(\r\n self._FORMAT_URL.format(partner=self.PARTNER_ID, entry=entryid, session=k_session), video_id)\r\n```", "severity": "major", "line": 26 } ]
1
python
#!/usr/bin/env python3 import os import openai import pinecone import time import sys from collections import deque from typing import Dict, List from dotenv import load_dotenv import os # Set Variables load_dotenv() # Set API Keys OPENAI_API_KEY = os.getenv("OPENAI_API_KEY", "") assert OPENAI_API_KEY, "OPENAI_API_KE...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\nassert OPENAI_API_MODEL, \"OPENAI_API_MODEL environment variable is missing from .env\"\r\n```", "severity": "minor", "line": 20 } ]
1
python
@classmethod def _extract_from_webpage(cls, url, webpage): # Reference: https://slideslive.com/embed_presentation.js for embed_id in re.findall(r'(?s)new\s+SlidesLiveEmbed\s*\([^\)]+\bpresentationId:\s*["\'](\d+)["\']', webpage): url_parsed = urllib.parse.urlparse(url) origin...
Review this code and list any quality issues.
[ { "issue": "Why put it into a custom dict only to unpack it immediately", "severity": "minor", "line": 26 } ]
1
python
@pytest.mark.onlynoncluster async def test_master_odown(cluster, sentinel): cluster.master["is_odown"] = True with pytest.raises(MasterNotFoundError): await sentinel.discover_master("mymaster") @pytest.mark.onlynoncluster async def test_master_sdown(cluster, sentinel): cluster.master["is_sdown"] =...
Review this code and list any quality issues.
[]
0
python
"tracker_id", "data", }, DoesNotRaise(), ), ( Detections( xyxy=np.array([[1, 2, 3, 4], [5, 6, 7, 8]]), class_id=np.array([1, 2]), confidence=np.array([0.1, 0.2]), mask=np.array([[[1]], [[2...
Review this code and list any quality issues.
[ { "issue": "Make that case raise Exception.", "severity": "minor", "line": 26 } ]
1
python
@classmethod def suitable(cls, url): return False if PolskieRadioLegacyIE.suitable(url) else super().suitable(url) def _entries(self, url, page, category_id): content = page is_billennium_tabs = 'onclick="TB_LoadTab(' in page is_post_back = 'onclick="__doPostBack(' in page ...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n 'id': media['uid'],\r\n```\r\nid cant be None", "severity": "minor", "line": 26 } ]
1
python
if joint.type == gs.JOINT_TYPE.FIXED: continue if joint.type == gs.JOINT_TYPE.REVOLUTE: revolute_joints.append(joint) joint_qpos_indices.append(joint.qs_idx_local[0]) joint_dof_indices.append(joint.dofs_idx_local[0]) elif joint.typ...
Review this code and list any quality issues.
[]
0
python
next_token_logits = logits_processor(input_ids, next_token_logits) # sample probs = torch.softmax(next_token_logits, dim=-1, dtype=torch.float) next_tokens = torch.multinomial(probs, num_samples=1).squeeze(1) # finished sentences should have their next token be a padding token i...
Review this code and list any quality issues.
[]
0
python
assert ckpt_name == 'epoch=003-acc=0.03' # prefix char_org = ModelCheckpoint.CHECKPOINT_JOIN_CHAR ModelCheckpoint.CHECKPOINT_JOIN_CHAR = '@' ckpt_name = ModelCheckpoint._format_checkpoint_name('{epoch},{acc:.5f}', 3, {'acc': 0.03}, prefix='test') assert ckpt_name == 'test@epoch=3,acc=0.03000' M...
Review this code and list any quality issues.
[ { "issue": "This comment is not correct\r\n\r\n```suggestion\r\n # using slashes\r\n```", "severity": "minor", "line": 26 } ]
1
python
self._save_progress() self._save_temp_book() sys.exit(0) def load_state(self): try: with open(self.bin_path, "rb") as f: self.p_to_save = pickle.load(f) except Exception: raise Exception("can not load resume file") def _save_t...
Review this code and list any quality issues.
[ { "issue": "not self.exclude_filelist or item.file_name not in self.exclude_filelist.split(\",\") \r\nmaybe better?", "severity": "minor", "line": 26 } ]
1
python
capacity_nbytes=capacity_nbytes, device=device, pin_memory=pin_memory, ) else: return CoalescingPoolAllocator( capacity_nbytes=capacity_nbytes, device=device, pin_memory=pin_memory, ) def __l...
Review this code and list any quality issues.
[ { "issue": "what's `MR_USE_COMPACT_LAYOUT`?", "severity": "minor", "line": 26 } ]
1
python
def test_setup(self) -> None: source, expected = read_data("../setup", data=False) actual = fs(source) self.assertFormatEqual(expected, actual) black.assert_equivalent(source, actual) black.assert_stable(source, actual, black.FileMode()) self.assertFalse(ff(THIS_DIR / ".....
Review this code and list any quality issues.
[ { "issue": "It's fine to have another test file, but could you name it something less generic, like `test_function_trailing_comma`?", "severity": "minor", "line": 26 } ]
1
python
'--floating', action='store_true', default=False, help='If set, the current Pod/Deployment can not be further chained, ' 'and the next `.add()` will chain after the last Pod/Deployment not this current one.', ) if pod_type != 'gateway': gp.add_argument( '...
Review this code and list any quality issues.
[ { "issue": "should not be added to the gateway in my opinion", "severity": "minor", "line": 26 } ]
1
python
else: assert_never(part) try: # At the moment, we prioritize at least executing tool calls if they are present. # In the future, we'd consider making this configurable at the agent or run level. # This accounts for case...
Review this code and list any quality issues.
[]
0
python
'timestamp': 1752354007, 'upload_date': '20250712', 'release_timestamp': 1752354000, 'release_date': '20250712', 'live_status': 'is_live', }, }] def _real_extract(self, url): username, event_id = self._match_valid_url(url).group('username', 'id') ...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n self.report_warning(\r\n 'The server did not return a valid file extension for the stream URL. '\r\n 'Assuming an mp3 stream; postprocessing may fail if this is incorrect')\r\n```", "severity": "critical", "li...
1
python
) req_meta = ReqMeta.from_request_tracker( request_tracker, self._block_size, self._lmcache_chunk_size, load_spec=load_spec, discard_partial_chunks=self._discard_partial_chunks, save_decode_cache=self._save_deco...
Review this code and list any quality issues.
[ { "issue": "nit: \r\nlookup_id = request.request_id", "severity": "minor", "line": 26 } ]
1
python
axis : None Unused. Parameter needed for compatibility with DataFrame. skipna : bool, default True Exclude NA/null values. If the entire Series is NA, or if ``skipna=False`` and there is an NA value, this method will raise a ``ValueError``. *args, **kwargs ...
Review this code and list any quality issues.
[ { "issue": "Same comment about using `Index` here instead", "severity": "minor", "line": 26 } ]
1
python
# mweb has 'ultralow' formats # See: https://github.com/yt-dlp/yt-dlp/pull/557 'mweb': { 'INNERTUBE_API_KEY': 'AIzaSyAO_FJ2SlqU8Q4STEHLGCilw_Y9_11qcW8', 'INNERTUBE_CONTEXT': { 'client': { 'clientName': 'MWEB', 'clientVersion': '2.20220801.00.00', ...
Review this code and list any quality issues.
[ { "issue": "as pukkandan mentioned on discord, `_` has special meaning in client names, so we need to change this to something like `mediaconnect`", "severity": "minor", "line": 26 } ]
1
python
): ParametricSurface.__init__( self, self.func, resolution=resolution, u_min=u_min, u_max=u_max, v_min=v_min, v_max=v_max, **kwargs, ) self.radius = radius self.scale(self.radius) def fun...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n radius : :class:`float`, optional\r\n```", "severity": "minor", "line": 26 } ]
1
python
# Handle page close event page.on(event='close', f=self._on_page_close) # Update internal state self._pages.append(page) self._last_page_opened_at = datetime.now(timezone.utc) return page @override async def close(self, *, force: bool = False) -> None: if force...
Review this code and list any quality issues.
[ { "issue": "Could we rename this to `create_browser_context`?", "severity": "minor", "line": 26 } ]
1
python
#!/usr/bin/env python3 # Copyright (c) 2021-present The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Stress tests related to node initialization.""" from pathlib import Path import platform import shut...
Review this code and list any quality issues.
[ { "issue": "nit:\r\nwhy not declaring this custom param within the test function?", "severity": "minor", "line": 16 } ]
1
python
raise CannotOrderDelistedAsset( msg="Cannot order {0}, as it stopped trading on" " {1}.".format(asset.symbol, asset.end_date) ) else: last_price = \ self.trading_client.current_data.current(asset, "price") if np.isnan(last_...
Review this code and list any quality issues.
[ { "issue": "agreed. OK with me making it all `asset`? hopefully that doesn't cause too many legacy breakages.", "severity": "minor", "line": 26 } ]
1
python
mock_filtered_query.one_or_none.return_value = None # This should not raise TypeError if filter() is used correctly result = Slice.get(test_uuid) # Verify that query() was called with Slice mock_db.session.query.assert_called_once_with(Slice) # Verify that ...
Review this code and list any quality issues.
[ { "issue": "[nitpick] The comment formatting is inconsistent with the period placement before the noqa comment. Consider moving the period after the noqa comment or removing it entirely for better readability.\n```suggestion\n # Success - no TypeError occurred, result can be None or a Slice # noq...
1
python
# Copyright 2021-2024 Avaiga Private Limited # # Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agree...
Review this code and list any quality issues.
[]
0
python
} for path in images], } def _real_extract(self, url): vod_id = self._match_id(url) video = self._download_info(vod_id) info = self._extract_info_gql(video, vod_id) access_token = self._download_access_token(vod_id, 'video', 'id') formats = self._extract_m3u8_f...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n if video.get('storyboard') and info.get('duration'):\r\n```\r\nor, even better imo, you could just have:\r\n```py\r\nformats.extend(self._extract_storyboard(vod_id, video.get('storyboard'), info.get('duration')))\r\n```\r\nand handle the None case in _extract_storyboard", ...
1
python
'modified_date': '20241010', 'release_date': '20240903', 'release_timestamp': 1725379200, 'modified_timestamp': 1728577804, }, }, { 'url': 'https://prophecywatchers.subspla.sh/8gps8cx', 'only_matching': True, }] def _real_extract(self, url): ...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n _VALID_URL = r'https?://(?:www\\.)?subsplash\\.com/[^/?#]+/(?:our-videos|media)/ms/\\+(?P<id>\\w+)'\r\n```", "severity": "minor", "line": 26 } ]
1
python
_VALID_URL = r'https?://(?:www\.)?tver\.jp/(?:(?P<type>lp|corner|series|episodes?|feature|tokyo2020/video)/)+(?P<id>[a-zA-Z0-9]+)' _TESTS = [{ 'skip': 'videos are only available for 7 days', 'url': 'https://tver.jp/episodes/ephss8yveb', 'info_dict': { 'title': '#44 料理と値段と店主にびっくり ...
Review this code and list any quality issues.
[ { "issue": "Although this isn't part of the PR, isn't the ability to populate `BRIGHTCOVE_URL_TEMPLATE` something that should be a method or variable of the `BrightCoveNewIE` class and imported from there?", "severity": "minor", "line": 26 } ]
1
python
'format_id': 'default', 'quality': 1, }, fatal=True) # the formats below don't always exist add_format({ 'url': f'{track_url}/player_asset?quality=hd', 'format_id': 'hd', 'quality': 10, }, fatal=False) add_format({ 'url'...
Review this code and list any quality issues.
[ { "issue": "Okay, I wrote a function to extract more metadata fields. For artist/performer, how about we split this across `artist` and `album_artist`, with a fallback for `artist`.\r\n```suggestion\r\n more_info = get_element_by_class('single-more-info', webpage)\r\n\r\n def get_info_field(name):...
1
python
return [list(group) for group in self._toposorted_groups] @property def grouped_by_namespace(self): """Return a dictionary of the pipeline nodes grouped by namespace. Returns: The pipeline nodes grouped by namespace. """ nodes_by_namespace = defaultdict(list) ...
Review this code and list any quality issues.
[ { "issue": "minor: maybe should be `defaultdict(set)` to avoid lines 407-409", "severity": "minor", "line": 26 } ]
1
python
# Missing `enable_private_networks` config entry in introducer_peer should default to False for back compat discovery0 = FullNodeDiscovery( server=chia_server, target_outbound_count=0, peers_file_path=SIMULATOR_ROOT_PATH / Path(chia_server.config["peers_file_path"]), introducer_info=...
Review this code and list any quality issues.
[]
0
python
Raises ------ Expired Raised when `dt` is greater than self.expires. """ expires = self._expires if expires is AlwaysExpired or expires < dt: raise Expired(self._expires) return self._value def _unsafe_get_value(self): """You almost ce...
Review this code and list any quality issues.
[ { "issue": "This comment is referencing variables from TradingAlgorithm, which doesn't really make sense if this is a standalone function.", "severity": "minor", "line": 26 } ]
1
python
'server.address': 'example.com', 'server.port': 8000, 'model_request_parameters': { 'function_tools': [], 'builtin_tools': [], 'output_mode': 'text', 'output_ob...
Review this code and list any quality issues.
[]
0
python
Typical usage examples: .. code-block:: bash # Execute this module as a CLI entry: python -m monai.bundle run training --meta_file <meta path> --config_file <config path> # Override config values at runtime by specifying the component id and its new value: python -m monai.bundle r...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n It's optional for both configs and `run`.\r\n```", "severity": "minor", "line": 26 } ]
1
python
def unspecialize(self): """ Unspecialize a column to its generic form. This is equivalent to ``column.specialize(GENERIC)``. """ return self.specialize(GENERIC) @coerce_types(currency=(str, Currency)) def fx(self, currency): """ Construct a currency-conv...
Review this code and list any quality issues.
[ { "issue": "I don't think this can be correct. `extra_coords` will be different for every dataset family, so we can't assume that `'item'` will be present.", "severity": "minor", "line": 26 } ]
1
python
status = filelist['status'] if status != 'ok': raise ExtractorError('Received error from service, status: %s' % status, expected=True) contents = try_get(filelist, lambda x: x['data']['contents'], dict) foundfiles = False for file in contents.values(): filetype...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n raise ExtractorError('No video/audio found at provided URL.', expected=True)\r\n```\r\nThis is a playlist. It doesn't make sense to raise_no_formats", "severity": "major", "line": 26 } ]
1
python
key_points=key_points, labels=labels ) ``` ![vertex-label-annotator-custom-example](https://media.roboflow.com/ supervision-annotator-examples/vertex-label-annotator-custom-example.png) """ font = cv2.FONT_HERSHEY_SIMPLEX skeletons_count, ...
Review this code and list any quality issues.
[ { "issue": "@LinasKo, Should I call the `preprocess_and_validate_colors` method here too to get the list of `text_colors` then?", "severity": "minor", "line": 26 } ]
1
python
"languageId": "en_US", "userId": "0", "token": token2, } metad = self._download_json( base_url + '/icareus-suite-api-portlet/publishing', video_id, data=urlencode_postdata(data)) title = metad.get('name') des...
Review this code and list any quality issues.
[ { "issue": "the one from json/ld would already be \"clean\", no?", "severity": "minor", "line": 26 } ]
1
python
aws_access_key: str, aws_secret_access_key: str, aws_s3_bucket_name: str, aws_s3_object_key: str, aws_region: Optional[str] = None, aws_s3_object_parameters: Optional[Dict[str, Any]] = None, scope: Optional[Scope] = None, validity_period: Optional[timedelta] = Non...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n relevant tasks will run even if they are skippable (see the\r\n [Task configs page](../../userman/scenario_features/task-orchestration/scenario-config.md#from-task-configurations)\r\n for more details).\r\n```", "severity": "minor", ...
1
python
"session_name": session_name, } account_id = role.get("Arn").split(":")[4] policy_arn = f"arn:aws:iam::{account_id}:policy/{policy_name}" client = boto3_cached_conn( "iam", account_number=account_id, assume_role=config.get("policies.role_name"), session_name=session_name,...
Review this code and list any quality issues.
[ { "issue": "\"account_id\": account_id\r\n\r\n^ to be consistent and not have too many layers of abstraction", "severity": "major", "line": 26 } ]
1
python
return resp pull_url = get_hubble_url_v2() + f'/rpc/executor.getPackage' payload = {'id': name, 'include': ['code'], 'rebuildImage': rebuild_image} if image_required: payload['include'].append('docker') if secret: payload['secret'] = secret if tag: ...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n buildEnv = resp['commit'].get('commitParams', {}).get('buildEnv', None)\r\n```", "severity": "minor", "line": 26 } ]
1
python
if connection.connection_type != NodeType.FARMER: raise InvalidConnectionTypeError(connection.connection_type, NodeType.HARVESTER) self._connection = connection def bump_next_message_id(self) -> None: self._next_message_id = uint64(self._next_message_id + 1) def _reset(self) -> Non...
Review this code and list any quality issues.
[]
0
python
default_factory=dict, ) json_format: bool = SchemaField( title="JSON format", description="Whether to send and receive body as JSON", default=True, ) body: Any = SchemaField( description="The body of the request", default=None, ...
Review this code and list any quality issues.
[]
0
python
f"No OTEL_EXPORTER_OTLP_ENDPOINT detected, OTLP {exporter_type.value} exporter is disabled." ) # noqa def is_enabled(self, extension: ExtensionType): return self.otel_exporter_endpoint is not None class OTLPTraceExporterProvider(OTLPExporterProvider): def __init__(self, logger) -> None: ...
Review this code and list any quality issues.
[ { "issue": "How often is the `_export` method called? Is it good to get token every time when this method is called?", "severity": "minor", "line": 26 } ]
1
python
}] def _call_api(self, uploader_id, work_id): return self._download_json( f'https://skeb.jp/api/users/{uploader_id}/works/{work_id}', work_id, headers={ 'Accept': 'application/json', 'Authorization': 'Bearer null', 'User-Agent': 'Mozilla/5.0 (Maci...
Review this code and list any quality issues.
[ { "issue": "I don't like duplicating the playlist id as the entries' `title` and `display_id`\r\n\r\n`display_id` is redundant if it's the same as the playlist id, could be removed\r\n\r\nif there's really no alternative we could use for the entries' `title`, then let's enumerate the `previews` and use `{work_i...
1
python
from .common import InfoExtractor from ..utils import merge_dicts, unified_timestamp, url_or_none from ..utils.traversal import traverse_obj class ZetlandDKArticleIE(InfoExtractor): _VALID_URL = r'https://www.zetland.dk/\w+/(?P<id>(?P<story_id>\w{8})-(?P<uploader_id>\w{8})-(?:\w{5}))' _TESTS = [{ 'url...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n _VALID_URL = r'https://www\\.zetland\\.dk/\\w+/(?P<id>(?P<story_id>\\w{8})-(?P<uploader_id>\\w{8})-(?:\\w{5}))'\r\n```", "severity": "minor", "line": 7 } ]
1
python
member.debug_mode = True member.debug_level = self.debug_level if isinstance(member, Agent): member.team_id = self.id member.set_id() # Inherit team primary model if agent has no explicit model if member.model is None and self.model is not None: ...
Review this code and list any quality issues.
[ { "issue": "We'd also simplify this using an enum", "severity": "major", "line": 26 } ]
1
python
yield { "run_info": PipelineRunErrored( pipeline_run_id=pipeline_run_id, payload=error, dataset_id=dataset.id, dataset_name=dataset.name, ) } async def run_tasks_per_data( data_item, dataset, tasks, pipelin...
Review this code and list any quality issues.
[ { "issue": "It is a bit confusing name for the function, maybe `run_tasks_incremental_data_item_generator ` -> `run_tasks_incremental`. Would be good that name tells us what it does.", "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 2017 Quantopian, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
Review this code and list any quality issues.
[ { "issue": "I would probably make this an `Equity` or a `Future`. The base `Asset` class isn't really meant to be instantiated directly.", "severity": "minor", "line": 26 } ]
1
python
from chia_rs import ( SpendBundleConditions, ) from chia_rs.sized_bytes import bytes32 from chia_rs.sized_ints import uint32, uint64 from chia.types.coin_record import CoinRecord from chia.util.errors import Err def check_time_locks( removal_coin_records: dict[bytes32, CoinRecord], bundle_conds: SpendBun...
Review this code and list any quality issues.
[]
0
python
assert "transport" not in call_kwargs def _mock_pager(self, number_of_jobs): mock_pager = [] for i in range(number_of_jobs): mock_pager.append(Job(name=f"name{i}")) return mock_pager class TestCloudRunAsyncHook: @pytest.mark.asyncio async def test_get_operation(self):...
Review this code and list any quality issues.
[ { "issue": "I would spec that MagicMock(spec=CloudRunServiceHook) here with the class of the sync hook", "severity": "minor", "line": 26 } ]
1
python
Note: This is an expensive operation. Returns: int: the number of files present inside the root. Raises: S3ListError: Any S3 error encountered while listing the objects. """ return sum(1 for _ in self._keys_iterator()) def __iter__(self): ...
Review this code and list any quality issues.
[ { "issue": "can you cover in tests this line?", "severity": "minor", "line": 26 } ]
1
python
begin_index (`int`, defaults to `0`): The begin index for the scheduler. """ self._begin_index = begin_index # Copied from diffusers.schedulers.scheduling_edm_euler.EDMEulerScheduler.precondition_inputs def precondition_inputs(self, sample, sigma): """ Preconditi...
Review this code and list any quality issues.
[ { "issue": "The method signature is missing type hints that are present in the source method (`scheduling_edm_euler.EDMEulerScheduler.precondition_noise`). The signature should be:\n\n```python\ndef precondition_noise(self, sigma: Union[float, torch.Tensor]) -> torch.Tensor:\n```\n\nThis ensures consistency wit...
1
python
'ext': 'm4a', 'view_count': int, 'thumbnail': r're:^https?://.*\.jpg', 'like_count': int, 'live_status': 'is_live', }, 'params': { 'skip_download': True, }, }] def _real_extract(self, url): url_type, live_radio_id = sel...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n 'thumbnail': (('thumbnail', 'thumbnailM', 'thumbnailV', 'thumbnailH'), {url_or_none}),\r\n```\r\nimport `utils.url_or_none`", "severity": "minor", "line": 26 } ]
1
python
target: 3D target tensor with shape BCDHW. """ input = medicalnet_intensity_normalisation(input) target = medicalnet_intensity_normalisation(target) # Get model outputs feats_per_ch = 0 for ch_idx in range(input.shape[1]): input_channel = input[:, ch_idx, .....
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n if self.channel_wise:\r\n```", "severity": "minor", "line": 26 } ]
1
python
ydl.extract_info, 'https://127.0.0.1:%d/video.html' % self.port) ydl = YoutubeDL({'logger': FakeLogger(), 'nocheckcertificate': True}) r = ydl.extract_info('https://127.0.0.1:%d/video.html' % self.port) self.assertEqual(r['entries'][0]['url'], 'https://127.0.0.1:%d/vid.mp4' % self.port) class...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n ydl = YoutubeDL({\r\n 'logger': FakeLogger(),\r\n # Disable client-side validation of unacceptable self-signed testcert.pem\r\n # The test is of a check on the server side, so unaffected\r\n 'nocheckcertificate': True,\r\n ...
1
python
assert ask(Q.finite(log(x)), ~Q.zero(x)) is True assert ask(Q.finite(log(x)), Q.infinite(x)) is False assert ask(Q.finite(log(x)), Q.zero(x)) is False assert ask(Q.finite(exp(x))) is None assert ask(Q.finite(exp(x)), Q.finite(x)) is True assert ask(Q.finite(exp(2))) is True # trigonometric func...
Review this code and list any quality issues.
[ { "issue": "This is not needed as the issue number is in `def test_issue_27447()`", "severity": "minor", "line": 26 } ]
1
python
@chat_template.setter @abc.abstractmethod def chat_template(self, new_chat_template: str) -> None: """Sets a tokenizer associated with this processor.""" raise NotImplementedError @property @abc.abstractmethod def image_processor(self) -> Optional[BaseImageProcessor]: """Ret...
Review this code and list any quality issues.
[]
0
python
Grab ConversationInfo and all events from the agent server and make sure they exist in the app server.""" _logger.debug(f'Started Refreshing Conversation {app_conversation_info.id}') try: url = runtime['url'] # TODO: Maybe we can use RemoteConversation here? # First get conversatio...
Review this code and list any quality issues.
[ { "issue": "I think we want to use `updated_conversation_info.stats.get_combined_metrics()` here (to aggregate the total convo cost)", "severity": "minor", "line": 26 } ]
1
python
"""A spherical dot. Parameters -------- point : Union[:class:`list`, :class:`numpy.ndarray`], optional The location of the dot. radius : :class:`float`, optional The radius of the dot. color : :class:`~.Colors`, optional The color of the :class:`Dot3D` Examples ----...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n dot_2 = Dot3D(point=axes.coords_to_point(2, 0, 0), radius=0.1, color=BLUE)\r\n dot_3 = Dot3D(point=[0, 0, 0], radius=0.1, color=ORANGE)\r\n self.add(axes, dot_1, dot_2,dot_3)\r\n```", "severity": "minor", "line": 26 } ]
1
python
"""Upload a file to an S3 object. Usage:: import boto3 s3 = boto3.resource('s3') s3.meta.client.upload_file('/tmp/hello.txt', 'mybucket', 'hello.txt') Similar behavior as S3Transfer's upload_file() method, except that parameters are capitalized. Detailed examples can be found at ...
Review this code and list any quality issues.
[ { "issue": "Technically this should be a function as it does not necessarily have to be attached to a class.", "severity": "minor", "line": 26 } ]
1
python
# arguments with less meaningful index. # The 1st index returns a tuple, the 2nd index return the name of module. assert call_args[0][0] == f"{prefix}pandas.CSVDataset" def test_config_import_extras(self, sane_config): """Test kedro_datasets default path to the dataset class""" ...
Review this code and list any quality issues.
[]
0
python
# Directly call handle_preemptions on the scheduler's connector # Note: handle_preemptions is normally a worker-side method, but we're # testing the delegation behavior of MultiConnector here. # The connector attribute contains the KV connector. assert scheduler.connector is not None, "S...
Review this code and list any quality issues.
[]
0
python
# If this is a ranged get, ContentRange needs to be returned, # contents needs to be pruned, and Range needs to be an expected param. if end_byte is not None: contents = full_contents[start_byte : end_byte + 1] part_range = f'bytes={start_byte}-{end_byte_range}' conte...
Review this code and list any quality issues.
[ { "issue": "Kind of a nit here, but can we get rid of this if statement by just defaulting `extra_params` to `{}` instead of `None`?", "severity": "minor", "line": 26 } ]
1
python
profileId = profileIds[0] profileIdHash = profileIdHashes[0] chooseProfileResultWebpage = self._download_json( 'https://www.hidive.com/ajax/chooseprofile', '', data=urlencode_postdata({ 'profileId': profileId, 'hash': profileIdHash, ...
Review this code and list any quality issues.
[ { "issue": "Duplicate API call - Pass it into the function from _real_extract", "severity": "major", "line": 26 } ]
1
python
) if len(sources) == 1: reformat_one( src=sources.pop(), fast=fast, write_back=write_back, mode=mode, report=report, ) else: reformat_many( sources=sources, fast=fast, write_back=write_back, mode=mode, report=report...
Review this code and list any quality issues.
[ { "issue": "I don't know the `mypy` incantation to say this returns an optional if `regex` was an optional. Suggestions welcome 👍", "severity": "minor", "line": 26 } ]
1
python
high_price = self.reader.get_value(sid, minute, 'high') self.assertEquals(27.0, high_price) low_price = self.reader.get_value(sid, minute, 'low') self.assertEquals(21.0, low_price) close_price = self.reader.get_value(sid, minute, 'close') self.assertEquals(25.0, close_price)...
Review this code and list any quality issues.
[]
0
python
super().__init__(*args, **kwargs) self.password = password def execute(self, context): pass task = CustomOperator( task_id="redact_test", password=secret_value, ) runtime_ti = create_runtime_ti(task=task, dag_id="redact_test_...
Review this code and list any quality issues.
[ { "issue": "I don't think we need this test, we cover the two basic tests below. Order of operations is ok to not test", "severity": "minor", "line": 26 } ]
1
python
if layouts: for layout_key, layout_url in layouts.items(): layout_url = url_or_none(layout_url) if not layout_url: continue thumbnail = { 'url': layout_url, 'format_id': layout_key, } ...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n chapter_marks = t.get('streamAnchorTag') or []\r\n chapter_marks.append({'anchorOffset': int_or_none(t.get('duration'))})\r\n chapters = [{\r\n 'start_time': chap.get('anchorOffset'),\r\n 'end_time': next_chap.get('anchorOffset'),\r\n ...
1
python
@pytest.mark.parametrize( ("available_backups", "backup_id", "unlink_calls", "unlink_path"), [ ( [TEST_BACKUP_PATH_ABC123, TEST_BACKUP_PATH_DEF456], TEST_BACKUP_ABC123.backup_id, 1, TEST_BACKUP_PATH_ABC123, ), ( [TEST_BACKUP_PAT...
Review this code and list any quality issues.
[ { "issue": "The parametrization for `test_delete_backup` includes a case with an extra set of parentheses, making it a single nested tuple instead of a 4-tuple. This will cause pytest to fail collecting/running the test; adjust the last case in the `@pytest.mark.parametrize` list so it is a 4-item tuple matchin...
1
python
max_sub_interval = 5 times = values config, entity_id = await _setup_sensor( hass, { "time_window": {"seconds": time_window}, "unit_time": UnitOfTime.SECONDS, "round": 2, "max_sub_interval": {"seconds": max_sub_interval}, }, ) bas...
Review this code and list any quality issues.
[]
0
python
search_params = dict(parse_qsl(parsed_url.query)) # Convert query to a dict # Remove any 'utm_' parameters search_params = {k: v for k, v in search_params.items() if not k.startswith('utm_')} # Construct the new query string sorted_keys = sorted(search_params.keys()) sorted_query = urlencode([(k,...
Review this code and list any quality issues.
[]
0
python
'info_dict': { 'id': 'love-chunibyo-other-delusions-heart-throb-', 'title': 'Love, Chunibyo & Other Delusions - Heart Throb -', }, 'playlist_mincount': 10, }, { 'url': 'https://beta.crunchyroll.com/it/series/GY19NQ2QR/Girl-Friend-BETA', 'only_matching': True, ...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n series_response = self._download_json(\r\n f'{api_domain}/cms/v2{bucket}/series/{internal_id}', display_id,\r\n note='Retrieving series metadata', query=params)\r\n```", "severity": "minor", "line": 26 } ]
1
python
link = Link("http://example.com/foo.tgz") downloader = Downloader(session, "on", resume_retries=5) # Mock an incomplete download followed by a successful resume incomplete_resp = MockResponse(b"0cfa7e9d-1868-4dd7-9fb3-") incomplete_resp.headers = {"content-length": "36"} incomplete_resp.status_code...
Review this code and list any quality issues.
[ { "issue": "Could you just not create a pip session with caching already enabled? `PipSession(cache=str(tmpdir))` I get this is an unit test, but practically, I'd prefer if the we tested the actual implementation to avoid mismatches that hide issues down the line.", "severity": "major", "line": 26 } ]
1
python
def _entries(self, list_id): total_count = 1 count = page_num = 0 while count < total_count: json_parsed = self._download_json( self._API_URL % (list_id, self._PAGE_SIZE, page_num + 1), list_id, headers=self._API_HEADERS, note='Download...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n IE_DESC = 'ニコニコ生放送'\r\n _VALID_URL = r'https?://(?:sp\\.)?live2?\\.nicovideo\\.jp/(?:watch|gate)/(?P<id>lv\\d+)'\r\n```", "severity": "minor", "line": 26 } ]
1
python
# or an offset into a file (file) if loc.get("type", "") in ("absolute", "file"): yield loc.get("value"), match_dict.get("node") if match_dict["children"]: for child in match_dict.get("children", {}): yield from get_locations(child) def parse_json(capa_data...
Review this code and list any quality issues.
[ { "issue": "What happens if `this_attack` and/or `this_mbc` are set to `None` here?", "severity": "minor", "line": 26 } ]
1
python
self.gguf_writer.add_eot_token_id(4) self.gguf_writer.add_add_space_prefix(False) if "chat_template" in tokenizer_config and tokenizer_config["chat_template"] is not None: self.gguf_writer.add_chat_template(tokenizer_config["chat_template"]) def _sliding_window_pattern(self, block_cou...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n def set_gguf_parameters(self):\r\n super().set_gguf_parameters()\r\n self.gguf_writer.add_vocab_size(self.hparams[\"vocab_size\"])\r\n if (sliding_window := self.find_hparam([\"window_size\", \"sliding_window\"], optional=True)) is not None:\r\n s...
1
python
}] def _real_extract(self, url): show_id = self._match_id(url) show_data = self._download_json( 'https://bandcamp.com/api/bcradio_api/1/get_show', show_id, 'Downloading Show Data.', data=json.dumps({'id': show_id}).encode(), headers={ ...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n metadata = traverse_obj(raw_metadata, (\r\n 'appData', 'shows', lambda _, mb: int(mb.get('showId')) == int(show_id),\r\n any))\r\n```", "severity": "minor", "line": 26 } ]
1
python
# Pick strategy # Note: We're trying to be smart here by picking a strategy on how to # determine the critical path. This is not always clear and we may want to # consider just calculating both orderings and picking the one with less # pressure. The only concern to this would be performance but at time ...
Review this code and list any quality issues.
[ { "issue": "Unrelated to your changes but given performance here has been an issue...\n\nWe should be able to use the knowledge that all `v` are root nodes and perform the sort on all roots once.\nWith this knowledge we should be able to do sort every iteration in N instead of N logN", "severity": "major", ...
1
python
handle = self._request_webpage(update_url_query(BASE_URL, query={ 'client_id': 'tennis-tv-web', 'redirect_uri': 'https://www.tennistv.com/resources/v1.1.10/html/silent-check-sso.html', 'state': random_uuidv4(), 'response_mode': 'fragment', ...
Review this code and list any quality issues.
[ { "issue": "If all videos need subscription, better to `self.raise_login_required`", "severity": "minor", "line": 26 } ]
1
python
if i.type != 0: want.inv.append(i) if len(want.inv): self.send_message(want) def on_ping(self, message): self.send_message(msg_pong(message.nonce)) def on_verack(self, message): pass def on_version(self, message): assert message.nVersion >= MIN_...
Review this code and list any quality issues.
[ { "issue": "maybe rename \"delay\" to \"check_interval\" or another similar term?", "severity": "minor", "line": 26 } ]
1