language
string
code-snippit
string
instruction
string
flaws
list
flaw_count
int64
python
.. versionadded:: 2.0 """ return ApplicationFlags._from_value(self._flags) class AppInstallParams: """Represents the settings for custom authorization URL of an application. .. versionadded:: 2.0 Attributes ---------- scopes: List[:class:`str`] The list of `OAuth2 scopes ...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n self.scopes: List[str] = data.get('scopes', [])\r\n```", "severity": "minor", "line": 26 } ]
1
python
), ( 'Reset morsel after invalid to not capture attributes', 'a=b; $invalid; $Version=1; c=d', {'a': 'b', 'c': 'd'}, ), ( 'Continue after non-flag attribute without value', 'a=b; path; Version=1; c=d', ...
Review this code and list any quality issues.
[ { "issue": "Do we want to parse this as `{'foo': 'bar'}` ? Should I revert the regex changes?\r\n\r\nI'm still not clear on what exactly we needed to fix back with crunchyroll or what real world examples that `LenientSimpleCookie` is solving", "severity": "minor", "line": 26 } ]
1
python
below. load_versions: A mapping between dataset names and versions to load. Has no effect on datasets without enabled versioning. save_version: Version string to be used for ``save`` operations by all datasets with enabled versioning. It must: a) be a ...
Review this code and list any quality issues.
[]
0
python
# coding: utf-8 from __future__ import unicode_literals import re from .common import InfoExtractor from ..utils import ( ExtractorError, smuggle_url, str_or_none, traverse_obj, ) class TVerIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?tver\.jp/(?:(?:lp|corner|series|episodes?|feature|tok...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n _VALID_URL = r'https?://(?:www\\.)?tver\\.jp/(?:(?P<type>lp|corner|series|episodes?|feature|tokyo2020/video)/)+(?P<id>[a-zA-Z0-9]+)'\r\n```\r\nsee next comment", "severity": "minor", "line": 18 } ]
1
python
assert result["reason"] == "already_configured" assert config_entry_setup.data == { CONF_HOST: "2.3.4.5", CONF_PORT: expected_port, CONF_USERNAME: "root", CONF_PASSWORD: "pass", CONF_MODEL: MODEL, CONF_NAME: NAME, } @pytest.mark.parametrize( ("source", "disc...
Review this code and list any quality issues.
[ { "issue": "Since you are not mocking 2.3.4.5 like you are in the other tests, it might be better to remove it. If not, perhaps change to localhost.\n\n```suggestion\n \"presentationURL\": \"\",\n```", "severity": "minor", "line": 26 } ]
1
python
async def _run_agent_loop( self, sampling_params: dict[str, Any], trajectory: dict[str, Any], *, agent_name: str, trace: bool = True, **kwargs, ) -> _InternalAgentLoopOutput: with rollout_trace_attr( step=trajectory["step"], sam...
Review this code and list any quality issues.
[]
0
python
inject_openai_api() if IS_LEGACY_OPENAI: return_string = openai.Completion.create(stream=False) return_generator = openai.Completion.create(stream=True) else: return_string = openai.resources.Completions.create(stream=False) return_generator = openai.reso...
Review this code and list any quality issues.
[]
0
python
dt: Optional[float] = None gravity: Optional[tuple] = None enable_collision: bool = True enable_joint_limit: bool = True enable_self_collision: bool = True enable_adjacent_collision: bool = False disable_constraint: bool = False max_collision_pairs: int = 300 integrator: gs.integrator = ...
Review this code and list any quality issues.
[ { "issue": "can we change it to 0.01 to be safer?", "severity": "minor", "line": 26 } ]
1
python
def load_model(self, model_path: str, from_pretrained_kwargs: dict): revision = from_pretrained_kwargs.get("revision", "main") # Apply monkey patch, TODO(Dacheng): Add flash attention support config = AutoConfig.from_pretrained(model_path, revision=revision) replace_llama_with_condense(...
Review this code and list any quality issues.
[ { "issue": "This is too loose. Make them more restrictive, such as \r\n```\r\nany(model_str in model_path.lower() in for model_str in [\"flan-\", \"fastchat-t5\", \"codet5p\"])\r\n```", "severity": "minor", "line": 26 } ]
1
python
from pathlib import Path from TTS.utils.synthesizer import Synthesizer from TTS.utils.manage import ModelManager class TTS(): """TODO: Add voice conversion and Capacitron support. """ def __init__(self, model_name:str=None, progress_bar:bool=True, gpu=False): """🐸TTS python interface that allows ...
Review this code and list any quality issues.
[ { "issue": "I don't know If calling it TTS is the best thing because it conflicts with the name of the package so it might prevent this kind of import: `from TTS.api import TTS`", "severity": "minor", "line": 6 } ]
1
python
""" Script to autogenerate pyplot wrappers. pyplot.py consists of two parts: a hand-written part at the top, and an automatically generated part at the bottom, starting with the comment ### REMAINING CONTENT GENERATED BY boilerplate.py ### This script generates the automatically generated part of pyplot.py. It con...
Review this code and list any quality issues.
[ { "issue": "```suggestion\nconsists of wrapper functions for colormap setter functions and methods of Figure and Axes. Whenever the API of one of the wrapped methods changes,\n```", "severity": "minor", "line": 11 } ]
1
python
}, INSTRUCTION_SCOPE: { capa.features.common.MatchedRule, capa.features.insn.API, capa.features.insn.Property, capa.features.insn.Number, capa.features.common.String, capa.features.common.Bytes, capa.features.insn.Offset, capa.features.insn.Mnemonic, ...
Review this code and list any quality issues.
[ { "issue": "is this meant to still be here?", "severity": "minor", "line": 26 } ]
1
python
Examples -------- .. manim:: DashedVMobjectExample :save_last_frame: class DashedVMobjectExample(Scene): def construct(self): r = 0.5 top_row = VGroup() # Increasing num_dashes for dashes in range(2, 12): circ = Da...
Review this code and list any quality issues.
[ { "issue": "Not sure what happened to the spacing, this reintroduces it.\r\n```suggestion\r\n class DashedVMobjectExample(Scene):\r\n def construct(self):\r\n r = 0.5\r\n \r\n top_row = VGroup() # Increasing num_dashes\r\n for dashes...
1
python
pass class B(A): pass class C(B): DEFAULT_CSS = "C" class D(C): pass class E(D): DEFAULT_CSS = "E" node = DOMNode() node_css = node._get_default_css() a = A() a_css = a._get_default_css() b = B() b_css = b._get_default_css() c = C() c_...
Review this code and list any quality issues.
[]
0
python
def any_np_pt(x: NdarrayOrTensor, axis: int | Sequence[int]) -> NdarrayOrTensor: """`np.any` with equivalent implementation for torch. For pytorch, convert to boolean for compatibility with older versions. Args: x: input array/tensor. axis: axis to perform `any` over. Returns: ...
Review this code and list any quality issues.
[]
0
python
from .common import InfoExtractor from ..utils import ( float_or_none, parse_qs, unified_timestamp, ) class ClypIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?clyp\.it/(?P<id>[a-z0-9]+)' _TESTS = [{ 'url': 'https://clyp.it/ojz2wfah', 'md5': '1d4961036c41247ecfdcc439c0cddcbb',...
Review this code and list any quality issues.
[ { "issue": "* Doesn't need to be a function\r\n* The https check can be part of the regex\r\n* Relax the regex with `\\s*`\r\n* Change `\\\"` to `\\'\"`, `.+` to `[^\\'\"]+`", "severity": "minor", "line": 26 } ]
1
python
break # Youtube sometimes sends incomplete data # See: https://github.com/ytdl-org/youtube-dl/issues/28194 last_error = 'Incomplete data received' if count >= retries: if fatal: raise ExtractorError(last_error) ...
Review this code and list any quality issues.
[ { "issue": "We need to handle the case that `traverse_obj(renderer, ('title', 'accessibility', 'accessibilityData', 'label'))` returns `None`, which crashes `_search_regex`. This can happen when downloading a playlist that contains unavailable videos.", "severity": "critical", "line": 26 } ]
1
python
tempdir, utc_flag_val, time_type, time_unit, ): # GH-47441 filename = tempdir / "time_adjusted_to_utc.parquet" time_values = [0, 123, 10_000, 100_000] table = pa.table({ "time_col": pa.array(time_values, type=time_type(time_unit)), }) schema = pa.schema([ ("time_co...
Review this code and list any quality issues.
[ { "issue": "Please let's validate the result.\r\n```suggestion\r\n result = pq.read_table(filename, schema=schema)\r\n result.validate(full=True)\r\n```", "severity": "minor", "line": 26 } ]
1
python
import subprocess import sys def list_tests(self_test_exe, tags, rng_seed): cmd = [self_test_exe, '--list-test-names-only', '--order', 'rand', '--rng-seed', str(rng_seed)] tags_arg = ','.join('[{}]'.format(t) for t in tags) if tags_arg: cmd.append(tags_arg + '~[.]') process = subpro...
Review this code and list any quality issues.
[]
0
python
async def test_update_fail_token_needed( hass: HomeAssistant, mock_bridge, caplog: pytest.LogCaptureFixture, freezer: FrozenDateTimeFactory, ) -> None: """Test entities state unavailable when updates fail..""" entry = await init_integration(hass, USERNAME, TOKEN) assert mock_bridge mock...
Review this code and list any quality issues.
[ { "issue": "This is a for loop for a const that has only 1 device, please remove it", "severity": "minor", "line": 26 } ]
1
python
for i in range(len(dataFrame)): model_to_score[dataFrame.loc[i, "Model"]] = dataFrame.loc[ i, "Win-rate" ] md = arena_hard_title(date) gr.Markdown(md, elem_id="leaderboard_markdown") g...
Review this code and list any quality issues.
[ { "issue": "can we make this tab optional and default not showing? Otherwise people who do not have access to `COPILOT_ARENA_LEADERBOARD_URL` will error out.\r\n\r\nWe can add an argument to the `build_leaderboard_tab` function", "severity": "minor", "line": 26 } ]
1
python
# Drop empty tool_calls to keep templates on the normal assistant path. message.pop("tool_calls", None) continue for item in tool_calls: # if arguments is None or empty string, set to {} if content := item["function"].get("arguments"): ...
Review this code and list any quality issues.
[ { "issue": "I think we don't need `mm_processor_kwargs` here anymore? So you can revert this file. Or did I miss something?", "severity": "minor", "line": 26 } ]
1
python
from .common import InfoExtractor from ..utils import clean_html from ..utils.traversal import find_elements, traverse_obj class FilmArchivIE(InfoExtractor): IE_NAME = 'FILMARCHIV ON' _VALID_URL = r'https?://(?:www\.)?filmarchiv\.at/de/filmarchiv-on/video/(?P<id>[0-9a-zA-Z_]+)' _TESTS = [{ 'url': ...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\nfrom ..utils.traversal import (\r\n find_element,\r\n find_elements,\r\n traverse_obj,\r\n)\r\n```", "severity": "minor", "line": 3 } ]
1
python
) if not _config_file.is_file(): raise FileNotFoundError(f"Cannot find the config file: {_config_file}.") else: self.config_root_path = Path("configs") logging_file = str(self.config_root_path / "logging.conf") if logging_file is None else logging_file ...
Review this code and list any quality issues.
[ { "issue": "Should we use `self.meta_file` instead? To do you would move `meta_file=str(self.config_root_path / \"metadata.json\") if meta_file is None else meta_file` to be just before the `super()` call and then pass `meta_file=meta_file` as a new argument. I think the check for files existing here wouldn't b...
1
python
dataset_type = config.pop(TYPE_KEY) class_obj = None warning = None if isinstance(dataset_type, str): if len(dataset_type.strip(".")) != len(dataset_type): raise DatasetError( "'type' class path does not support relative " "paths or paths ending with a dot...
Review this code and list any quality issues.
[ { "issue": "I'm not sure this error will now ever be reached. I played around with it and if I have a class called `MyCSVDataset` but try to import `YourCSVDataset` in the catalog I get:\r\n\r\n```\r\nDatasetError: An exception occurred when parsing config for dataset 'companies':\r\nmodule 'wizard.my_dataset' ...
1
python
You can specify the types of supported errors which trigger a retry with the `supported_errors` parameter. """ self._backoff = backoff self._retries = retries self._supported_errors = supported_errors def update_supported_errors(self, specified_errors: list): """ ...
Review this code and list any quality issues.
[ { "issue": "Same as above, type check is redundant", "severity": "minor", "line": 26 } ]
1
python
if video_id.isdigit(): room_id = video_id else: page = self._download_webpage(url, video_id) room_id = self._html_search_regex( r'"room_id\\?"\s*:\s*(\d+),', page, 'room id') # Grab metadata from API tt = int(time.time()) auth = md5(f'...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n video_url = url_join('https://hls3-akm.douyucdn.cn/',\r\n self._search_regex(r'(live/.*)', room['hls_url'], 'URL')\r\n```", "severity": "minor", "line": 26 } ]
1
python
) from .nhl import NHLIE from .nick import ( NickIE, NickBrIE, NickDeIE, NickNightIE, NickRuIE, ) from .niconico import ( NiconicoIE, NiconicoPlaylistIE, NiconicoUserIE, NiconicoSeriesIE, NiconicoHistoryIE, NicovideoSearchDateIE, NicovideoSearchIE, NicovideoSearchURLI...
Review this code and list any quality issues.
[]
0
python
from collections import defaultdict import csv import subprocess import time import argparse def grep(contents: list[str], target): return [l for l in contents if target in l] def get_cuda_usage() -> dict[int, int]: output = subprocess.check_output(["nvidia-smi"]).decode("utf-8") section = 0 subsec ...
Review this code and list any quality issues.
[ { "issue": "Interesting. Is this the best practice? Can we use pynvml? (asked ChatGPT. I did not try myself)", "severity": "minor", "line": 19 } ]
1
python
def test_settings_merge_hierarchy(): """Test the complete settings merge hierarchy: model -> agent -> run.""" # Create a function that captures the merged settings captured_settings = None def capture_settings(messages: list[ModelMessage], agent_info: AgentInfo) -> ModelResponse: nonlocal captu...
Review this code and list any quality issues.
[]
0
python
fil.update({"cycle": cycle.id}) return cls._get_all_by(filters) @classmethod def _get_primary_scenarios(cls) -> List[Scenario]: return [scenario for scenario in cls._get_all() if scenario.is_primary] @classmethod def _sort_scenarios( cls, scenarios: List[Scenario], ...
Review this code and list any quality issues.
[ { "issue": "This can be static. cls is never used. Right?", "severity": "minor", "line": 26 } ]
1
python
res = trim_zeros(a, trim='b') assert_array_equal(res, [0, 1, 2]) @pytest.mark.parametrize("trim", ("front", "")) def test_unexpected_trim_value(self, trim): arr = self.a with pytest.raises(ValueError, match=r"unexpected character\(s\) in `trim`"): trim_zeros(arr, trim=trim) ...
Review this code and list any quality issues.
[ { "issue": "this new test takes 0.35 s to run on my M3 macbook pro. I think that's acceptable.", "severity": "minor", "line": 26 } ]
1
python
) expected = Series([1, 6, 2, 8, 7], index=expected_index, name="value") tm.assert_series_equal(result, expected) @pytest.mark.xfail(WASM, reason="GH 23440") @pytest.mark.parametrize("base", [101, 1010]) def test_reindex_behavior_with_interval_index(self, base): # GH 51826 ...
Review this code and list any quality issues.
[ { "issue": "I suggest using the assertion function `tm.assert_series_equal `instead of `tm.assert_equal`. \r\nWe usually define an `expected` Series to check that left and right Series are equal (see the tests above).", "severity": "minor", "line": 26 } ]
1
python
def _extract_video_subtitles(self, api_response, subtitles_format): subtitles = {} for subtitle in traverse_obj(api_response, ('sfl', 'fi')): subtitles[subtitle['lang'].lower()] = [{ 'url': subtitle['url'], 'ext': subtitles_format, 'protocol': ...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n self._merge_subtitles(subs, native_subtitles, target=subtitles)\r\n```", "severity": "minor", "line": 26 } ]
1
python
b) If the new memory provides more recent or accurate information, update the existing memory accordingly. 3. Comprehensive Review: Thoroughly examine each existing graph memory against the new information, updating relationships as necessary. Multiple updates may be required. 4. Consistency: Maintain a uniform and cle...
Review this code and list any quality issues.
[ { "issue": "Shouldn't this be inside a {} ?", "severity": "minor", "line": 26 } ]
1
python
'2023': ['prefer-vp9-sort'], }, }, help=( 'Options that can help keep compatibility with youtube-dl or youtube-dlc ' 'configurations by reverting some of the changes made in yt-dlp. ' 'See "Differences in default behavior" for details')) general.add_option( ...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n 'See the \"Preset Aliases\" section at the end for more info. '\r\n```", "severity": "minor", "line": 26 } ]
1
python
drm_formats.append(format_dict) continue format_url = url_or_none(format_dict.get('src')) format_type = format_dict.get('type') ext = determine_ext(format_url) if (format_type == 'application/x-mpegURL' or format...
Review this code and list any quality issues.
[ { "issue": "branching with `...` in traversal will always return a list\r\n```suggestion\r\n for src in traverse_obj(player, ('lib', 'source', 'sources', ...)):\r\n```", "severity": "minor", "line": 26 } ]
1
python
self.__websocket_connection_options = websocket_connection_options def __enter__(self) -> RealtimeConnection: """ 👋 If your application doesn't work well with the context manager approach then you can call this method directly to initiate a connection. **Warning**: You must rememb...
Review this code and list any quality issues.
[]
0
python
- Supports dict-like access via `__getitem__`, `__setitem__`, and `__delitem__`. - Use `to_dict()` to convert the value to a standard dictionary. """ text: str files: list[UploadedFile] audio: UploadedFile | None = None def __len__(self) -> int: return len(vars(self)) def __iter__...
Review this code and list any quality issues.
[ { "issue": "The `_get_included_keys()` method creates and returns a new list on every call. This method is invoked by `__len__`, `__iter__`, `__contains__`, `__getitem__`, `__setitem__`, and `__delitem__`, which could lead to unnecessary allocations in tight loops.\n\nConsider caching the result as an instance ...
1
python
TEST_CASE_11_PADDING = [ TENSOR_4x4, dict( splitter=SlidingWindowSplitter(patch_size=(2, 3), pad_mode="constant", pad_value=0.0), merger_cls=AvgMerger, match_spatial_shape=False, ), lambda x: x, pad(TENSOR_4x4, (0, 2), value=0.0), ] # non-divisible patch_size with matching s...
Review this code and list any quality issues.
[]
0
python
"itemsize": 2 }) self.check(Union, expected) def test_union_with_struct_packed(self): class Struct(ctypes.Structure): _pack_ = 1 _fields_ = [ ('one', ctypes.c_uint8), ('two', ctypes.c_uint32) ] class Union(ctypes.U...
Review this code and list any quality issues.
[ { "issue": "nitpick:\r\n\r\n```suggestion\r\n [('one', 'u1'), ('two', np.uint32)],\r\n```", "severity": "minor", "line": 26 } ]
1
python
import re import uuid from datetime import datetime from typing import Any, Dict, Optional from taipy.config.common.frequency import Frequency from .._entity._entity import _Entity from .._entity._labeled import _Labeled from .._entity._properties import _Properties from .._entity._reload import _Reloader, _self_relo...
Review this code and list any quality issues.
[ { "issue": "What do you think about the following?\r\n\r\n```suggestion\r\n Many business operations are periodic, such as weekly predictions of sales data, monthly\r\n master planning of supply chains, quarterly financial reports, yearly budgeting, etc.\r\n The data applications to solve these busines...
1
python
( ConfigurationStyle.LEGACY, { "value_template": "{{ 'off' }}", }, ), ( ConfigurationStyle.MODERN, { "state": "{{ 'off' }}", }, ), ( ConfigurationStyle.TRIGGER, ...
Review this code and list any quality issues.
[]
0
python
def test_gh_128961(self): a = array.array('i') it = iter(a) list(it) it.__setstate__(0) self.assertRaises(StopIteration, next, it) @subTests( ("dtype", "items"), [ ("b", [0] * 64), ("B", [1, 2, 3]), ("h", [1, 2, 3]), ...
Review this code and list any quality issues.
[ { "issue": "As Serhiy told me, it's not a re-entrancy issue but rather a concurrency issue so let's use:\r\n\r\n```py\r\n# Tests for NULL pointer dereference in array.__setitem__\r\n# when the index conversion mutates the array.\r\n# See: github.com/python/cpython/issues/142555.\r\n\r\n@subTests(...)\r\ndef tes...
1
python
from django import template from wagtail.admin.userbar import Userbar from wagtail.models import PAGE_TEMPLATE_VAR, Page register = template.Library() def get_page_instance(context): """ Given a template context, try and find a Page variable in the common places. Returns None if a page can not be found....
Review this code and list any quality issues.
[]
0
python
else: raise ImportError("Called a Tensorflow-specific function but Tensorflow is not installed.") getter_fn = partial( np_get_batch, dataset=dataset, cols_to_retain=cols_to_retain, collate_fn=collate_fn, collate_fn_args=collate_fn_args, columns_to_np_types=co...
Review this code and list any quality issues.
[ { "issue": "The change from `numpy_function` to `py_function` here should be okay, but is it necessary? I understand you want to be able to pass a single index instead of a batch of indices, but I feel like you could just pass a Numpy scalar in that case (with shape == ()) and leave the rest of the code the sam...
1
python
from homeassistant.components.binary_sensor import ( DEVICE_CLASSES_SCHEMA, PLATFORM_SCHEMA as BINARY_SENSOR_PLATFORM_SCHEMA, BinarySensorDeviceClass, BinarySensorEntity, ) from homeassistant.const import CONF_DEVICE_CLASS, CONF_DEVICES, CONF_NAME from homeassistant.core import HomeAssistant, callback f...
Review this code and list any quality issues.
[ { "issue": "Updated to mark CONF_NAME as required, as it would fall over on the debug line 60/62 if it's wasn't set.", "severity": "critical", "line": 26 } ]
1
python
1. Decreasing specificity (no of characters outside the curly brackets 2. Decreasing number of placeholders (no of curly bracket pairs) 3. Alphabetically """ sorted_keys = sorted( data_set_patterns, key=lambda pattern: ( -(cls._specificity(pattern)...
Review this code and list any quality issues.
[ { "issue": "For completeness this doc string should also include the return type/value.", "severity": "minor", "line": 26 } ]
1
python
detector = cv.QRCodeDetector() retval, points = detector.detect(img) self.assertTrue(retval) self.assertEqual(points.shape, (1, 4, 2)) def test_detect_and_decode(self): img = cv.imread(os.path.join(self.extraTestDataPath, 'cv/qrcode/link_ocv.jpg')) self.assertFalse(img is No...
Review this code and list any quality issues.
[]
0
python
continue key_base = cls_prefix + attr_name member_prefix = key_base + "." # ---- StructField: gather its members ----------------------------- member_items = {} for saved_key, saved_arr in arr_dict.items(): if saved_key.startswith(member_pref...
Review this code and list any quality issues.
[ { "issue": "Why not just `field.from_numpy(arr)` ?", "severity": "minor", "line": 26 } ]
1
python
with mock.patch(prop, return_value="foobar.png"): fname = fig.canvas.manager.toolbar.save_figure() os.remove("foobar.png") assert fname == "foobar.png" with mock.patch(prop, return_value=None): fname = fig.canvas.manager.toolbar.save_figure() assert fname is None @pytest.ma...
Review this code and list any quality issues.
[ { "issue": "This test should probably go in a subprocess (like a few others in this file) or else if broken, it would break the whole test suite.", "severity": "critical", "line": 26 } ]
1
python
for f in current_formats: # TODO: Convert language to code f.update({'language': fmt['lang'], 'format_note': fmt['uncut']}) formats.extend(current_formats) self._remove_duplicate_formats(formats) self._sort_formats(formats) return { ...
Review this code and list any quality issues.
[ { "issue": "Github won't let me leave a comment on line 222 (one below this), so leaving it here.\r\nLine 222 gave me an error due to `video_id `being an int\r\n`ERROR: can only concatenate str (not \"int\") to str`", "severity": "minor", "line": 26 } ]
1
python
from matplotlib.axes import Axes from matplotlib.artist import Artist from matplotlib.backend_bases import MouseEvent from matplotlib.figure import Figure from matplotlib.font_manager import FontProperties from matplotlib.legend_handler import HandlerBase from matplotlib.lines import Line2D from matplotlib.offsetbox im...
Review this code and list any quality issues.
[ { "issue": "This line is technically first-party and should be grouped with the others (though the rest of these of this block are stdlib and belong first, also.)", "severity": "minor", "line": 22 } ]
1
python
await create_db_and_tables() counter = ExecutionCounter() user = await get_default_user() tasks = [Task(create_counting_task, counter=counter)] # First run pipeline_results_1 = [] async for result in run_pipeline( tasks=tasks, datasets="test_dat...
Review this code and list any quality issues.
[]
0
python
"Using default signature path, but it doesn't exist. " # noqa: G003 [logging statement uses +] + "Please install the signatures first: " + "https://github.com/mandiant/capa/blob/master/doc/installation.md#method-2-using-capa-as-a-python-library." ) ...
Review this code and list any quality issues.
[ { "issue": "alternatively/additionally set the types in the function so mypy can do type checking", "severity": "minor", "line": 26 } ]
1
python
url="https://github.com/microsoft/qlib", description=DESCRIPTION, long_description=long_description, long_description_content_type="text/markdown", python_requires=REQUIRES_PYTHON, packages=find_packages(exclude=("tests",)), # if your package is a single module, use this instead of 'packages': ...
Review this code and list any quality issues.
[ { "issue": "Why are `xgboost catboost` these necessary?", "severity": "minor", "line": 26 } ]
1
python
from .common import InfoExtractor from ..utils import ( ExtractorError, UserNotLive, int_or_none, traverse_obj, unified_strdate, url_or_none, urlencode_postdata, ) class PandaTVIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.|m\.)?pandalive\.co\.kr/play/(?P<id>[\da-z]+)' _TESTS ...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n 'thumbnail': r're:https://cdn\\.pandalive\\.co\\.kr/ivs/v1/.+/thumb\\.jpg',\r\n```", "severity": "minor", "line": 22 } ]
1
python
self._sort_formats(formats) result_obj = {'formats': formats} result_obj.update({'id': video_id}) title = video.get('title') if title is not None: result_obj.update({'title': title}) series = video.get('seriestitle') if series is not None: resu...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n return {\r\n 'id': video_id,\r\n 'formats': formats,\r\n 'title': video.get('title'),\r\n 'series': video.get('seriestitle'),\r\n 'season_id': video.get('series'),\r\n 'creator': traverse_obj(video, ('creators...
1
python
from .common import InfoExtractor from .vimeo import VimeoIE from ..utils import ( ExtractorError, join_nonempty, ) from ..utils.traversal import traverse_obj class CroatianFilmIE(InfoExtractor): IE_NAME = 'croatian.film' _VALID_URL = r'https://?(?:www\.)?croatian\.film/[a-z]{2}/[^/?#]+/(?P<id>\d+)' ...
Review this code and list any quality issues.
[ { "issue": "this is geo-restricted but works with xff, should be a proper test instead of `only_matching`", "severity": "minor", "line": 26 } ]
1
python
f"it must implement the '_load' method" ) @abc.abstractmethod def _save(self, data: _DI) -> None: raise NotImplementedError( f"'{self.__class__.__name__}' is a subclass of AbstractDataset and " f"it must implement the '_save' method" ) @abc.abstractmethod ...
Review this code and list any quality issues.
[ { "issue": "I think the issue with this is that all of the pretty-printed subkeys will be on a single line, and no formatting/wrapping is applied there. By using `PrettyPrinter` directly, you can get something pretty similar, and also get the formatting.\r\n\r\nHappy to share some more context/pointers on this ...
1
python
def set_offset(self, xy): """ Set the offset of the container. Parameters ---------- xy : (float, float) The (x, y) coordinates of the offset in display units. """ self._offset = xy self.offset_transform.clear() self.offset_transform.t...
Review this code and list any quality issues.
[ { "issue": "This is consistent with the code logic before (`yd` was the last descent). But why do we take specifically the last only? Why not the first or a max?\n\nOh, I see now. `info` is per-line information and it's the descent of the last line. This is maximally obscured by naming `info` and missing proper...
1
python
'categories': ['Entertainment'], } }] def _real_extract(self, url): episode_id = self._match_id(url) page = self._download_webpage(url, episode_id) audios = self._parse_html5_media_entries('https://audio.camfm.co.uk', page, episode_id) formats = [] for i in audio...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n 'thumbnail': self._absolute_url(self._search_regex(r'<div[^>]+class=\"cover-art\"[^>]+style=\"[^\"]+url\\(\\'([^\\']+)',\r\n```\r\ntrailing part does nothing", "severity": "minor", "line": 26 } ]
1
python
data_bytes = json.dumps(data).encode('utf-8') search_results = self._download_json( self._search_engine_access_url, self._SEARCH_KEY, note=note, errnote=errnote, fatal=False, encoding='utf-8', data=data_bytes, headers={'authorization': self._search_engine_access_key}) if search_r...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n r'REACT_APP_ENDPOINT_BASE\\s*:\\s*\"(?P<url>[^\"]+)\"', js_content,\r\n```", "severity": "minor", "line": 26 } ]
1
python
'timestamp': 1740612872, 'modified_timestamp': 1740613037, 'upload_date': '20250226', 'modified_date': '20250226', }, }] def _real_extract(self, url): video_type, video_id = self._match_valid_url(url).group('type', 'id') webpage = self._download_webpa...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n 'concurrent_view_count': ('viewersCurrent', {int_or_none}),\r\n 'view_count': ('total_views', {int_or_none}),\r\n 'thumbnail': ('thumbnail_url_small', {url_or_none}),\r\n 'like_count': ('likes', {int_or_none}),\r\n```", ...
1
python
import re from .common import InfoExtractor class MixlrIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?(?P<username>[\w-]+)\.mixlr\.com/events/(?P<id>\d+)' _TESTS = [{ 'url': 'https://suncity-104-9fm.mixlr.com/events/4261962', 'info_dict': { 'id': '4261962', 'titl...
Review this code and list any quality issues.
[ { "issue": "I also added an extractor for recordings:\r\n```suggestion\r\n }\r\n\r\n\r\nclass MixlrRecoringIE(InfoExtractor):\r\n _VALID_URL = r'https?://(?:www\\.)?(?P<username>[\\w-]+)\\.mixlr\\.com/recordings/(?P<id>\\d+)'\r\n _TESTS = [{\r\n 'url': 'https://biblewayng.mixlr.com/recording...
1
python
token = try_get(ytcfg, lambda x: x['ID_TOKEN'], str) if token: return token if webpage: return self._search_regex( r'\bID_TOKEN["\']\s*:\s*["\'](.+?)["\']', webpage, 'identity token', default=None, fatal=False) def _data_sync_id_to_del...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n if delegated_sid := traverse_obj(args, (..., 'DELEGATED_SESSION_ID', {str}, any)):\r\n```", "severity": "minor", "line": 26 } ]
1
python
res = stats.wilcoxon(x, y) assert not hasattr(res, 'zstatistic') def test_wilcoxon_tie(self, xp): # Regression test for gh-2391. # Corresponding R code is: # > result = wilcox.test(rep(0.1, 10), exact=FALSE, correct=FALSE) # > result$p.value # [1] 0.00156540225...
Review this code and list any quality issues.
[]
0
python
type="package_name", help="Exclude specified package from the output", ) no_python_version_warning: Callable[..., Option] = partial( Option, "--no-python-version-warning", dest="no_python_version_warning", action="store_true", default=False, help="Silence deprecation warnings for upcoming ...
Review this code and list any quality issues.
[ { "issue": "Why not remove this, as we've done with other `--use-feature` flags?", "severity": "major", "line": 26 } ]
1
python
model_name_or_path (str): The name or path of the model to use. output_file (str): The path to the output file. existing_ids (set): A set of ids that have already been processed. """ test_dataset = test_dataset.filter( lambda x: count_string_tokens(x["text"], model_name_or_path) <= MAX_TOKEN, ...
Review this code and list any quality issues.
[]
0
python
def _handle_negative_timestamp(time, info): return max(info['duration'] + time, 0) if info.get('duration') and time < 0 else time def __eq__(self, other): return (isinstance(other, download_range_func) and self.chapters == other.chapters and self.ranges == other.ranges) def __r...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n return '{:02.0f}:{:02.0f}:{:02.0f},{:03.0f}'.format(*timetuple_from_msec(seconds * 1000))\r\n```", "severity": "minor", "line": 26 } ]
1
python
input_dim=1, output_dim=0, weight_loader=patched_weight_loader, ) _copy_missing_attrs(layer.weight, weight) layer.register_parameter("weight", weight) del layer._load_device # refresh the reference to `p...
Review this code and list any quality issues.
[ { "issue": "Can you add a FIXME here to note that this part should be reverted after `weight_loader` supports tuple shard_id?", "severity": "minor", "line": 26 } ]
1
python
'resolution': f'{video_data.get("resolution")}p' if video_data else None } watermark_fmt = { 'url': video_data.get('download_url'), 'ext': 'mp4', 'format_note': 'Watermarked', 'resolution': f'{video_data.get("resolution")}p' if vide...
Review this code and list any quality issues.
[ { "issue": "If the above is non fatal, we should check it first\r\n\r\n```python\r\ncomment_data = []\r\nif comment_json:\r\n comment_data = [{\r\n ....\r\n } for comment in comment_json.get('comment_list') or ()]\r\n```", "severity": "minor", "line": 26 } ]
1
python
user.id, additional_properties={ "endpoint": "POST /v1/permissions/roles", "role_name": role_name, }, ) from cognee.modules.users.roles.methods import create_role as create_role_method role_id = await create_role_method(role_name=role_nam...
Review this code and list any quality issues.
[]
0
python
from core.rag.extractor.entity.extract_setting import ExtractSetting, NotionInfo from core.rag.extractor.notion_extractor import NotionExtractor from extensions.ext_database import db from fields.data_source_fields import integrate_list_fields, integrate_notion_info_list_fields from libs.datetime_utils import naive_utc...
Review this code and list any quality issues.
[ { "issue": "The datasource_parameters field is defined as `dict[str, Any] | None`, but query parameters in Flask are strings. When a JSON string is passed via the query parameter (e.g., `?datasource_parameters={\"key\":\"value\"}`), Pydantic will not automatically parse it into a dict. The previous code explici...
1
python
thumbnails.append({ 'url': thumbnail_url, 'preference': quality_key(thumbnail_id), }) return { 'id': info['_id'], 'title': info.get('title') or 'Untitled Broadcast', 'description': info.get('description'), 'd...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n for moment in info['moments']:\r\n```\r\nsince the other cases are already handled", "severity": "minor", "line": 26 } ]
1
python
for mob in mobject, self: mob.rotate(angle, about_point=ORIGIN) def put_at_tip(self, mob, use_next_to=True, **kwargs): if use_next_to: mob.next_to(self.get_tip(), np.round(self.get_direction()), **kwargs) else: mob.move_to(self.get_tip()) buff = kwarg...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n return self.points[28]\r\n```\r\nAlso, I don't like that this is hardcoded, but it'd be good to write a comment on what this is doing, or a docstring.", "severity": "minor", "line": 26 } ]
1
python
def test_show_verbose_with_classifiers(script: PipTestEnvironment) -> None: """ Test that classifiers can be listed """ result = script.pip("show", "pip", "--verbose") lines = result.stdout.splitlines() assert "Name: pip" in lines assert re.search(r"Classifiers:\n( .+\n)+", result.stdout) ...
Review this code and list any quality issues.
[]
0
python
head node via ``NodeAffinitySchedulingStrategy``. If the head node was intentionally started with zero logical resources (a common practice to avoid OOMs), those tasks become unschedulable. Detect this upfront and raise a clear error with remediation steps. """ # Ray defaults to reserving 1 CPU per...
Review this code and list any quality issues.
[ { "issue": "No need to changes anything since I think this might conflict with an earlier review comment, but I felt surprised that we're validating custom resources types in this abstraction. I guess I would've assumed a valid `ray_remote_args` is more of a pre-condition and we validate `ray_remote_args` earli...
1
python
pageCategoryContent = 2 while next_url_category_content and len(episode_ids) < countCategoryContent: next_page_url = f'{categoryContentsUrl.format(category_id=seriesid)}&page={pageCategoryContent}' pageCategoryContent += 1 next_data = self._do...
Review this code and list any quality issues.
[ { "issue": "`serieThumb` is used nowhere else. Also why are we introducing this other format instead of just returning an info dict here?", "severity": "minor", "line": 26 } ]
1
python
#!/usr/bin/env python3 # # Copyright (c) 2024 Raspberry Pi (Trading) Ltd. # # SPDX-License-Identifier: BSD-3-Clause import sys with open(sys.argv[1], "r") as f: data = f.read() lines = data.split(";") for line in lines[1].split("\n"): if "#define CYW43_WIFI_FW_LEN" in line: cyw43_wifi_...
Review this code and list any quality issues.
[ { "issue": "Doesn't really matter, but I guess using a regex here might be more readable.", "severity": "minor", "line": 14 } ]
1
python
AutomationControllerJobScope.CLAIM_LAUNCH_TYPE: 'manual', AutomationControllerJobScope.CLAIM_PLAYBOOK_NAME: 'test.yml', }, ), ( {'id': 100, 'name': '', 'job_type': 'run', 'launch_type': 'manual', 'playbook': ''}, { AutomationControllerJ...
Review this code and list any quality issues.
[ { "issue": "we have a \"job\" fixture that is creates a Job django object. Might be more thorough to use that, which would help catch regressions if the job fields change one day\n\nfor example, this test uses the fixture https://github.com/fosterseth/awx/blob/292262e14fc66883d97b46f84a9ef891c153e2b6/awx/main/t...
1
python
} } # django-ansible-base ANSIBLE_BASE_TEAM_MODEL = 'main.Team' ANSIBLE_BASE_ORGANIZATION_MODEL = 'main.Organization' ANSIBLE_BASE_RESOURCE_CONFIG_MODULE = 'awx.resource_api' ANSIBLE_BASE_PERMISSION_MODEL = 'main.Permission' from ansible_base.lib import dynamic_config # noqa: E402 include(os.path.join(os.path.dirn...
Review this code and list any quality issues.
[ { "issue": "This was a big goof. Since I had put up https://github.com/ansible/django-ansible-base/pull/296 I confused myself about the contract with DAB. This was _unexpectedly_ creating the managed role definitions in the post_migrate hook, _in addition to_ AWX logic I added that did the same thing. Had it be...
1
python
input_size: int = 0 output_size: int = 0 llm_call_count: int = 0 llm_retry_count: int = 0 input_token_count: int = 0 output_token_count: int = 0 extra_cost: int = 0 extra_steps: int = 0 class GraphExecutionStats(BaseModel): """Execution statistics for a graph execution.""" model_c...
Review this code and list any quality issues.
[ { "issue": "```suggestion\n extra_steps: int = 0\n \n def __iadd__(self, other: \"NodeExecutionStats\") -> \"NodeExecutionStats\":\n self_values = self.model_dump()\n for key, value in other.model_dump().items():\n if key == \"error\" and value:\n self.error = va...
1
python
"""Return number of test framework p2p connections to the node.""" return len([peer for peer in self.getpeerinfo() if peer['subver'] == P2P_SUBVERSION]) def disconnect_p2ps(self): """Close all p2p connections to the node. Use only after each p2p has sent a version message to ensure the wait...
Review this code and list any quality issues.
[ { "issue": "Feels like `TestNode` itself shouldn't have tx-level code. Maybe `/test/functional/test_framework/blocktools.py` would be slightly better? It has `create_witness_tx(node, ...)` and `send_to_witness(use_p2wsh, node, utxo, ...)`.", "severity": "minor", "line": 26 } ]
1
python
_TESTS = [ { 'url': 'https://nebula.app/videos/that-time-disney-remade-beauty-and-the-beast', 'md5': '14944cfee8c7beeea106320c47560efc', 'info_dict': { 'id': '5c271b40b13fd613090034fd', 'ext': 'mp4', 'title': 'That Time Disney R...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n 'thumbnail': r're:https://\\w+\\.cloudfront\\.net/[\\w-]+\\.jpeg?height=720&?',\r\n```", "severity": "minor", "line": 26 } ]
1
python
'md5': '6aca68be71112314738dd17cced7f8bf', 'info_dict': { 'id': '17', 'ext': 'mp4', 'title': 'Episode 14', 'thumbnail': r're:https://.+\.jpg(?:\?c=\d+)?$', 'description': 'md5:4719b418e058c209def41d48b601276e', 'upload_date': '20100916', ...
Review this code and list any quality issues.
[ { "issue": "We can use the `get_element_text_and_html_by_tag` and `extract_attributes` functions from `..utils` to more easily retrieve the data. The `episode_attr` extraction can also be non-fatal, since it only contains metadata.\r\n```suggestion\r\n telecast_id, episode = self._match_valid_url(url).gr...
1
python
@property def base_url(self) -> str: return self._client.meta.endpoint_url @property def client(self) -> BaseClient: return self._client def model_profile(self, model_name: str) -> ModelProfile | None: provider_to_profile: dict[str, Callable[[str], ModelProfile | None]] = { ...
Review this code and list any quality issues.
[ { "issue": "we can get rid of the new `_strip_geo_prefix` function, (we went from 5 lines to 25 for the same thing)\r\nlet's simply fix the check\r\n\r\n```python\r\n # Split the model name into parts\r\n parts = model_name.split('.', 2)\r\n\r\n # Handle regional prefixes\r\n if len(...
1
python
_register_template( name="cpm", format_user=StringFormatter(slots=["<用户>{{content}}<AI>"]), format_prefix=EmptyFormatter(slots=[{"bos_token"}]), ) _register_template( name="cpm3", format_user=StringFormatter(slots=["<|im_start|>user\n{{content}}<|im_end|>\n<|im_start|>assistant\n"]), format_sy...
Review this code and list any quality issues.
[]
0
python
from typing import Optional from openai import AzureOpenAI from mem0.configs.embeddings.base import BaseEmbedderConfig from mem0.embeddings.base import EmbeddingBase class AzureOpenAIEmbedding(EmbeddingBase): def __init__(self, config: Optional[BaseEmbedderConfig] = None): super().__init__(config) ...
Review this code and list any quality issues.
[]
0
python
ret = system_prompt + self.sep else: ret = "" for i, (role, message) in enumerate(self.messages): if i % 2 == 0: ret += f"[Round {i//2 + round_add_n}]{self.sep}" if message: ret += f"{role}:{message}{self.s...
Review this code and list any quality issues.
[ { "issue": "same here. need `\\n` ending or not?", "severity": "minor", "line": 26 } ]
1
python
try: last_visited_dt, last_min = entries[asset] if last_visited_dt == dt_value: lows.append(last_min) continue elif last_visited_dt == prev_dt: curr_val = self._minute_reader.get_value( ...
Review this code and list any quality issues.
[]
0
python
raise APIConnectionError("failed to connect to OpenAI Responses WebSocket") from e except asyncio.TimeoutError as e: raise APIConnectionError("timed out connecting to OpenAI Responses WebSocket") from e async def connect(self) -> None: self._input_ch = utils.aio.Chan[dict]() sel...
Review this code and list any quality issues.
[ { "issue": "log a warning or raise when msg is not `openai.BaseModel`?", "severity": "minor", "line": 26 } ]
1
python
nested_class_table = {} # Used to find nested classes in typedef for rid, nestedclass in iter_dotnet_table(pe, dnfile.mdtable.NestedClass.number): assert isinstance(nestedclass, dnfile.mdtable.NestedClassRow) nested_class_table[nestedclass.NestedClass.row_index] = nestedclass.EnclosingClass...
Review this code and list any quality issues.
[ { "issue": "Please give this function a more descriptive name, e.g. `resolve_nested_typeref_name`.", "severity": "minor", "line": 26 } ]
1
python
flow=flow, output_path=output_path, inputs=inputs, environment_variables=environment_variables, variant=variant, node=node, experiment=experiment, session=session, allow_generator_output=False, stream_output=Fals...
Review this code and list any quality issues.
[ { "issue": "it seems that we can't handle dag flow now. Maybe we can ask extension to keep their previous logic to handle dag flow first?", "severity": "minor", "line": 26 } ]
1
python
# You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, 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 Li...
Review this code and list any quality issues.
[ { "issue": "Why does the base class need to enforce using a config in the initializer? I don't see any methods that use this value.", "severity": "minor", "line": 26 } ]
1
python
# Look for embedded Wistia player wistia_urls = WistiaIE._extract_urls(webpage) if wistia_urls: playlist = self.playlist_from_matches(wistia_urls, video_id, video_title, ie=WistiaIE.ie_key()) for entry in playlist['entries']: entry.update({ '_t...
Review this code and list any quality issues.
[ { "issue": "use `_extract_url` like other extractors", "severity": "major", "line": 26 } ]
1
python
if class_reduction == "micro": return fraction elif class_reduction == "macro": return torch.mean(fraction) elif class_reduction == "weighted": return torch.sum(fraction * (weights.float() / torch.sum(weights))) elif class_reduction == "none" or class_reduction is None: retur...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n If dim of ``x`` is greater than 1 since stable sort works with only 1d tensors.\r\n```", "severity": "minor", "line": 26 } ]
1
python
return rsp else: logger.info("Use response cache") return self.rsp_cache[msg] @pytest.fixture(scope="session") def rsp_cache(): # model_version = CONFIG.openai_api_model rsp_cache_file_path = TEST_DATA_PATH / "rsp_cache.json" # read repo-provided new_rsp_cache_file_path = ...
Review this code and list any quality issues.
[]
0
python
sigmoid_scale=False, mean_only=False, ).to(device) # reference model to compare model weights model_ref = GlowTTS( num_chars=32, hidden_channels_enc=48, hidden_channels_dec=48, hidden_channels_dp=32, out_channels=80, ...
Review this code and list any quality issues.
[]
0
python
'genres': ['Keyboard', 'Sonata (Keyboard)'], 'track': 'I. Adagio sostenuto', 'timestamp': 1518076337, 'upload_date': '20180208', }, }] def _real_extract(self, url): track_id = self._match_id(url) track_info = self._download_json( f'https:/...
Review this code and list any quality issues.
[ { "issue": "Very minor thing, lets set the `vcodec` to `'none'` so yt-dlp knows it's audio only.\r\n```suggestion\r\n 'ext': 'mp3',\r\n 'vcodec': 'none',\r\n```", "severity": "minor", "line": 26 } ]
1