language string | code-snippit string | instruction string | flaws list | flaw_count int64 |
|---|---|---|---|---|
python | self.start_node(1, extra_args=["-assumevalid=" + block102.hash_hex])
self.start_node(2, extra_args=["-assumevalid=" + block102.hash_hex])
p2p0 = self.nodes[0].add_p2p_connection(BaseNode())
p2p0.send_header_for_blocks(self.blocks[0:2000])
p2p0.send_header_for_blocks(self.blocks[2000:])
... | Review this code and list any quality issues. | [
{
"issue": "It feels a bit lacking to have `CHECKED_NOT_UNDER_ASSUMEVALID` when the block is based upon the assumevalid block. Would expect something like `CHECKED_EXCEEDS_ASSUMEVALID`. For *validation.cpp*:\r\n```C++\r\n } else if (it->second.nHeight < pindex->nHeight) {\r\n assume_valid = CH... | 1 |
python | positive_diagonals = M._has_positive_diagonals()
if positive_diagonals is False:
return False
if positive_diagonals and M.is_strongly_diagonally_dominant:
return True
return None
def _fuzzy_positive_semidefinite(M):
nonnegative_diagonals = M._has_nonnegative_diagonals()
if nonneg... | Review this code and list any quality issues. | [] | 0 |
python | m3u8_url = file_info.get('url')
if not m3u8_url:
self.raise_no_formats('No M3U8 URL found')
formats = self._extract_m3u8_formats(m3u8_url, video_id, 'mp4', 'm3u8_native')
# Parse duration from duration string (format: "HH:MM:SS:FF")
duration_str = file_info.get('duration')
... | Review this code and list any quality issues. | [
{
"issue": "The conversion function tests for validity:\r\n```suggestion\r\n upload_date = unified_timestamp(video_details.get('recordingFrom'))\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | blocking=True,
)
# Even if we requested updates for two entities, our integration should smartly
# group the API calls to just one.
assert mock_request_status.call_count == request_call_count_before + 1
# The new state should be effective.
state = hass.states.get(f"sensor.{device_slug}_load")
... | Review this code and list any quality issues. | [
{
"issue": "The parametrization hardcodes entity IDs like `sensor.apc_ups_last_self_test`. Elsewhere in this file entity IDs are derived from `UPSNAME` via `slugify(...)`, which makes tests resilient if the fixture UPS name changes. Consider passing a suffix/key and building `entity_id` from `slugify(mock_reque... | 1 |
python | WEEK_ENDING_SUNDAY = "P1W/1970-01-04T00:00:00Z"
MONTH = "P1M"
QUARTER = "P3M"
QUARTER_YEAR = "P0.25Y"
YEAR = "P1Y"
class PandasAxis(int, Enum):
ROW = 0
COLUMN = 1
class PandasPostprocessingCompare(StrEnum):
DIFF = "difference"
PCT = "percentage"
RAT = "ratio"
class CacheRegion(... | Review this code and list any quality issues. | [
{
"issue": "nit: rename to `CACHE_DISABLED_TIMEOUT` because the `NO_TIMEOUT` in my mind reads like \"it's cached forever because it has no timeout\"",
"severity": "major",
"line": 26
}
] | 1 |
python | if query_context_json is None:
# Fallback: Chart has no saved query_context
# This can happen with older charts that haven't been re-saved
await ctx.warning(
"Chart has no saved query_context. "
"Data may not match the chart visuali... | Review this code and list any quality issues. | [
{
"issue": "What about [BigNumberPeriodOverPeriod](https://github.com/apache/superset/blob/master/superset-frontend/packages/superset-ui-core/src/chart/types/VizType.ts#L24)?",
"severity": "minor",
"line": 26
}
] | 1 |
python | def __init__(self, pos):
pygame.sprite.Sprite.__init__(self, self.containers)
self.image = self.images[0]
self.rect = self.image.get_rect(midbottom=pos)
def update(self):
"""called every time around the game loop.
Every tick we move the shot upwards.
"""
sel... | Review this code and list any quality issues. | [] | 0 |
python | @unittest.skipIf(
support.is_android or support.is_apple_mobile,
"Subinterpreters are not supported on Android and iOS"
)
def test_endian_table_init_subinterpreters(self):
# Verify that the _struct extension module can be initialized
# concurrently in subinterpreters (gh-140260).... | Review this code and list any quality issues. | [
{
"issue": "5 lines to test 5 methods. I think that it would be clearer if just write them one per line. If the test fail, you will see what test failed. And you could use method specific arguments.\n\nTest also attributes `format` and `size`.",
"severity": "critical",
"line": 26
}
] | 1 |
python | """
Serializable object is a wrapper of existing python objects, that supports dump and load easily.
Stores a symbol ``s`` and a dict of arguments ``args``, and the object can be restored with ``s(**args)``.
:class:`SerializableObject` is not always a full object. Sometimes it could only
contain necess... | Review this code and list any quality issues. | [
{
"issue": "Seems identical to `list(self.trace_args)`?",
"severity": "minor",
"line": 26
}
] | 1 |
python | return merge_dicts(clean_info, jw_data, json_ld_data)
class LRTRadioIE(LRTBaseIE):
_VALID_URL = r'https?://(?:www\.)?lrt\.lt/radioteka/irasas/(?P<id>[0-9]+)/(?P<path>[^?#/]+)'
_TESTS = [{
# m3u8 download
'url': 'https://www.lrt.lt/radioteka/irasas/2000359728/nemarios-eiles-apie-pragarus-ir-ska... | Review this code and list any quality issues. | [
{
"issue": "Being explicit is more maintainable\r\n```suggestion\r\n video_id, path = self._match_valid_url(url).group('id', 'path')\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | from __future__ import annotations
import abc
import dataclasses
import functools
import os.path
from ._utils import _get_exe_version_output, detect_exe_version, int_or_none
# NOT public API
def runtime_version_tuple(v):
# NB: will return (0,) if `v` is an invalid version string
return tuple(int_or_none(x, d... | Review this code and list any quality issues. | [
{
"issue": "we probably don't want others to use this for now\n```suggestion\ndef _determine_runtime_path(path, basename):\n```",
"severity": "minor",
"line": 16
}
] | 1 |
python | from uuid import UUID
from typing import Optional
from cognee.infrastructure.databases.vector.create_vector_engine import create_vector_engine
from cognee.modules.users.models import User
from cognee.modules.users.models import DatasetDatabase
from cognee.infrastructure.databases.vector import get_vectordb_config
from... | Review this code and list any quality issues. | [
{
"issue": "This is not enough, this will only remove tables and data from a database in PostgreSQL we should remove the whole database here",
"severity": "minor",
"line": 26
}
] | 1 |
python | hass: HomeAssistant,
mock_account_with_litterrobot_4: MagicMock,
robot_data: dict[str, str | bool],
expected_state: str,
) -> None:
"""Test sending commands to the switch."""
await setup_integration(hass, mock_account_with_litterrobot_4, VACUUM_DOMAIN)
robot: Robot = mock_account_with_litterrobo... | Review this code and list any quality issues. | [
{
"issue": "`SERVICE_SET_SLEEP_MODE` is registered under the Litter-Robot integration domain (`DOMAIN`) via `async_register_platform_entity_service` (see `homeassistant/components/litterrobot/services.py`). Using `VACUUM_DOMAIN` here will call a non-existent service and make this parametrized case fail. Set `se... | 1 |
python | async def get_graph_execution(
user_id: str,
execution_id: str,
include_node_executions: bool = False,
) -> GraphExecution | GraphExecutionWithNodes | None:
execution = await AgentGraphExecution.prisma().find_first(
where={"id": execution_id, "isDeleted": False, "userId": user_id},
inclu... | Review this code and list any quality issues. | [] | 0 |
python | )
if not (
math.isfinite(gpu_memory_utilization)
and gpu_memory_utilization > 0
and gpu_memory_utilization <= 1.0
):
raise ValueError(
"GPU memory utilization must be within (0, 1]. Got "
f"{gpu_memory_utilization}."
... | Review this code and list any quality issues. | [
{
"issue": "nit: this should be a `ValueError` if it's a wrong config value from the user",
"severity": "critical",
"line": 26
}
] | 1 |
python | + [None] * num_models
+ anony_names
+ [""]
+ [disable_btn] * 6
)
def share_click(state0, state1, model_selector0, model_selector1, request: gr.Request):
logger.info(f"share (anony). ip: {request.client.host}")
if state0 is not None and state1 is not None:
vote_last_response... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n \"mpt-7b-chat\": 1.2,\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | COLLECTION_NAME,
shard_key = f"test2",
shard_number = 2,
replication_factor = 2,
)
# Cannot reshard down on key with just one shard
response = start_resharding(
peer_urls[0],
COLLECTION_NAME,
"down",
peer_id = None,
shard_key = "test1",
)
... | Review this code and list any quality issues. | [] | 0 |
python | 'id': '5f488148b70e4f392572977c',
'title': 'Daryl Hall',
'ext': 'mp4',
'description': 'md5:e54ecaa0f4b5683fc9259e9e4b196628',
'upload_date': '20230214',
'timestamp': 1676403615,
'duration': 2570.668,
'channel': 'The Big Interview with D... | Review this code and list any quality issues. | [
{
"issue": "IMO since `_META_URL` is only being used once, this is more readable:\r\n\r\n```suggestion\r\n meta = self._download_json(\r\n f'https://api.myspotlight.tv/dotplayer/video/{company_id}/{video_id},\r\n video_id, query={'device_type': 'desktop_web'})['video']\r\n```\r\n(an... | 1 |
python | v = np.array(vector) / norm
phi = np.arccos(v[2])
if any(v[:2]):
# projection of vector to unit circle
axis_proj = v[:2] / np.linalg.norm(v[:2])
theta = np.arccos(axis_proj[0])
if axis_proj[1] < 0:
theta = -theta
else:
theta = 0
phi_down = np.array(
... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n \"\"\"Returns polar coordinate theta when vector is projected on xy plane.\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | post_data.get('txt') or self._og_search_description(webpage))
uploader = str_or_none(
user_data.get('nickname')
or remove_end(self._og_search_title(webpage), ' on GETTR'))
if uploader:
title = '%s - %s' % (uploader, title)
if not dict_get(post_data, ['vid', ... | Review this code and list any quality issues. | [
{
"issue": "Yes, this is technically correct, but is misleading\r\n\r\n```suggestion\r\n 'source_preference': 1,\r\n 'quality': 1,\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | """
import time
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import assert_raises_rpc_error
class UptimeTest(BitcoinTestFramework):
def set_test_params(self):
self.num_nodes = 1
self.setup_clean_chain = True
def run_test(self):
self._test_n... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\n assert uptime_after - uptime_before < wait_time # uptime should not jump with wall clock\n```\n\nnit: Could use wait_time here, to avoid something hard-coded? (Here and in setmocktime)",
"severity": "minor",
"line": 26
}
] | 1 |
python | # This file is automatically picked by pytest
# while running tests. So, that each test is
# run on difference temporary directories and avoiding
# errors.
from __future__ import annotations
try:
import readline # required to prevent a segfault on Python 3.10
except ModuleNotFoundError: # windows
pass
impo... | Review this code and list any quality issues. | [
{
"issue": "A link to the open issue is better https://github.com/moderngl/moderngl/issues/517\r\n```suggestion\r\n # https://github.com/moderngl/moderngl/issues/517\r\n import readline # required to prevent a segfault on Python 3.10\r\n```",
"severity": "critical",
"line": 10
}
] | 1 |
python | async def _react(self) -> Message:
"""Think first, then act, until the Role _think it is time to stop and requires no more todo.
This is the standard think-act loop in the ReAct paper, which alternates thinking and acting in task solving, i.e. _think -> _act -> _think -> _act -> ...
Use llm to ... | Review this code and list any quality issues. | [
{
"issue": "rsp will be `not defined` if break in the first loop.",
"severity": "minor",
"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 | assert result is pd.NA
@pytest.mark.parametrize(
"values, expected", [([1, 2, 3], 6.0), ([1, 2, 3, None], 6.0), ([None], 0.0)]
)
def test_floating_array_numpy_sum(values, expected):
arr = pd.array(values, dtype="Float64")
result = np.sum(arr)
assert result == expected
@pytest.mark.parametrize("op", ... | Review this code and list any quality issues. | [
{
"issue": "i think float64 subclasses float, so this won't exclude float64",
"severity": "minor",
"line": 26
}
] | 1 |
python | @classmethod
def all_channel(cls) -> Self:
"""A :class:`Permissions` with all channel-specific permissions set to
``True`` and the guild-specific ones set to ``False``. The guild-specific
permissions are currently:
- :attr:`manage_guild_expressions`
- :attr:`view_audit_log`
... | Review this code and list any quality issues. | [
{
"issue": "No need to mention this since it's a transparent alias.",
"severity": "minor",
"line": 26
}
] | 1 |
python | }]
TRACK_API = 'https://www.monstercat.com/api/release/{release_id}/track-stream/{song_id}'
def _extract_tracks(self, table, album_meta):
for td in re.findall(r'<tr[^<]*>((?:(?!</tr>)[\w\W])+)', table): # regex by chatgpt due to lack of get_elements_by_tag
title = traverse_obj(get_element... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n title = try_call(lambda: get_element_text_and_html_by_tag('h1', html)[0])\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | from urllib.request import * # noqa: F403
from .. import compat_os_name
from ..compat_utils import passthrough_module
import sys
passthrough_module(__name__, 'urllib.request')
del passthrough_module
if compat_os_name == 'nt':
# On older python versions, proxies are extracted from Windows registry erroneously. [... | Review this code and list any quality issues. | [
{
"issue": "I think it makes sense to start with lowest version and always use `<=`/`<`\r\n```suggestion\r\n (3, 9, 13) <= sys.version_info < (3, 10) # https://docs.python.org/3.9/whatsnew/changelog.html#python-3-9-13-final\r\n or (3, 10, 5) <= sys.version_info # https://docs.python.org/... | 1 |
python | from .common import InfoExtractor
from ..utils import (
ExtractorError,
clean_html,
extract_attributes,
get_element_by_class,
get_element_html_by_class,
multipart_encode,
unified_timestamp,
url_or_none,
)
from ..utils.traversal import traverse_obj
class PiaLiveIE(InfoExtractor):
PL... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n _VALID_URL = r'https?://player\\.pia-live\\.jp/stream/(?P<id>[\\w-]+)'\r\n _PLAYER_ROOT_URL = 'https://player.pia-live.jp/'\r\n _PIA_LIVE_API_URL = 'https://api.pia-live.jp'\r\n _API_KEY = 'kfds)FKFps-dms9e'\r\n```",
"severity": "minor",
"line": 19
}
] | 1 |
python | entity_type=EventEntityType.SEQUENCE,
entity_id="SEQUENCE_scenario_id",
operation=EventOperation.UPDATE,
attribute_name="tasks",
)
assert isinstance(registration_2.registration_id, str)
assert registration_2.registration_id.startswith(_Registration._ID_PREFIX)
assert isinstance(r... | Review this code and list any quality issues. | [] | 0 |
python | # Ensure endpoint starts with /
if not endpoint.startswith("/"):
endpoint = f"/{endpoint}"
url = f"{WORDPRESS_BASE_URL.rstrip('/')}{endpoint}"
request_method = getattr(Requests(raise_for_status=False), method.lower())
response = await request_method(
url,
headers=headers,
... | Review this code and list any quality issues. | [] | 0 |
python | input_type = tensor.dtype
input_shape = tensor.shape
input_device = tensor.device
input_size = tensor.numel()
flat_padded_x = tensor.flatten()
assert op in [ReduceOp.SUM, ReduceOp.AVG], "op can only be ReduceOp.SUM or ReduceOp.AVG"
if flat_padded_x.size(0) % world_size != 0:
pad_size =... | Review this code and list any quality issues. | [
{
"issue": "Why wait when async op is enabled?",
"severity": "minor",
"line": 26
}
] | 1 |
python | # privacy setting options ['public',"logged_in", "shared_password", "user_groups"]
default_privacy_setting = self.page.get_default_privacy_setting(self.request)
if (
default_privacy_setting["type"] == "public"
): # default privacy setting is public no need to do anything
... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n raise ValueError(\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | def test_train_val_loop_only(tmpdir):
reset_seed()
dm = BoringDataModule()
model = BoringModel()
model.validation_step = None
model.validation_step_end = None
model.validation_epoch_end = None
trainer = Trainer(
default_root_dir=tmpdir,
max_epochs=1,
weights_summar... | Review this code and list any quality issues. | [
{
"issue": "what should be done with such assertions when using `BoringModel`? Since the dataset used with `BoringModel` is completely random.",
"severity": "minor",
"line": 26
}
] | 1 |
python | color: Color = WHITE,
font_size: float = DEFAULT_FONT_SIZE,
line_spacing: float = -1,
font: str = "",
slant: str = NORMAL,
weight: str = NORMAL,
t2c: Dict[str, str] = None,
t2f: Dict[str, str] = None,
t2g: Dict[str, tuple] = None,
t2s: Dict[str, st... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n self.line_spacing = line_spacing\r\n self.font = font\r\n self._font_size = float(font_size)\r\n # needs to be a float or else size is inflated when font_size = 24 (unknown cause)\r\n self.slant = slant\r\n```",
"severity": "minor",
"line"... | 1 |
python | 'info_dict': {
'id': 'inmates-vote-jail-nevada-murray-dnt-ac360-digvid-1563291-1920x1080_8000k',
'ext': 'mp4',
'direct': True,
'title': 'inmates-vote-jail-nevada-murray-dnt-ac360-digvid-1563291-1920x1080_8000k',
'timestamp': 1718158370.0,
'upload_d... | Review this code and list any quality issues. | [
{
"issue": "Surely this can't work? The URL didn't match `CNNIE._VALID_URL` or it wouldn't be in here, so trying to force it back there will just crash. The original code constructed a new URL that was expected to be `CNNIE.suitable()`, which was fine.",
"severity": "critical",
"line": 26
}
] | 1 |
python | def angle_of_vector(vector: Sequence[float]) -> float:
"""Returns polar coordinate theta when vector is project on xy plane.
Parameters
----------
vector : Sequence[float]
The vector to find the angle for.
Returns
-------
float
The angle of the vector projected.
"""
... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n \"\"\"Returns the angle between two vectors. \r\n```\r\nAs this also works for the typical 2 D vectors, mentioning 3D here can be a bit misleading",
"severity": "minor",
"line": 26
}
] | 1 |
python | except capa.exceptions.UnsupportedFormatError as e:
if format_ == FORMAT_CAPE:
capa.helpers.log_unsupported_cape_report_error(str(e))
else:
capa.helpers.log_unsupported_format_error()
return -1
except capa.exceptions.UnsupportedRuntimeError:
... | Review this code and list any quality issues. | [] | 0 |
python | rope_scaling = None
base = rotary_emb.base
is_neox_style = rotary_emb.is_neox_style
dtype = rotary_emb.dtype
self.fused_rotary_emb = get_fused_rope(
head_dim,
rotary_dim=head_dim,
max_position=max_position_embeddings,
base=base,
... | Review this code and list any quality issues. | [] | 0 |
python | 'url': 'http://www.bbc.com/weather/features/33601775',
'only_matching': True,
}, {
# custom redirection to www.bbc.com
# also, video with window.__INITIAL_DATA__
'url': 'http://www.bbc.co.uk/news/science-environment-33661876',
'info_dict': {
'id': 'p02xzws1',
... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n 'upload_date': '20211130',\r\n 'duration': 125,\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | Set the feature tags to enable on the font.
Parameters
----------
features : list of str, or tuple of str, or None
A list of feature tags to be used with the associated font. These strings
are eventually passed to HarfBuzz, and so all `string formats supported by
... | Review this code and list any quality issues. | [
{
"issue": "Slightly restrictive to have only list and tuple, but not actually too offended. \r\n\r\nThis is a pretty niche feature, so probably fine, but in most cases I would tend to think \"accept any Sequence\", but that is mostly just a gut reaction.",
"severity": "minor",
"line": 26
}
] | 1 |
python | def test_download_new_file(
self,
mock_get,
mock_tqdm,
mock_copyfileobj,
mock_exists,
mock_mkdir,
mock_open_file,
mock_print,
):
"""Test download_assets downloading a new file."""
filename = "vehicles.mp4"
mock_response = Magic... | Review this code and list any quality issues. | [
{
"issue": "These lines configure `mock_tqdm.return_value.__enter__/__exit__`, but `download_assets()` uses `tqdm.wrapattr(...)` (not `tqdm(...)`). As written, this setup is ineffective and the test isn’t actually controlling the context manager used by the implementation. Configure `mock_tqdm.wrapattr.return_v... | 1 |
python | key=slice(offset, offset + batch_size),
indices=self._indices if self._indices is not None else None,
).to_pandas(types_mapper=pandas_types_mapper)
for offset in range(0, len(self), batch_size)
)
def to_parquet(
self,
path_or_buf: Unio... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n <Added version=\"2.19.0\"/>\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | else:
formats.append({
'url': v_url,
'format_id': video_format,
})
process_video_files(video_files)
metadata = self._parse_json(
vpl_data['data-metadata'], display_id)
duration = (int_or_none(tr... | Review this code and list any quality issues. | [
{
"issue": "could we simplify this with `get_element_by_class` (utils)?",
"severity": "major",
"line": 26
}
] | 1 |
python | if start >= end:
raise ValueError(
f"control_guidance_start: {start} cannot be larger or equal to control guidance end: {end}."
)
if start < 0.0:
raise ValueError(f"control_guidance_start: {start} can't be smaller than 0.")
if e... | Review this code and list any quality issues. | [] | 0 |
python | import time
from .common import InfoExtractor
from ..networking import Request
from ..utils import (
ExtractorError,
OnDemandPagedList,
UserNotLive,
determine_ext,
filter_dict,
int_or_none,
orderedSet,
parse_iso8601,
url_or_none,
urlencode_postdata,
urljoin,
)
from ..utils.t... | Review this code and list any quality issues. | [
{
"issue": "`Request` sets this by default if `data` is passed\r\n```suggestion\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | out_patch = self.patch_transform(patch, **apply_args)
if self.with_coordinates and len(others) > 0: # patch_iter to yield at least 2 items: patch, coords
yield out_patch, others[0]
else:
yield out_patch
def __iter__(self):
if self.cache:
... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n else:\r\n if self._cache is None:\r\n raise RuntimeError(\"Cache buffer is not initialized, please call `set_data()` before epoch begins.\")\r\n data = self._cache[cache_index] # type: ignore\r\n ... | 1 |
python | def test_epoch_end(self, outputs):
final_value = 0
for dataloader_outputs in outputs:
for test_step_out in dataloader_outputs:
# do something
final_value += test_step_out
self.log... | Review this code and list any quality issues. | [
{
"issue": "mind update optimizer, lr_scheduler, and frequency with\r\n```\r\n``param``\r\n```\r\nabove",
"severity": "major",
"line": 26
}
] | 1 |
python | return get_conv_template("vicuna_v1.1")
def raise_warning_for_old_weights(self, model):
if isinstance(model, LlamaForCausalLM) and model.model.vocab_size > 32000:
warnings.warn(
"\nYou are probably using the old Vicuna-v0 model, "
"which will generate unexpected ... | Review this code and list any quality issues. | [] | 0 |
python | series = self.feature.load(instrument, start_index, end_index, freq)
return series.isnull()
class Cut(ElemOperator):
"""Cut Operator
Parameters
----------
feature : Expression
feature instance
l : int
l > 0, delete the first l elements of feature (default is None, which me... | Review this code and list any quality issues. | [
{
"issue": "The code is right, but it looks weird.\r\n`XXX is not YYYY` is preferred than `not XXX is YYYY`\r\n\r\nhttps://www.examtray.com/index.php/python/last-minute-python-operator-priority-precedence-examples-tutorial#:~:text=Python%20Operator%20Priority%20or%20precedence%20Each%20operator%20in,and%20eva... | 1 |
python | StorageClientManager._cloud_client = None
# Remove global configuration instance - it may contain settings adjusted by a previous test
Configuration._default_instance = None
# Clear creation-related caches to ensure no state is carried over between tests
monkeypatch.setattr(_creation_management, '_cac... | Review this code and list any quality issues. | [
{
"issue": "i was expecting to see just `storage_dir` here, the config options shouldn't be prefixed with `crawlee_`. or do we support both now?",
"severity": "minor",
"line": 26
}
] | 1 |
python | return False
def __iter__(self):
return LinkedListIterator(self.head)
def get_head_data(self):
if self.head:
return self.head.data
return None
def get_tail_data(self):
if self.tail:
return self.tail.data
return None
def set_head(self, n... | Review this code and list any quality issues. | [
{
"issue": "In the set_tail method, the check now uses self.tail instead of self.head. Please double-check that initializing both head and tail directly here does not bypass any additional logic present in set_head that might be important for maintaining list invariants.\n```suggestion\n self.set_hea... | 1 |
python | The default implementation always returns an empty list.
To support querying in a subclass, this must be implemented.
Args:
query: The tree-sitter Query to perform.
start_point: The (row, column byte) to start the query at.
end_point: The (row, column byte) to end t... | Review this code and list any quality issues. | [
{
"issue": "Could we provide a default implementation `return (0, 0)` here?",
"severity": "minor",
"line": 26
}
] | 1 |
python | call_count = Value("i", 0)
app = Dash(__name__)
ids = [
{"id": {"index": "1", "type": "test"}, "children": ["rawr"]},
{"id": "two", "children": "this is a test"},
{"id": "three", "children": "i see trees of green"},
]
app.layout = html.Div(
[
*[html.Div(id=... | Review this code and list any quality issues. | [] | 0 |
python | if sd_url:
sources.append((sd_url, 'sd'))
sources.append((hd_url, 'hd'))
formats = [{
'url': video_url,
'format_id': format_id,
'height': int_or_none(self._search_regex(
... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n 'width': int_or_none(media_json.get('width') or self._og_search_property('video:width', webpage, default=None)),\r\n 'height': int_or_none(media_json.get('height') or self._og_search_property('height', webpage, default=None)),\r\n```",
"severity": "minor",... | 1 |
python | else:
config = {}
provider = Provider(
provider_type=provider_type,
config=config,
provider_id=provider_type.split("::")[1],
)
provider_list.setdefault(api, []).app... | Review this code and list any quality issues. | [] | 0 |
python | from .common import InfoExtractor
from ..utils import (
int_or_none,
make_archive_id,
mimetype2ext,
parse_resolution,
str_or_none,
strip_jsonp,
traverse_obj,
url_or_none,
urlencode_postdata,
urljoin,
)
class WeiboBaseIE(InfoExtractor):
def _update_visitor_cookies(self, visi... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n headers=headers, transform_source=strip_jsonp,\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | """
logging_first_step: bool = field(
default=False,
metadata={"help": "Whether to log and evaluate the first global_step or not."},
)
"""Whether to log and evaluate the first global step.
If True, metrics will be logged and evaluation will be performed at the very
beginning of tra... | Review this code and list any quality issues. | [
{
"issue": "Instead of logging_steps I think we should set this to match the default save_steps",
"severity": "minor",
"line": 26
}
] | 1 |
python | @pytest.mark.usefixtures("current_request_with_host", "mock_setup_entry")
async def test_reauth_flow(
hass: HomeAssistant,
hass_client_no_auth: ClientSessionGenerator,
aioclient_mock: AiohttpClientMocker,
mock_config_entry: MockConfigEntry,
) -> None:
"""Test the reauthentication flow."""
mock_c... | Review this code and list any quality issues. | [] | 0 |
python | # Set max leverage to 0 so buying one share fails.
def handle_data(algo, data):
algo.order(algo.sid(self.sidint), 1)
algo.record(latest_time=algo.get_datetime())
algo = SetMaxLeverageAlgorithm(0, sim_params=self.sim_params,
env=self.env)
... | Review this code and list any quality issues. | [
{
"issue": "This comment doesn't match the test case.",
"severity": "minor",
"line": 26
}
] | 1 |
python | return default
return value if value.startswith("#") else default
metadata = _create_test_widget_metadata(
"widget_1",
value_type="string_value",
deserializer=color_deserializer,
serializer=lambda x: x,
)
seeded = self.session_state._... | Review this code and list any quality issues. | [
{
"issue": "This 'lambda' is just a simple wrapper around a callable object. Use that object directly.",
"severity": "minor",
"line": 26
}
] | 1 |
python | extract_metrics_from_output,
extract_spans_from_output,
get_parent_child_dict,
)
from tests_common.test_utils.version_compat import AIRFLOW_V_3_0_PLUS, AIRFLOW_V_3_1_PLUS
log = logging.getLogger("integration.otel.test_otel")
def wait_for_otel_collector(host: str, port: int, timeout: int = 120) -> None:
"... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\n with socket.create_connection((host, port), timeout=5):\n pass\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | def normalize_vision_tile_frame(vision_tile_frame : VisionFrame, tile_size : int) -> VisionFrame:
vision_tile_frame = vision_tile_frame.transpose(0, 2, 3, 1).squeeze(0) * 255
vision_tile_frame = vision_tile_frame.clip(0, 255).astype(numpy.uint8)[:,:,::-1]
vision_tile_frame = cv2.resize(vision_tile_frame, (tile_size,... | Review this code and list any quality issues. | [
{
"issue": "Undo this, must be done by accident",
"severity": "minor",
"line": 26
}
] | 1 |
python | """Add two RunUsages together.
This is provided so it's trivial to sum usage information from multiple runs.
"""
new_usage = copy(self)
new_usage.incr(other)
return new_usage
def _incr_usage_tokens(slf: RunUsage | RequestUsage, incr_usage: RunUsage | RequestUsage) -> None:
... | Review this code and list any quality issues. | [
{
"issue": "We don't need the `is not None` bit if we're already verifying the type :)",
"severity": "minor",
"line": 26
}
] | 1 |
python | self.get_param('ignore_no_formats_error') or self.get_param('wait_for_video')):
self.report_warning(msg, video_id)
elif isinstance(msg, ExtractorError):
raise msg
else:
raise ExtractorError(msg, expected=expected, video_id=video_id)
# Methods for following #608
... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n matches = variadic(matches)\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | branches = await service.get_branches(repository)
all_branches.extend(branches)
# If we found branches, no need to check other providers
if all_branches:
break
except Exception as e:
logger.warning(f'Error fetching branches ... | Review this code and list any quality issues. | [
{
"issue": "if this is unused then lets remove it (including the methods to get a branch in the service classes); besides this PR LGTM",
"severity": "minor",
"line": 26
}
] | 1 |
python | prompt_index = getattr(prompt_result, "prompt_index", i)
for prediction in predictions:
if isinstance(prediction, dict):
prediction_format = prediction.get("format")
if prediction_format and prediction_format != "polygon":
cont... | Review this code and list any quality issues. | [
{
"issue": "`full_mask = np.logical_or(full_mask, mask)` allocates a new array on every polygon. Consider using the `out=` parameter (and/or casting `mask` to bool once) to update `full_mask` in-place to reduce allocations when many polygons are returned.\n```suggestion\n mask = mask.astype(b... | 1 |
python | 'ext': 'mp3',
'duration': 1823,
'title': '#138 Nepilnīgā kompensējamo zāļu sistēma pat mēnešiem dzenā pacientus pa aptiekām',
'thumbnail': 'https://pic.latvijasradio.lv/public/assets/media/9/d/large_fd4675ac.jpg',
'upload_date': '20231102',
'timestamp': 169892... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n **traverse_obj(data, {\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | }, {
# Streams/Clips
'url': 'https://www.mzaalo.com/play/clip/83cdbcb5-400a-42f1-a1d2-459053cfbda5/Manto-Ki-Kahaaniya',
'md5': '9a20e6603c83a799543af8ec1a52d7ef',
'info_dict': {
'id': '83cdbcb5-400a-42f1-a1d2-459053cfbda5',
'title': 'Manto Ki Kahaaniya',
... | Review this code and list any quality issues. | [
{
"issue": "single-quote\r\n```suggestion\r\n formats, subtitles = self._extract_m3u8_formats_and_subtitles(data['streamURL'], video_id)\r\n```\r\n \r\nAlso, it looks like there aren't any subtitles to be extracted from the m3u8, but there are webvtt subtitles in the API JSON / `data` var, e.g.:\r\n... | 1 |
python | """
Specify `bundle workflow` to run monai bundle components and workflows.
Typical usage examples:
.. code-block:: bash
# Execute this module as a CLI entry with default ConfigWorkflow:
python -m monai.bundle run_workflow --meta_file <meta path> --config_file <config path>
# Set... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n workflow_class, has_built_in = optional_import(\"monai.bundle\", name=str(workflow_name)) # search built-in\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | from .common import ExtractorError, InfoExtractor
from ..utils import determine_ext, join_nonempty
from ..utils.traversal import traverse_obj
class PlayerFmIE(InfoExtractor):
_VALID_URL = r'https?://(?:www.)?player.fm/(?:series)?/[a-z\d-]+/(?P<id>[a-z\d-]+)'
_TESTS = [{
'url': 'https://player.fm/serie... | Review this code and list any quality issues. | [
{
"issue": "line too long. use regex\r\n\r\n```suggestion\r\n 'description': r're:The first episode of this season of Movie Mindset is free .+ we feel about it\\.',\r\n```",
"severity": "major",
"line": 16
}
] | 1 |
python | self.prune_dotgit_folder = False
else:
self.prune_dotgit_folder = prune_dotgit_folder
self._log = log.bind(
bundle_name=self.name,
version=self.version,
bare_repo_path=self.bare_repo_path,
repo_path=self.repo_path,
versions_path=se... | Review this code and list any quality issues. | [
{
"issue": "This is a bit blurry honestly... since we use the normal git binary, things like your system ssh keys can still be used for auth too. So there may be auth still, it just may not come from Airflow.",
"severity": "critical",
"line": 26
}
] | 1 |
python | args["tex_offsets"] = np.array(texture_offsets, np.int64)
args["mat_rgba"] = np.array(mat_rgbas, np.float32)
args["mat_tex_ids"] = np.array(mat_texture_indices, np.int32)
args["mat_tex_offsets"] = np.array(mat_texture_offsets, np.int32)
return args
# FIXME: Use a kernel to do it ef... | Review this code and list any quality issues. | [
{
"issue": "Keep everything on a single line.",
"severity": "minor",
"line": 26
}
] | 1 |
python | msg = msgspec.convert(msg_dict, type=Msg)
else:
# MessagePack format - internal LMCache communication
msg = msgspec.msgpack.decode(part, type=Msg)
if isinstance(msg, WorkerReqMsg):
ret_msg = await self.handle_worker_req_message... | Review this code and list any quality issues. | [
{
"issue": "f-string is deprecated, please change to use formatted string. @chunxiaozheng",
"severity": "minor",
"line": 26
}
] | 1 |
python | c = cfuncs.commonhooks[k]
else:
errmess(f'buildmodule: unknown need {repr(k)}.\n')
continue
code[n].append(c)
mod_rules.append(code)
for r in mod_rules:
if ('_check' in r and r['_check'](m)) or ('_check' not in r):
ar = applyrules(r, vr... | Review this code and list any quality issues. | [
{
"issue": "nit:\n\n```suggestion\n outmess(f' ReST Documentation is saved to file \"{fn}\"\\n')\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | df1["cat"] = df1["cat"].astype(CategoricalDtype(categories, ordered=ordered))
df2 = DataFrame({"id": [2, 4], "num": [1, 9]})
result = df1.merge(df2)
expected = DataFrame({"id": [2, 4], "cat": expected_categories, "num": [1, 9]})
expected["cat"] = expected["cat"].astype(
Categ... | Review this code and list any quality issues. | [
{
"issue": "Sorry one last comment. Could we make the data sizes smaller i.e. use 10 instead of 100?",
"severity": "minor",
"line": 26
}
] | 1 |
python | return self.workers.get(worker_id)
def get_worker_ids(self) -> list[int]:
"""Get sorted list of worker IDs."""
return sorted(self.workers.keys())
def has_workers(self) -> bool:
"""Check if instance has any workers."""
return len(self.workers) > 0
def get_all_worker_infos(s... | Review this code and list any quality issues. | [
{
"issue": "Can there be two vllm instances starting from the same ip?",
"severity": "minor",
"line": 26
}
] | 1 |
python | from .common import InfoExtractor
from ..networking.exceptions import HTTPError
from ..utils import (
ExtractorError,
parse_iso8601,
str_or_none,
traverse_obj,
UserNotLive,
url_or_none,
)
class FlexTVIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?flextv\.co\.kr/channels/(?P<id>\d+)/l... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n ExtractorError,\r\n UserNotLive,\r\n parse_iso8601,\r\n str_or_none,\r\n traverse_obj,\r\n```",
"severity": "major",
"line": 8
}
] | 1 |
python | def test_health(self, llama_stack_client: LlamaStackAsLibraryClient | LlamaStackClient):
health = llama_stack_client.inspect.health()
assert health is not None
assert health.status == "OK"
@pytest.mark.skip(reason="inspect tests disabled")
def test_version(self, llama_stack_client: Llam... | Review this code and list any quality issues. | [] | 0 |
python | async def async_setup_entry(
hass: HomeAssistant,
config_entry: ConfigEntry,
async_add_entities: AddConfigEntryEntitiesCallback,
) -> None:
"""Set up the notification entity platform."""
json_path = hass.config.path(REGISTRATIONS_FILE)
registrations = await hass.async_add_executor_job(_load_con... | Review this code and list any quality issues. | [
{
"issue": "entity description doesn't add much as it's just setting translation key and name",
"severity": "minor",
"line": 26
}
] | 1 |
python | # Licensed under the MIT License.
from contextlib import contextmanager
from typing import Text, Optional
from .expm import MLflowExpManager
from .exp import Experiment
from .recorder import Recorder
from ..utils import Wrapper
class QlibRecorder:
"""
A global system that helps to manage the experiments.
... | Review this code and list any quality issues. | [
{
"issue": "You change the order of the parameters. \r\nThis is not compatible with the previous version.\r\nYou can use https://python-3-for-scientists.readthedocs.io/en/latest/python3_advanced.html to raise error when receiving non-keyward arguments to help users debug.",
"severity": "critical",
"li... | 1 |
python | 'platform': 'android',
'grant_type': 'urn:ietf:params:oauth:grant-type:token-exchange'
})['access_token']
playback = self._download_json(
video_data['videoHref'].format(scenario='browser~ssai'), video_id,
headers={
'Acc... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n formats, subtitles = self._extract_m3u8_formats_and_subtitles(m3u8_url, video_id, 'mp4', m3u8_id='hls')\r\n```",
"severity": "major",
"line": 26
}
] | 1 |
python | """Representation of a Bond light."""
def __init__(
self,
data: BondData,
device: BondDevice,
sub_device: str | None = None,
) -> None:
"""Create HA entity representing Bond light."""
super().__init__(data, device, sub_device)
if device.supports_set_brigh... | Review this code and list any quality issues. | [] | 0 |
python | texs + ""
self.set_color_by_tex(texs, color, **kwargs)
except TypeError:
# If the given key is a tuple
for tex in texs:
self.set_color_by_tex(tex, color, **kwargs)
return self
def index_of_part(self, part):
split_self =... | Review this code and list any quality issues. | [
{
"issue": "Just format it so that Sphinx can parse it a little bit more nicely :)\r\n```suggestion\r\n r\"\"\"A string compiled with LaTeX in normal mode.\r\n \r\n The color can be set using\r\n the ``color`` argument. Any parts of the ``tex_string`` that are colored by the\r\n TeX commands ``\\... | 1 |
python | "use_pretrain": False,
"pretrained_path": "",
"determ": True,
}
if torch.cuda.is_available()
else {}
)
pred_param = {"files_slices": slice(0, 1), "mode": "mean", "sigmoid": True}
@skip_if_quick
@SkipIfBeforePyTorchVersion((1, 9, 1))
@unittest.skipIf(not has_tb, "no tensorboard summary wri... | Review this code and list any quality issues. | [] | 0 |
python | ATTR_PRICE_CAP: Final = "price_cap"
SERVICE_LIST_CHARGE_SLOTS = "list_charge_slots"
SERVICE_LIST_CHARGE_SLOTS_SCHEMA: Final = vol.Schema(
{
vol.Required(ATTR_CONFIG_ENTRY): selector.ConfigEntrySelector(
{
"integration": DOMAIN,
}
),
}
)
SERVICE_SET_PRICE... | Review this code and list any quality issues. | [] | 0 |
python | if target:
# If the target function is given, it may return
# several columns and hence we cannot check the availability of columns
# without knowing target function semantics.
# Instead, here we will validate the columns, taken by target.
_validate_input_data_for_evaluator(... | Review this code and list any quality issues. | [
{
"issue": "Probably a dumb question: Can we directly pass the function to the `flow` param?",
"severity": "minor",
"line": 26
}
] | 1 |
python | video_id = self._search_regex(r'\bvId\s*=\s*(\d+)', webpage, 'video id')
video_exp = self._search_regex(r'\bvEx\s*=\s*["\'](\d+)', webpage, 'video expiry')
video_hashes = self._search_json(
r'\bvHash\s*=\s*', webpage, 'video hashes', video_id,
contains_pattern=r'\[.+\]', transfor... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n 'title': (self._og_search_title(webpage, default=None)\r\n or remove_end(self._html_extract_title(webpage, 'title'), ' - Mojevideo')),\r\n```",
"severity": "major",
"line": 26
}
] | 1 |
python | 'id': 'urn:dr:mu:programcard:57c926176187a50a9c6e83c6',
'ext': 'mp4',
'title': 'christiania pusher street ryddes drdkrjpo',
'description': 'md5:2a71898b15057e9b97334f61d04e6eb5',
'timestamp': 1472800279,
'upload_date': '20160902',
'duration': 131.4... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n 'season_id': 'urn:dr:mu:bundle:5afc03ad6187a4065ca5fd35',\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | ),
SubModuleReplacementDescription(
suffix="output.dropout",
target_module=Dropout1D,
),
# SubModuleReplacementDescription(
# suffix="layernorm_before",
... | Review this code and list any quality issues. | [
{
"issue": "Remove these lines. Do not push lines which are commented out.",
"severity": "minor",
"line": 26
}
] | 1 |
python | 'ext': 'mp4',
'title': 'FOX CLASSICS - Forever Classic ID - A Full Minute',
'uploader': 'The DMCI',
'uploader_id': 4719020,
'timestamp': 1324361742,
'upload_date': '20111220',
'release_date': '20111220',
'rel... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n 'uploader_id': 'frameworkla',\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | class ADNIE(ADNBaseIE):
_VALID_URL = r'https?://(?:www\.)?(?:animation|anime)digitalnetwork\.com/(?:(?P<lang>de)/)?video/[^/?#]+/(?P<id>\d+)'
_TESTS = [{
'url': 'https://animationdigitalnetwork.com/video/558-fruits-basket/9841-episode-1-a-ce-soir',
'md5': '1c9ef066ceb302c86f80c2b371615261',
... | Review this code and list any quality issues. | [
{
"issue": "The old url was testing the match for `animedigitalnetwork.com` rather than `animationdigitalnetwork.com`. Does the `anime` domain still work?",
"severity": "minor",
"line": 26
}
] | 1 |
python | num_classes: number of classes (default: None, computes automatically from data)
Return:
Tensor containing ROCAUC score
Example:
>>> pred = torch.tensor([[0.85, 0.05, 0.05, 0.05],
... [0.05, 0.85, 0.05, 0.05],
... [0.05, 0.05, 0.85, 0.... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n f\"Number of classes found in in 'target' ({torch.unique(target).size(0)})\"\r\n f\" does not equal the number of columns in 'pred' ({pred.size(1)}).\"\r\n \" Multiclass AUROC is not defined when all of the classes do not\"\r\n \" occur i... | 1 |
python | sess.rollback() # Rollback the current batch if there's an error
raise
except Exception as e:
log_error(f"Error upserting documents: {e}")
raise
def update_metadata(self, content_id: str, metadata: Dict[str, Any]) -> None:
"""
Update the meta... | Review this code and list any quality issues. | [
{
"issue": "Did we always have JSONB here? if we introduced them in the last migration this won't be backwards compatible, we should at minimum log a warning announcing a migration is required",
"severity": "minor",
"line": 26
}
] | 1 |
python | 0.5,
"constant",
1.0,
"constant",
0.0,
device,
device,
has_tqdm,
None,
None,
None,
0,
t1,
test2=t2,
)
expected = np.ones((1, 1, 3, 3)) + 2.0
... | Review this code and list any quality issues. | [
{
"issue": "suggest to write like:\r\n\r\n```\r\nrand_input = torch.ones((1, 6, 20, 20))\r\nfor inputs in [rand_input, MetaTensor(rand_input)]:\r\n inputs = inputs.to(device=device)\r\n ....\r\n```\r\nThe test should still cover the tensor input case.",
"severity": "minor",
"line": 26
}
] | 1 |
python | if [f.get('width'), f.get('height')] == _QUALITY.get(tbr):
format_copy[1] = f.copy()
format_copy[1]['tbr'] = tbr
# prefer format with similar bitrate because there might be
# multiple video with the same resolution but different bitrate
format... | Review this code and list any quality issues. | [
{
"issue": "Isn't this what `IE._check_formats()`/`IE._is_valid_url()` are for?",
"severity": "minor",
"line": 26
}
] | 1 |
python | url = f'http://{blog}.tumblr.com/post/{video_id}/'
webpage, urlh = self._download_webpage_handle(url, video_id)
redirect_url = urlh.geturl()
api_only = bool(self._search_regex(
r'(tumblr.com|^)/(safe-mode|login_required|blog/view)',
redirect_url, 'redirect', default=Non... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n content_json = traverse_obj(post_json, ('trail', 0, 'content'), 'content') or []\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | optimizers = [optimizers[0]]
# loop over optimizers
for opt_idx, optimizer in optimizers:
# make sure only the gradients of the current optimizer's parameters are calculated
# in the training step to prevent dangling gradients in multiple-optimizer setup.
... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n self.trainer.model.no_sync.__exit__()\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | changed = False
def __init__(
self,
anim: Animation | _AnimationBuilder,
speedinfo: dict[float, float],
rate_func: Callable[[float], float] | None = None,
**kwargs,
) -> None:
self.anim = self.setup(anim)
if issubclass(type(anim), AnimationGroup):
... | Review this code and list any quality issues. | [
{
"issue": "I think it would be worth it to rename m and n so that their variable names reflect their actual purpose. This makes the code more maintainable.\r\n\r\n```suggestion\r\n self.speed_modifier = (\r\n lambda x, initial_speed, final_speed: (final_speed**2 - initial_speed**2) * x**2 / 4... | 1 |
python | return engine
else:
error = 'load_engine() failed!'
raise ValueError(error)
except Exception as e:
error = f'load_engine() error: {e}'
raise ValueError(error)
def convert(self, sentence_index:int, sentence:str)->bool:
try:
... | Review this code and list any quality issues. | [
{
"issue": "Using 'bool' as a variable name shadows Python's built-in 'bool' type, which can cause confusion and potential issues. Consider renaming this variable to something more descriptive like 'success', 'result', or 'is_valid'.",
"severity": "minor",
"line": 26
}
] | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.