language
string
code-snippit
string
instruction
string
flaws
list
flaw_count
int64
python
def construct_model_from_line(model: Type[BaseModel], line: List[str]) -> BaseModel: origin = get_origin(model) # If the model is of type Optional[X], unwrap it to get X if origin is Union: # If the model is of type Optional[X], unwrap ...
Review this code and list any quality issues.
[ { "issue": "use thr fastapi status codes and not plain numbers", "severity": "minor", "line": 26 } ]
1
python
and self.chapters == other.chapters and self.ranges == other.ranges) def __repr__(self): return f'{__name__}.{type(self).__name__}({self.chapters}, {self.ranges})' def parse_dfxp_time_expr(time_expr): if not time_expr: return mobj = re.match(rf'^(?P<time_offset>{NUMBER_RE})s?$', time_exp...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n return '{:01.0f}:{:02.0f}:{:02.0f}.{:02.0f}'.format(*time[:-1], time.milliseconds / 10)\r\n```", "severity": "minor", "line": 26 } ]
1
python
self.dummy_outputs = None self.current_step = -1 self.state_manager.reset() def new_forward(self, module: torch.nn.Module, *args, **kwargs): state: TaylorSeerState = self.state_manager.get_state() state.current_step += 1 current_step = state.current_step is_warmup_ph...
Review this code and list any quality issues.
[ { "issue": "Do we actually need to pass `current_step` here or even in `state.update`? The state already tracks it internally right?", "severity": "minor", "line": 26 } ]
1
python
'episode_id': '267851', 'episode_number': 1, 'title': '1 残酷', 'duration': 1425.256, 'timestamp': 1554566400, 'upload_date': '20190406', 'thumbnail': r're:^https?://.*\.(jpg|jpeg|png)$' }, 'skip': 'According to the copyright owner\'s...
Review this code and list any quality issues.
[ { "issue": "- add a `headers` var since we're using the same headers multiple times\r\n - use `episode_id` in the query\r\n```suggestion\r\n headers = {'Referer': url, **self.geo_verification_headers()}\r\n play_info = self._download_json(\r\n 'https://api.bilibili.com/pgc/player/web/v2...
1
python
_converter: Callable[[Any], float] = float def __init__(self, hass: HomeAssistant, config: TriggerConfig) -> None: """Initialize the state trigger.""" super().__init__(hass, config) self._above = self._options.get(CONF_ABOVE) self._below = self._options.get(CONF_BELOW) def is_v...
Review this code and list any quality issues.
[ { "issue": "This change converts valid Python 3 syntax to deprecated Python 2 syntax. In Python 3, multiple exceptions must be caught using parentheses: `except (ExceptionA, ExceptionB):`. The Python 2 syntax `except ExceptionA, ExceptionB:` is not valid in Python 3 and will cause a syntax error. This line shou...
1
python
class QdrantStore(BaseStore): def __init__(self, connect: QdrantConnection): if connect.memory: self.client = QdrantClient(":memory:") elif connect.url: self.client = QdrantClient(url=connect.url, api_key=connect.api_key) elif connect.host and connect.port: ...
Review this code and list any quality issues.
[ { "issue": "In order to clarify, it is necessary to provide the definition or annotations for the input parameters.", "severity": "minor", "line": 26 } ]
1
python
def _entries(self, base_url, playlist_id, session_list_id): session_list_info = self._call_api( base_url, f'/Api/SessionLists/{session_list_id}?collections[0].maxCount=500&collections[0].name=ViewableItemsOnly', playlist_id) items = session_list_info['Items'] if len(items) == 500: ...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n base_url, playlist_id = self._match_valid_url(url).group('base_url', 'id')\r\n```", "severity": "minor", "line": 26 } ]
1
python
return cls T = TypeVar('T', bound='_FunctionWithSchema') class _FunctionWithSchema(NamedTuple): fn: Callable request_schema: Type[DocumentArray] = DocumentArray response_schema: Type[DocumentArray] = DocumentArray @staticmethod def get_function_with_schema(fn: Callable) -> T: docs_anno...
Review this code and list any quality issues.
[ { "issue": "Maybe u can add something specific to `Optional` that would be the most common usecase", "severity": "minor", "line": 26 } ]
1
python
Returns: The latest submission created from _scenario_, _sequence_ and _task_, or None if no submission has been created from _scenario_, _sequence_ and _task_. """ return _SubmissionManagerFactory._build_manager()._get_latest(entity) def get_data_nodes() -> List[DataNode]: """Return all t...
Review this code and list any quality issues.
[ { "issue": "Is it possible to make the config optional?\r\nIf no config is passed, we just return True (an empty Reason). The false part will be implemented with the role management in Enterprise Edition.\r\n\r\nSo the API can be used for a specific config, or globally.\r\n\r\nWhat do you think?", "severity...
1
python
self._request_webpage('https://nubiles-porn.com/authentication/login', None, data=urlencode_postdata(inputs)) def _real_extract(self, url): url_match = self._match_valid_url(url) video_id = url_match.group('id') page = self._download_webpage(url, video_id) media_entries = self._par...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n 'channel_url': format_field(channel_id, None, 'https://members.nubiles-porn.com/video/website/%s'),\r\n```", "severity": "minor", "line": 26 } ]
1
python
if os.environ.get('PL_GLOBAL_SEED') is None and 'PL_GLOBAL_SEED' in env_copy: del env_copy['PL_GLOBAL_SEED'] # start process # if hydra is available and initialized, make sure to set the cwd correctly cwd: Optional[str] = None if HYDRA_AVAILABLE: ...
Review this code and list any quality issues.
[ { "issue": "@awaelchli it seems there is no restore anywhere else... so how is it possible it passes on master now?", "severity": "minor", "line": 26 } ]
1
python
) return result def convert_to_svg(dvi_file, extension, page=1): """Converts a .dvi, .xdv, or .pdf file into an svg using dvisvgm. Parameters ---------- dvi_file : :class:`Path` File name of the input file to be converted. extension : :class:`str` String containing the file ex...
Review this code and list any quality issues.
[ { "issue": "I think this change should be made separately (along with refactoring the variable name from `dvi_file` to something that captures that the file can be an xdv or pdf as well).\r\n\r\n```suggestion\r\n \"--pdf\" if extension == \".pdf\" else \"\",\r\n```", "severity": "major", "lin...
1
python
UserMemory( memory_id=memory_id, user_id=user_id, agent_id=agent_id, team_id=team_id, memory=memory, topics=topics, input=in...
Review this code and list any quality issues.
[ { "issue": "In addition we should probably improve the instructons?", "severity": "minor", "line": 26 } ]
1
python
if url_parts is None: # page is not routable return site_id, root_url, page_path = url_parts return Site.objects.get(id=site_id) @classmethod def get_indexed_objects(cls): content_type = ContentType.objects.get_for_model(cls) return super().get_indexed_...
Review this code and list any quality issues.
[ { "issue": "Shouldn’t this have logic to account for `private_page_options`? Avoid defaulting to `public` if it’s not in the list of allowed options?", "severity": "minor", "line": 26 } ]
1
python
_df = self.data_merge_calendar(df, calendar_list) # used when creating a bin file date_index = self.get_datetime_index(_df, calendar_list) for field in self.get_dump_fields(_df.columns): bin_path = features_dir.joinpath(f"{field}.{self.freq}{self.DUMP_FILE_SUFFIX}") if fi...
Review this code and list any quality issues.
[]
0
python
def config(self, dump_all: bool = None, exclude: list = None, recursive=False): """ configure the serializable object Parameters ---------- dump_all : bool will the object dump all object exclude : list What attribute will not be dumped re...
Review this code and list any quality issues.
[]
0
python
Note: This only works with StreamReaderProtocol (used by the streams API). Custom Protocol implementations that buffer data must handle this manually before calling start_tls(). """ if not hasattr(protocol, '_stream_reader'): return stream_reader = protocol._stream_r...
Review this code and list any quality issues.
[ { "issue": "Wouldn't it make sense to transfer the buffer after reading is paused rather than before?", "severity": "minor", "line": 26 } ]
1
python
model_config=self.vllm_config.model_config, ) if self.lora_config: self.model = self.load_lora_model( self.model, self.vllm_config, self.device ) if self.use_aux_hidden_state_outputs: assert self.speculative_config ...
Review this code and list any quality issues.
[ { "issue": "Just an idea: Instead of `set_model`, could have model in the `ModelState` constructor and construct it here rather than in model runner constructor. So then init of `ModelState` itself is more atomic/complete.", "severity": "minor", "line": 26 } ]
1
python
def _call_api(self, endpoint, display_id, data=None, headers=None, query=None): return self._download_json(Request( f'https://api.m.sooplive.co.kr/{endpoint}', data=data, headers=headers, query=query, extensions={'legacy_ssl': True}), display_id, 'Downloading API ...
Review this code and list any quality issues.
[ { "issue": "Revert; changing dead URLs to non-existent URLs doesn't make sense. If this type of URL doesn't exist anymore then we should just remove these tests entirely\r\n\r\n```suggestion\r\n 'url': 'http://live.afreecatv.com:8079/app/index.cgi?szType=read_ucc_bbs&szBjId=dailyapril&nStationNo=16711924...
1
python
divnorm = colors.TwoSlopeNorm(vmin=-500., vcenter=0, vmax=4000) pcm = ax.pcolormesh(longitude, latitude, topo, rasterized=True, norm=divnorm, cmap=terrain_map, shading='auto') # Simple geographic plot, set aspect ratio because distance between lines of # longitude depends on latitude. ax.set_aspect...
Review this code and list any quality issues.
[ { "issue": "This is not currently grammatically correct and you refer to \"TwoSlopeNorm segments\". Norms cannot have segments, it is the colormap that has segments. Maybe:\n\n\n```suggestion\n# By default, colorbars adopt the same axis scaling as their associated norm. \n# For example, for a `.TwoSlopeNorm...
1
python
from ..utils import ExtractorError, traverse_obj class CamsodaIE(InfoExtractor): _VALID_URL = r'https?://www\.camsoda\.com/(?P<id>[0-9A-Za-z-]+)' _TESTS = [{ 'url': 'https://www.camsoda.com/lizzhopf', 'info_dict': { 'id': 'lizzhopf', 'ext': 'mp4', 'title': '...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n webpage = self._download_webpage(url, video_id, headers=self.geo_verification_headers())\r\n\r\n data = self._download_json(\r\n f'https://camsoda.com/api/v1/video/vtoken/{video_id}', video_id,\r\n query={'username': f'guest_{random.randrange(100...
1
python
config_path=dict(section='core', name='worker-wait-interval')) wait_jitter = FloatParameter(default=5.0) max_keep_alive_idle_duration = TimeDeltaParameter(default=datetime.timedelta(0)) max_reschedules = IntParameter(default=1, config_path=dict(section='core', name='work...
Review this code and list any quality issues.
[ { "issue": "i don't see the reason to allow this to be included in the legacy `core` section with alt name. I'd recommend just removing the config_path option and force the inclusion of `check_complete_on_run` in a `[worker]` section.", "severity": "minor", "line": 26 } ]
1
python
await kvs.set_value('key1', 'value1') await kvs.set_value('key2', 'value2') # Verify they exist assert await kvs.record_exists('key1') is True assert await kvs.record_exists('key2') is True # Purge the store await kvs.purge() # Should no longer exist assert await kvs.record_exists('ke...
Review this code and list any quality issues.
[]
0
python
# Form / Combobox / Trigger # To handle live changes to a #combobox, enable the `trigger` attribute. # #combobox #trigger # --- from h2o_wave import main, app, Q, ui combobox_choices = ['Cyan', 'Magenta', 'Yellow', 'Black'] def get_form_items(choice: str): return [ ui.combobox(name='combobox', trigger=Tr...
Review this code and list any quality issues.
[]
0
python
if self.get_usetex(): if s == " ": s = r"\ " return s, "TeX" elif not self.get_parse_math(): return s, False elif cbook.is_math_text(s): return s, True else: return s.replace(r"\$", "$"), False def set_fontpropertie...
Review this code and list any quality issues.
[ { "issue": "Possibly we should shorten to\r\n\r\n```suggestion\r\n @_docstring.kwdoc(\"bool, default: :rc:`text.usetex`\")\r\n```\r\n\r\nWe can always change the decorator to a more generic name when we start providing further information.", "severity": "minor", "line": 26 } ]
1
python
def _split_symbol_mappings(df, exchanges): """Split out the symbol: sid mappings from the raw data. Parameters ---------- df : pd.DataFrame The dataframe with multiple rows for each symbol: sid pair. exchanges : pd.DataFrame The exchanges table. Returns ------- asset_in...
Review this code and list any quality issues.
[ { "issue": "Is there a place we can add a quick test for this behavior?", "severity": "minor", "line": 26 } ]
1
python
return threads_map except psutil.NoSuchProcess: return {} def get_cpu_affinity(pid: int) -> list: """Get CPU affinity for a thread.""" return psutil.Process(pid).cpu_affinity() def set_cpu_affinity(pid: int, cpulist: list) -> list: """Set CPU affinity for a thread.""" real_cpulist = list...
Review this code and list any quality issues.
[ { "issue": "why do we need `super()` here? we're not overwriting any methods :thinking: \r\n\r\n```suggestion\r\n for pthread in self.threads():\r\n```", "severity": "minor", "line": 26 } ]
1
python
# # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing per...
Review this code and list any quality issues.
[ { "issue": "can we ask user to pass in the endpoint and region. they should be same as credentials. We can not fix it here. We already have cluster setup for other regions", "severity": "critical", "line": 26 } ]
1
python
'season_number': 1, 'episode_number': 4, 'thumbnail': str, 'duration': 1653, 'age_limit': 0, }, }, { 'url': 'https://maraya.sba.net.ae/en/episode/127735', 'info_dict': { 'id': 'maraya.faul...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n },\r\n }]\r\n```", "severity": "minor", "line": 26 } ]
1
python
python_package_name (str): The name of the python package. example_pipeline (str): 'True' if example pipeline was selected """ if "Linting" not in selected_tools_list: _remove_from_file(requirements_file_path, lint_requirements) _remove_from_toml(pyproject_file_path, lint_pyproject_requi...
Review this code and list any quality issues.
[ { "issue": "We also need to do this when there's no example chosen, but also no `pyspark` or viz right? https://github.com/kedro-org/kedro-starters/blob/main/spaceflights-pandas/%7B%7B%20cookiecutter.repo_name%20%7D%7D/requirements.txt", "severity": "minor", "line": 26 } ]
1
python
init_tmp_socket: zmq.Socket, init_side_msg: InitSideMsgBase, ) -> InitSideRetMsgBase: """ Async version of send_init_side_msg. """ init_msg_bytes = msgspec.msgpack.encode(init_side_msg) await init_tmp_socket.send(init_msg_bytes) init_ret_msg_bytes = await ini...
Review this code and list any quality issues.
[]
0
python
import capa.features.extractors.viv.function import capa.features.extractors.viv.basicblock from capa.features.common import Feature from capa.features.address import Address, AbsoluteVirtualAddress from capa.features.extractors.base_extractor import BBHandle, InsnHandle, FunctionHandle, FeatureExtractor logger = logg...
Review this code and list any quality issues.
[]
0
python
from .ninegag import NineGagIE from .ninenow import NineNowIE from .nintendo import NintendoIE from .nitter import NitterIE from .njpwworld import NJPWWorldIE from .nobelprize import NobelPrizeIE from .nonktube import NonkTubeIE from .noodlemagazine import NoodleMagazineIE from .noovo import NoovoIE from .normalboots i...
Review this code and list any quality issues.
[]
0
python
Returns: The loss of the model along with its output if return_outputs was set to True """ # DeepSpeed SP automatically injects shift_labels into inputs (pre-shifted labels for SP). # The model's forward pass receives shift_labels via **kwargs and passes it to the loss function. ...
Review this code and list any quality issues.
[ { "issue": "Maybe switch the order so that we first check if we are using deepspeed ? I'm afraid of silent bug where `torch_device_mesh` is actually defined.", "severity": "critical", "line": 26 } ]
1
python
if not player_url: continue signature = self._decrypt_signature(sc['s'][0], video_id, player_url) sp = try_get(sc, lambda x: x['sp'][0]) or 'signature' fmt_url += '&' + sp + '=' + signature if itag: itags.append(itag) ...
Review this code and list any quality issues.
[]
0
python
'url': 'https://utexas.app.box.com/s/2x6vanv85fdl8j2eqlcxmv0gp1wvps6e', 'info_dict': { 'id': '787379022466', 'ext': 'mp4', 'title': 'Webinar recording: Take the Leap!.mp4', 'uploader': 'Patricia Mosele', 'timestamp': 1615824864, 'upload_dat...
Review this code and list any quality issues.
[ { "issue": "use `traverse_obj` so we don't throw during error handling (which should be `expected=True`, right?)\r\n\r\nthen let's intentionally KeyError if there's no `itemID`, since we need it for the next request\r\n```suggestion\r\n shared_item = traverse_obj(post_stream_data, ('/app-api/endusera...
1
python
""" Approximates all complex roots of a polynomial using the Weierstrass (Durand-Kerner) method. Args: polynomial: A function that takes a NumPy array of complex numbers and returns the polynomial values at those points. degree: Degree of the polynomial (number of roots t...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n >>> np.allclose(np.sort(roots), np.array([-1, 1]))\r\n```", "severity": "minor", "line": 26 } ]
1
python
def docs_group(group_name: str) -> None: pass
Review this code and list any quality issues.
[ { "issue": "This likely breaks all the code and needs fixing. \r\n\r\nAll the \"noop\" decorator approaches (that work for both classes and functions) I found had way too many lines - definitely more than I'm comfortable with changing :) \r\n\r\nCan one of you Python whizzes fix this please? (cc @vdusek @Pijuka...
1
python
group=anim.group, run_time=anim.run_time, rate_func=anim.rate_func, lag_ratio=anim.lag_ratio, ) else: self.anim = self.setup(anim) if affects_speed_updaters: assert ( ChangeSpeed.is_changing_dt is False ...
Review this code and list any quality issues.
[ { "issue": "Ugh, one of the cases where I really dislike the auto-formatting of black. Here is another version that I think is better in terms of readability:\r\n\r\n```suggestion\r\n self.speed_modifier = lambda x, init_speed, final_speed: (\r\n (final_speed**2 - init_speed**2) * x**2 / 4 + i...
1
python
# before being checked against. blocklist = [ # Not performance sensitive, so save bytes + compilation time: "blib2to3/__init__.py", "blib2to3/pgen2/__init__.py", "black/output.py", "black/concurrency.py", "black/files.py", "black/report.py", # Breaks ...
Review this code and list any quality issues.
[]
0
python
fd, path = tempfile.mkstemp( prefix='.kubeconfig', dir=self.private_data_dir ) with open(path, 'wb') as temp: temp.write(yaml.dump(self.pod_manager.kube_config).encode()) temp.flush() os.chmod(temp.name, stat.S_IRUSR | stat.S_IWUSR ...
Review this code and list any quality issues.
[ { "issue": "We should rename this variable now that it's being used for more than just inventory plugins.", "severity": "minor", "line": 26 } ]
1
python
), ( InternalServerError( message=None, response=Response( status_code=500, request=Request(method="POST", url=URL()), ), body=None, ), "unknown", ), ( ...
Review this code and list any quality issues.
[ { "issue": "`test_api_error` now continues the flow until `CREATE_ENTRY`, which will trigger config entry setup. Since this test does not use the `mock_setup_entry` fixture (unlike `test_form` / `test_reauth`), it will call the real `homeassistant.components.anthropic.async_setup_entry`, which performs an API c...
1
python
self._priv_key = ECKey() self._priv_key.set((1).to_bytes(32, 'big'), True) pub_key = self._priv_key.get_pubkey() self._scriptPubKey = key_to_p2pk_script(pub_key.get_bytes()) elif mode == MiniWalletMode.ADDRESS_OP_TRUE: internal_key = None if tag_name is None else ...
Review this code and list any quality issues.
[ { "issue": "style nit: Could use the more specific `RuntimeError` to clarify this is a programming error?", "severity": "minor", "line": 26 } ]
1
python
) self._has_finished = True raise ex from None if self._pending_meta_ref.is_nil(): # We have a reference to the block but the metadata isn't ready # yet. break self._metadata_re...
Review this code and list any quality issues.
[ { "issue": "@machichima as someone who presumably doesn't have a lot of context on this, can you easily understand this warning message? If not, what's unclear or missing?", "severity": "minor", "line": 26 } ]
1
python
prompt_str = get_prompt_template(input_query, history=history, roles=roles) eos_token_id = [tokenizer.eos_token_id] inputs = tokenizer(prompt_str, return_tensors="pt").to(model.device) history.append({"role": roles[1], "message": input_query.strip()}) history.append({"role": roles[2], "message": Non...
Review this code and list any quality issues.
[ { "issue": "Better to change to `stream_generate` to show diff between original generate.", "severity": "minor", "line": 26 } ]
1
python
approximation but more compute. taylor_factors_dtype (`torch.dtype`, defaults to `torch.bfloat16`): Data type for computing Taylor series expansion factors. Use lower precision to reduce memory usage. Use higher precision to improve numerical stability. skip_identifiers (`List[...
Review this code and list any quality issues.
[ { "issue": "I think the purpose of this parameter is a bit more clear if we call it something like `disable_cache_after_step`", "severity": "major", "line": 26 } ]
1
python
from homeassistant.exceptions import HomeAssistantError from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback from .const import DOMAIN from .coordinator import FlexitConfigEntry, FlexitCoordinator from .entity import FlexitEntity @dataclass(kw_only=True, frozen=True) class FlexitSwitchEnt...
Review this code and list any quality issues.
[ { "issue": "Is it possible to keep the switch and deprecate it instead of removing?\r\n(disabled by default/warn if enabled)", "severity": "minor", "line": 26 } ]
1
python
'channel': 'Flooxer', 'duration': 1196, 'thumbnail': 'https://imagenes.atresplayer.com/atp/clipping/cmsimages01/2025/02/14/17CF90D3-FE67-40C5-A941-7825B3E13992/1920x1080.jpg', 'tags': ['Juvenil', 'Terror', 'Piel de gallina', 'Te sigo', 'Un break', 'Del tirón'], 'series': ...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n 'Logging in', 'Failed to log in', data=urlencode_postdata({\r\n```", "severity": "critical", "line": 26 } ]
1
python
strict=ALL_BUT_LAST) self.assertRaises(OSError, ntpath.realpath, ntpath.basename(ABSTFN), strict=True) @os_helper.skip_unless_symlink @unittest.skipUnless(HAVE_GETFINALPATHNAME, 'need _getfinalpathname') def test_realpath_symlink_loops_raise(self): # Symlink loops ...
Review this code and list any quality issues.
[]
0
python
if self.get_param('noplaylist'): self.to_screen(f'Downloading just video {video_id} because of --no-playlist') else: return self.playlist_result( self._entries(video, next_video_id), **traverse_obj(video, { 'id':...
Review this code and list any quality issues.
[ { "issue": "I don't understand why you are fully extracting the entries here. This breaks `--flat-playlist`.", "severity": "major", "line": 26 } ]
1
python
from .common import InfoExtractor class MatchTVIE(InfoExtractor): _VALID_URL = [ r'https?://matchtv\.ru/on-air', r'https?://video\.matchtv\.ru/iframe/channel/106', ] _TESTS = [{ 'url': 'http://matchtv.ru/on-air/', 'info_dict': { 'id': 'matchtv-live', ...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n r'data-config=\"config=(https?://[^?\"]+)[?\"]', webpage, 'video URL').replace('/feed/', '/media/') + '.m3u8'\r\n```", "severity": "minor", "line": 26 } ]
1
python
import contextlib import copy import gc import math import random import re import warnings from contextlib import contextmanager from typing import Any, Dict, Iterable, List, Optional, Tuple, Union, Set, Type import numpy as np import torch import torch.distributed as dist from torch.distributed.fsdp import CPUOffloa...
Review this code and list any quality issues.
[ { "issue": "We should guard this like so:\r\n\r\n```\r\nif getattr(torch, \"distributed\", None) is not None:\r\n import torch.distributed as dist\r\n```\r\n\r\nSame for FSDP.", "severity": "minor", "line": 16 } ]
1
python
break else: assert False, "Aggregate pubkey for pubnonce not seen as output key, or in any scripts" else: assert False, "Aggregate pubkey for pubnonce not seen as output key or internal key" # Add partial sigs psig_psbts = [] for i...
Review this code and list any quality issues.
[ { "issue": "In c7c9dc2d8634bc79e76783be113f8d42cee63c6e \"test: Add musig failure scenarios\"\r\n\r\nNit: extra blank line", "severity": "critical", "line": 26 } ]
1
python
from ..mobject.types.vectorized_mobject import VGroup __all__ = ["AnimationGroup", "Succession", "LaggedStart", "LaggedStartMap"] DEFAULT_LAGGED_START_LAG_RATIO: float = 0.05 class AnimationGroup(Animation): """Plays a group or series of :class:`~.Animation`. Parameters ---------- animations ...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n ``n.nn`` means the next animation will play when ``nnn%`` of the current animation has played.\r\n```", "severity": "minor", "line": 26 } ]
1
python
return self._into_message_param() def _into_message_param(self) -> chat.ChatCompletionAssistantMessageParam: """Converts the collected texts and tool calls into a single OpenAI `ChatCompletionAssistantMessageParam`. This method serves as a hook that can be overridden by subclasses ...
Review this code and list any quality issues.
[ { "issue": "I don't think we should need to hard-code the `reasoning` field", "severity": "minor", "line": 26 } ]
1
python
ax_ref = fig_ref.subplots() ax_ref.fill_between(x, stack_baseline, y1, hatch="x", facecolor="white") ax_ref.fill_between(x, y1, y1+y2, hatch="//", facecolor="white") ax_ref.fill_between(x, y1+y2, y1+y2+y3, hatch="\\\\", facecolor="white") ax_ref.set_xlim(0, 10) ax_ref.set_ylim(0, 70) def test_stac...
Review this code and list any quality issues.
[ { "issue": "```suggestion\n facecolors = ['r', 'b']\n\n fig, ax = plt.subplots()\n\n colls = ax.stackplot(x, y1, y2, facecolor=facecolors, colors=['c', 'm'])\n for coll, fcol in zip(colls, facecolors):\n assert mcolors.same_color(coll.get_facecolor(), facecolors)\n\n # Plural alias should ...
1
python
return np.asarray(size[:spatial_rank]) def _get_array_data(self, img, filename): """ Get the raw array data of the image, converted to Numpy array. Args: img: a Nibabel image object loaded from an image file. filename: file name of the image. """ if...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n```\r\nNot needed?", "severity": "minor", "line": 26 } ]
1
python
'release_timestamp': 1741982400, 'release_date': '20250314', }, 'expected_warnings': ['Failed to download extended metadata: HTTP Error 404: Not Found'], }] _API_URL_TMPL = None # the following few functions are ported from https://www.nhk.or.jp/radio/assets/js/timetable_detail...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n formatted_roles.append(join_nonempty(res, act.get('name'), delim=''))\r\n```", "severity": "minor", "line": 26 } ]
1
python
os.environ["EGL_DEVICE_ID"] = str(_get_egl_index(gpu_index)) except (AttributeError, KeyError): # AttributeError: CUDA is not supported on this machine # KeyError: The selected GPU does not support CUDA pass def pytest_addoption(parser): ...
Review this code and list any quality issues.
[ { "issue": "Are you sure it is really necessary to expose this many options?\nI have the feeling just adding `--profile-num-steps` that would be equal to 0 by default should be good enough?", "severity": "minor", "line": 26 } ]
1
python
NATIVE_STRUCT = ''' struct js_source_all { const char* name; const char* source; const int length; }; #define DECLARE_JS_CODES \\ struct js_source_all js_codes[] = \\ { \\''' def extract_name(path): special_chars = re.compile(r'[-\\?\'".]') return special_chars.sub('_', os.path.splitext(os.path.basenam...
Review this code and list any quality issues.
[ { "issue": "I don't think we need this line here. The `code` will be overwritten in line 61.", "severity": "minor", "line": 26 } ]
1
python
when the actual value exceeds this ratio. """ model: Union[str, nn.Module] tokenizer: str = None tokenizer_mode: str = "auto" trust_remote_code: bool = False max_batch_size: int = None max_output_len: int = 256 max_input_len: int = 256 block_size: int = 16 dtype: Union[str, torc...
Review this code and list any quality issues.
[ { "issue": "I still don't see where this method gets called in your code?", "severity": "minor", "line": 26 } ]
1
python
# Determine missing ext if not format.get('ext') and 'url' in format: format['ext'] = determine_ext(format['url']) if format.get('vcodec') == 'none': format['audio_ext'] = format['ext'] if format.get('acodec') != 'none' else 'none' format['video_ex...
Review this code and list any quality issues.
[]
0
python
return False return True def is_scalar_sequence_field(field: ModelField) -> bool: if (field.shape in sequence_shapes) and not lenient_issubclass( field.type_, BaseModel ): if field.sub_fields is not None: for sub_field in field.sub_fields: if not is_scalar_field...
Review this code and list any quality issues.
[ { "issue": "It can be simplified using `inspect.unwrap`:\r\n```suggestion\r\n nsobj = inspect.unwrap(call)\r\n```", "severity": "minor", "line": 26 } ]
1
python
raise NotImplementedError("Passing a %r to `isin`" % typename(type(values))) # We wrap values in a delayed for two reasons: # - avoid serializing data in every task # - avoid cost of traversal of large list in optimizations if isinstance(values, list): # Motivated by https:/...
Review this code and list any quality issues.
[ { "issue": "Is there a utility function in `pandas` that we could use here instead of this explicit list of object-like dtypes? Maybe `pandas.api.types.is_object_dtype`?", "severity": "major", "line": 26 } ]
1
python
elif type_ == "property_": ff = f.property_ return frzf.PropertyFeature(property=ff.property_, access=ff.access or None, description=ff.description or None) elif type_ == "number": ff = f.number return frzf.NumberFeature(number=number_from_pb2(ff.number), description=ff.description o...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n ) # type: ignore\r\n # Mypy is unable to recognize `operand_offset` as an argument due to aliasing\r\n```", "severity": "minor", "line": 26 } ]
1
python
target_versions=versions, line_length=line_length, is_pyi=pyi, string_normalization=not skip_string_normalization, ) if config and verbose: out(f"Using configuration from {config}.", bold=False, fg="blue") if code is not None: print(format_str(code, mode=mode)) ...
Review this code and list any quality issues.
[ { "issue": "Should say `force_exclude`, not `exclude`.", "severity": "minor", "line": 26 } ]
1
python
type='str', callback_kwargs={'delim': None}, default=['default'], help=( 'Path to an additional directory to search for plugins. ' 'This option can be used multiple times to add multiple directories. ' 'Use "default" to search the default plugin directories (d...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n 'Supported runtimes are (in order of priority, from highest to lowest): deno, node, quickjs, bun. '\r\n 'Only \"deno\" is enabled by default. The highest priority runtime that is both enabled and '\r\n 'available will be used. In order to use a lowe...
1
python
""" The property is dynamic and holds a Boolean value. """ number = "number" """ The property holds a number. """ dynamic_number = _TaipyNumber """ The property is dynamic and holds a number. """ string = "string" """ The property holds a string. """ dynamic_s...
Review this code and list any quality issues.
[]
0
python
from __future__ import annotations class IdCounter: def __init__(self, start_id: int = 0): """ Initialize the ID counter. Args: start_id: The starting integer for the counter. Raises: ValueError: If start_id is less than or equal to NO_ID. """ ...
Review this code and list any quality issues.
[ { "issue": "The docstring references \"NO_ID\" but this is actually a property (self.NO_ID), not a constant. The error message should be clearer about what NO_ID is, or the documentation should specify it's a property that returns -1. Consider updating to: \"ValueError: If start_id is less than or equal to -1.\...
1
python
NicovideoSearchURLIE, ) from .ninecninemedia import ( NineCNineMediaIE, CPTwentyFourIE, ) from .ninegag import NineGagIE from .ninenow import NineNowIE from .nintendo import NintendoIE from .nitter import NitterIE from .njpwworld import NJPWWorldIE from .nobelprize import NobelPrizeIE from .nonktube import Nonk...
Review this code and list any quality issues.
[]
0
python
def construct(self): G = nx.Graph() G.add_nodes_from([0, 1, 2, 3]) G.add_edges_from([(0, 2), (0,3), (1, 2)]) graph = Graph(list(G.nodes), list(G.edges), layout="partite", partitions=[[0, 1]]) self.play(Create(graph)) The representation...
Review this code and list any quality issues.
[ { "issue": "I don't think it is necessary to use `np.sum`, Python's default `sum` does the job. :-)\r\n\r\n```suggestion\r\n last = sum(layers[:i+1])\r\n```", "severity": "minor", "line": 26 } ]
1
python
video_info = self._call_api(region, video_id, 'data', note='Trying fallback', fatal=True) video_extra = {} duration = int_or_none(video_info.get('duration'), 1000) title = video_info.get('name') upload_date = video_info.get('created') formats = traverse_obj(video_info, ('ex...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n for live_chat_url in traverse_obj(video_info, ('chats', ..., 'url', {url_or_none})):\r\n subtitles.setdefault('live_chat', []).append({'url': live_chat_url})\r\n```", "severity": "minor", "line": 26 } ]
1
python
clean_html, float_or_none, traverse_obj, try_call, ) # Video from www.kompas.tv and video.kompas.com seems use jixie player # see [1] https://jixie.atlassian.net/servicedesk/customer/portal/2/article/1339654214?src=-1456335525, # [2] https://scripts.jixie.media/jxvideo.3.1.min.js for more info class Komp...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n 'tags': 'count:9',\r\n```", "severity": "minor", "line": 26 } ]
1
python
def __init__(self, main_shape, *mobjects, **kwargs): VMobject.__init__(self, **kwargs) self.append_points(main_shape.get_points()) if main_shape.get_direction() == "CW": sub_direction = "CCW" else: sub_direction = "CW" for mobject in mobjects: ...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n or start point (-1), and the second value functions similarly for the \r\n end (1) or start (-1) of the second line.\r\n```\r\nMake a line break here as the sentence is too big", "severity": "minor", "line": 26 } ]
1
python
self.dtype = torch.float32 if model_policy is None: model_policy = model_policy_map[model.config.model_type]() # Init pg mesh pg_mesh = ProcessGroupMesh(pp_size, tp_size) stage_manager = PipelineStageManager(pg_mesh, PP_AXIS, True) self.cache_manager_list = [ ...
Review this code and list any quality issues.
[ { "issue": "Same. This is not related to PP", "severity": "minor", "line": 26 } ]
1
python
with open(file_path, "w") as file: toml.dump(data, file) def _remove_dir(path: Path) -> None: """Remove a directory if it exists. Args: path (Path): The path of the directory to remove. """ if path.exists(): shutil.rmtree(str(path)) def _remove_file(path: Path) -> None: ...
Review this code and list any quality issues.
[ { "issue": "Maybe this function needs to be renamed too", "severity": "minor", "line": 26 } ]
1
python
def get_points_defining_boundary(self): return self.get_all_points() def get_num_points(self): return len(self.points) def get_extremum_along_dim(self, points=None, dim=0, key=0): if points is None: points = self.get_points_defining_boundary() values = points[:, dim...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n ::\r\n\r\n sample = Arc(start_angle=PI/7, angle = PI/5)\r\n```", "severity": "minor", "line": 26 } ]
1
python
AppleDailyIE, NextTVIE, ) from .nexx import ( NexxIE, NexxEmbedIE, ) from .nfb import NFBIE from .nfhsnetwork import NFHSNetworkIE from .nfl import ( NFLIE, NFLArticleIE, NFLPlusEpisodeIE, NFLPlusReplayIE, ) from .nhk import ( NhkVodIE, NhkVodProgramIE, NhkForSchoolBangumiIE, ...
Review this code and list any quality issues.
[]
0
python
if stream_type in ('dash', 'dash_widevine', 'dash_playready'): this_formats = self._extract_mpd_formats( watch_url, video_id, mpd_id=format_id, fatal=False) elif stream_type in ('hls', 'hls5', 'hls5_fairplay'): this_formats = self._extract_...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n info_dict['formats'] = self._extract_formats(cid, video_id, record_id=record_id)\r\n```\r\nsame below", "severity": "major", "line": 26 } ]
1
python
# Compress responses greater than 1kB with optimal compression level as 5 # with level ranging from 1 to 9 with 1 (fastest, least compression) # and 9 (slowest, most compression) app.state.secret_key = get_signing_key("api", "secret_key") def init_error_handlers(app: FastAPI) -> None: from a...
Review this code and list any quality issues.
[ { "issue": "Could we move the comments as well?", "severity": "minor", "line": 26 } ]
1
python
await hass.services.async_call( DOMAIN, SERVICE_UPDATE_RECORDS, {}, blocking=True, ) await hass.async_block_till_done() instance.update_dns_record.assert_not_called() assert "All target records are up to date" in caplog.text @pytest.mark.usefixtures("location_info") as...
Review this code and list any quality issues.
[ { "issue": "Can we use the freezer now here to skip time?\r\n```suggestion\r\n freezer.tick(timedelta(minutes=DEFAULT_UPDATE_INTERVAL))\r\n async_fire_time_changed(hass)\r\n```", "severity": "minor", "line": 26 } ]
1
python
"""Retrieve the current memory usage of the process and its children. It utilizes the `psutil` library. """ logger.debug('Calling get_memory_info()...') current_process = psutil.Process(os.getpid()) # Retrieve the Resident Set Size (RSS) of the current process. RSS is the portion of memory # o...
Review this code and list any quality issues.
[ { "issue": "This internal type hint does not seem to be available. The actual type is dependent on the OS as well.", "severity": "minor", "line": 26 } ]
1
python
# Verify the returned profile is an OpenAIModelProfile with OpenAIJsonSchemaTransformer assert isinstance(profile, OpenAIModelProfile) assert profile.json_schema_transformer == OpenAIJsonSchemaTransformer def test_model_profile_with_different_models(mocker: MockerFixture): provider = LiteLLMProvider(api_k...
Review this code and list any quality issues.
[]
0
python
cloudtrail_errors = {} cloudtrail_errors_j = red.get( config.get( "celery.cache_cloudtrail_errors_by_arn.redis_key", "CLOUDTRAIL_ERRORS_BY_ARN", ) ) if cloudtrail_errors_j: cloudtrail_errors = json.loads(cloudtrail_errors_j) s3_error_topic = config.get("...
Review this code and list any quality issues.
[ { "issue": "I'm not sure what `role_details.get(\"tags\")` returns 🤔", "severity": "minor", "line": 26 } ]
1
python
deficit = uint8(0) adjusted = False validated_block_count = 0 for idx, block in enumerate(recent_chain.recent_chain_data): required_iters = uint64(0) overflow = False ses = False height = block.height for sub_slot in block.finished_sub_slots: prev_challeng...
Review this code and list any quality issues.
[ { "issue": "this change looks unrelated. Could you add a comment to the code explaining why this should be `> 2`?", "severity": "minor", "line": 26 } ]
1
python
"""Wraps around ray.util.metrics.Gauge to provide same API as prometheus_client.Gauge""" def __init__( self, name: str, documentation: str | None = "", labelnames: list[str] | None = None, multiprocess_mode: str | None = "", ): # All Ray metrics are keyed by ...
Review this code and list any quality issues.
[]
0
python
rigid_global_info.mass_mat[i_d, j_d, i_b] = rigid_global_info.mass_mat[j_d, i_d, i_b] # Take into account motor armature ti.loop_config(serialize=static_rigid_sim_config.para_level < gs.PARA_LEVEL.ALL) for i_d, i_b in ti.ndrange(dofs_state.f_ang.shape[0], links_state.pos.shape[1]): I_d = [i_d, i_b]...
Review this code and list any quality issues.
[ { "issue": "Atomic add is not necessary here.", "severity": "minor", "line": 26 } ]
1
python
def format_help(self, ctx, formatter): """Writes the help into the formatter if it exists. This is a low-level method called by :meth:`get_help`. This calls the following methods: - :meth:`format_usage` - :meth:`format_help_text` - :meth:`format_options` ...
Review this code and list any quality issues.
[ { "issue": "After thinking about the formatting, I think putting the notice at the front of the line instead of on its own line looks better. Also, the current notice has a space at the front, which can be removed since it's being prepended instead of appended now.", "severity": "minor", "line": 26 } ...
1
python
# Check URL (passed as positional argument) assert call_args[0][0] == f"{mock_kubernetes_api_server}/apis/authentication.k8s.io/v1/selfsubjectreviews" # Check headers (passed as keyword argument) headers = call_args[1]["headers"] assert headers["Authorization"] == f"Bearer {valid_token}...
Review this code and list any quality issues.
[ { "issue": "use a fixture to factor this code so both test functions can use it?", "severity": "minor", "line": 26 } ]
1
python
return col def get_last_traded_dt(self, asset, day): volumes = self._spot_col('volume') search_day = day while True: try: ix = self.sid_day_index(asset, search_day) except NoDataOnDate: return None except NoDataBeforeDate...
Review this code and list any quality issues.
[]
0
python
def test_autofilter_with_startrow_startcol(engine, tmp_excel): # GH 61194 df = DataFrame.from_dict([{"A": 1, "B": 2, "C": 3}, {"A": 4, "B": 5, "C": 6}]) with ExcelWriter(tmp_excel, engine=engine) as writer: df.to_excel(writer, autofilter=True, startrow=10, startcol=10) openpyxl = pytest.importo...
Review this code and list any quality issues.
[ { "issue": "For each test, can you test all engines with something like:\n\n```python\nif engine in [...]:\n with pytest.raises(...):\n ...\n return\n```\n\nThis makes the test suite more robust when adding a new engine. You might find it easier to move these over to `test_writers` with `TestEx...
1
python
def test_replace_callable_named_groups(any_string_dtype): # test regex named groups ser = Series(["Foo Bar Baz", np.nan], dtype=any_string_dtype) pat = r"(?P<first>\w+) (?P<middle>\w+) (?P<last>\w+)" repl = lambda m: m.group("middle").swapcase() result = ser.str.replace(pat, repl, regex=True) ex...
Review this code and list any quality issues.
[]
0
python
# but I'm not sure in general, # so we just let mpmath figure # it out by taking log of 0 directly. # It would be better to return -inf instead. xre = fzero if xim: from sympy.functions.elementary.complexes import Abs from sympy.functions.elementary.exponential impor...
Review this code and list any quality issues.
[ { "issue": "When are these conditions not satisfied and what happens in that case?", "severity": "minor", "line": 26 } ]
1
python
eventData = event.data if self.errorState: return None self.sf.debug(f"Received event, {eventName}, from {srcModuleName}") if self.opts["api_key"] == "": self.sf.error("You enabled sfp_bitcoinabuse but did not set an API key!", False) self.errorState = True...
Review this code and list any quality issues.
[ { "issue": "Is there any additional text that can go in the result to make it more meaningful? At the very least it should be modeled around the other modules that report malicious entities (see `sfp_emailrep.py` as an example).", "severity": "minor", "line": 26 } ]
1
python
# Add cluster metadata put_metadata_key(peer_api_uris, 'my_metadata', 'My value!') # Repeatedly drop, re-create collection to accumulate Raft log entries for i in range(0, 5): print(f"recreating collection {i}") # Drop test_collection drop_collection(peer_api_uris[0], "test_collecti...
Review this code and list any quality issues.
[ { "issue": "This makes sense! If we query too early we might not have the data applied from the snapshot yet. IIRC we normally handle this through `/readyz` in cloud.", "severity": "minor", "line": 26 } ]
1
python
from __future__ import annotations from abc import ABC, abstractmethod from dataclasses import dataclass from typing import TYPE_CHECKING, Protocol from crawlee._utils.http import is_status_code_error from crawlee.errors import HttpStatusCodeError if TYPE_CHECKING: from crawlee._types import HttpHeaders, HttpMet...
Review this code and list any quality issues.
[ { "issue": "I like the simplification here!", "severity": "minor", "line": 26 } ]
1
python
aioclient_mock.post(SNAPSHOT_ENDPOINT_URL, status=200, json={}) assert await async_setup_component(hass, "labs", {}) assert await async_setup_component(hass, DOMAIN, {DOMAIN: {}}) hass.bus.async_fire(EVENT_HOMEASSISTANT_STARTED) await hass.async_block_till_done() async_fire_time_changed(hass, dt_...
Review this code and list any quality issues.
[ { "issue": "The test verifies that enabling the labs feature triggers snapshot sending, but it doesn't verify that the analytics preferences are updated. When async_update_preview_feature is called, it should trigger _async_handle_labs_update which saves preferences with ATTR_SNAPSHOTS. Consider adding an asser...
1
python
else: document_custom_method( action_section, action_name, resource_actions[action_name] ) # Write actions in individual/nested files. # Path: <root>/reference/services/<service>/<resource_name>/<action_name>.rst actions_dir_path = ...
Review this code and list any quality issues.
[ { "issue": "Out of curiosity, because I'm not very familiar with this codebase: Why does the new argument override the previous method? Instead of giving the previous method precedence or merging the results of both?", "severity": "minor", "line": 26 } ]
1
python
self.camera: ThreeDCamera self.camera.add_fixed_in_frame_mobjects(*mobjects) else: for mob in mobjects: mob: OpenGLMobject mob.fix_in_frame() self.add(mob) def remove_fixed_orientation_mobjects(self, *mobjects): """ Thi...
Review this code and list any quality issues.
[ { "issue": "Would also be good to have a test covering the opengl part to check it is removed", "severity": "minor", "line": 26 } ]
1
python
traverse_obj(stream_info, 'rtmp_url'), traverse_obj(stream_info, 'rtmp_live')) if stream_url: rate_id = traverse_obj(stream_info, ('rate', {int_or_none})) rate_info = traverse_obj(stream_info, ('multirates', lambda _, v: v.get('rate') == rate_id), get_all=False) ...
Review this code and list any quality issues.
[ { "issue": "Might be better to use regex here to account for variations in JS?\r\n```suggestion\r\n if self._search_regex(r'\"videoLoop\"\\s*:\\s*(\\d+)', webpage, 'loop', default='') == '1':\r\n raise UserNotLive('The channel is auto-playing VODs', video_id=video_id)\r\n if self._searc...
1