language
string
code-snippit
string
instruction
string
flaws
list
flaw_count
int64
python
) -> _ArrayT: ... copy: Any diagonal: Any flatten: Any @overload def repeat( self, repeats: _ArrayLikeInt_co, axis: None = None, ) -> MaskedArray[tuple[int], _DTypeT_co]: ... @overload def repeat( self, repeats: _ArrayLikeInt_co, axis: Su...
Review this code and list any quality issues.
[ { "issue": "if this is the same as `ndarray.mT`, we might as well leave it out", "severity": "minor", "line": 26 } ]
1
python
if has_tool_return and message_parts: contents.append({'role': 'user', 'parts': message_parts}) message_parts = [] has_tool_return = False message_parts.extend(await self._map_user_prompt(part)) ...
Review this code and list any quality issues.
[ { "issue": "I think it may be easier to do the \"splitting into 2 lists\" thing in a new loop _after_ we've built `message_parts`, because by then we can easily test on `'function_response' in part`, instead of having to deal with `RetryPromptPart` which can be `text` or `function_response`.", "severity": "...
1
python
(Foo(a=21, b='foo'), True), (Foo(a=21, b='foo'), False), ] ) class OutputType(BaseModel): """Result type used by multiple tests.""" value: str class TestMultipleToolCalls: """Tests for scenarios where multiple tool calls are made in a single response.""" # NOTE:...
Review this code and list any quality issues.
[ { "issue": "Let's add that `test_output_function_text` test with `TextOutput(func)`, create a new issue for that bug, and then skip the test", "severity": "critical", "line": 26 } ]
1
python
get_directory_size, ) from azure.core.exceptions import ResourceExistsError from azure.storage.fileshare import DirectoryProperties, ShareDirectoryClient from promptflow._sdk._vendor import get_upload_files_from_folder from promptflow.azure._constants._flow import PROMPTFLOW_FILE_SHARE_DIR from promptflow.azure._utils...
Review this code and list any quality issues.
[ { "issue": "where is this legacy_directory_client used?", "severity": "minor", "line": 26 } ]
1
python
# flags: --preview --minimum-version=3.10 match "test": case "test" if "first long condition" != "some loooooooooooooooooooooooooooooooooooooog condition": print("Test") match match: case "test" if case != "not very loooooooooooooog condition": print("No format change") match "test": case ...
Review this code and list any quality issues.
[ { "issue": "Can you add some test cases where there are comments inside existing parentheses? That often causes us grief. Something like this:\r\n\r\n```\r\nmatch match:\r\n case case if (True # some comment\r\n ):\r\n pass\r\n```", "severity": "minor", "line": 2 } ]
1
python
import numpy as np import pytest import torch import sys import genesis as gs from genesis.utils.misc import tensor_to_array from .utils import assert_allclose @pytest.mark.required @pytest.mark.parametrize("n_envs", [0, 1]) def test_rasterizer_camera_sensor(show_viewer, tol, n_envs): scene = gs.Scene( p...
Review this code and list any quality issues.
[ { "issue": "We are (manually sadly...) organising imports. Here is the rule: You should first import standards libraries, skip line, then ubiquitous third-party libraries (torch, numpy, tqdm...etc), skip line, then random third-party libraries, skip line, then our own custom libraries, skip line, then relative ...
1
python
# Load snapshot. vm2 = microvm_factory.build() vm2.spawn() vm2.restore_from_snapshot(snapshot, resume=True) vm2.wait_for_up() # After snap restore all vsock connections should be # dropped. This means guest socat should exit same way # as it did after snapshot was taken. code, _, _ = vm...
Review this code and list any quality issues.
[ { "issue": "this is already covered by a different test", "severity": "minor", "line": 26 } ]
1
python
'info_dict': { 'title': 'Viktor, 18, förlorade armar och ben i sepsis – vill återuppta karaten och bli svetsare', 'id': 'viktor-18-forlorade-armar-och-ben-i-sepsis-vill-ateruppta-karaten-och-bli-svetsare', }, 'playlist_count': 2, }, { 'url': 'https://www.svt.se/nyhete...
Review this code and list any quality issues.
[ { "issue": "You want to add `skip`, not only_matching", "severity": "minor", "line": 26 } ]
1
python
See: https://github.com/yt-dlp/yt-dlp/pull/519 """ for ytcfg in data: session_index = int_or_none(try_get(ytcfg, lambda x: x['SESSION_INDEX'])) if session_index is not None: return session_index # Deprecated? def _extract_identity_token(self, ytcfg=None, ...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n channel_syncid, _, user_syncid = data_sync_id.partition('||')\r\n if user_syncid:\r\n return channel_syncid\r\n```", "severity": "minor", "line": 26 } ]
1
python
meta = this_capability["meta"] # get Mitre ATT&CK and MBC this_attack = meta.get("attack") this_mbc = meta.get("mbc") # scope match for the rule this_scope = meta["scopes"].get("static") with suppress(KeyError): # always grab first location of match ...
Review this code and list any quality issues.
[ { "issue": "What happens if `matches` is empty?", "severity": "minor", "line": 26 } ]
1
python
import os import typing as t def get_style(style: t.Union[str, t.Dict[str, t.Union[str, t.Dict[str, str]]]]): if isinstance(style, dict): style_arr = [] for k, v in style.items(): if isinstance(v, dict): rules= [] for vk, vv in v.item...
Review this code and list any quality issues.
[ { "issue": "I'm afraid it's worse than that...\r\nt.Union[str, t.Dict[str, t.Union[str, t.Dict[str, t.Union[str, t.Dict[str, t.Union[str, t.Dict[str, t.Union[str, t.Dict[str, t.Union[str, t.Dict[str, str]]]]]]]] why not?", "severity": "minor", "line": 6 } ]
1
python
class TestAddOnsFromUserPrompts: @pytest.mark.parametrize( "add_ons", [ "1", "2", "3", "4", "5", "6", "none", "2,3,4", "3-5", "all", "1, 2, 3", "1, 2, ...
Review this code and list any quality issues.
[ { "issue": "Some of these tests are repetitive, can it be reduce some of these to one example. For example\r\n```\r\n \"ALL\",\r\n \"All\",\r\n \"AlL\" \r\n ```\r\ncan be reduced to one since `AlL` is probably the most weird case?", "severity": "minor", "line": 26 } ]
1
python
elif p.type == syms.dictsetmaker: # dict unpacking if prev and prev.type == token.DOUBLESTAR: return NO elif p.type in {syms.factor, syms.star_expr}: # unary ops if not prev: prevp = preceding_leaf(p) if not prevp or prevp.type in OPENING_BRACKETS...
Review this code and list any quality issues.
[]
0
python
q, k, v = op_ext.llama_rope( qkv, total_seq_len, self.rope_theta, self.num_attention_heads, self.num_key_value_heads ) # Step 3. Query and update KVCache self.k_cache.append(op.squeeze(k, axis=0)) self.v_cache.append(op.squeeze(v, axis=0)) k = self.k_cache.view(total_...
Review this code and list any quality issues.
[ { "issue": "Here, we can combine the gate_proj and up_proj matmul similar to what we did in combing QKV in attention layer.\r\n```\r\nself.gate_up_proj = nn.Linear(\r\n in_features=config.hidden_size,\r\n out_features=2 * config.intermediate_size,\r\n bias=False,\r\n)\r\nself.down_proj = nn.Linear(self...
1
python
result = await self.fetch("get_aggsig_additional_data", {}) return bytes32.from_hexstr(result["additional_data"]) async def get_coin_records_by_hint( self, hint: bytes32, include_spent_coins: bool = True, start_height: Optional[int] = None, end_height: Optional[int] ...
Review this code and list any quality issues.
[ { "issue": "I see. The RPC client swallows errors. I think a better solution would be to not catch the exception here, and let it propagate to the caller", "severity": "minor", "line": 26 } ]
1
python
if not info.get('url'): post_file = attributes['post_file'] ext = determine_ext(post_file.get('name')) if ext in KNOWN_EXTENSIONS: info.update({ 'ext': ext, 'url': post_file['url'], }) return info clas...
Review this code and list any quality issues.
[ { "issue": "Generally `_entries` is used as the name", "severity": "minor", "line": 26 } ]
1
python
"""Prepare all datasets.""" import os def run_cmd(cmd): print(cmd, flush=True) return os.system(cmd) prefix = "~/datasets/sharegpt_20230521" llama_weights = "~/model_weights/llama-7b/" cmd_list = [ f"python3 -m fastchat.data.clean_sharegpt --in {prefix}_html.json --out {prefix}_clean.json", f"pyth...
Review this code and list any quality issues.
[]
0
python
r'(?s)window\.__data__\s*=\s*({.+?});', webpage, 'data'), play_id, js_to_json) data = self._download_json( f'{base_url}nws/recording/1.0/play/info/{data["fileId"]}', play_id)['result'] subtitles = {} for _type in ('transcript', 'cc', 'chapter'): if data.get(...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n 'filesize_approx': traverse_obj(data, (\r\n 'recording', 'fileSizeInMB', {str_or_none}, {parse_filesize})),\r\n```", "severity": "minor", "line": 26 } ]
1
python
if not H: return max_interval event = H[0] entry = event[2] is_due, next_time_to_run = self.is_due(entry) if is_due: verify = heappop(H) if verify is event: next_entry = self.reserve(entry) self.apply_entry(entry, produ...
Review this code and list any quality issues.
[]
0
python
from ._operation import all_to_all_comm from .attn import AttnMaskType, ColoAttention, RingAttention, get_pad_info from .dropout import DropoutForParallelInput, DropoutForReplicatedInput from .embedding import Embedding1D, PaddingEmbedding, VocabParallelEmbedding1D from .linear import Linear1D_Col, Linear1D_Row, Linear...
Review this code and list any quality issues.
[]
0
python
# mweb previously did not require PO Token with this UA 'userAgent': 'Mozilla/5.0 (iPad; CPU OS 16_7_10 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.6 Mobile/15E148 Safari/604.1,gzip(gfe)', }, }, 'INNERTUBE_CONTEXT_CLIENT_NAME': 2, 'PO_TOKEN_REQU...
Review this code and list any quality issues.
[ { "issue": "rest of the PR looks good, just not sure about this", "severity": "minor", "line": 26 } ]
1
python
self.processVideoOrStream(asset_id, videos[0]) ) livestream = meta.get('livestream') if livestream is not None: info.update( self.processVideoOrStream(asset_id, livestream) ) return info def processVideoOrStream(self, asset_id, video): ...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n token = self._download_json(\r\n f'https://api.sportdeutschland.tv/api/frontend/asset-token/{asset_id}',\r\n video_id, query={'type': video_type, 'playback_id': video_src})['token']\r\n formats = self._extract_m3u8_formats(f'https://stream.mux.co...
1
python
f"/ 1000000000" ) input_blocking_rate_expr = ( f"max(" f" {input_blocking_rate_per_edge_expr}" f") by (fragment_id)" ) busy_rate_expr = ( f"1 - (" f" ({output_blocking_rate_expr}) > ({input_blocking_rate_expr}) or" f" ({input_blocking_rate_expr})" ...
Review this code and list any quality issues.
[ { "issue": "The space between `topk` and the opening parenthesis is inconsistent with the rest of the codebase. It should be `topk(1,` instead of `topk (1,` to match the pattern used for all other function calls in this file (e.g., `sum(`, `max(`, `rate(`).\n```suggestion\n f\"topk(1,\"\n```", "sever...
1
python
], columns=['sid', 'ex_date', 'amount'], ) # give every extra date field a unique date so that we can make sure # they appear unchanged in the dividends payouts ix = first_date_ix for col in 'declared_date', 'record_date', 'pay_date': extra_dates = self.t...
Review this code and list any quality issues.
[]
0
python
("dt BETWEEN '2050-01-01' AND '2100-12-31'", [1]), ("dt::datetime = '1960-01-07'", [2]), ("dt::datetime = '1960-01-07 00:00'", [2]), ("dt::datetime = '1960-01-07 00:00:00'", [2]), ("dtm BETWEEN '2020-12-30 10:30:44' AND '2023-01-01 00:00'", [2]), ("dt IN ('1960-01-07','2077-01-01...
Review this code and list any quality issues.
[]
0
python
Dates in which to search. dt : pd.Timestamp Date for which to find bounds. """ if not dts.is_unique: raise ValueError("dts must be unique") if not dts.is_monotonic_increasing: raise ValueError("dts must be sorted in increasing order") if not len(dts): return None, N...
Review this code and list any quality issues.
[]
0
python
first_page = fetch_page(0) metadata = get_metadata(first_page) paged_list = InAdvancePagedList( lambda idx: get_entries(fetch_page(idx) if idx else first_page), metadata['page_count'], metadata['page_size']) return metadata, paged_list class BilibiliSpaceVideoIE(Bilib...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n }, {\r\n # Hidden-mode collection\r\n 'url': 'https://space.bilibili.com/3669403/video',\r\n```", "severity": "minor", "line": 26 } ]
1
python
min_trade_cost=self.min_trade_cost, ) ) def calculate(self, order, transaction): return calculate_per_unit_commission( order=order, transaction=transaction, cost_per_unit=self.cost_per_share, initial_commission=0, min_trade_cos...
Review this code and list any quality issues.
[]
0
python
def get_streamer(): """ Return a streamer object based on the current environment context. The streamer object is contructed using runtime arguments stored in the `JINA_STREAMER_ARGS` environment variable. If this method is used outside a Jina context (process not controlled/orchestrated...
Review this code and list any quality issues.
[ { "issue": "also we wanted to have something `called` `post` to unify with the interface", "severity": "minor", "line": 26 } ]
1
python
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. import numpy as np import torch.nn as nn def count_parameters(model_or_parameters, unit="mb"): if isinstance(model_or_parameters, nn.Module): counts = np.sum(np.prod(v.size()) for v in model_or_parameters.parameters()) else: ...
Review this code and list any quality issues.
[ { "issue": "From my perspective, it is not necessary to make this feature as a single function, which actually can be implemented in one line. Here are some [resources](https://pytorch.org/docs/stable/generated/torch.numel.html) and references ([link1](https://discuss.pytorch.org/t/how-do-i-check-the-number-of-...
1
python
from pathlib import Path from kedro.templates.project.hooks.utils import ( setup_template_add_ons, sort_requirements, ) def main(): current_dir = Path.cwd() requirements_file_path = current_dir / "requirements.txt" pyproject_file_path = current_dir / "pyproject.toml" python_package_name = '{...
Review this code and list any quality issues.
[]
0
python
from .common import InfoExtractor from .vimeo import VimeoIE from ..utils import traverse_obj, url_or_none class AeonCoIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?aeon\.co/videos/(?P<id>[^/?]+)' _TESTS = [{ 'url': 'https://aeon.co/videos/raw-solar-storm-footage-is-the-punk-rock-antidote-to-sl...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\nfrom ..utils import ExtractorError, traverse_obj, url_or_none\r\n```", "severity": "major", "line": 3 } ]
1
python
'modified_timestamp': 1705568739, 'release_timestamp': 1705377592, 'uploader_url': 'https://www.zetland.dk/skribent/a81VP3BY', 'uploader': 'Helle Fuusager', 'release_date': '20240116', 'thumbnail': 'https://zetland.imgix.net/2aafe500-b14e-11ee-bf83-65d5e1283a5...
Review this code and list any quality issues.
[ { "issue": "core code will set `ext` from `determine_ext(url)` if the extractor doesn't set it, so it's better to keep it simple imo\r\n```suggestion\r\n 'url': audio_url,\r\n 'vcodec': 'none',\r\n```", "severity": "major", "line": 26 } ]
1
python
_alarm_unsubs: list[CALLBACK_TYPE] | None = None _attr_color: RGBColor | None = None @property def color(self) -> RGBColor | None: """Return the color of the calendar entity as RGBColor.""" return self._attr_color @property def event(self) -> CalendarEvent | None: """Retur...
Review this code and list any quality issues.
[ { "issue": "Please add a test for a case where there is no upcoming event but the calendar has a color.\r\n\r\nYou may just want to add another MockCalendarEntity to the list of entities to exercise this case. You can also pass a color in the constructor instead of changing the attributes in the middle of the t...
1
python
data.token_lora_mapping, slice_offset, slice_size=hidden_size, add_inputs=add_inputs, ) slice_offset += hidden_size assert_close(data.ref_out_tensor, data.our_out_tensor) # General tests params that tests for variations in all dimensions # except hidden_size. t...
Review this code and list any quality issues.
[ { "issue": "we should add some pytest skip for non-xpu platform.", "severity": "minor", "line": 26 } ]
1
python
@skip_if_quick class TestFLEXIBLEUNET(unittest.TestCase): @parameterized.expand(CASES_2D + CASES_3D + CASES_VARIATIONS) def test_shape(self, input_param, input_shape, expected_shape): device = "cuda" if torch.cuda.is_available() else "cpu" with skip_if_downloading_fails(): net = Fl...
Review this code and list any quality issues.
[ { "issue": "Could you please rename the variable `eff_net` to a more general one? It means efficient net here. And since you are adding more backbones, it should be a more general one like `feature_extractor_net`.\r\n\r\nThanks,\r\nBin", "severity": "major", "line": 26 } ]
1
python
max_length=64, description="A key to use when reading from or writing to the prompt cache.", ) conversation: str | None = Field( default=None, description="Optional ID of a conversation to add the response to.", ) store: bool | None = Field( default=True, descript...
Review this code and list any quality issues.
[ { "issue": "nit: the description is pretty terse compared to the other sampling params. Something like \"Nucleus sampling parameter. Lower values (e.g. 0.1) make output more focused and deterministic.\" would help API consumers reading the generated docs. Not blocking though as this matches the brevity of the e...
1
python
class ClosestPoint(GeomOutputGeoFunc): arity = 2 geom_param_pos = (0, 1) class Difference(OracleToleranceMixin, GeomOutputGeoFunc): arity = 2 geom_param_pos = (0, 1) class DistanceResultMixin: @cached_property def output_field(self): return DistanceField(self.geo_field) def sour...
Review this code and list any quality issues.
[]
0
python
) def register_inplace( self, backend: str, name: str | None = None, ) -> Callable[ [Callable[BackendFuncParams, BackendFuncReturn]], Callable[BackendFuncParams, BackendFuncReturn], ]: """Register dispatchable function""" def decorator( f...
Review this code and list any quality issues.
[ { "issue": "This feels very lossy, how about something like this instead?\r\n\r\n```python\r\n except Exception as e:\r\n try:\r\n exc = type(e)(\r\n f\"An error occurred while calling the {funcname(func)} \"\r\n ...
1
python
# See the License for the specific language governing permissions and # limitations under the License. import string from dataclasses import dataclass, field from enum import Enum from typing import Optional from oumi.core.configs.params.base_params import BaseParams def resolve_placeholders( text: str, val...
Review this code and list any quality issues.
[ { "issue": "I don't think the string library is needed here. Instead do the following:\r\n```suggestion\r\n return text.format_map(SafeDict(values_dict))\r\n```", "severity": "minor", "line": 26 } ]
1
python
INFER = "infer" JOB = "job" _ALIASES: dict[str, dict[AliasType, str]] = { "llama4-scout": { AliasType.TRAIN: "oumi://configs/recipes/llama4/sft/scout_base_full/train.yaml", AliasType.JOB: "oumi://configs/recipes/llama4/sft/scout_base_full/train.yaml", }, "llama4-scout-instruct-lora": {...
Review this code and list any quality issues.
[ { "issue": "Use hyphens instead of underscores in model names. Here and below.", "severity": "minor", "line": 26 } ]
1
python
def _parse_time_text(self, text): if not text: return dt = self.extract_relative_time(text) timestamp = None if isinstance(dt, datetime.datetime): timestamp = calendar.timegm(dt.timetuple()) if timestamp is None: timestamp = ( ...
Review this code and list any quality issues.
[ { "issue": "Why is this the outer one? Shouldn't we have X retries overall, and each of those can use X incomplete data?", "severity": "minor", "line": 26 } ]
1
python
messages = [{"role": "user", "content": "{{content}}"}, {"role": "assistant", "content": "{{content}}"}] assistant_slot = tokenizer.apply_chat_template(messages, add_generation_prompt=False, tokenize=False) assistant_slot = assistant_slot[len(prefix) + len(user_slot) :] template_class = ReasoningTemplate if...
Review this code and list any quality issues.
[ { "issue": "we can remove the `\\n` in tool call words", "severity": "minor", "line": 26 } ]
1
python
def _real_extract(self, url): video_id = self._match_id(url) query = { 'query': '''{ getSubredditPost(url:"/%s"){ id title isNsfw mediaSources{ url ...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n for source in video_data['mediaSources']:\r\n```", "severity": "minor", "line": 26 } ]
1
python
# Some values are stringified JSON arrays for key in ('video_servers', 'subtitles'): if key in m3u8_dict: m3u8_dict[key] = self._parse_json(m3u8_dict[key], None, fatal=False) or [] return m3u8_dict def _parse_m3u8_vod_duration(self, m3u8_vod, video_id): # Slides...
Review this code and list any quality issues.
[ { "issue": "Is this useful enough to move to `extractor/common.py` to be with `_extract_m3u8_vod_duration`? If not, I can simplify it for this single use case", "severity": "major", "line": 26 } ]
1
python
", ".join(map(self.quote_name, unique_fields)), ", ".join( [ f"{field} = EXCLUDED.{field}" for field in map(self.quote_name, update_fields) ] ), ) return super().on_conflict_suffix...
Review this code and list any quality issues.
[ { "issue": "We have similar code for oracle & sqlite. I wonder if we should hoist all 3 implementations up to a single implementation on the superclass.\n\nWe might then one day implement a sane default for MySQL, which surely won't let you send a query of unbounded size even if the parameters have no strict up...
1
python
if mobj: if group is None: # return the first matching group return next(g for g in mobj.groups() if g is not None) elif isinstance(group, (list, tuple)): return tuple(mobj.group(g) for g in group) else: return mobj.grou...
Review this code and list any quality issues.
[ { "issue": "I don't think this behaves correctly. Pls double check\r\n\r\nWhat we want (when regex fails):\r\n* `fatal=True` => throw regex error\r\n* `fatal=False` => print regex warning, but not json warning and return `{}`\r\n* `default=xxx` => print neither warning and return `xxx` (not `json.loads(xxx)`)\r...
1
python
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- import os from promptflow._sdk._constants import PF_FLOW_ENTRY_IN_TMP from promptflow._utils.user_agent_utils import ClientUserAgentUtil fr...
Review this code and list any quality issues.
[ { "issue": "Should we restore it to it original value ?", "severity": "minor", "line": 26 } ]
1
python
for :math:`k \in \{0, 1, \dots, n\}`, :math:`n \geq 0`, :math:`a > 0`, :math:`b > 0`, where :math:`B(a, b)` is the beta function. `betabinom` takes :math:`n`, :math:`a`, and :math:`b` as shape parameters. %(after_notes)s References ---------- .. [1] https://en.wikipedia.org/wiki/Beta-binomial...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n return random_state.binomial(np.asarray(n, dtype=int), p, size)\r\n```", "severity": "minor", "line": 26 } ]
1
python
The probability level(s) of the percentile(s) to compute, in percent. Must be between 0 and 100. If a 1D array, computes multiple percentiles. average : bool, default=False If `True`, uses the "averaged_inverted_cdf" quantile method, otherwise defaults to "inverted_cdf". "averaged_inverted_...
Review this code and list any quality issues.
[ { "issue": "I chose to return an array of shape `(array.shape[1], percentile_rank.shape[0])` but it could also be `(percentile_rank.shape[0], array.shape[1])`. I don't know which one is more natural.\n\n... Maybe the second one actually?", "severity": "minor", "line": 26 } ]
1
python
} }] def _real_extract(self, url): video_id, display_id = self._match_valid_url(url).group('id', 'display_id') webpage = self._download_webpage(url, video_id) # Extract the JSON json_info = self._search_nextjs_data(webpage, video_id)['props']['pageProps']['ssr_data_showreel'] ...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n parsed_duration = try_call(lambda: parse_iso8601(json_info['end_date']) - start_date)\r\n```", "severity": "minor", "line": 26 } ]
1
python
(x**2 - 6*x + 9, And(x <= 3, x >= 2)), (0, True)) assert splines[3] == Piecewise((-3*x**2/2 + 8*x - 10, And(x <= 3, x >= 2)), (x**2/2 - 4*x + 8, And(x <= 4, x >= 3)), (0, True)) assert splines[4] == Piecewis...
Review this code and list any quality issues.
[ { "issue": "In testing, I found the function fails for degree 2 with more than 3 points, because this case uses Rational which isn't imported. On top of bspline.py, \r\n```\r\nfrom sympy.core import S, sympify\r\n```\r\nshould be\r\n```\r\nfrom sympy.core import S, sympify, Rational\r\n```\r\n\r\nAnd to make su...
1
python
await self._browser.close() def _on_page_close(self, page: Page) -> None: """Handle actions after a page is closed.""" self._pages.remove(page) async def _create_browser_context( self, page_options: Mapping[str, Any] | None = None, proxy_info: ProxyInfo | None = None ) -> BrowserCo...
Review this code and list any quality issues.
[ { "issue": "Done as recommended in PW documentation.\r\n\r\nFrom: [browser_context.close](https://playwright.dev/python/docs/api/class-browsercontext#browser-context-close)\r\n\"Closes the browser context. All the pages that belong to the browser context will be closed.\"\r\n\r\nFrom: [browser.new_context]( htt...
1
python
"Set enable_resource_isolation to True if you're using ray.init or use the " "--enable-resource-isolation flag if you're using the ray cli." ) if system_reserved_cpu: raise ValueError( "system_reserved_cpu cannot be set when resource is...
Review this code and list any quality issues.
[ { "issue": "I think we should limit this to just resource isolation configs and let the caller get the default object store memory. It doesn't make sense to pass None as `object_store_memory` to the ctor.", "severity": "major", "line": 26 } ]
1
python
'title': common_info.get('title'), } common_info['timestamp'] = traverse_obj(entries, (..., 'timestamp'), get_all=False) return self.playlist_result(entries, video_id, multi_video=True, **common_info) class AfreecaTVCatchStoryIE(AfreecaTVBaseIE): IE_NAME = 'afreecatv:catchstory' ...
Review this code and list any quality issues.
[ { "issue": "see https://github.com/yt-dlp/yt-dlp/pull/10174#issuecomment-2195320898 about using `impersonate` instead of insecure requests\r\n\r\nalso, let's use `traverse_obj` below when we iterate over the data instead of `.get()` here\r\n```suggestion\r\n data = self._download_json(\r\n 'ht...
1
python
script_to_p2wsh, ) from test_framework.descriptors import descsum_create from test_framework.key import ECPubKey from test_framework.test_framework import BitcoinTestFramework from test_framework.messages import COIN, CTransaction, CTxOut from test_framework.script import hash160 from test_framework.script_util import ...
Review this code and list any quality issues.
[ { "issue": "In 3854d6b56c50b26f7b61dfb37f5230726d561cf9 \"tests: Check that the last hardened cache upgrade occurs\"\r\n\r\nI think I have found a way of getting rid of this kind of duplicated try-import-except-setfileconstant instances in multiple files by introducing a `inspect_database` function in the test ...
1
python
'upload_date': '19700101', 'timestamp': 0, 'thumbnail': 'https://sun9-86.userapi.com/impf/7vN3ACwSTgChP96OdOfzFjUCzFR6ZglDQgWsIw/KPaACiVJJxM.jpg?size=800x450&quality=96&keep_aspect_ratio=1&background=000000&sign=b48ea459c4d33dbcba5e26d63574b1cb&type=video_thumb', }, }, { 'url...
Review this code and list any quality issues.
[ { "issue": "None of these are needed\r\n```suggestion\r\n```", "severity": "minor", "line": 26 } ]
1
python
"stop_strings", "stop_token_ids", "temperature", "top_p", "guided_decoding", } @override def _convert_conversation_to_api_input( self, conversation: Conversation, generation_params: GenerationParams ) -> dict[str, Any]: """Converts a c...
Review this code and list any quality issues.
[ { "issue": "could you wrap this expression into parens for better auto-formatatting?\r\n```\r\n\"model\": (self._model if self._adapter_model is None else self._adapter_model),\r\n```", "severity": "minor", "line": 26 } ]
1
python
from metagpt.schema import Plan, Task from metagpt.strategy.planner import Planner from metagpt.strategy.task_type import TaskType MOCK_TASK_MAP = { "1": Task( task_id="1", instruction="test instruction for finished task", task_type=TaskType.EDA.type_name, dependent_task_ids=[], ...
Review this code and list any quality issues.
[]
0
python
raise ExecutionTimeoutError(wait_timeout) # Raise exception if the process exit code is not 0 if p.exitcode != 0: # If process is not None, it indicates that the process has been terminated by other errors. exception = error_dict.get("error", None) ...
Review this code and list any quality issues.
[ { "issue": "Maybe there is no need to change the function name, just adding a parameter would be enough.", "severity": "minor", "line": 26 } ]
1
python
import math from .common import InfoExtractor from ..utils import ( InAdvancePagedList, clean_html, int_or_none, parse_iso8601, traverse_obj, urljoin, ) class MaveBaseIE(InfoExtractor): _API_BASE_URL = 'https://api.mave.digital/v1/website' _API_BASE_STORAGE_URL = 'https://store.cloud....
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n display_id, note='Downloading episode metadata')\r\n```", "severity": "minor", "line": 26 } ]
1
python
# selective projection used to make dt, B and C input dependent self.x_proj = nn.Linear(self.intermediate_size, self.time_step_rank + self.ssm_state_size * 2, bias=False) # time step projection (discretization) self.dt_proj = nn.Linear(self.time_step_rank, self.intermediate_size, bias=True) ...
Review this code and list any quality issues.
[ { "issue": "Same pattern as in mamba2 https://github.com/huggingface/transformers/blob/9a7d817885aab0728cd4894798790e47607920c7/src/transformers/models/mamba2/modeling_mamba2.py#L261-L270\n\nNot sure why this was done differently here cc @MekkCyber fyi", "severity": "minor", "line": 26 } ]
1
python
for plugin in pkg_resources.iter_entry_points("manim.plugins"): if plugin.name not in plugins_requested: continue loaded_plugin = plugin.load() if isinstance(loaded_plugin, types.ModuleType): # it is a module so it can't be called # see if __all__ is defined # if it is define...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n plugins_requested.remove(plugin.name)\r\n```", "severity": "minor", "line": 26 } ]
1
python
class NixlChannel: """Provides the primitives to send the data and process the received data. It will have some internal threads to handle the data receiving. """ def __init__( self, nixl_config: NixlConfigXpYd, config: LMCacheEngineConfig, backend: StorageBackendInterfa...
Review this code and list any quality issues.
[ { "issue": "initialize tp_rank for both sender and receiver", "severity": "minor", "line": 26 } ]
1
python
'tags': [], 'channel': '99 Percent Invisible', 'uploader_id': '@99percentinvisiblepodcast', }, 'playlist_count': 1, }, { # Releases tab, with rich entry playlistRenderers (same as Podcasts tab) 'url': 'https://www.youtube.com/@AHimitsu/releases', 'info...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n # FIXME: future: YouTube currently doesn't give continuation for this,\r\n```", "severity": "minor", "line": 26 } ]
1
python
""" Should emit: RUF066 - on lines 12, 23, 48 """ import abc import typing class User: @property def name(self): # No return f"{self.first_name} {self.last_name}" @property def age(self): return 100 def method(self): x = 1 @property def nested(self): # No retu...
Review this code and list any quality issues.
[ { "issue": "Would you mind adding inline comments marking each case as okay or an error instead of one comment at the top? That way it will appear in each of the snapshots. That makes it a bit easier to review.\n\nAnd could you renumber the rule to RUF069? I think we have PRs in flight for [66](https://github.c...
1
python
[256., 72., 768., 360.]]) >>> xyxy = np.array([ ... [256., 128., 768., 640.] ... ]) >>> sv.denormalize_boxes(xyxy, (1280, 720), normalization_factor=1024.0) array([[320., 90., 960., 450.]]) """ width, height = resolution_wh result = xyxy.copy() result[:, [...
Review this code and list any quality issues.
[ { "issue": "The phrase \"containing offset values in format is `[dx, dy]`\" is grammatically incorrect. It should be either \"containing offset values in the format `[dx, dy]`\" or \"containing offset values with format `[dx, dy]`\". Consider removing the word \"is\" or restructuring the sentence.", "severi...
1
python
start_time = time.time() try: # Run the test yield finally: # Clean up event listeners to prevent hangs during teardown try: page.remove_listener("websocket", on_web_socket) except Exception: pass #...
Review this code and list any quality issues.
[ { "issue": "'except' clause does nothing but pass and there is no explanatory comment.", "severity": "minor", "line": 26 } ]
1
python
# Position camera and display zoomed_camera.frame.move_to(self.zoomed_camera_frame_starting_position) if self.zoomed_display_center is not None: zoomed_display.move_to(self.zoomed_display_center) else: zoomed_display.to_corner( self.zoomed_display_corner, ...
Review this code and list any quality issues.
[ { "issue": "Had to use type ignore here, since `add_image_mobject_from_camera` does not exist for `OpenGLCamera`.", "severity": "minor", "line": 26 } ]
1
python
class RemoteConnector(metaclass=abc.ABCMeta): """ Interface for remote connector """ def __init__( self, config: LMCacheEngineConfig, metadata: Optional[LMCacheEngineMetadata] ): # TODO(chunxiaozheng): support layerwise here assert metadata is not None self.save_chun...
Review this code and list any quality issues.
[ { "issue": "Since the `RemoteMetadata` class controls how to serialize and deserialize the metadata, should we make the format a private field inside the `RemoteMetadata` class?\r\n\r\nLet's say in the future, someone wants to change the serialize/deserialize to use `msgpack`, such a `remote_data_fmt` may not b...
1
python
media_id += '_dvr' elif end_timestamp <= now: dvr_end_timestamp = traverse_obj(olympic_data, ( 'dvr_end_date', {unified_timestamp(tz_offset=9)})) if dvr_end_timestamp and now < dvr_end_timestamp: live_status = 'was_live' ...
Review this code and list any quality issues.
[ { "issue": "maybe?\r\n```suggestion\r\n live_status = 'was_live'\r\n```", "severity": "minor", "line": 26 } ]
1
python
# --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- from promptflow.rag.constants._common import CONNECTION_ID_TEMPLATE class ConnectionConfig: """Config class for connection. :par...
Review this code and list any quality issues.
[]
0
python
material=fem_material_linear, ) # Build the scene scene.build() # Run simulation for _ in range(200): scene.step() for entity in scene.entities: state = entity.get_state() pos = state.pos.detach().cpu().numpy() min_pos_z = np.min(pos[..., 2]) assert_all...
Review this code and list any quality issues.
[ { "issue": "Why forcing GPU? Why not marking this test as required?", "severity": "minor", "line": 26 } ]
1
python
return self.get_x_axis().get_unit_size() def get_axes(self): return self.axes def get_vector(self, coords, **kwargs): kwargs["buff"] = 0 return Arrow( self.coords_to_point(0, 0), self.coords_to_point(*coords), **kwargs ) def prepare_for_nonlinear_transform(self...
Review this code and list any quality issues.
[ { "issue": "I might be the only one, but I had to search for azimuth... An explanation wouldn't hurt imo.\r\n\r\n```\r\n The number of divisions in the azimuth (some explanation). If ``None`` is specified then it will use the default\r\n```\r\n\r\n(I would have suggested one, but it would probably better...
1
python
if line.magic_trailing_comma and penultimate.type == token.COMMA: # The rightmost non-omitted bracket pair is the one we want to explode on. return True if _can_omit_closing_paren(line, last=last, line_length=line_length): return True return False def _can_omit_openin...
Review this code and list any quality issues.
[ { "issue": "It may be possible to remove this conditional check block completely, with only a minor impact on the formatter's behaviour. See https://github.com/jayaddison/black/commit/1096bc908d56a6013c82f626f08f2915a38ecd32 for a possible change (cc @JelleZijlstra)\r\n\r\nI'm not including that commit here ye...
1
python
def _set_attrs(self): self.account_name, self.container_name, self.root_folder = self._get_attrs( self.root ) self.account_url = f"https://{self.account_name}.blob.core.windows.net" self.credential, self.account_key, self.sas_token = None, None, None self._set_credent...
Review this code and list any quality issues.
[ { "issue": "This check seems correct, except when in `storage_factory`, generic `az://account/container` is passed, then `account` is compared to `creds.get(\"account_name\")` which errors out unnecessarily", "severity": "minor", "line": 26 } ]
1
python
import os import shutil import subprocess import sys from packaging.version import Version, parse KNOWN_PLUGINS_URL = ( 'https://raw.githubusercontent.com/jina-ai/jina/master/cli/known_plugins.json' ) def _get_run_args(print_args: bool = True): from jina.helper import get_rich_console from jina.parsers ...
Review this code and list any quality issues.
[ { "issue": "if this is linked to master, why not keep it here statically?", "severity": "minor", "line": 8 } ]
1
python
def _session_for(sessions: dict, session_id: str): session = sessions.get(session_id, None) if session is None: session = Expando() sessions[session_id] = session return session class Auth: """ Represents authentication information for a given query context. Carries valid informati...
Review this code and list any quality issues.
[ { "issue": "nit: I don't know how the doc generation works so I just mention that this is internal attribute so it should not (IMHO) appear in the documentation.", "severity": "minor", "line": 26 } ]
1
python
""" if isinstance(recs, Recorder): recs = [recs] if end_train_func is None: end_train_func = self.end_train_func if experiment_name is None: experiment_name = self.experiment_name task_pool = self.task_pool if task_pool is None: tas...
Review this code and list any quality issues.
[ { "issue": "Why not use this method TaskManager.waiting?\r\nYou may make some improvements to it.", "severity": "minor", "line": 26 } ]
1
python
formats = [] for source_type, source in metadata['streams'].items(): stream_url = source['url'] if source_type == 'smoothStreaming': formats.extend(self._extract_ism_formats(stream_url, video_id, 'mss')) elif source_type == 'apple_HTTP_Live_Streaming': ...
Review this code and list any quality issues.
[ { "issue": "You could use the builtin functionality of `traverse_obj` for a result type:\r\n```suggestion\r\n age_limit = traverse_obj(metadata, ('snippet', 'minimumAge'), expected_type=int_or_none, default=0))\r\n```", "severity": "minor", "line": 26 } ]
1
python
if config["save_last_frame"]: file_paths.append(file_writer.image_file_path) if config["write_to_movie"] and not config["save_as_gif"]: file_paths.append(file_writer.movie_file_path) if config["save_as_gif"]: file_paths.append(file_writer.gif_file_path) for f...
Review this code and list any quality issues.
[]
0
python
import numpy as np from manim import NumberLine def test_unit_vector(): """Check if the magnitude of unit vector along the NumberLine is equal to its unit_size.""" axis1 = NumberLine(unit_size=0.4) axis2 = NumberLine(x_range=[-2, 5, 1]) axis2.width = 12 for axis in (axis1, axis2): ass...
Review this code and list any quality issues.
[ { "issue": "I'm not sure if this was intentional, but `NumberLine`'s length can be adjusted via the `length` parameter\r\n```suggestion\r\n axis2 = NumberLine(x_range=[-2, 5, 1], length = 12)\r\n```", "severity": "minor", "line": 11 } ]
1
python
painter.begin(pixmap) renderer.render(painter, QtCore.QRectF(0, 0, size.width(), size.height())) finally: if painter.isActive(): painter.end() return pixmap def _render_png(self, png_path, pixmap, scaled_size, dpr): """Render PNG content to pixmap wi...
Review this code and list any quality issues.
[ { "issue": "Also here\r\n```suggestion\r\n if self.is_dark_mode():\r\n```", "severity": "minor", "line": 26 } ]
1
python
'skip_download': True, }, }, { 'url': 'globo:3607726', 'only_matching': True, }] def _real_extract(self, url): video_id = self._match_id(url) video_view = ''' query getVideoView($videoId: ID!) { video(id: $videoId) { duration ...
Review this code and list any quality issues.
[ { "issue": "lines too long. use `query` kwarg instead of putting it all into the url string", "severity": "major", "line": 26 } ]
1
python
'device_id': 'whatvalueshouldbeforweb', 'device_type': 'com.crunchyroll.static', 'access_token': 'giKq5eY27ny3cqz', 'referer': self._LOGIN_URL }) if upsell_response['code'] != 'ok': raise ExtractorError('Could not get session id') s...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n def _get_beta_embedded_json(self, webpage, display_id):\r\n```", "severity": "minor", "line": 26 } ]
1
python
# Some OpenAI-compatible providers (e.g. MoonshotAI) currently do **not** accept # `tool_choice="required"`. This flag lets the calling model know whether it's # safe to pass that value along. Default is `True` to preserve existing # behaviour for OpenAI itself and most providers. openai_supports_tool...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n \"\"\"Whether the model supports reasoning (o-series, GPT-5+).\r\n```", "severity": "minor", "line": 26 } ]
1
python
data=json.dumps({ 'player_type': 'mirakulo_8k_hdr', 'video_id': video_id, 'quality': 'max', 'content_protection': 'widevine', 'vsid': f'{uuid.uuid4()}', 'consumption': 'streaming', 'capabilities': {'low_laten...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n formats, subtitles = self._extract_m3u8_formats_and_subtitles(main_source['url'], video_id, 'mp4', m3u8_id='hls')\r\n```", "severity": "major", "line": 26 } ]
1
python
) def test_check_requires_python( version_info: Tuple[int, int, int], requires_python: Optional[str], expected: bool ) -> None: actual = check_requires_python(requires_python, version_info) assert actual == expected def test_check_requires_python__invalid() -> None: """ Test an invalid Requires-Py...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n assert get_requirement(teststr) is not Requirement(teststr)\r\n```", "severity": "minor", "line": 26 } ]
1
python
----------- - query (str): The query string to execute against the database. - params (dict): A dictionary of parameters to be used in the query. """ raise NotImplementedError @abstractmethod async def add_node(self, node: Union[DataPoint, str], properties: Optional[Dic...
Review this code and list any quality issues.
[ { "issue": "Noob q - why do we want to support both `Node` and `DataPoint`?", "severity": "minor", "line": 26 } ]
1
python
return self.model.accessible_objects(self.user, 'read_role') @check_superuser def can_add(self, data): if not data: # So the browseable API will work return Organization.accessible_objects(self.user, 'project_admin_role').exists() return (self.check_related('organization', Organiza...
Review this code and list any quality issues.
[]
0
python
'author_id': str_or_none(author.get('uid')), 'id': str_or_none(comment.get('commentID')), 'text': content, 'timestamp': int_or_none(comment.get('createdAt')), 'parent': 'root' if parent == 0 else str_or_none(parent), }) info = { ...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n _VALID_URL = r'trovovod:(?P<id>[^\\s]+)'\r\n IE_DESC = 'All VODs of a trovo.live channel, \"trovovod\" keyword'\r\n```\r\nAdd similar desc for clips", "severity": "minor", "line": 26 } ]
1
python
Returns: `list` of `str` """ main_hop, *rest_hops = _as_str(path).split("::") if is_local_path(main_hop): return os.listdir(path) else: # globbing inside a zip in a private repo requires authentication path, storage_options = _prepare_path_and_storage_options(path, downlo...
Review this code and list any quality issues.
[]
0
python
# Copyright (c) Microsoft Corporation. # SPDX-License-Identifier: Apache-2.0 # DeepSpeed Team from deepspeed.accelerator import get_accelerator import torch enable_nvtx = True def instrument_w_nvtx(func): """Decorator that records an NVTX range for the duration of the function call. Skips NVTX instrumen...
Review this code and list any quality issues.
[ { "issue": "Better to utilize DeepSpeed utility \r\n```suggestion\r\n from deepspeed.runtime.compiler import is_compiling\r\n if enable_nvtx and not is_compiling():\r\n```", "severity": "major", "line": 18 } ]
1
python
video_uuid = uuid.uuid5(self._DNS_NAMESPACE, 'video') media_uuid = uuid.uuid5(video_uuid, media_id) return self._download_json( self._GRAPHQL_API, media_id, note='Downloading json from GRAPHQL API', data=json.dumps({ 'query': self._GRAPHQL_QUERY, 'variables': {'id': f'nyt://...
Review this code and list any quality issues.
[ { "issue": "inline `creator` extraction in return", "severity": "major", "line": 26 } ]
1
python
if page: self.add_page(name=Gui.__root_page_name, page=page) if pages is not None: self.add_pages(pages) if env_filename is not None: self.__env_filename = env_filename if libraries is not None: for library in libraries: Gui.add_lib...
Review this code and list any quality issues.
[ { "issue": "on_invalid_data should be handled the same way as on_action\r\n\r\n- [definition](https://github.com/Avaiga/taipy/blob/3297952c0e64bd10358fde8e63a3adf6aef4e613/taipy/gui/gui.py#L255)\r\n- [assignment](https://github.com/Avaiga/taipy/blob/3297952c0e64bd10358fde8e63a3adf6aef4e613/taipy/gui/gui.py#L258...
1
python
config = ( TQCConfig() .environment("Pendulum-v1") .training( initial_alpha=1.001, # Use a smaller learning rate for the policy. actor_lr=2e-4 * (args.num_learners or 1) ** 0.5, critic_lr=8e-4 * (args.num_learners or 1) ** 0.5, alpha_lr=9e-4 * (args.num_learners or 1)...
Review this code and list any quality issues.
[ { "issue": "I assume this has been tested by you @pseudo-rnd-thoughts ?", "severity": "minor", "line": 26 } ]
1
python
# Make POST login request payload = { 'email': username, 'password': password, 'authenticity_token': self._get_authenticity_token(), 'utf8': True } response = self._download_webpage(self._LOGIN_URL, video_id=self.display_id, ...
Review this code and list any quality issues.
[ { "issue": "move login to `_real_initialize`", "severity": "minor", "line": 26 } ]
1
python
path=(), msg='', array_verbose=True, array_decimal=None, **kwargs): f = ( np.testing.assert_array_equal if array_decimal is None else partial(np.testing.assert_array_almost_equal, decimal=array_decima...
Review this code and list any quality issues.
[ { "issue": "Hmm. this feels kinda gross. I feel like it might be cleaner to just delegate to an `assert_datetime_array_equal` method so that we don't have to keep the flag around.", "severity": "minor", "line": 26 } ]
1
python
"""Sets :attr:`points` to be an empty array.""" self.points = np.zeros((0, self.dim)) def init_colors(self): """Initializes the colors. Gets called upon creation. This is an empty method that can be implemented by subclasses. """ pass def generate_points(self): ...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n def add(self, *mobjects: \"Mobject\") -> \"Mobject\":\r\n```", "severity": "minor", "line": 26 } ]
1
python
else: raise ExtractorError(f'Unknown delivery_status: {delivery_status}', expected=False) # TODO: if there are multiple playlists, tell me. m3u8_playlist_urls = self._html_search_regex( r'var listChannels = (.+);\n', webpage, 'listChannels', default=None) if not m3u8_pla...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n return {\r\n 'id': data_json['app_id'],\r\n 'title': data_json.get('app_name'),\r\n 'formats': self._extract_m3u8_formats(m3u8_playlist_url, video_id),\r\n 'live_status': live_status,\r\n 'description': traverse_obj(data...
1