language
string
code-snippit
string
instruction
string
flaws
list
flaw_count
int64
python
array([[0, 0], [1, 1], [2, 2]]) >>> repeat_last_axis(a, 4) array([[0, 0, 0, 0], [1, 1, 1, 1], [2, 2, 2, 2]]) Notes ---- The resulting array will share memory with `array`. If you need to assign to the input or output, you should probably make a copy ...
Review this code and list any quality issues.
[]
0
python
from .common import InfoExtractor from ..utils import ( unescapeHTML ) class EpochIE(InfoExtractor): _VALID_URL = r'https?://www.theepochtimes\.com/[\w-]+_(?P<id>\d+).html' _TESTS = [ { 'url': 'https://www.theepochtimes.com/they-can-do-audio-video-physical-surveillance-on-you-24h-365d-...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\nfrom ..utils import unescapeHTML\r\n```", "severity": "critical", "line": 4 } ]
1
python
@pytest.mark.parametrize( "use_interactive,is_atty,expected", [ (None, False, False), (None, True, True), (False, False, False), (False, True, False), (True, False, True), (True, True, True), ], ) @mock.patch("sys.stdin.isatty") def test_subversion__init_use_i...
Review this code and list any quality issues.
[]
0
python
def show_vendor_versions() -> None: logger.info("vendored library versions:") vendor_txt_versions = create_vendor_txt_map() with indent_log(): show_actual_vendor_versions(vendor_txt_versions) def show_tags(options: Values) -> None: tag_limit = 10 target_python = make_target_python(option...
Review this code and list any quality issues.
[ { "issue": "This would make the list unpredictable and useless. The ordering (before this PR) is from restrictive to general and quite informative.", "severity": "minor", "line": 26 } ]
1
python
if cookies.get('__Secure-3PSID'): return socs = cookies.get('SOCS') if socs and not socs.value.startswith('CAA'): # not consented return self._set_cookie('.youtube.com', 'SOCS', 'CAI', secure=True) # accept all (required for mixes) def _initialize_pref(self): ...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n auth_type, _, user = (username or '').partition('+')\r\n```", "severity": "critical", "line": 26 } ]
1
python
handle = traverse_obj(post, ('author', 'handle')) uploader = traverse_obj(post, ('author', 'displayName')) description = traverse_obj(post, ('record', 'text')) extractor = self.extract_comments(meta) return { 'id': video_id, 'title': f'{uploader}: "{description}"...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n 'subtitles': subs,\r\n```", "severity": "minor", "line": 26 } ]
1
python
request = Request.from_url('https://a.placeholder.com') @crawler.router.default_handler async def handler(context: BasicCrawlingContext) -> None: if '|test' in context.request.unique_key: return raise ValueError('This error should not be handled by error handler') @crawler.erro...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n original_request = await queue.get_request(request.unique_key)\r\n error_request = await queue.get_request(f'{request.unique_key}|test')\r\n\r\n assert original_request is not None\r\n assert original_request.state == RequestState.ERROR_HANDLER\r\n assert original_re...
1
python
) -> str: return value @app.get("/partial-callable-dependency") async def get_partial_callable_dependency( value: Annotated[ str, Depends(partial(callable_dependency, "partial-callable-dependency")) ], ) -> str: return value @app.get("/partial-callable-gen-dependency") async def get_partial_...
Review this code and list any quality issues.
[]
0
python
'thumbnail': r're:https://.+\.webp.*', 'like_count': int, 'view_count': int, 'comment_count': int, 'repost_count': int, 'uploader_url': 'https://www.tiktok.com/@MS4wLjABAAAAXcNoOEOxVyBzuII_E--T0MeCrLP0ay1Sm6x_n3dluiWEoWZD0VlQOytwad4W0i0n', } }, { ...
Review this code and list any quality issues.
[ { "issue": "IMO we should try to keep the metadata fields consistent with the other TikTok IEs, in which case the `@username`/`unique_id`/`uniqueId` would instead be `uploader`\r\n```suggestion\r\n uploader = self._match_id(url)\r\n```", "severity": "minor", "line": 26 } ]
1
python
def __init__( self, *, api_url: NotGivenOr[str | None] = NOT_GIVEN, api_secret: NotGivenOr[str | None] = NOT_GIVEN, avatar_name: NotGivenOr[str | None] = NOT_GIVEN, avatar_expression: NotGivenOr[str | None] = NOT_GIVEN, avatar_participant_identity: NotGivenOr[str ...
Review this code and list any quality issues.
[ { "issue": "maybe also a default avatar name?", "severity": "minor", "line": 26 } ]
1
python
'uploader_id': '100040874179269', 'duration': 9.579, 'timestamp': 1637502609, 'upload_date': '20211121', 'thumbnail': r're:^https?://.*', } }] def _real_extract(self, url): video_id = self._match_id(url) return self.url_result( ...
Review this code and list any quality issues.
[ { "issue": "`uploader_id` needs to be str, not int", "severity": "minor", "line": 26 } ]
1
python
return outputs def enable_components(session_id:str)->tuple: session = context.get_session(session_id) if session and session.get('id', False): if session['event'] == 'confirm_blocks': outputs = tuple([gr.update() for _...
Review this code and list any quality issues.
[ { "issue": "The visible variable should be a boolean, not a mix of boolean and string. This line should be: visible = session['voice'] is not None (which evaluates to True or False). Mixing True and 'hidden' as possible values for the same variable is inconsistent with the rest of the codebase where visible is ...
1
python
# Store and sync before yielding terminal events # This ensures the storage/syncing happens even if the consumer breaks after receiving the event if ( stream_chunk.type in {"response.completed", "response.incomplete"} and final_response ...
Review this code and list any quality issues.
[ { "issue": "Given the amount of things happening in `close_all()`, shouldn't we wrap it with `asyncio.shield()` to prevent halfway cancellations which would leak resources (sockets, fd...)? shield() prevents cancellation from aborting cleanup, ensuring all sessions are closed deterministically before the task f...
1
python
# this WorkerGroup. self.sub_cls_name = "" self.device_name = kwargs.get("device_name", "cuda") self.profile_steps = kwargs.get("profile_steps", None) self.worker_nsight_options = kwargs.get("worker_nsight_options", None) self.customized_worker_env = kwargs.get("worker_env", {}) ...
Review this code and list any quality issues.
[ { "issue": "Why putting `SubRayResourcePool` as the default behavior instead of keeping `RayResourcePool` as the default?", "severity": "minor", "line": 26 } ]
1
python
import functools import re from .common import InfoExtractor from ..networking import HEADRequest from ..utils import ( InAdvancePagedList, clean_html, determine_ext, float_or_none, int_or_none, join_nonempty, make_archive_id, mimetype2ext, orderedSet, remove_end, smuggle_ur...
Review this code and list any quality issues.
[ { "issue": "Oh, and you can add this to the imports from above sorted alphabetically", "severity": "minor", "line": 26 } ]
1
python
``` """ _URL = "http://www.openslr.org/12" _DL_URL = "http://www.openslr.org/resources/12/" def retrieve_subset(name): # "train-other-500.tar.gz" -> "other-500" return "-".join(name.split(".")[0].split("-")[1:]) _DL_URLS = { "clean": { "dev": _DL_URL + "dev-clean.tar.gz", "test": _DL_UR...
Review this code and list any quality issues.
[ { "issue": "I think it is more standard to split this into dev-clean and dev-other because you usually always treat and report them separately.", "severity": "major", "line": 26 } ]
1
python
""" Base class for all types of sensors. A sensor must have a read() method that returns the sensor data. """ def __init__(self, sensor_options: "SensorOptions", sensor_idx: int, sensor_manager: "SensorManager"): self._options: "SensorOptions" = sensor_options self._idx: int = sensor_id...
Review this code and list any quality issues.
[ { "issue": "You should probably set the absolute tolerance yourself.", "severity": "minor", "line": 26 } ]
1
python
video_info = self._download_json( 'https://api.redgifs.com/v2/gifs/%s' % video_id, video_id, 'Downloading video info') if 'error' in video_info: raise ExtractorError('RedGifs said: ' + video_info['error'], expected=True) gif = video_info['gif'] urls = gif['ur...
Review this code and list any quality issues.
[ { "issue": "makes sense as a class var - like this:\r\n\r\n```\r\n_FORMATS = {\r\n 'gif': 250,\r\n 'sd': 480,\r\n 'hd': None,\r\n}", "severity": "minor", "line": 26 } ]
1
python
return dttm.strftime(strftime) return ( self.database.db_engine_spec.convert_dttm(target_type or "", dttm) if self.database and dttm else None ) return TimeFilter( from_expr=_format_dttm(from_expr), to_expr=_format_...
Review this code and list any quality issues.
[]
0
python
self._remove_duplicate_formats(formats) for f in formats: if f.get('height') is None: f['height'] = int_or_none( self._search_regex(r'_(\d{2,3}[02468])_', f['url'], 'video height', default=None)) if 'preview' in f['format_id']: f['pref...
Review this code and list any quality issues.
[ { "issue": "```py\r\n return {\r\n 'id': video_id,\r\n 'title': title,\r\n 'formats': formats,\r\n **traverse_obj(metadata, {\r\n 'description': ('description', {clean_html}),\r\n 'uploader': ('model', 'displayName', {clean_html}),...
1
python
axis: SupportsIndex | None, fill_value: _ScalarLike_co | None, out: _ArrayT, *, keepdims: bool | _NoValueType = ..., ) -> _ArrayT: ... minimum: _extrema_operation maximum: _extrema_operation @overload def take( # type: ignore[overload-overlap] a: _MaskedArray[_SCT], indices: _IntLike_co, ...
Review this code and list any quality issues.
[ { "issue": "This will match \r\n\r\n```pycon\r\n>>> np.ma.take(np.eye(2), 1, axis=0)\r\nmasked_array(data=[0., 1.],\r\n mask=False,\r\n fill_value=1e+20)\r\n```\r\n\r\nand infer the return type as `Any`. \r\n\r\nBy swapping this overload with the one below, then that overload would be matched ...
1
python
@staticmethod def memory_usage(): alloc = "mem_allocated: {:.4f} GB".format(get_accelerator().memory_allocated() / (1024 * 1024 * 1024)) max_alloc = "max_mem_allocated: {:.4f} GB".format(get_accelerator().max_memory_allocated() / (1024 * 1024...
Review this code and list any quality issues.
[]
0
python
choicestr += "]" session = get_prompt_session() answer = ( session.prompt( [("bold fg:ansiyellow bg:red", f" {question} {choicestr} "), ("", " ")], ) .lower() .strip() ) if not override_auto: if copiable and answer == "c": if copy(): ...
Review this code and list any quality issues.
[ { "issue": "Not so secret anymore\r\n```suggestion\r\n # skip asking for a number of times\r\n```", "severity": "critical", "line": 26 } ]
1
python
] logger.debug(f"Webhook events to subscribe to: {', '.join(events)}") # Check & process prerequisites for auto-setup webhooks if auto_setup_webhook := isinstance(trigger_base_config, BlockWebhookConfig): try: resource = trigger_base_config.resource_format.format(**trigger_config) ...
Review this code and list any quality issues.
[]
0
python
'series': traverse_obj(videos, ('program_detail', 'title')), } class NetversePlaylistIE(NetverseBaseIE): _VALID_URL = r'https?://(?:\w+\.)?netverse\.id/(?P<type>webseries)/(?P<display_id>[^/?#&]+)' _TEST = { 'url': 'https://netverse.id/webseries/tetangga-masa-gitu', 'info_dict': { ...
Review this code and list any quality issues.
[ { "issue": "will you be addressing this todo now? or should I merge without it?\r\n\r\n```suggestion\r\n # FIXME: get video from other season from api_url/<season_id>?page=<page>\r\n```", "severity": "minor", "line": 26 } ]
1
python
for int_func in int_funcs: assert_equal(int_func(np.array(0)), 0) with pytest.warns(DeprecationWarning): assert_equal(int_func(np.array([1])), 1) with pytest.warns(DeprecationWarning): assert_equal(int_func(np.array([[42]])), 42) assert_rai...
Review this code and list any quality issues.
[ { "issue": "New tests? I don't say no to new tests ever :). (I think `float` and `__float__` is a bit double, since `float` just calls `__float__`, but OK.)", "severity": "minor", "line": 26 } ]
1
python
}, }, 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( '--alias', metavar='ALIASES OPTIONS...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n 'This option can be used multiple times'))\r\n```", "severity": "minor", "line": 26 } ]
1
python
from botocore import xform_name from botocore.docs.bcdoc.restdoc import DocumentStructure from botocore.docs.method import ( document_custom_method, document_model_driven_method, ) from botocore.model import OperationModel from botocore.utils import get_service_module_name from boto3.docs.base import NestedDoc...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\nPUT_DATA_WARNING_MESSAGE = \"\"\"\r\n.. warning::\r\n It is recommended to use the :py:meth:`put_metric_data`\r\n :doc:`client method <../../cloudwatch/client/put_metric_data>`\r\n instead. If you would still like to use this resource method,\r\n please make sure that ``...
1
python
self._requests_priority[request.request_id] = getattr(request, "priority", 0) token_ids = request.prompt_token_ids # If the request has multimodal hashes, apply them to the token ids mm_hashes, mm_positions = extract_mm_features(request) if mm_hashes and mm_positions: # TOD...
Review this code and list any quality issues.
[ { "issue": "Do you think it can be good to maintain if we put this logic into lmcache lookup client? @sammshen", "severity": "major", "line": 26 } ]
1
python
assert result.shape == (2, bins + 1) assert result.columns.tolist() == [ "group", "1.0 - 2.8", "2.8 - 4.6", "4.6 - 6.4", "6.4 - 8.2", "8.2 - 10.0", ] assert result.values.tolist() == [["A", 2, 2, 4, 4, 6], ["B", 0, 2, 2, 4, 4]] def test_histogram_with_groupb...
Review this code and list any quality issues.
[]
0
python
backend, bucket_size=bucket_size, **engine_kwargs ) self.extra_rollout_args = args self.extra_rollout_kwargs = kwargs if self.server_adapter is None: self.server_adapter = get_rollout_class(self.rollout_config.name, self.rollout_config.mode)( *self.extra_rollo...
Review this code and list any quality issues.
[ { "issue": "@wuxibin89 Does adding these methods in base reasonable?", "severity": "minor", "line": 26 } ]
1
python
======== >>> from sympy.utilities.misc import func_name >>> from sympy import Matrix >>> from sympy.abc import x >>> func_name(Matrix.eye(3)) 'MutableDenseMatrix' >>> func_name(x < 1) 'StrictLessThan' >>> func_name(x < 1, short=True) 'Lt' """ alias = { 'GreaterThan': 'Ge...
Review this code and list any quality issues.
[ { "issue": "A better way to do this is just to have\r\n```\r\ntyp = str(type(x))\r\n```\r\nat the beginning and the `str(typ)` can be `typ` everywhere else.", "severity": "minor", "line": 26 } ]
1
python
pass @abstractmethod async def get_download_url(self, storage_path: str, expires_in: int = 3600) -> str: """ Get URL for downloading the file. Args: storage_path: The storage path expires_in: URL expiration time in seconds (default 1 hour) Returns: ...
Review this code and list any quality issues.
[ { "issue": "```suggestion\n ## Event-loop-aware\n Each event loop gets its own `aiohttp` session and GCS\n client. This is required because `aiohttp.ClientSession` (and the\n `asyncio.timeout()` calls it makes internally) are bound to the loop they\n were created on. In the copilot executor every...
1
python
def set_vocab(self): if (self.dir_model / "tokenizer.json").is_file(): self._set_vocab_gpt2() else: self._set_vocab_sentencepiece() self.gguf_writer.add_add_space_prefix(False) def set_gguf_parameters(self): hparams = self.hparams # some default ...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n if (final_logit_softcap := hparams.get(\"final_logit_softcapping\")):\r\n self.gguf_writer.add_final_logit_softcapping(final_logit_softcap)\r\n if hparams.get(\"sliding_window_pattern\") != 1:\r\n self.gguf_writer.add_sliding_window(hparams[\"sli...
1
python
"user_divisions": None, "label": None, "_partitions": None, "_series": False, } _absorb_projections = True @functools.cached_property def columns_operand(self): return _convert_to_list(self.operand("columns")) @property def columns(self): if self.columns...
Review this code and list any quality issues.
[]
0
python
self.cache.store(self._NETRC_MACHINE, 'device_id', self._DEVICE_ID) def _refresh_token(self): refresh = self._download_json( 'https://securetoken.googleapis.com/v1/token', None, 'Refreshing token', query=self._LOGIN_QUERY, data=urlencode_postdata({ 'grant_type': 'ref...
Review this code and list any quality issues.
[ { "issue": "This was fine to do; for the best even. Sorry if I was being confusing w/my earlier comment\r\n```suggestion\r\n if auth and self._TOKEN:\r\n```", "severity": "critical", "line": 26 } ]
1
python
# https://openid.net/specs/openid-connect-core-1_0.html#CodeFlowAuth (Sec. 3.1.1) # Steps 4 & 5 authorize yt-dlp to act on user's behalf. # random_str() came from https://www.rokfin.com/static/js/2.*.chunk.js def random_str(): rnd_lst = [random.choice('0123456789abcdef') for _ in r...
Review this code and list any quality issues.
[ { "issue": "shouldn't this be a warning/error?", "severity": "minor", "line": 26 } ]
1
python
if y_vals is None: y_vals = [] x_mobs = self.get_x_axis().get_number_mobjects(*x_vals) y_mobs = self.get_y_axis().get_number_mobjects(*y_vals) self.coordinate_labels = VGroup(x_mobs, y_mobs) return self.coordinate_labels def add_coordinates(self, x_vals=None, y_vals=Non...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n \"\"\"Draws a line graph.\r\n \r\n The graph connects the vertices formed from zipping\r\n ``x_values``, ``y_values`` and ``z_values``. Also adds :class:`~.Dot`s at the\r\n vertices if ``add_vertex_dots`` is set to ``True``.\r\n```", "severity...
1
python
pp. 591-611, :doi:`10.2307/2333709` .. [3] Razali, N. M. & Wah, Y. B., "Power comparisons of Shapiro-Wilk, Kolmogorov-Smirnov, Lilliefors and Anderson-Darling tests", Journal of Statistical Modeling and Analytics, 2011, Vol. 2, pp. 21-33. .. [4] Royston, P. "A toolkit for testing for non-n...
Review this code and list any quality issues.
[ { "issue": "```suggestion\n # `x` is an array and axis=-1 due to _axis_nan_policy decorator\n```", "severity": "minor", "line": 26 } ]
1
python
@pytest.mark.unittest class TestRun: @pytest.mark.parametrize( "kwargs", [ {"source": EAGER_FLOWS_DIR / "simple_with_yaml"}, {"source": EAGER_FLOWS_DIR / "simple_with_yaml" / "flow.flex.yaml"}, ], ) def test_eager_flow_load(self, kwargs): flow = load_f...
Review this code and list any quality issues.
[]
0
python
reg_mode = DEFAULT_MODE py36_mode = replace(DEFAULT_MODE, target_versions=PY36_VERSIONS) source, expected = read_data("force_py36") with cache_dir() as workspace: paths = [ (workspace / "file1.py").resolve(), (workspace / "file2.py").resolve(), ...
Review this code and list any quality issues.
[]
0
python
""" if rgbas is None and color is None: color = YELLOW self.append_points(points) # rgbas array will have been resized with points if color is not None: if opacity is None: opacity = self.data["rgbas"][-1, 3] new_rgbas = np.repeat([colo...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n mob.set_rgba_array_direct(mob.rgbas[thin_func()])\r\n mob.set_points(mob.points[thin_func()])\r\n```", "severity": "minor", "line": 26 } ]
1
python
'playlist_mincount': 13, 'info_dict': { 'id': 'data-scale-spring-2022', 'title': 'Data @Scale Spring 2022', 'description': 'md5:7d7ca1c42ac9c6d8a785092a1aea4b55' }, }, { 'url': 'https://atscaleconference.com/events/video-scale-2021/', 'playlist_min...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n return self.playlist_from_matches(\r\n re.findall(r'data-url\\s*=\\s*\"(https?://(?:www\\.)?atscaleconference\\.com/videos/[^\"]+)\"', webpage),\r\n ie='Generic', playlist_id=id,\r\n title=self._og_search_title(webpage), description=self._og_...
1
python
}, 'playlist_mincount': 2, }, { # 20 minuten embed 'url': 'http://www.20min.ch/schweiz/news/story/So-kommen-Sie-bei-Eis-und-Schnee-sicher-an-27032552', 'info_dict': { 'id': '523629', 'ext': 'mp4', 'title': 'S...
Review this code and list any quality issues.
[]
0
python
import functools import urllib.parse import hashlib import json from .common import InfoExtractor from ..utils import ( ExtractorError, OnDemandPagedList, int_or_none, mimetype2ext, qualities, traverse_obj, unified_timestamp, ) # https://github.com/yt-dlp/yt-dlp/issues/6671 class IwaraBas...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n _NETRC_MACHINE = 'iwara'\r\n```", "severity": "minor", "line": 22 } ]
1
python
session_table = agent.db.session_table_name if agent.db else None knowledge_table = agent.db.knowledge_table_name if agent.db and agent.knowledge else None tools_info = { "tools": formatted_tools, "tool_call_limit": agent.tool_call_limit, "tool_choice": agent.tool_ch...
Review this code and list any quality issues.
[ { "issue": "`Agent.knowledge_filters` is typed/used as `Optional[Union[Dict[str, Any], List[FilterExpr]]]` (and `os/utils.py` explicitly preserves dict-form filters). This change assumes it’s always iterable as a list; if `knowledge_filters` is a dict, the list-comprehension will iterate keys and return a `List...
1
python
'otype': 'json', 'spwm': '1', # For SHD 'host': self._HOST, 'referer': self._REFERER, 'ehost': video_url, 'appVer': self._APP_VERSION, 'platform': self._PLATFORM, # For VQQ 'guid': guid, 'flowid': ''....
Review this code and list any quality issues.
[ { "issue": "Avoid declaring variables only used once\r\n\r\nhttps://github.com/yt-dlp/yt-dlp/blob/master/CONTRIBUTING.md#inline-values", "severity": "minor", "line": 26 } ]
1
python
y = second.detach().numpy() print("ATOL", atol) if verbose: print("x = {}".format(x.flatten())) print("y = {}".format(y.flatten())) print('-' * 80) np.testing.assert_allclose(x, y, err_msg="param-update mismatch!", atol=atol) @pytest.mark.parametrize('dtype', [torch.half, torch.flo...
Review this code and list any quality issues.
[]
0
python
'url': 'https://v.youku.com/v_show/id_XNTA2NTA0MjA1Mg==.html', 'info_dict': { 'id': 'XNTA2NTA0MjA1Mg', 'ext': 'mp4', 'title': 'Minecraft我的世界:建造超大巨型航空飞机,菜鸟vs高手vs黑客', 'duration': 542.13, 'thumbnail': r're:^https?://.*', 'uploader': '波哥游戏解说', ...
Review this code and list any quality issues.
[ { "issue": "Don't delete this one since there is no replacement test and just add something like `'skip': '404'`", "severity": "minor", "line": 26 } ]
1
python
""" Checks if the supplied string is a number with octal or binary notation """ return text.startswith(("0o", "0b")) def is_hex(text: str) -> bool: """Checks if the supplied string is a number with hexadecimal notation""" return text.startswith("0x") def format_hex(text: str) -> str: """ ...
Review this code and list any quality issues.
[ { "issue": "This code matches 0xdeadbeef; it's an incorrect abstraction that depends on is_hex and other test having been applied earlier.", "severity": "critical", "line": 26 } ]
1
python
'duration': 210.0, 'thumbnail': r're:https?://images\.universal-music\.de/img/assets/.+\.jpg', 'timestamp': 1513591800, 'upload_date': '20171218', 'view_count': int, }, }, { 'url': 'https://www.universal-music.de/alexander-eder/videos/der-doktor-hat-ge...
Review this code and list any quality issues.
[ { "issue": "Instead of requesting the url here then later using `urlh.url`, should you not use `yt_dlp.utils.update_url_query()` and just let the extract formats call handle the request?", "severity": "major", "line": 26 } ]
1
python
return { 'id': episode_id, 'title': episode.get('title'), 'description': episode.get('description'), 'thumbnail': episode.get('thumbnail'), 'formats': [ {'url': episode[f'jwVideo{h}Embed'], 'height': h} for h in (320, 480, 720, ...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n _VALID_URL = r'https?://app.itpro.tv/course/(?P<id>[0-9a-z-]+)/?(?:$|[#?])'\r\n```\r\nshould fix the `test_all_urls` issue", "severity": "minor", "line": 26 } ]
1
python
) ) # AquilaChat default template # source: https://github.com/FlagAI-Open/FlagAI/blob/master/examples/Aquila/Aquila-chat/cyg_conversation.py register_conv_template( Conversation( name="aquila-chat", system_message="A chat between a curious human and an artificial intelligence assistant. " ...
Review this code and list any quality issues.
[ { "issue": "I think third element is never used. We can delete them", "severity": "minor", "line": 26 } ]
1
python
return self._search_json( r'window\.__INITIAL_DATA__\s*=', webpage, 'init json', audio_id, transform_source=js_to_json) class JioSaavnSongIE(JioSaavnBaseIE): _VALID_URL = r'https?://(?:www\.)?(?:jiosaavn\.com/song/[^/?#]+/|saavn\.com/s/song/(?:[^/?#]+/){3})(?P<id>[^/?#]+)' _TESTS = [{ ...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n\r\n _VALID_BITRATES = ('16', '32', '64', '128', '320')\r\n\r\n def _real_extract(self, url):\r\n```", "severity": "major", "line": 26 } ]
1
python
return isinstance(other, Sequence) and self.id == other.id def __getattr__(self, attribute_name): protected_attribute_name = _validate_id(attribute_name) if protected_attribute_name in self._properties: return _tpl._replace_templates(self._properties[protected_attribute_name]) t...
Review this code and list any quality issues.
[]
0
python
K = rbf_kernel(X, gamma=gamma) assert_array_almost_equal(K, np.dot(X_transformed, X_transformed.T)) assert np.all(np.isfinite(Y)) @pytest.mark.parametrize( "array_namespace, device, dtype_name", yield_namespace_device_dtype_combinations() ) def test_nystroem_singular_kernel_array_api(array_namespace, dev...
Review this code and list any quality issues.
[ { "issue": "Also: I think we almost always can and should use the `@` operator instead of `np.dot` in new code.", "severity": "minor", "line": 26 } ]
1
python
) as mock_cleanup: # Execute result = await service.resume_sandbox('oh-test-abc123') # Verify assert result is True mock_container.unpause.assert_called_once() mock_container.start.assert_not_called() # Verify cleanup was called with the correct limit ...
Review this code and list any quality issues.
[]
0
python
def _parse(self): self.f.seek(0x0) self.file_header = self.f.read(0x40) if not self.file_header.startswith(b"\x7fELF"): raise CorruptElfFile("missing magic header") ei_class, ei_data = self.file_header[4], self.file_header[5] logger.debug("ei_class: 0x%02x ei_data: ...
Review this code and list any quality issues.
[ { "issue": "i find this region to be very noisy and hard to read. is there some way to refactor the repeated leaflets, for example?", "severity": "major", "line": 26 } ]
1
python
need_enforce_dtype = True else: # We follow NumPy's rules for dtype promotion, which special cases # scalars and 0d ndarrays (which it considers equivalent) by using # their values to compute the result dtype: # https://github.com/numpy/numpy/issues/6240 # We don't inspect th...
Review this code and list any quality issues.
[ { "issue": "While broad exception catching is a bad habit this PR seems to change the exception type here in a way that seems unrelated to the goal of the PR. This could be breaking in some ways and would need further investigation, probably in a separate PR.\n\nI also don't think the comment is that helpful be...
1
python
async def _sendfile_fallback(self, transp, file, offset, count): if offset: file.seek(offset) blocksize = min(count, 16384) if count else 16384 buf = bytearray(blocksize) total_sent = 0 proto = _SendfileFallbackProtocol(transp) try: while True: ...
Review this code and list any quality issues.
[ { "issue": "As this method is called from just one place, I suggest to inline it", "severity": "minor", "line": 26 } ]
1
python
return y async def defer(ctx: RunContext[None], tool_def: ToolDefinition) -> ToolDefinition | None: return replace(tool_def, kind='external') @agent.tool_plain(prepare=defer) def deferred_tool(x: int) -> int: # pragma: no cover return x + 1 result = agent.run_...
Review this code and list any quality issues.
[]
0
python
'remove key if branch in dict key not successful' def test_traversal_default(self): _DEFAULT_DATA = {'None': None, 'int': 0, 'list': []} assert traverse_obj(_DEFAULT_DATA, 'fail') is None, \ 'default value should be `None`' assert traverse_obj(_DEFAULT_DATA, 'fail', 'fail', def...
Review this code and list any quality issues.
[]
0
python
assert_allclose(inv_a[1], np.diag(1 / np.arange(1, 4)), atol=1e-14) # ill-conditioned inputs warn a = np.asarray([[1e30, 0], [0, 1]]) with pytest.warns(LinAlgWarning): inv(a, assume_a="diagonal") class TestDet: def test_1x1_all_singleton_dims(self): a = np.array([[1]])...
Review this code and list any quality issues.
[ { "issue": "From the testsuite perspective, this PR seems quite safe for the usual reasons, you've added more testing without mutating old tests.", "severity": "minor", "line": 26 } ]
1
python
@RunIf(min_torch="2.4") @pytest.mark.parametrize( ("precision", "raises"), [("32-true", False), ("16-true", False), ("bf16-true", False), ("16-mixed", True), ("bf16-mixed", False)], ) def test_precision_selection_model_parallel(precision, raises, mps_count_0): error_context = pytest.raises(ValueError, match...
Review this code and list any quality issues.
[ { "issue": "```suggestion\ndef test_mps_amp_device_selection(accelerator, precision):\n \"\"\"Test that MPS accelerator with mixed precision correctly sets device to 'mps' instead of 'cuda'.\"\"\"\n connector = _AcceleratorConnector(accelerator=accelerator, precision=precision)\n assert isinstance(conn...
1
python
settings = Settings() stripe.api_key = settings.secrets.stripe_api_key logger = logging.getLogger(__name__) class UsageTransactionMetadata(BaseModel): graph_exec_id: str | None = None graph_id: str | None = None node_id: str | None = None node_exec_id: str | None = None block_id: str | None = None...
Review this code and list any quality issues.
[ { "issue": "Why `datatime.max` as default? +nit:\r\n```suggestion\r\n usage_start_time: datetime = datetime.max\r\n```", "severity": "minor", "line": 26 } ]
1
python
# same directory as project root, so a lot of things were available on Path.cwd(). # We take care to delete with `delete_unnecessary_assets` to simulate the behaviour # of a installed package in a fresh environment. context.result = run(cmd, env=context.env, cwd=str(context.root_project_dir)) @when("I ask...
Review this code and list any quality issues.
[]
0
python
def re_compile_maybe_verbose(regex: str) -> Pattern[str]: """Compile a regular expression string in `regex`. If it contains newlines, use verbose mode. """ if "\n" in regex: regex = "(?x)" + regex compiled: Pattern[str] = re.compile(regex) return compiled def enumerate_reversed(sequen...
Review this code and list any quality issues.
[ { "issue": "To someone like me, the `diff_lines.append(\"\\\\ No newline at end of file\\n\")` link just looks plain wrong. I would suggest explaining that this code is using a special feature of the patch specification(?) to work around a Python bug. Also linking the BPO would be the cherry on the cake!\r\n\r\...
1
python
if max_new_tokens: generating_args.pop("max_length", None) generating_args["max_new_tokens"] = max_new_tokens gen_kwargs = dict( inputs=inputs, attention_mask=attention_mask, generation_config=GenerationConfig(**generating_args), logits_pr...
Review this code and list any quality issues.
[ { "issue": "use getattr(model.config, \"model_type\", None) to avoid exceptions", "severity": "minor", "line": 26 } ]
1
python
): ToolCallPart( tool_name='final_result', args={ 'ingredients': ['spaghetti', 'tomato sauce', 'vegetarian mince', 'onions', 'garlic'], 'steps': ['Cook the spaghetti in boiling water', '...'], }, ), ( '<examples>\n' ' <dish_name>Chocolate Cake</di...
Review this code and list any quality issues.
[]
0
python
q = df.select( pl.col("a").slice(offset=1, length=pl.len() - 1).alias("1"), pl.col("a").slice(offset=1, length=pl.len() - 1).alias("2"), ) assert "__POLARS_CSE" in q.explain( optimizations=pl.QueryOptFlags(comm_subexpr_elim=True) ) assert q.collect(optimizations=pl.QueryOptFlag...
Review this code and list any quality issues.
[]
0
python
asset_id = request.path_params.get('asset_id') if session_id and asset_id: asset = asset_store.get_asset(session_id, asset_id) if asset: return JSONResponse( { 'id': asset.get('id'), 'created_at': asset.get('created_at').isoformat(), 'expires_at': asset.get('expires_at').isoformat(), 'type'...
Review this code and list any quality issues.
[ { "issue": "should we eventually allow asset_ids for mass-deletion?", "severity": "minor", "line": 26 } ]
1
python
history_processors=self.history_processors, builtin_tools=list(self._builtin_tools), tool_manager=tool_manager, tracer=tracer, get_instructions=get_instructions, instrumentation_settings=instrumentation_settings, ) # Apply overrides to the sta...
Review this code and list any quality issues.
[ { "issue": "These 2 fields are not actually used anywhere, but I suppose we can't remove them or stop setting them because `UserPromptNode` is public (exposed via `pydantic_ai.agent`) and people may be using them...", "severity": "minor", "line": 26 } ]
1
python
'episode_number': 1, 'release_year': 2016, }, 'params': { 'skip_download': True, }, }, { 'url': 'https://www.sonyliv.com/movies/tahalka-1000050121?watch=true', 'only_matching': True, }, { 'url': 'https://www.sonyliv.com/clip/jigarbaaz-10000...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n _LOGIN_HINT = 'Use \"--username <mobile_number>\" to login using OTP or \"--username token --password <user_token>\" to login using auth token'\r\n```", "severity": "critical", "line": 26 } ]
1
python
>>> rankdata([0, 2, 3, np.nan, -2, np.nan], nan_policy="omit") array([ 2., 3., 4., nan, 1., nan]) """ methods = ('average', 'min', 'max', 'dense', 'ordinal') if method not in methods: raise ValueError(f'unknown method "{method}"') xp = array_namespace(a) x = xp.asarray(a) if ax...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n # whether to always or never run this block with JIT.\r\n```\r\nLet's not hold this back for a typo, though.", "severity": "minor", "line": 26 } ]
1
python
:type service_name: string :param service_name: The name of a service, e.g. 's3' or 'ec2'. You can get a list of available services via :py:meth:`get_available_services`. :type region_name: string :param region_name: The name of the region associated with the client. ...
Review this code and list any quality issues.
[]
0
python
if self.tracker_state.get(tracker_id) == tracker_state: continue self.tracker_state[tracker_id] = tracker_state all_anchors_in_range = True for anchor in anchors: if not self.is_point_in_line_range(anchor): ...
Review this code and list any quality issues.
[ { "issue": "That line was changed [recently](https://github.com/roboflow/supervision/pull/737/files). Please reflect that change in your new implementation.", "severity": "minor", "line": 26 } ]
1
python
self.description: str = data['description'] self.required: bool = data.get('required', False) self.choices: List[Choice[Union[int, float, str]]] = [ Choice(name=d['name'], value=d['value']) for d in data.get('choices', []) ] self.arguments: List[Argument] = [ Argu...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n \"\"\"Represents the permissions for an application command.\r\n\r\n .. versionadded:: 2.0\r\n\r\n Attributes\r\n```", "severity": "critical", "line": 26 } ]
1
python
-------- :meth:`move_to` """ if config.renderer == "opengl": self.apply_points_function( lambda points: scale_factor * points, works_on_bounding_box=True, **kwargs, ) return self else: self.a...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n about_point: Optional[Sequence[float]] = None,\r\n```", "severity": "minor", "line": 26 } ]
1
python
log_name = self.task.instance.log_format logger.warning(f"Could not launch pod for {log_name}. Exceeded quota.") self.task.update_model(self.task.instance.pk, status='pending') return try: receptor_output = '' ...
Review this code and list any quality issues.
[ { "issue": "What's are the version compatibility issues with this? Does this requires an updated receptor, and does that make it unreasonable to backport? Is there any idea to work on a different fix for backports?", "severity": "minor", "line": 26 } ]
1
python
'channel_id': ('channel', 'id', {str}), 'release_timestamp': ('releaseDate', {parse_iso8601}), }), } items = [] for media in traverse_obj(post_data, (('videoAttachments', 'audioAttachments'), ...)): media_id = media['id'] media_typ = media.get...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n format_id = traverse_obj(variant, ('name', {str}))\r\n```", "severity": "minor", "line": 26 } ]
1
python
Returns ------- sample_weight : ndarray of shape (n_samples,) Validated sample weight. It is guaranteed to be "C" contiguous. """ xp, _, device = get_namespace_and_device(X, remove_types=(int, float)) n_samples = _num_samples(X) max_float_type = _max_precision_float_dtype(xp, device) ...
Review this code and list any quality issues.
[ { "issue": "We can probably do the dtype conversion there as well, no? That might spare a temporary allocation on the device in some cases.\n\n\n```suggestion\n sample_weight = xp.asarray(sample_weight, dtype=dtype, device=device)\n```", "severity": "minor", "line": 26 } ]
1
python
if True not in traverse_obj(post_data, ('metadata', ('hasVideo', 'hasAudio'))): raise ExtractorError('Post does not contain a video or audio track', expected=True) items = [] for media in traverse_obj(post_data, (('videoAttachments', 'audioAttachments'), ...)): media_id = media[...
Review this code and list any quality issues.
[ { "issue": "Not a huge fan of how this function looks, but nothing comes to mind. Maybe we can at least pull out `path` since its static?", "severity": "minor", "line": 26 } ]
1
python
""" Sherlock Module This module contains the main logic to search for usernames at social networks. """ __shortname__ = "Sherlock" __longname__ = "Sherlock: Find Usernames Across Social Networks" __version__ = "0.15.0" forgeApiLatestReleaseUrl = "https://api.github.com/repos/sherlock-project/sherlock/relea...
Review this code and list any quality issues.
[ { "issue": "Since we use snake_case across the project, we should use snake_case here as well", "severity": "minor", "line": 12 } ]
1
python
function_name="async_create_todo_item", arg_types={ 1: "TodoItem", }, return_type="None", mandatory=True, ), TypeHintMatch( function_name="async_update_todo_item", ...
Review this code and list any quality issues.
[ { "issue": "These new `mandatory=True` flags change behavior under `ignore-missing-annotations` (they bypass the skip logic in `_ignore_function_match`). Please add/extend a pylint plugin unit test that demonstrates that a `TodoListEntity` implementation missing annotations for these methods now triggers the ch...
1
python
or ``Path`` object. Paths can be absolute or relative to the working directory (where you execute ``streamlit run``). - Any object. If ``body`` is not a string or path, Streamlit will convert the object to a string. ``body._repr_html_()`` takes precedence over ``str...
Review this code and list any quality issues.
[]
0
python
@pytest.mark.parametrize( argnames=("conn_id", "account_id"), argvalues=[(ACCOUNT_ID_CONN, None), (NO_ACCOUNT_ID_CONN, ACCOUNT_ID)], ids=["default_account", "explicit_account"], ) @patch.object(DbtCloudHook, "run") @patch.object(DbtCloudHook, "_paginate") def test_trigger_job_run...
Review this code and list any quality issues.
[]
0
python
wte = model.get_input_embeddings() if not self.is_encoder_decoder: input_ids = inputs["input_ids"] # some models infer position ids/attn mask differently when input ids # by check if pad_token let's make sure no padding is in input ids not_pad_...
Review this code and list any quality issues.
[]
0
python
calibration_path : str (optional) path to save quantize parameters after calibration onnx_path : str (optional) path to save onnx model input_shape : list or tuple input shape to onnx model device : torch.device device of the model, used to place t...
Review this code and list any quality issues.
[ { "issue": "is `calibration_config[name]['tracked_min_weight'] = -val` and `calibration_config[name]['tracked_max_weight'] = val`?", "severity": "minor", "line": 26 } ]
1
python
ignore_http_error_status_codes: NotRequired[Iterable[int]] """HTTP status codes that are typically considered errors but should be treated as successful responses.""" _additional_context_managers: NotRequired[Sequence[AbstractAsyncContextManager]] """Additional context managers used throughout the crawler ...
Review this code and list any quality issues.
[ { "issue": "This is a string in JS and it makes more sense that way", "severity": "minor", "line": 26 } ]
1
python
[ ("min", [np.nan, 0, 0, 1, 2, 3, 4, 5, 6]), ("max", [np.nan, 0, 1, 2, 3, 4, 5, 6, 7]), ("sum", [np.nan, 0, 1, 3, 5, 7, 9, 11, 13]), ], ) def test_rolling_period_index(index, window, func, values): # GH: 34225 ds = Series([0, 1, 2, 3, 4, 5, 6, 7, 8], index=index) result = getattr...
Review this code and list any quality issues.
[ { "issue": "At first glance I'm having a hard time deciphering what `exp_value` does - some times it is zero and other times it is \"numpy_compute\"?", "severity": "minor", "line": 26 } ]
1
python
"""Run `pip install ddgs` to install dependencies.""" from agno.agent import Agent from agno.models.deepseek import DeepSeek from agno.tools.duckduckgo import DuckDuckGoTools """ DeepSeek model's thinking mode now supports tool calls. Before outputting the final answer, the model can engage in multiple turns of reas...
Review this code and list any quality issues.
[]
0
python
from .common import InfoExtractor from ..utils import ( extract_attributes, int_or_none, str_or_none, traverse_obj, unescapeHTML, url_or_none, ) class ZaikoIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?zaiko\.io/event/(?P<id>\d+)/stream(?:/\d+)+' _TESTS = [{ 'url': 'http...
Review this code and list any quality issues.
[ { "issue": "apparently there are artist subdomains too, e.g. https://vark-live.zaiko.io/\r\n```suggestion\r\n _VALID_URL = r'https?://(?:[\\w-]+\\.)?zaiko\\.io/event/(?P<id>\\d+)/stream(?:/\\d+)+'\r\n```", "severity": "minor", "line": 13 } ]
1
python
video_info = self._search_json( r'<script>\s*window\.\$DATA\s*=', webpage, 'video info', video_id, transform_source=js_to_json) js_sign_func = self._search_js_sign_func(webpage) form_data = { 'vid': video_id, **self._calc_sign(js_sign_func, video_id, vide...
Review this code and list any quality issues.
[ { "issue": "same deal as the other m3u8 URL comment:\r\n\r\n```suggestion\r\n ext = determine_ext(video_url)\r\n formats.append({\r\n 'format': self._FORMATS.get(name),\r\n 'format_id': name,\r\n 'url': video_url,\r\n ...
1
python
stride_width = face_detector_width // feature_stride anchors = create_static_anchors(feature_stride, anchor_total, stride_height, stride_width) bbox_raw = detections[index + feature_map_channel] * feature_stride kps_raw = detections[index + feature_map_channel * 2] * feature_stride for bbox in distance_to_b...
Review this code and list any quality issues.
[ { "issue": "we cannot use the ratio_height / ratio_width that are being passed like in retinaface?", "severity": "minor", "line": 26 } ]
1
python
assert ask(Q.finite(a), Q.finite(x) & ~Q.finite(y)) is None assert ask(Q.finite(a), ~Q.finite(x) & Q.finite(y)) is None assert ask(Q.finite(a), ~Q.finite(x) & Q.zero(y)) is None a = x*y*z assert ask(Q.finite(a), Q.finite(x) & Q.finite(y) & ~Q.finite(z)) is None assert ask(Q.finite(a), Q.f...
Review this code and list any quality issues.
[ { "issue": "You should put this in a separate test as the reasons why this is failing is unrelated to the other xfailing tests here. Or actually maybe don't even add it at all.", "severity": "critical", "line": 26 } ]
1
python
def disable_on_voice_upload()->tuple: return ( *([gr.update(interactive=False) for _ in range(8)]), gr.update(visible=False), gr.update(visible=False) ) def enable_on_voice_upload(session_id: str) -> tup...
Review this code and list any quality issues.
[ { "issue": "The refactoring has changed the function's behavior when a session doesn't exist. In the original code, when session was None or didn't have 'id', the function would return 8 empty gr.update() calls without setting interactive=True. In the new code, the final return statement sets interactive=True f...
1
python
# IMPORTANT: LEGACY V0 CODE - Deprecated since version 1.0.0, scheduled for removal April 1, 2026 # This file is part of the legacy (V0) implementation of OpenHands and will be removed soon as we complete the migration to V1. # OpenHands V1 uses the Software Agent SDK for the agentic core and runs a new application ser...
Review this code and list any quality issues.
[]
0
python
{"loss": 2.0, "accuracy": 0.8, "max_reward": 8.0, "min_error": 0.05} """ for key, val in metrics.items(): if isinstance(val, Metric): metrics[key] = val.aggregate() elif "max" in key: metrics[key] = np.max(val) elif "min" in key: metrics[key] = np.min(...
Review this code and list any quality issues.
[ { "issue": "Could you also add a unit test for this.", "severity": "minor", "line": 26 } ]
1
python
maskiter: Any def __init__(self, ma): ... def __iter__(self): ... def __getitem__(self, indx): ... def __setitem__(self, index, value): ... def __next__(self): ... class MaskedArray(ndarray[_ShapeT_co, _DTypeT_co]): __array_priority__: Any @overload def __new__( cls, dat...
Review this code and list any quality issues.
[ { "issue": "this returns an explicit shape type, so we can't have `ndim` interfere here:\r\n\r\n```suggestion\r\n ndmin: Literal[0] = 0,\r\n```", "severity": "minor", "line": 26 } ]
1
python
mobject : :class:`~.VMobject` The VMobject to animate. Raises ------ :class:`TypeError` If ``mobject`` is not an instance of :class:`~.VMobject`. Examples -------- .. manim:: ShowCreationScene class ShowCreationScene(Scene): def construct(self): ...
Review this code and list any quality issues.
[ { "issue": "I'd suggest to handle the actual deprecation differently, like outlined in https://stackoverflow.com/a/53450052.\r\n\r\nEssentially, this would mean that this should only be something like\r\n\r\n```py\r\nclass ShowCreation(Create):\r\n \"\"\"Deprecated. Use :class:`~.Create` instead.\"\"\"\r\n ...
1