language string | code-snippit string | instruction string | flaws list | flaw_count int64 |
|---|---|---|---|---|
python | 'duration': parse_duration(video_data.get('duration')),
'timestamp': unified_timestamp(video_data.get('datePublished')),
'formats': formats,
'subtitles': subtitles,
}
class NBCOlympicsIE(InfoExtractor):
IE_NAME = 'nbcolympics'
_VALID_URL = r'https?://www\.nbcolympic... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n 'skip': '404 Not Found',\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | SubscriptionRequired,
TeslaFleetError,
)
from tesla_fleet_api.teslemetry import EnergySite, Vehicle
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import ConfigEntryAuthFailed
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
if TYPE_CHECKING:
... | Review this code and list any quality issues. | [
{
"issue": "Not sure why we use getattr, as the data is always available for a TeslaFleetError",
"severity": "minor",
"line": 26
}
] | 1 |
python | import json
from typing import Any, Dict, Optional
from facefusion.filesystem import is_file
def is_json(json_path : str) -> bool:
if is_file(json_path):
try:
with open(json_path, 'r') as file:
json.load(file)
return True
except json.JSONDecodeError:
return False
return False
def read_json(json_... | Review this code and list any quality issues. | [
{
"issue": "That exception handling belongs into the read_json() method and is_json just uses read_json()",
"severity": "minor",
"line": 13
}
] | 1 |
python | 'rpc_getdescriptoractivity.py',
'rpc_scanblocks.py',
'tool_bitcoin.py',
'p2p_sendtxrcncl.py',
'rpc_scantxoutset.py',
'feature_unsupported_utxo_db.py',
'feature_logging.py',
'interface_ipc.py',
'feature_anchors.py',
'mempool_datacarrier.py',
'feature_coinstatsindex.py',
'featu... | Review this code and list any quality issues. | [
{
"issue": "57f7c68: nit: would keeping it in something like `TEST_FRAMEWORK_TESTSHELL_TESTS` (similar to `TEST_FRAMEWORK_UNIT_TESTS`) be a better place since it's a test framework infra test.",
"severity": "minor",
"line": 26
}
] | 1 |
python | self.process_time_per_fn: defaultdict[BlockFunction, ProcessTime] = defaultdict(
ProcessTime
)
self.live_updates = live_updates
self.sleep_when_free = 0.05
self.progress_update_sleep_when_free = 0.1
self.max_size = max_size
self.blocks = blocks
self._a... | Review this code and list any quality issues. | [
{
"issue": "This variable name is confusing since it sounds like the number of events since the last analytics cache, but actually, it's the number of events _at the time_ analytics were last cached. I'd suggest `n_events_at_last_cache` or even `event_count_at_last_cache`.",
"severity": "major",
"line":... | 1 |
python | # Meta / SidePanel / Closable
# Display a #sidePanel having a close button, and detect when it's closed. #meta
# ---
from h2o_wave import main, app, Q, ui
@app('/demo')
async def serve(q: Q):
if not q.client.initialized:
# Create an empty meta_card to hold the side panel
q.page['meta'] = ui.meta_c... | Review this code and list any quality issues. | [] | 0 |
python | encoder_model_path = os.path.join(get_tests_input_path(), "checkpoint_0.pth")
sample_wav_path = os.path.join(get_tests_input_path(), "../data/ljspeech/wavs/LJ001-0001.wav")
sample_wav_path2 = os.path.join(get_tests_input_path(), "../data/ljspeech/wavs/LJ001-0002.wav")
d_vectors_file_path = os.path.join(get_tests_input_... | Review this code and list any quality issues. | [] | 0 |
python | ("select * from mytable limit 20, 10", "postgresql", 10),
("select * from mytable limit 10 offset 20", "postgresql", 10),
(
"""
SELECT id, value, i
FROM (SELECT * FROM my_table LIMIT 10),
LATERAL generate_series(1, value) AS i;
""",
"postgresql",
None,
... | Review this code and list any quality issues. | [] | 0 |
python | """private-gpt."""
import logging
import os
# Set to 'DEBUG' to have extensive logging turned on, even for libraries
ROOT_LOG_LEVEL = "DEBUG"
PRETTY_LOG_FORMAT = (
"%(asctime)s.%(msecs)03d [%(levelname)-8s] %(name)+25s - %(message)s"
)
logging.basicConfig(level=ROOT_LOG_LEVEL, format=PRETTY_LOG_FORMAT, datefmt="%... | Review this code and list any quality issues. | [
{
"issue": "Oooops - this change is not intended\r\n```suggestion\r\nROOT_LOG_LEVEL = \"INFO\"\r\n```",
"severity": "minor",
"line": 6
}
] | 1 |
python | if primary_artists:
info['artists'] = primary_artists
if info.get('artists'):
info['artists'] = list(set(info['artists']))
return info
def _call_api(self, type_, token, note='API', params={}):
return self._download_json(
self._API_URL, token, f'Down... | Review this code and list any quality issues. | [
{
"issue": "We want the formats to be extracted lazily which is why we were smuggling the `id`'s and `encrypted_media_url`s in `url_transparent` results",
"severity": "major",
"line": 26
}
] | 1 |
python | def _entries(self, nextjs_json, display_id):
if isinstance(nextjs_json, dict):
yield from self._get_video_data(nextjs_json, display_id)
else:
for item in nextjs_json:
yield from self._get_video_data(item, display_id)
def _real_extract(self, url):
site... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n 'categories': traverse_obj(nextjs_json, ('categories', ..., 'label')),\r\n```\r\ntraverse_obj never raises",
"severity": "minor",
"line": 26
}
] | 1 |
python | self._loop.run_until_complete(self.async_teardown())
self._loop.stop()
self._loop.close()
super().teardown()
self._stop_time = time.time()
send_telemetry_event(
event='stop',
obj=self,
duration=self._stop_time - self._start_time,
en... | Review this code and list any quality issues. | [] | 0 |
python | """
const pos = store.getState().profile.graphLayout.positions['new-item.Xvalue'];
pos.y -= 100;
return pos.y;
"""
)
# hide and redraw the callback graph so we get the new position
dash_duo.find_element(".dash-debug-menu__button--callbacks").click()
# fire callbacks so ... | Review this code and list any quality issues. | [] | 0 |
python | from contextlib import asynccontextmanager
from fastapi import FastAPI
from fastapi.testclient import TestClient
items = {}
@asynccontextmanager
async def lifespan(app: FastAPI):
items["foo"] = {"name": "Fighters"}
items["bar"] = {"name": "Tenders"}
yield
# clean up items or other work
...
app... | Review this code and list any quality issues. | [
{
"issue": "To ensure the code with startup\\shutdown is still tested, I would split this code example into two separate: first is for `lifespan`, second is for `startup` and `shutdown`.\r\nWe can add the warning that it's deprecated outside the code block.\r\nWhat do you think?",
"severity": "major",
"... | 1 |
python | def get_file_taste(sample_path: str) -> bytes:
if not os.path.exists(sample_path):
raise IOError(f"sample path {sample_path} does not exist or cannot be accessed")
with open(sample_path, "rb") as f:
taste = f.read(8)
return taste
def is_runtime_ida():
try:
import idc
except... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n if \"CAPE\" in report.keys():\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | #
# Simply does the most basic transfer: no concurrent updates during the
# transfer.
#
# Test that data on the both sides is consistent
def test_replicate_points_stream_transfer(tmp_path: pathlib.Path):
assert_project_root()
# seed port to reuse the same port for the restarted nodes
peer_api_uris, peer_di... | Review this code and list any quality issues. | [] | 0 |
python | continue
for standard_format in formats_list:
if not isinstance(standard_format, dict):
continue
for standard_format_key in ('url', 'fallback'):
standard_url = standard_format.... | Review this code and list any quality issues. | [
{
"issue": "`xplayerSettings2` seems to work",
"severity": "minor",
"line": 26
}
] | 1 |
python | # handle rules w/o namespace -> capa lib rule
if self.namespace == "capa":
lib_str = Namespace.DELIMITER + "lib" + Namespace.DELIMITER
self.namespace = self.namespace + lib_str + self.capability.replace(" ", "-")
cmd = CreateNamespacesCmd(self.namespace, SourceType.USER_DEFINED)
... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n for item in self.attack:\r\n```\r\n\r\nDepends on change to `CAPADATA` constructor",
"severity": "minor",
"line": 26
}
] | 1 |
python | video = self._download_json(
'https://store.externulls.com/facts/file/%s' % video_id,
video_id, 'Downloading JSON for %s' % video_id)
fc_facts = video.get('fc_facts')
firstKey = None
for i in range(len(fc_facts)):
if not firstKey or fc_facts[i - 1]['id'] < fc... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n height = int_or_none(self._search_regex(r'fl_cdn_(\\d+)', format_id, 'height', default=None))\r\n current_formats = self._extract_m3u8_formats(f'https://video.beeg.com/{video_uri}', video_id, ext='mp4', m3u8_id=str(height))\r\n for f in current_form... | 1 |
python | import pytest
from metagpt.actions.talk_action import TalkAction
from metagpt.configs.models_config import ModelsConfig
from metagpt.const import METAGPT_ROOT, TEST_DATA_PATH
from metagpt.utils.common import aread, awrite
@pytest.mark.asyncio
async def test_models_configs(context):
default_model = ModelsConfig.d... | Review this code and list any quality issues. | [] | 0 |
python | "Create",
"Uncreate",
"DrawBorderThenFill",
"Write",
"Unwrite",
"ShowPartial",
"ShowIncreasingSubsets",
"SpiralIn",
"AddTextLetterByLetter",
"RemoveTextLetterByLetter",
"ShowSubmobjectsOneByOne",
"AddTextWordByWord",
"AddTextLetterByLetterWithCursor",
"RemoveTextLette... | Review this code and list any quality issues. | [
{
"issue": "I like using this over the `from ..constants import TAU` a few lines below, would you mind changing this to\r\n```py\r\nfrom manim.constants import RIGHT, TAU\r\n```\r\nand removing the \r\n```py\r\nfrom ..constants import TAU\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | @params paths Paths which to traverse by.
@param default Value to return if the paths do not match.
If the last key in the path is a `dict`, it will apply to each value inside
the dict instead, depth first. Try to avoid if using nested `dict... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n If no default is given and the last path branches, a `list` is always returned.\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | Options
-------
maximize : bool (default: False)
Maximizes the objective function if ``True``.
partial_match : 2-D array of integers, optional (default: None)
Fixes part of the matching. Also known as a "seed" [2]_.
Each row of `partial_match` specifies a pair of matched nodes:
... | Review this code and list any quality issues. | [
{
"issue": "I this this is my fault. I regret trying to copy-paste full documentation from public functions into private methods. At the time, I thought I was \"supposed\" to. But besides being superfluous (developers don't need a full reminder of what `rng` means), it bloats files (making them a little hard to... | 1 |
python | if self.is_wallet_compiled():
self.init_wallet(node=0)
rawtx2 = self.nodes[0].createrawtransaction([], outs)
frawtx2a = self.nodes[0].fundrawtransaction(rawtx2, {"replaceable": True})
frawtx2b = self.nodes[0].fundrawtransaction(rawtx2, {"replaceable": False})
... | Review this code and list any quality issues. | [
{
"issue": "In 636fa219d37f86067d996c86fada286cedc0d78e \"test fixups\"\r\n\r\nCan drop the `.8f`, otherwise these are printed with 8 decimal places of 0's that are not necessary.",
"severity": "minor",
"line": 26
}
] | 1 |
python | "Werkzeug>=1.0.1",
"six~=1.15.0",
]
TESTS_REQUIRE.extend(VISION_REQUIRE)
TESTS_REQUIRE.extend(AUDIO_REQUIRE)
QUALITY_REQUIRE = ["black~=23.1", "ruff>=0.0.241", "pyyaml>=5.3.1"]
DOCS_REQUIRE = [
# Might need to add doc-builder and some specific deps in the future
"s3fs",
]
EXTRAS_REQUIRE = {
"audio":... | Review this code and list any quality issues. | [
{
"issue": "for consistency with `fsspec` extra dependencies\r\n```suggestion\r\n \"gcs\": [\"gcsfs\"],\r\n \"gs\": [\"gcsfs\"],\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | from typing import Any, Dict, Optional
from pydantic import BaseModel, Field, model_validator
class MongoDBConfig(BaseModel):
"""Configuration for MongoDB vector database."""
db_name: str = Field("mem0_db", description="Name of the MongoDB database")
collection_name: str = Field("mem0", description="Nam... | Review this code and list any quality issues. | [] | 0 |
python | 'skip_download': True,
},
'skip': 'Dead link',
}, {
# WittyTV embed
'url': 'https://www.wittytv.it/mauriziocostanzoshow/ultima-puntata-venerdi-25-novembre/',
'info_dict': {
'id': 'F312172801000801',
'ext': 'mp4',
'title': 'Ultima puntata - ... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n 'categories': ['Intrattenimento'],\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | translation_domain=DOMAIN,
translation_key="invalid_auth",
translation_placeholders={"error": repr(err)},
) from err
except PortainerConnectionError as err:
raise UpdateFailed(
translation_domain=DOMAIN,
translation_key="can... | Review this code and list any quality issues. | [
{
"issue": "As this integration grows more and more, we may consider not downloading all the data every time, but only the data that is needed.\r\n\r\nsystemmonitor implements such a pattern:\r\nhttps://github.com/home-assistant/core/blob/3b2a7ba561c8d70741a5a99d0d37e4e50f975f7c/homeassistant/components/systemm... | 1 |
python | self.client.can_paginate.return_value = True
self.client.get_paginator.return_value.paginate.return_value = []
handler.return_value.return_value = []
collection = self.get_collection()
list(collection.all().page_size(1))
paginator = self.client.get_paginator.return_value
... | Review this code and list any quality issues. | [
{
"issue": "wait, nevermind, I see, this is an indent from the second paren.",
"severity": "minor",
"line": 26
}
] | 1 |
python | yield {
'author': traverse_obj(replies, ('member', 'name')),
'author_id': traverse_obj(replies, ('member', 'mid')),
'author_thumbnail': traverse_obj(replies, ('member', 'face')),
'text': traverse_obj(replies, ('content', 'message')),
... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n '__post_extractor': self.extract_comments(video_id, ep_id)\r\n```\r\nSee next comment",
"severity": "major",
"line": 26
}
] | 1 |
python | return model, tokenizer
def load_compress_model(model_path, device):
# partially load model
tokenizer = AutoTokenizer.from_pretrained(model_path, use_fast=False)
base_pattern = os.path.join(model_path, "pytorch_model-*.bin")
files = glob.glob(base_pattern)
with init_empty_weights():
... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n tensor = tmp_state_dict[name].to(device).data\r\n compressed_state_dict[name] = compress(tensor, default_compression_config)\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | from abc import ABC
from typing import Optional
class BaseEmbedderConfig(ABC):
"""
Config for Embeddings.
"""
def __init__(
self,
model: Optional[str] = None,
embedding_dims: Optional[int] = None,
# Ollama specific
base_url: Optional[str] = None
):
... | Review this code and list any quality issues. | [
{
"issue": "Assuming model as deployment_name in config args for azure.\r\nLet me know if I should explicitly declare \"deployment_name\" instead for Azure OpenAI models.",
"severity": "minor",
"line": 18
}
] | 1 |
python | """
Get the panel to use in the Wagtail admin when editing this model.
"""
if hasattr(model, "edit_handler"):
# use the edit handler specified on the model class
panel = model.edit_handler
else:
panels = extract_panel_definitions_from_model_class(model)
panel = ObjectList... | Review this code and list any quality issues. | [
{
"issue": "Good opportunity to use a walrus operator :=)\r\n\r\n```suggestion\r\n if real_panel := panel.construct()\r\n result.append(real_panel)\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | def run_cmd(cmd, check=False, shell=True, cwd=None, timeout=None) -> CommandReturn:
"""
Execute a given command.
:param cmd: command to execute
:param check: whether a non-zero return code should result in a `ChildProcessError` or not.
:param shell: run the command in a sub-shell
:param cwd: se... | Review this code and list any quality issues. | [] | 0 |
python | Returns
-------
Camera
The camera object
"""
self.set_cairo_context_path(ctx, vmobject)
self.apply_stroke(ctx, vmobject, background=True)
self.apply_fill(ctx, vmobject)
self.apply_stroke(ctx, vmobject)
return self
def set_cairo_context_pat... | Review this code and list any quality issues. | [] | 0 |
python | Comment.objects.create(tenant=self.tenant, id=self.comment.id, user_id=1)
def test_get_primary_key_columns(self):
self.assertEqual(
self.get_primary_key_columns(User._meta.db_table),
["tenant_id", "id"],
)
self.assertEqual(
self.get_primary_key_columns(Co... | Review this code and list any quality issues. | [
{
"issue": "Can you tell me a little bit about this change? Was there a test isolation problem? What is the state of `connection.features` after this test?",
"severity": "minor",
"line": 26
}
] | 1 |
python | reviewers: list[GithubListPRReviewersBlock.Output.ReviewerItem] = [
{"username": reviewer["login"], "url": reviewer["html_url"]}
for reviewer in data.get("users", [])
]
return reviewers
def run(
self,
input_data: Input,
*,
credentials: GithubC... | Review this code and list any quality issues. | [
{
"issue": "nit: can we do the error more clearly such as: \r\n\r\nunable to parse ur: pr_url",
"severity": "minor",
"line": 26
}
] | 1 |
python | # Then the event loop will wait for all tasks to be completed before raising the cancellation error.
# See reference: https://docs.python.org/3/library/concurrent.futures.html#concurrent.futures.Executor
try:
outputs = await self._execute_with_thread_pool(executor, nodes, inputs, context, ti... | Review this code and list any quality issues. | [
{
"issue": "How about adding another method called `_cancel_nodes()` and then we modify the logic here to something like:\r\n\r\n```python\r\nwhile not dag_manager.completed():\r\n if execution_time >= timeout_seconds:\r\n await self._cancel_nodes()\r\n break\r\n\r\n # Do the exiting thing h... | 1 |
python | raise NotImplementedError(
"This property should be implemented in the subclass to return the appropriate quantization config."
)
def setUp(self):
super().setUp()
gc.collect()
backend_empty_cache(torch_device)
torch.compiler.reset()
def tearDown(self):
... | Review this code and list any quality issues. | [] | 0 |
python | # Mean density should be in similar range (50-100% of rho0)
assert 0.5 < normalized_mean < 1.0, (
f"Normalized mean density {normalized_mean:.3f} is outside expected range [0.5, 1.0] "
f"for particle_size={particle_size}"
)
# Standard deviation should be bounded
assert normalized_std < ... | Review this code and list any quality issues. | [
{
"issue": "Add a todo to remember that this test should be removed and replace by something that truly validates the physics behind it.",
"severity": "minor",
"line": 26
}
] | 1 |
python | """Add hidden field to chats
Revision ID: b66fd8f9da1f
Revises: f0e18084aae4
Create Date: 2023-04-14 16:11:35.361507
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = "b66fd8f9da1f"
down_revision = "f0e18084aae4"
branch_labels = None
depends_on = None
def upgrad... | Review this code and list any quality issues. | [] | 0 |
python | 'uploader_id': 'ProjectVeritasAction',
'uploader_url': 'https://truthsocial.com/@ProjectVeritasAction',
'repost_count': int,
'comment_count': int,
'like_count': int,
},
},
]
_GEO_COUNTRIES = ['US'] # The site is only available ... | Review this code and list any quality issues. | [
{
"issue": "These comments are unnecessary",
"severity": "minor",
"line": 26
}
] | 1 |
python | console: Optional[Any] = None,
# Add tags to include in markdown content
tags_to_include_in_markdown: Optional[Set[str]] = None,
**kwargs: Any,
) -> None:
if self._has_async_db():
raise Exception(
"This method is not supported with an async DB. Please use ... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\n \"The 'stream_events' parameter is not needed. Event streaming is now enabled by default when using the print_response function.\",\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | return subtitles
def _raise_extractor_error(self, media_selection_error):
raise ExtractorError(
'%s returned error: %s' % (self.IE_NAME, media_selection_error.id),
expected=True)
def _download_media_selector(self, programme_id):
last_exception = None
formats, su... | Review this code and list any quality issues. | [
{
"issue": "f-string\r\n```suggestion\r\n self.report_warning(f'{self.IE_NAME} returned error: {last_exception.id}')\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | raise
def get_channels_with_search(
search_string: str = "",
types: Optional[list[SlackChannelTypes]] = None,
exact_match: bool = False,
force: bool = False,
) -> list[SlackChannelSchema]:
"""
The slack api is paginated but does not include search, so we need to fetch
all channels and filt... | Review this code and list any quality issues. | [
{
"issue": "Don't hardcode values, what if the user is already at 10 or something else, this exception message is now wrong.",
"severity": "critical",
"line": 26
}
] | 1 |
python | 'url': 'https://www.banking.senate.gov/hearings/21st-century-communities-public-transportation-infrastructure-investment-and-fast-act-reauthorization',
'info_dict': {
'id': 'banking041521',
'display_id': '21st-century-communities-public-transportation-infrastructure-investment-and-fast-a... | Review this code and list any quality issues. | [
{
"issue": "Is there a reasoning for this order? or just random?",
"severity": "minor",
"line": 26
}
] | 1 |
python | ... {"name": "embedding_2", "htype": "embedding"},
... {"name": "source", "htype": "text"},
... {"name": "metadata", "htype": "json"}
... ]
... )
Args:
path... | Review this code and list any quality issues. | [
{
"issue": "@adolkhan pls rephrase to:\r\n\r\nruntime (Dict, optional): Parameters for creating the Vector Store in Deep Lake's Managed Tensor Database. Not applicable when loading an existing Vector Store. To create a Vector Store in the Managed Tensor Database, set `runtime = {\"tensor_db\": True}`.",
"se... | 1 |
python | return next(matches, None)
@classmethod
def _sort_patterns(cls, dataset_patterns: Patterns) -> dict[str, dict[str, Any]]:
"""Sort a dictionary of dataset patterns according to parsing rules.
In order:
1. Decreasing specificity (number of characters outside the curly brackets)
... | Review this code and list any quality issues. | [
{
"issue": "It might be helpful to add here how to resolve the problem by making sure only one catch-all exists in the catalog.",
"severity": "minor",
"line": 26
}
] | 1 |
python | (workspace / "file1.py").resolve(),
(workspace / "file2.py").resolve(),
]
for path in paths:
with open(path, "w") as fh:
fh.write(source)
self.invokeBlack([str(p) for p in paths] + PY36_ARGS)
for path in paths:
... | Review this code and list any quality issues. | [] | 0 |
python | # ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
VERSION = "1.14.0.dev0" | Review this code and list any quality issues. | [] | 0 |
python | ),
)
def pytest_configure(config: Config) -> None:
reporter = TerminalReporter(config, sys.stdout)
config.pluginmanager.register(reporter, "terminalreporter")
if config.option.debug or config.option.traceconfig:
def mywriter(tags, args):
msg = " ".join(map(str, args))
... | Review this code and list any quality issues. | [
{
"issue": "This feels overly nested. How about\r\n```suggestion\r\n # Some terminals interpret OSC 9;4 as desktop notification,\r\n # skip on those we know (#13896).\r\n should_skip_terminal_progress = (\r\n # iTerm2 (reported on version 3.6.5).\r\n \"ITERM_SESSION_ID\" in os.environ\r\n... | 1 |
python | player = self._download_webpage(embed_url, video_id, 'Downloading player page')
if 'MESSAGE_GEOBLOCKED' in player:
self.raise_geo_restricted(countries=self._GEO_COUNTRIES)
formats, subtitles = self._extract_m3u8_formats_and_subtitles(
self._html_search_regex(r'["\']?source["\']?... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n 'thumbnail': url_or_none(player_data.get('poster')),\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | for idx, shard_pair in enumerate(state_dict_shard):
if not self.coordinator.is_master():
continue
shard = shard_pair[0]
shard_file = get_shard_filename(weights_name, idx)
total_size = total_size + shard_pair[1]
for key in shard.keys():
... | Review this code and list any quality issues. | [
{
"issue": "Note that is method is named `save_sharded_model()`. We assume that the checkpoint is sharded and we have an index file. We don't need to handle single shard individually.",
"severity": "minor",
"line": 26
}
] | 1 |
python | 'like_count': int,
'duration': 7036,
'age_limit': 15,
'series': '신발 벗고 돌싱포맨',
'episode': '돌싱포맨 저격수들 등장!',
'episode_number': 104,
},
}]
def request_details(self, video_id, rscuse=''):
return self._download_json(
f'https://ap... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n details = self._call_api(video_id)\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | )
def get_loader(column):
if column in USEquityPricing.columns:
return loader
else:
raise AssertionError("No loader registered for %s" % column)
cls.pipeline_engine = SimplePipelineEngine(
get_loader=get_loader,
calendar=c... | Review this code and list any quality issues. | [
{
"issue": "Is there a mro issue with `WithSeededRandomPipelineEngine`?",
"severity": "minor",
"line": 26
}
] | 1 |
python | async def async_step_reconfigure(
self, user_input: dict[str, Any] | None = None
) -> ConfigFlowResult:
"""Confirm if we are migrating adapters or just re-configuring."""
self._reconfigure_config_entry = self._get_reconfigure_entry()
return self.async_show_menu(
step_id="... | Review this code and list any quality issues. | [
{
"issue": "is `Home ID` something that should be translated or not? Should we add a `Host: ` to the beginning of the string (not placeholder), to make clear in the UI what the first part is?",
"severity": "minor",
"line": 26
}
] | 1 |
python | media_key = broadcast['media_key']
source = self._call_api(
f'live_video_stream/status/{media_key}', media_key)['source']
m3u8_url = source.get('noRedirectPlaybackUrl') or source['location']
if '/live_video_stream/geoblocked/' in m3u8_url:
self.raise_geo_restricted()
... | Review this code and list any quality issues. | [
{
"issue": "since twitter names change, let's avoid using `md5:` values in the descriptions\r\n\r\nyou can use `re:` if the line gets too long, e.g. `r're:Twitter Space participated by stupid dipshit.{50}'`",
"severity": "major",
"line": 26
}
] | 1 |
python | if TYPE_CHECKING:
from genesis.engine.scene import Scene
from genesis.engine.simulator import Simulator
class Solver(RBC):
def __init__(self, scene: "Scene", sim: "Simulator", options):
self._uid = gs.UID()
self._sim = sim
self._scene = scene
self._dt: float = options.dt
... | Review this code and list any quality issues. | [
{
"issue": "Remove this method and move its content line 23.",
"severity": "major",
"line": 26
}
] | 1 |
python | 'description': '',
'uploader': 'Aciel',
'timestamp': 1651628243,
'upload_date': '20220504',
'uploader_id': '19335460',
'uploader_url': 'https://medal.tv/users/19335460',
'comment_count': int,
'view_count': int,
'like_count':... | Review this code and list any quality issues. | [
{
"issue": "IMO it's good to check extension since we block non-image extensions now",
"severity": "minor",
"line": 26
}
] | 1 |
python | resp = self.connection.post(
auth_urls.access_token,
data={"grant_type": "password", "username": username, "password": password, "client_id": client_id, "scope": scope},
headers=req.headers,
)
else:
HTTPBasicAuth(username, password)(req)
... | Review this code and list any quality issues. | [
{
"issue": "Perhaps declare this at the module top level as a `TypedDict` or a `dataclass`?",
"severity": "minor",
"line": 26
}
] | 1 |
python | handle = self._request_webpage(update_url_query(BASE_URL, query={
'client_id': 'tennis-tv-web',
'redirect_uri': 'https://www.tennistv.com/resources/v1.1.10/html/silent-check-sso.html',
'state': random_uuidv4(),
'response_mode': 'fragment',
... | Review this code and list any quality issues. | [
{
"issue": "If all videos need subscription, better to `self.raise_login_required`",
"severity": "minor",
"line": 26
}
] | 1 |
python | 'ifc': 'IFC',
'sundancetv': 'SUNDANCE',
'wetv': 'WETV',
}
def _real_extract(self, url):
site, display_id = re.match(self._VALID_URL, url).groups()
requestor_id = self._REQUESTOR_ID_MAP[site]
page_data = self._download_json(
'https://content-delivery-gw.svc.ds... | Review this code and list any quality issues. | [
{
"issue": "don't try...except. Use `try_get` or `.get` when accessing keys that are not necessarily present",
"severity": "minor",
"line": 26
}
] | 1 |
python | ]
BUILTIN_TOOL_CALL_ID_PREFIX: Final[str] = 'pyd_ai_builtin'
@dataclass
class AGUIEventStream(UIEventStream[RunAgentInput, BaseEvent, AgentDepsT, OutputDataT]):
"""UI event stream transformer for the Agent-User Interaction (AG-UI) protocol."""
_thinking_text: bool = False
_builtin_tool_call_ids: dict[st... | Review this code and list any quality issues. | [
{
"issue": "Small thing, but I like `_get_timestamp` better",
"severity": "minor",
"line": 26
}
] | 1 |
python | # Extract the player element so that the rest of the matching will be done only there.
player = self._search_regex(r'(<div id="cvp-player-.+?></div>)', webpage, 'player')
hls = self._html_search_regex(r' data-hls="(.+?)" ', player, 'HLS URL')
title = self._html_search_regex(r' data-title="(.+?)... | Review this code and list any quality issues. | [
{
"issue": "You are throwing away all other metadata from json/ld?",
"severity": "minor",
"line": 26
}
] | 1 |
python | DatabaseError: If there's an issue updating or creating the profile
"""
logger.info("Updating profile for user %s with data: %s", user_id, profile)
try:
# Sanitize username to allow only letters, numbers, and hyphens
username = "".join(
c if c.isalpha() or c == "-" or c.isnumeric... | Review this code and list any quality issues. | [
{
"issue": "I don't think we should be raising HTTPExceptions here, in the DB layer. Can you do another error here?",
"severity": "critical",
"line": 26
}
] | 1 |
python | 'deviceType': 'ipad',
'idMedia': video_stream_id,
'multibitrate': 'true',
'output': 'json',
'tech': 'hls',
'manifestType': 'desktop',
})
formats = self._extract_m3u8_formats(
s... | Review this code and list any quality issues. | [
{
"issue": "Seems like a pretty broad match. Any reason not to use this?\r\n```suggestion\r\n _VALID_URL = r'https?://(?:www\\.)?cbc\\.ca/listen/(?:cbc-podcasts|live-radio)/[\\w-]+/[\\w-]+/(?P<id>\\d+)'\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | prediction_confidence = []
for keypoint in prediction["keypoints"]:
prediction_xy.append([keypoint["x"], keypoint["y"]])
prediction_confidence.append(keypoint["confidence"])
xy.append(prediction_xy)
confidence.append(prediction_confidence)
... | Review this code and list any quality issues. | [
{
"issue": "Let's use this URL:\r\nhttps://ai.google.dev/edge/mediapipe/solutions/vision/pose_landmarker/python",
"severity": "minor",
"line": 26
}
] | 1 |
python | _VALID_URL = r'https?://space\.bilibili\.com/(?P<id>\d+)(?P<video>/video)?/?(?:[?#]|$)'
_TESTS = [{
'url': 'https://space.bilibili.com/3985676/video',
'info_dict': {
'id': '3985676',
},
'playlist_mincount': 178,
}]
def _real_extract(self, url):
playlist_i... | Review this code and list any quality issues. | [
{
"issue": "Dont print whole response. Put the relevent parts into the error message",
"severity": "minor",
"line": 26
}
] | 1 |
python | Arguments:
favicon_path: The path to the image file to use.<br/>
This can be expressed as a path name or a URL (relative or not).
state: The state to apply the change to.<br/>
If no set or set to None, all the application's clients are impacted.
"""
... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n _warn(\"Exception in Hook._add_event_listener(): \", e)\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | h = HostnameRegexValidator(regex=regex_expr, flags=re_flags)
try:
h("@#$%)$#(TUFAS_DG")
except ValidationError as e:
assert e.message is not None
def test_good_call_with_inverse(self, regex_expr, re_flags, inverse_match=True):
h = HostnameRegexValidator(regex=regex_e... | Review this code and list any quality issues. | [
{
"issue": "I see no reason why these imports can't be at the top of the file.",
"severity": "minor",
"line": 26
}
] | 1 |
python | # Top-level modules that are dev-only and must never be imported at runtime.
FORBIDDEN_MODULES = ("tests_common",)
# Pattern matching a ``.tests.`` component anywhere in a dotted module path,
# or a module path that starts with ``tests.`` or equals ``tests``.
_TESTS_PATH_RE = re.compile(r"(^|\.)(tests)(\..*|$)")
def... | Review this code and list any quality issues. | [] | 0 |
python | "authenticator": "oauth",
# OCSP checks do not work in Snowflake containers.
"ocsp_fail_open": True,
# We want to keep this alive, as the user token will expire fairly quickly
# - so we can't create a new session on expiration.
"client_session_keep_alive": Tru... | Review this code and list any quality issues. | [
{
"issue": "Spelling error: \"runnning\" should be \"running\" (three n's instead of two).",
"severity": "minor",
"line": 26
}
] | 1 |
python | class SocksHTTPTestRequestHandler(http.server.BaseHTTPRequestHandler, SocksTestRequestHandler):
def do_GET(self):
if self.path == '/socks_info':
payload = json.dumps(self.socks_info.copy())
self.send_response(200)
self.send_header('Content-Type', 'application/json; charse... | Review this code and list any quality issues. | [] | 0 |
python | except (TimeoutError, aiohttp.ClientError) as exc:
_LOGGER.error("Cannot connect to ViaggiaTreno API endpoint: %s", exc)
return
except ValueError:
_LOGGER.error("Received non-JSON data from ViaggiaTreno API endpoint")
return
if self._tstatus is not None:
... | Review this code and list any quality issues. | [
{
"issue": "In the past we only set the monitored_info, not tstatus, can we fix that?",
"severity": "minor",
"line": 26
}
] | 1 |
python | # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND... | Review this code and list any quality issues. | [
{
"issue": "Nit: consider not using class variables? Had to check in an interactive session that different instances do indeed not share the value of `_axis`, while mutable class variables do get shared between instances. TBH I'm not sure why and whether this relies on small integers being special. \r\nSo while... | 1 |
python | use_incognito_pages: By default pages share the same browser context. If set to True each page uses its
own context that is destroyed once the page is closed or crashes.
fingerprint_generator: An optional instance of implementation of `FingerprintGenerator` that is used
to ge... | Review this code and list any quality issues. | [
{
"issue": "Could we please add a comment explaining this?",
"severity": "minor",
"line": 26
}
] | 1 |
python | # for compat with vision-only models
self.hparams = self.hparams_vision or self.hparams_audio or self.hparams
# TODO @ngxson : this is a hack to support both vision and audio encoders
have_multiple_encoders = self.has_audio_encoder and self.has_vision_encoder
self.block_count = 128 if h... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n super().prepare_metadata(vocab_only=vocab_only)\r\n```\r\nMight as well be `False`, but let's keep it like this in case it becomes useful in the future.",
"severity": "minor",
"line": 26
}
] | 1 |
python | )
ret += "\n\n"
else:
ret += role + ":"
return ret
elif self.sep_style == SeparatorStyle.DOLLY:
seps = [self.sep, self.sep2]
ret = self.system
for i, (role, message) in enumerate(self.messages):
... | Review this code and list any quality issues. | [
{
"issue": "Can it be covered with an existing separator style?",
"severity": "minor",
"line": 26
}
] | 1 |
python | parser.add_argument("--print-all",
action="store_true", dest="print_all",
help="Output sites where the username was not found."
)
parser.add_argument("--print-found",
action="store_false", dest="print_all", default=False... | Review this code and list any quality issues. | [
{
"issue": "Remove `-n`, its enough with `--nsfw` in my opinion. Because a user may accidentally type in `-n` when meaning to use `-l`. So having the user to type out `--nsfw` will become a sort of proper confirmation if that makes sense",
"severity": "minor",
"line": 26
}
] | 1 |
python | def add_param_set(parser):
parser.add_argument(
"--set",
dest="params_override",
action=AppendToDictAction,
help="Update an object by specifying a property path and value to set. Example: --set "
"property1.property2=<value>.",
nargs="+",
)
def add_param_set_pos... | Review this code and list any quality issues. | [
{
"issue": "we don't need to support -env , --env is ok",
"severity": "minor",
"line": 26
}
] | 1 |
python | coin_hints: dict[bytes32, bytes32] = {
coin_id: bytes32(hint) for coin_id, hint in ppp_result.hints if len(hint) == 32
}
peak = Peak(
state_change_summary.peak.header_hash, state_change_summary.peak.height, state_change_summary.peak.weight
)
# Looks up coin reco... | Review this code and list any quality issues. | [
{
"issue": "I would have thought we'd want this early in this function, to minimize the reordering of these things",
"severity": "minor",
"line": 26
}
] | 1 |
python | proposer.is_rejected_token_mask[:num_tokens], expected_is_rejected
)
# Verify masked token mask (should all be False for non-parallel drafting)
expected_is_masked = torch.zeros(7, dtype=torch.bool, device=device)
assert torch.equal(proposer.is_masked_token_mask[:num_tokens], expected_is_masked)
# ... | Review this code and list any quality issues. | [] | 0 |
python | import json
import re
from .common import ExtractorError, InfoExtractor
from ..utils import (
int_or_none,
require,
str_or_none,
traverse_obj,
url_or_none,
)
class AGalegaBaseIE(InfoExtractor):
_VALID_URL = False
def _get_access_token(self, video_id: str) -> dict[str, str] | None:
... | Review this code and list any quality issues. | [
{
"issue": "Not needed\r\n```suggestion\r\n```",
"severity": "minor",
"line": 16
}
] | 1 |
python | def __init__(
self,
room: rtc.Room,
*,
track_source: rtc.TrackSource.ValueType | list[rtc.TrackSource.ValueType],
) -> None:
self._room = room
self._accepted_sources = (
{track_source}
if isinstance(track_source, rtc.TrackSource.ValueType)
... | Review this code and list any quality issues. | [
{
"issue": "nit,\r\nin line 127, function aclose(self) -> None:\r\nadd \r\nself._room.off(\"token_refreshed\", self._on_token_refreshed) ?",
"severity": "minor",
"line": 26
}
] | 1 |
python | self._log_params(self.experiment_param)
attrs = {attr: getattr(engine.state, attr, None) for attr in self.default_tracking_params}
self._delete_exist_param_in_dict(attrs)
self._log_params(attrs)
if self.dataset_logger:
self.dataset_logger(self.dataset_dict)
else:
... | Review this code and list any quality issues. | [
{
"issue": "I don't think this line is needed. Furthermore, if the exception is raised three times in a row the loop will silently do nothing. In place of this line we should check if this is the last time through the loop and raise the exception if so instead of sleeping. The check after this loop isn't suffic... | 1 |
python | from .config import SEPARATOR, SettingsList, find_start_end_indexes, write_content_to_file
# markers
START_MARKER = (
f"//===----------------------------------------------------------------------===//\n"
f"// This code is autogenerated from 'update_settings_header_file.py'.\n"
f"// Please do not make any c... | Review this code and list any quality issues. | [
{
"issue": "I'm not such a big fan of this - it seems like this doesn't generalize particularly nicely.\r\n\r\nMy proposed solution here would be to add a second setting - `extension_directories` - that takes a `VARCHAR[]`. The original `extension_directory` setting can then only be used to set a single directo... | 1 |
python | if not is_first_iteration and use_cache:
model_inputs["pixel_values"] = None
model_inputs["pixel_values_videos"] = None
# Keep behavior consistent between inferred and user-provided 2D `position_ids` in multimodal generation.
model_position_ids = model_inputs.get("position_ids")... | Review this code and list any quality issues. | [
{
"issue": "For position ids, we need to manipulate in `self._prepare_position_ids_for_generate`. Usually position ids are prepared only once and at each decoding step we increment by 1 more position. We don't want to revert back this huge block of code\n\nI am not 100% sure, but qwen-vl style models can pick u... | 1 |
python | geoms_state=geoms_state,
rigid_global_info=rigid_global_info,
static_rigid_sim_config=static_rigid_sim_config,
contact_island_state=contact_island_state,
)
func_update_acc(
update_cacc=False,
dofs_state=dofs_state,
links_info=links_info,
links_state=links_... | Review this code and list any quality issues. | [
{
"issue": "Do not add dedicated clear ingredients kernel. This will significantly affect simulation performance. Just add the clearing code in `func_update_force` kernel, at the very end.",
"severity": "major",
"line": 26
}
] | 1 |
python | if data is None:
return None
resultSet = data.get('data')
if resultSet:
if resultSet.get('score') >= self.opts['fraud_threshold']:
maliciousDesc = f"SEON [{eventData}]\n - FRAUD SCORE: {resultSet.get('score')}"
evt = Spider... | Review this code and list any quality issues. | [
{
"issue": "`RAW_RIR_DATA` should only be reported if data was found. Also, it's only being reported in this `elif` branch - it should probably be up one further.",
"severity": "minor",
"line": 26
}
] | 1 |
python | username, password = hub_cloud_dev_credentials
ds = deeplake.empty(hub_cloud_path, token=hub_cloud_dev_token)
with ds:
populate(ds)
ds = deeplake.load(hub_cloud_path, token=hub_cloud_dev_token)
view = ds[50:100]
view.save_view(id="50to100")
ds = deeplake.load(hub_cloud_path, read_only... | Review this code and list any quality issues. | [] | 0 |
python | if filename:
result[fs.sep.join([path, filename])] += 1
else:
return None # File path is missing, abort
return tuple(result.values())
def _merge_statistics(stats, s):
""" Update `stats` with vaules in `s`
"""
stats[-1]["total_byte_size"] += s["total_byte_size"]
sta... | Review this code and list any quality issues. | [
{
"issue": "It has recently been brought to my attention that max/min are [deprecated](https://github.com/apache/parquet-format/blob/master/src/main/thrift/parquet.thrift#L199) and the recommendation is to use max/min_value, which are the same except maybe reversed if the column_ordering value says so. I don't ... | 1 |
python | db.session.rollback()
raise ValueError(f'Skill with name does not exist: {skill_name}')
association = db.AgentSkillsAssociation(
parameters=parameters,
agent=agent,
skill=existing_skill
)
db.session.add(association)
... | Review this code and list any quality issues. | [] | 0 |
python | """
Convert a 3D point coordinates into image mask. The returned mask has the same spatial
size as `image_size` while the batch dimension is the same as 'point' batch dimension.
The point is converted to a mask ball with radius defined by `radius`. The output
contains two channels each for negative (fir... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n channel = int(point_label[b, n] not in (0, 2))\r\n```\r\nMinor and pedantic, ignore if it's less readable this way.",
"severity": "minor",
"line": 26
}
] | 1 |
python | """
if TYPE_CHECKING:
_protocol_check: ClassVar[BlocksProtocol] = cast("AugmentedBlockchain", None)
_underlying: BlocksProtocol
_extra_blocks: dict[bytes32, tuple[FullBlock, BlockRecord]]
_height_to_hash: dict[uint32, bytes32]
def __init__(self, underlying: BlocksProtocol) -> None:
... | Review this code and list any quality issues. | [
{
"issue": "my model of errors is that an `assert` failing indicates a bug, but any other exception being raised is not necessarily a bug. Which makes me ask this question: I would expect this violation of precondition to be a bug, is it still?",
"severity": "critical",
"line": 26
}
] | 1 |
python | data_granularity = simulator_config.get("data_granularity", 1)
def _simulator_factory_simple(order: Order) -> SingleAssetOrderExecutionSimple:
return SingleAssetOrderExecutionSimple(
order=order,
data_dir=Path(data_config["source"]["data_dir"]),
ticks_per_step=simulator_... | Review this code and list any quality issues. | [
{
"issue": "Putting this in the next-if as checkpoint_path is optional.",
"severity": "minor",
"line": 26
}
] | 1 |
python | def test_snapshot_rename_interface(uvm_nano, microvm_factory):
"""
Test that we can restore a snapshot and point its interface to a
different host interface.
"""
vm = uvm_nano
base_iface = vm.add_net_iface()
vm.start()
snapshot = vm.snapshot_full()
# We don't reuse the network names... | Review this code and list any quality issues. | [
{
"issue": "nit: not needed, as `restore_from_snapshot` already does this iirc",
"severity": "minor",
"line": 26
}
] | 1 |
python | link : RigidLink
The target link.
local_point : torch.Tensor or None, shape (3,)
Coordinates of the point in the link’s *local* frame.
If None, the link origin is used (back-compat).
Returns
-------
jacobian : torch.Tensor
The Jacobian mat... | Review this code and list any quality issues. | [
{
"issue": "Define a kernel that accepts `ti.types.ndarray()` directly so that you don't need to allocate a `ti.Vector` in Python-scope, which is slow.",
"severity": "major",
"line": 26
}
] | 1 |
python | self.await_consumed_messages(consumer)
assert num_rebalances == consumer.num_rebalances(), "Static consumers attempt to join with instance id in use should not cause a rebalance"
self.logger.debug("Members status - Joined [%d/%d]: %s, Not joined: %s",
l... | Review this code and list any quality issues. | [
{
"issue": "I don't quite get what we want to say here?",
"severity": "minor",
"line": 26
}
] | 1 |
python | Optional. If two nodes have the same label, they are considered same by the mutator.
operation
...
cell
Read only shortcut to get the referenced subgraph.
If this node is not a subgraph (is a primitive operation), accessing `cell` will raise an error.
predecessors
Predecessor... | Review this code and list any quality issues. | [
{
"issue": "Can we attach `input_shape` and `output_shape` onto `self.operation` as `self.operation.attrs['input_shape']`?",
"severity": "minor",
"line": 26
}
] | 1 |
python | # temp_dir_path is the parent directory of the project root dir
contents = [member for member in temp_dir_path.iterdir() if member.is_dir()]
if len(contents) != 1:
raise KedroCliError(
"Invalid sdist was extracted: exactly one directory was expected, "
f"got {... | Review this code and list any quality issues. | [
{
"issue": "`elem` isn't a very descriptive variable name, can you rename it to be clearer? Something like project_item maybe?",
"severity": "minor",
"line": 26
}
] | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.