language string | code-snippit string | instruction string | flaws list | flaw_count int64 |
|---|---|---|---|---|
python | def _reduce_grad(self, partition_grad):
# if not overlapping communication (no reduction hook is attached) when zero1
# we need to manually reduce these gradients
if not partition_grad and not self._overlap_communication:
for group_id in range(len(self._working_param_groups)):
... | Review this code and list any quality issues. | [
{
"issue": "If this is like a complete inheritance, why not just make it the same class?",
"severity": "minor",
"line": 26
}
] | 1 |
python | # often used for forms, and we need instructions for using CSRF
# protection to be as simple as possible.
csrf_token = context.get("csrf_token")
if csrf_token is not None:
new_context["csrf_token"] = csrf_token
return t.render(new_context)
def parse_bits(
parser,
bi... | Review this code and list any quality issues. | [
{
"issue": "Should we clarify here that `context` should already be popped?",
"severity": "minor",
"line": 26
}
] | 1 |
python | mock_mealie_client: AsyncMock,
mock_config_entry: MockConfigEntry,
) -> None:
"""Test the set_random_mealplan service with invalid entry types for version."""
mock_mealie_client.get_about.return_value = About(version="v3.6.0")
await setup_integration(hass, mock_config_entry)
with pytest.raises(Ser... | Review this code and list any quality issues. | [] | 0 |
python | """Support for Cambridge Audio switch entities."""
from collections.abc import Awaitable, Callable
from dataclasses import dataclass, field
from typing import TYPE_CHECKING
from aiostreammagic import StreamMagicClient
from homeassistant.components.number import NumberEntity, NumberEntityDescription
from homeassistan... | Review this code and list any quality issues. | [
{
"issue": "The docstring incorrectly says \"Describes Cambridge Audio switch entity\" when this describes a number entity. This appears to be a copy-paste error from switch.py.",
"severity": "critical",
"line": 22
}
] | 1 |
python | # See https://github.com/scipy/scipy/pull/8042 for more details
rs = np.random.RandomState(123)
def _perturb(g):
return (np.asarray(g) + 1e-10 * rs.randn(len(g))).tolist()
g1_ = _perturb(g1)
g2_ = _perturb(g2)
g3_ = _perturb(g3)
# Test that center='trimmed' ... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n assert_allclose(W, 15.953569890010614, rtol=5e-14)\r\n assert_allclose(pval, 0.06785752327432863, rtol=5e-14)\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | "name": "Feeder",
"parent": {"product_id": 1, "id": HUB_ID},
"status": {
"battery": 6.4,
"locking": {"mode": 0},
"learn_mode": 0,
"signal": {"device_rssi": 60, "hub_rssi": 65},
"online": True,
},
}
MOCK_FELAQUA = {
"id": 31337,
"product_id": 8,
"household... | Review this code and list any quality issues. | [] | 0 |
python | },
'add_ie': [SenateISVPIE.ie_key()],
},
{
# Limelight embeds (1 channel embed + 4 media embeds)
'url': 'http://www.sedona.com/FacilitatorTraining2017',
'info_dict': {
'id': 'FacilitatorTraining2017',
'title': 'Facilitator T... | Review this code and list any quality issues. | [] | 0 |
python | import binascii
import json
import time
from .common import InfoExtractor
from ..utils import (
ExtractorError,
int_or_none,
jwt_decode_hs256,
traverse_obj,
url_or_none,
)
class WrestleUniverseBaseIE(InfoExtractor):
_VALID_URL_TMPL = r'https?://(?:www\.)?wrestle-universe\.com/(?:(?P<lang>\w{2... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n WrestleUniverseBaseIE._TOKEN = try_call(lambda: self._get_cookies(\r\n 'https://www.wrestle-universe.com/')['token'].value)\r\n if not self._TOKEN:\r\n self.raise_login_required()\r\n```",
"severity": "minor",
"line": 26
... | 1 |
python | # Running in parallel may crash the test OOM.
sizes = [(1.5, 1.8), (10.0, 7.0)]
n_tiles = [(0.5, 0.75), (5.0, 3.0), None]
for test_idx, (size, n_tiles) in enumerate(itertools.product(sizes, n_tiles)):
CAM_RES = (512, 512)
NUM_STEPS = 1
scene = gs.Scene(
renderer=renderer,... | Review this code and list any quality issues. | [
{
"issue": "This is not good enough I think. You should ideally check that the pattern is correct, or at least that all the images are different. (this is done in advanced render api test).",
"severity": "minor",
"line": 26
}
] | 1 |
python | # bezier(points)
h0 = curve(a) if a > 0 else points[0]
h2 = curve(b) if b < 1 else points[2]
h1_prime = (1 - a) * points[1] + a * points[2]
end_prop = (b - a) / (1.0 - a)
h1 = (1 - end_prop) * h0 + end_prop * h1_prime
return [h0, h1, h2]
def split_quadratic_bezier(points: Iterable[float], t: f... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n The two Bézier curves as a list of tuples,\r\n has the shape ``[a1, h1, b1], [a2, h2, b2]``\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | async def _call_tools(
tool_manager: ToolManager[DepsT],
tool_calls: list[_messages.ToolCallPart],
deferred_tool_results: dict[str, DeferredToolResult],
tracer: Tracer,
usage_limits: _usage.UsageLimits | None,
output_parts: list[_messages.ModelRequestPart],
output_deferred_calls: dict[Litera... | Review this code and list any quality issues. | [
{
"issue": "Judging by the rest of the codebase, we prefer `Callable[..., Awaitable[...]]` over `Coroutine[...]`",
"severity": "minor",
"line": 26
}
] | 1 |
python | if video_data.get('error'):
error_msg = traverse_obj(video_data, ('error', 'message'))
if error_msg == 'OutsideRegionError: ':
self.raise_geo_restricted('This video is available in Taiwan only')
if error_msg:
raise ExtractorError(f'{self.IE_NAME} said:... | Review this code and list any quality issues. | [
{
"issue": "I would inline all this below in the return\r\n\r\nimport `functools`, and import `join_nonempty` and `urljoin` from `..utils`\r\n```py\r\n return {\r\n 'id': video_id,\r\n 'formats': formats,\r\n 'title': join_nonempty('title', 'secondary_mark', delim='', fro... | 1 |
python | else:
self._pre_navigation_hooks.append(hook)
# No parameter in decorator. Execute directly.
if hook:
register_hooks(hook)
# Return parametrized decorator that will be executed through decorator syntax if called with parameter.
return register_hooks
def... | Review this code and list any quality issues. | [
{
"issue": "I don't think that the user should be able to change anything in the `proxy_info` - what am I missing?",
"severity": "minor",
"line": 26
}
] | 1 |
python | id: :class:`int`
The ID of the channel.
type: :class:`~discord.ChannelType`
The type of channel.
name: :class:`str`
The name of the channel.
permissions: :class:`~discord.Permissions`
The resolved permissions of the user who invoked
the application command in that cha... | Review this code and list any quality issues. | [] | 0 |
python | title = self._html_search_regex(r'(?s)<title\b[^>]*>(.*)</title>', webpage, 'title',
default=None) or self._og_search_title(webpage)
urlType = self._search_regex(
self._VALID_URL,
url, 'audio URL', group="m")
if urlType == 'm.':
... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n```\r\nthis is all no longer needed if we're not downloading the desktop webpages anymore",
"severity": "minor",
"line": 26
}
] | 1 |
python | from .common import InfoExtractor
from .. import traverse_obj
from ..utils import (
determine_ext,
int_or_none,
parse_count,
parse_duration,
parse_iso8601,
url_or_none,
)
class ManyVidsIE(InfoExtractor):
_VALID_URL = r'(?i)https?://(?:www\.)?manyvids\.com/video/(?P<id>\d+)'
_TESTS = [{... | Review this code and list any quality issues. | [
{
"issue": "you can remove the dead video test",
"severity": "minor",
"line": 20
}
] | 1 |
python | @classmethod
def generate_template_map(cls, template_path: Optional[pathlib.Path] = None):
if not template_path:
template_path = pathlib.Path(taipy.__file__).parent.resolve() / "templates"
# Update the template map with the new templates but do not override the existing ones
cls... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n help=\"The template used to create the new Taipy application.\",\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | async def async_step_creation(
self, user_input: dict[str, Any] | None = None
) -> config_entries.ConfigFlowResult:
"""Create config entry from external data."""
_LOGGER.debug("Creating config entry from external data")
try:
async with asyncio.timeout(OAUTH_TOKEN_TIMEOUT... | Review this code and list any quality issues. | [
{
"issue": "I think we should consider removing the `HTTPStatus.UNAUTHORIZED` condition since we now classify all 400 errors as unauthorized. The status attribute also comes from the aiohttp parent exception, which we may remove after the deprecation period.",
"severity": "critical",
"line": 26
}
] | 1 |
python | continue
format_url = format_item
format_url = url_or_none(format_url)
if not format_url or format_url in format_urls:
continue
format_urls.add(format_url)
formats.append({
... | Review this code and list any quality issues. | [
{
"issue": "Remove preceding two lines, \"simplify\" this part, and reindent the lines down to, but not including, original l.244 :\r\n```suggestion\r\n \r\n for hls_format_key, hls_url in traverse_obj(initials, (\r\n 'xplayerSettings', 'sources', 'hls', {dict.items},\r\n l... | 1 |
python | def _polygons_to_masks(
polygons: list[npt.NDArray[np.number]], resolution_wh: tuple[int, int]
) -> npt.NDArray[np.bool_]:
return np.array(
[
polygon_to_mask(polygon=polygon, resolution_wh=resolution_wh)
for polygon in polygons
],
dtype=bool,
)
def _with_mas... | Review this code and list any quality issues. | [
{
"issue": "The new `ValueError` messages in `_extract_class_names` don’t include the `file_path`, which can make debugging harder when loading multiple datasets. Consider including the path (and possibly the unexpected type/value) in the error messages so users can quickly locate the problematic `data.yaml`.",... | 1 |
python | @staticmethod
def _is_special_text(text):
return text.isdigit() or text.isspace() or isLink(text)
def _make_new_book(self, book):
new_book = epub.EpubBook()
new_book.metadata = book.metadata
new_book.spine = book.spine
new_book.toc = book.toc
return new_book
... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n for i in range(len(wait_p_list)):\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | print(f'Creating new file {file_name}')
# Get the new version of the file
content = self.replace_complete_file(
convo,
file_content,
file_name,
files,
)
for i in range(MAX_REVIEW_RETRIES):
if not content or content == file_con... | Review this code and list any quality issues. | [
{
"issue": "only effect of this line is that it prints empty line, `category='agent:code-monkey'` is already set few lines above (line 111)",
"severity": "minor",
"line": 26
}
] | 1 |
python | >>> import supervision as sv
>>> cd = sv.ClassificationDataset(...)
>>> cd.as_multiclass_folder_structure(
... root_directory_path="./images/valid/",
... output_directory_path="./out",
... )
"""
os.makedirs(output_directory_path, exis... | Review this code and list any quality issues. | [
{
"issue": "Because we use `from __future__ import annotations` at the top of the file, we do not need `\"` around `\"ClassificationDataset\"`.",
"severity": "minor",
"line": 26
}
] | 1 |
python | # XXX can this ever happen if base was an Add?
return Add(*[f*multi for f in base.args])
elif (exp.is_Rational and exp.p < 0 and base.is_Add and
abs(exp.p) > exp.q):
return 1 / self.func(base, -exp)._eval_expand_multinomial()
elif exp.is_Add and base.i... | Review this code and list any quality issues. | [
{
"issue": "The comment here is not needed. The code is clear enough.",
"severity": "minor",
"line": 26
}
] | 1 |
python | - [Open-Orca/Mistral-7B-OpenOrca #Prompt Template](https://huggingface.co/Open-Orca/Mistral-7B-OpenOrca#prompt-template)
"""
use_fast_tokenizer = False
def match(self, model_path: str):
if "mistral-7b-openorca" in model_path.lower():
return get_conv_template("mistral-7b-openorca")
... | Review this code and list any quality issues. | [
{
"issue": "In function `def match(self, model_path: str):`, it should return \"True/Flase\" instead of `get_conv_template`.\r\nCould you fix it?",
"severity": "minor",
"line": 26
}
] | 1 |
python | return bb.type == idaapi.fcb_ret
def has_sib(oper: idaapi.op_t) -> bool:
# via: https://reverseengineering.stackexchange.com/a/14300
return oper.specflag1 == 1
def get_function_alternative_names(fva: int):
"""Get all alternative names for an address."""
# Check indented comment
cmt = ida_bytes.... | Review this code and list any quality issues. | [
{
"issue": "nit: don't repeat the code here",
"severity": "minor",
"line": 26
}
] | 1 |
python | command = request.param.get("command")
keys = request.param.get("redis_keys")
return CacheKey(command, keys)
def mock_identity_provider() -> IdentityProviderInterface:
jwt = pytest.importorskip("jwt")
mock_provider = Mock(spec=IdentityProviderInterface)
token = {"exp": datetime.now(timezone.utc).... | Review this code and list any quality issues. | [
{
"issue": "Could you please move that import in the beginning of the file, where all other imports are - it is not a good practice to hide imports throughout the code.",
"severity": "minor",
"line": 26
}
] | 1 |
python | def compare_build_systems():
cmake_files = [
f
for p in CMAKE_FILE_TYPES
for f in glob.glob(os.path.join(SDK_ROOT, p), recursive=True)
]
bazel_files = [
f
for p in BAZEL_FILE_TYPES
for f in glob.glob(os.path.join(SDK_ROOT, p), recursive=True)
]
_LOG.i... | Review this code and list any quality issues. | [
{
"issue": "I guess this is assuming that our submodules are always in the `lib/` subdirectory? Whilst this will _probably_ always be true for `pico-sdk`, I guess moving the `lib/` part of the path into the `MODULE.bazel` file might give you an extra bit of flexibility? :shrug:",
"severity": "minor",
"l... | 1 |
python | # === Main Plot ===
fig, ax = plt.subplots(layout="constrained")
im = ax.imshow(Z, cmap=cmap,
origin='lower', extent=[-3, 3, -3, 3],
norm=norm)
# === Inset Histogram – Positioning adjusted ===
cax = ax.inset_axes([1.18, 0.02, 0.25, 0.95]) # left, bottom, width, height
# === Plot Histogr... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\ncax.set_yticks(bins)\r\ncax.tick_params(axis='both', which='both', length=0)\r\n```\r\nticks is a subset of styling for these purposes",
"severity": "minor",
"line": 26
}
] | 1 |
python | """
sample_count: Optional[int] = None
"""The number of examples to sample from the dataset.
If None, uses the full dataset. If specified, must be non-negative.
"""
output_path: str = "."
"""Directory path where output files will be saved.
Defaults to current directory ('.').
"""
... | Review this code and list any quality issues. | [
{
"issue": "I'm a bit confused - isn't the above method private __finalize_and_validate__()?\r\n\r\nAlso, why do we need to run this in the post_init of the config? Couldn't we just validate in the analyzer's post_init, meaning every analyzer we get is already valid?",
"severity": "minor",
"line": 26
... | 1 |
python | NiconicoUserIE,
NicovideoSearchDateIE,
NicovideoSearchIE,
NicovideoSearchURLIE,
)
from .ninecninemedia import NineCNineMediaIE
from .ninegag import NineGagIE
from .ninenow import NineNowIE
from .nintendo import NintendoIE
from .nitter import NitterIE
from .njpwworld import NJPWWorldIE
from .nobelprize impor... | Review this code and list any quality issues. | [] | 0 |
python | webpage, 'uploader or channel url', default=None)
owner_profile_url = url_or_none(microformats.get('ownerProfileUrl')) # @a6211d2
# Uploader refers to the /user/ id ONLY
uploader_id = (
id_from_url(owner_profile_url, 'user')
or id_from_url(upch_url, 'user')
... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n self._search_regex(\r\n [r'<a\\s*id=\"watch-username\".*\">\\s*<strong[^>]?>([^<]+)</strong>',\r\n r'var\\s*watchUsername\\s*=\\s*\\'(.+)\\';', # ~May 2009\r\n r'<div\\s*\\bid=\\\"watch-channel-stats\"[^>]*>\\s*<a[^>]*>\\s*... | 1 |
python | {
'formats': formats,
'subtitles': subtitles
})
def _extract_thumbnails(self, thumbs):
thumbnails = []
for image in thumbs:
image_url = image.get('url')
if not image_url:
continue
thumbnails.append({
... | Review this code and list any quality issues. | [
{
"issue": "I'd break this line up\r\n\r\nalso, it's not really json anymore at this point, I'd just name it `blocks`\r\n```suggestion\r\n blocks_json = traverse_obj(article_json, (\r\n 'sprinkledBody', 'content', ..., ('ledeMedia', None),\r\n lambda _, v: v['__typename'] in ('Video... | 1 |
python | def _entropy_formula(self, **kwargs):
return (1 + np.log(2*np.pi))/2
def _logentropy_formula(self, **kwargs):
return np.log1p(np.log(2*np.pi)) - np.log(2)
def _median_formula(self, **kwargs):
return 0
def _mode_formula(self, **kwargs):
return 0
def _moment_raw_formula... | Review this code and list any quality issues. | [
{
"issue": "Since I've seen this twice now, maybe it's an idea to extract this as a constant? If you care about import time, then you could pre-computing it with wolfram alpha or something.",
"severity": "major",
"line": 26
}
] | 1 |
python | """
grouped_nodes: dict[str, dict[str, Any]] = defaultdict(dict)
toposorted_nodes = [node for group in self.grouped_nodes for node in group]
for node in toposorted_nodes:
key = node.namespace.split(".")[0] if node.namespace else node.name
if key not in grouped_nodes:
... | Review this code and list any quality issues. | [
{
"issue": "it will be possible duplication here?",
"severity": "minor",
"line": 26
}
] | 1 |
python | def test_fact_cache_with_invalid_path_traversal(tmpdir):
hosts = [
Host(
name='../foo',
ansible_facts={"a": 1, "b": 2},
),
]
artifacts_dir = tmpdir.mkdir("artifacts")
inventory_id = 42
start_fact_cache(hosts, artifacts_dir=str(artifacts_dir), timeout=0, inven... | Review this code and list any quality issues. | [] | 0 |
python | def makedirs(self, path, *args, **kwargs):
path = posixpath.join(self.local_root_dir, self._strip_protocol(path))
return self._fs.makedirs(path, *args, **kwargs)
def rmdir(self, path):
path = posixpath.join(self.local_root_dir, self._strip_protocol(path))
return self._fs.rmdir(path)... | Review this code and list any quality issues. | [
{
"issue": "Why is it needed ? IIRC it's already implemented as part of the `AbstractFileSystem` and uses `self.open()` under the hood",
"severity": "major",
"line": 26
}
] | 1 |
python | self._attr_current_temperature = None
self._attr_target_temperature = None
self._attr_fan_mode = None
self._attr_preset_mode = None
self.scoped = Scope.VEHICLE_CMDS in scopes
if not self.scoped:
self._attr_supported_features = ClimateEntityFeature(0)
self.sid... | Review this code and list any quality issues. | [] | 0 |
python | IE_NAME = 'vrsquare:search'
_VALID_URL = r'https?://livr\.jp/web-search'
_TESTS = [{
'url': 'https://livr.jp/web-search?w=%23%E5%B0%8F%E6%A0%97%E6%9C%89%E4%BB%A5',
'info_dict': {
'id': '#小栗有以',
'title': '#小栗有以',
},
'playlist_mincount': 70,
}]
def... | Review this code and list any quality issues. | [
{
"issue": "don't duplicate the playlist id for playlist title\r\n```suggestion\r\n return self.playlist_result(self._entries(query), query)\r\n```",
"severity": "major",
"line": 26
}
] | 1 |
python | self.setup_clean_chain = True
self.num_nodes = 4
# Node0 has no required chainwork; node1 requires 15 blocks on top of the genesis block; node2 requires 2047
self.extra_args = [["-minimumchainwork=0x0", "-checkblockindex=0"], ["-minimumchainwork=0x1f", "-checkblockindex=0"], ["-minimumchainwork=... | Review this code and list any quality issues. | [
{
"issue": "Setting mock time for all nodes seems like it could potentially be useful in multiple functional tests. Maybe it could be added to `BitcoinTestFramework` rather than live in this functional test?",
"severity": "minor",
"line": 26
}
] | 1 |
python | from .common import InfoExtractor
from .brightcove import BrightcoveNewIE
from ..utils import ExtractorError, traverse_obj
class NineNewsIE(InfoExtractor):
IE_NAME = '9News'
_VALID_URL = r'https?://(?:www\.)?9news\.com\.au/\w+/(?:\w+/)?[^/]+/(?P<id>[^/]+)(?:$|[?#])'
_TESTS = [{
'url': 'https://ww... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\nfrom .common import InfoExtractor\r\nfrom .brightcove import BrightcoveNewIE\r\nfrom ..utils import ExtractorError\r\nfrom ..utils.traversal import traverse_obj\r\n```",
"severity": "major",
"line": 4
}
] | 1 |
python | import ssl
import socket
from urllib.parse import urlparse
import pytest
import pytest_asyncio
import redis.asyncio as redis
from redis.exceptions import RedisError, ConnectionError
import ssl
# Skip test or not based on cryptography installation
try:
import cryptography # noqa
skip_if_cryptograph... | Review this code and list any quality issues. | [
{
"issue": "Consider using urlparse(ssl_url).hostname and urlparse(ssl_url).port for clarity and better error-proofing of the URL parsing.\n```suggestion\n ssl_url = request.config.option.redis_ssl_url\n parsed_url = urlparse(ssl_url)\n client = redis.Redis(host=parsed_url.hostname, port=pa... | 1 |
python | tokenizer: "PreTrainedTokenizer",
model_args: "ModelArguments",
finetuning_args: "FinetuningArguments",
is_trainable: bool = False,
add_valuehead: bool = False,
) -> "PreTrainedModel":
r"""Load pretrained model."""
init_kwargs = _get_init_kwargs(model_args)
config = load_config(model_args)
... | Review this code and list any quality issues. | [
{
"issue": "please move these lines to func `patch_config()`",
"severity": "minor",
"line": 26
}
] | 1 |
python | import torch
from parameterized import parameterized
from monai.networks import eval_mode
from monai.networks.blocks.crossattention import CrossAttentionBlock
from monai.networks.layers.factories import RelPosEmbedding
from monai.utils import optional_import
from tests.utils import SkipIfBeforePyTorchVersion
einops, ... | Review this code and list any quality issues. | [
{
"issue": "Hi @virginiafdez , do you think it would make sense to compare the output consistency with versus without `use_flash_attention`?",
"severity": "minor",
"line": 26
}
] | 1 |
python | 'y': { '_type': 'qnormal', '_value': [0, 1, 0.5] },
},
],
},
'z': { '_type': 'quniform', '_value': [-0.5, 0.5, 0.1] },
},
{
'_name': 'common',
'x': { '_type': 'lognormal', '_value': [1, 0.... | Review this code and list any quality issues. | [] | 0 |
python | arguments=arguments,
function_call_count=1,
request_index=0,
function_behavior=FunctionChoiceBehavior.Auto(),
)
async def test_invoke_function_call_with_continuation_on_malformed_arguments(kernel: Kernel, get_tool_call_mock):
tool_call_mock = MagicMock(spec=FunctionCall... | Review this code and list any quality issues. | [] | 0 |
python | import platform
import sys
import os
from posthog import Posthog
from mem0.memory.setup import get_user_id, setup_config
MEM0_TELEMETRY = os.environ.get("MEM0_TELEMETRY", "True")
if isinstance(MEM0_TELEMETRY, str):
MEM0_TELEMETRY = MEM0_TELEMETRY.lower() in ("true", "1", "yes")
if not isinstance(MEM0_TELEMETRY... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n raise ValueError(\"MEM0_TELEMETRY must be a boolean value.\")\r\n\r\n```",
"severity": "minor",
"line": 16
}
] | 1 |
python | # %%
# Temperature scaling in `CalibratedClassifierCV`
# -----------------------------------------------
# Probability calibration of classifiers with temperature scaling is available in
# :class:`calibration.CalibratedClassifierCV` by setting `method = "temperature"`.
# This method is particularly well suited for mult... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\nX, y = make_classification(random_state=42)\r\n```\r\n\r\nA follow-up to [#32809 (comment)](https://github.com/scikit-learn/scikit-learn/pull/32809/files#r2585022364): since `n_classes * n_clusters_per_class <= 2**n_informative`, the cleanest way to do this is probably to specify `... | 1 |
python | # coding: utf-8
from __future__ import unicode_literals
import re
from urllib.parse import (
parse_qs,
urlparse,
)
from .common import InfoExtractor
from ..utils import (
clean_html,
determine_ext,
ExtractorError,
extract_attributes,
get_element_by_class,
get_element_html_by_id,
HE... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\nimport urllib.parse\r\n```",
"severity": "minor",
"line": 8
}
] | 1 |
python | formats.append({
'format_note': 'Camera stream',
'url': str_or_none(data.get('viewMp4Url')),
'width': int_or_none(traverse_obj(data, ('viewResolvtions', 0))),
'height': int_or_none(traverse_obj(data, ('viewResolvtions', 1))),
'format_id': s... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n 'title': str_or_none(traverse_obj(data, ('meet', 'topic'))),\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | :type collection_name: Optional[str], optional
:param dir: Path to the database directory, where the database is stored, defaults to "db"
:type dir: str, optional
:param uri: Cluster endpoint obtained from the Zilliz Console, defaults to None
:type uri: Optional[str], optional
:p... | Review this code and list any quality issues. | [
{
"issue": "Can convert these three lines into one line by doing:\r\n\r\n```python\r\nself.metric_type = metric_type if metric_type else \"L2\"",
"severity": "minor",
"line": 26
}
] | 1 |
python | 'url': 'https://asobistage.asobistore.jp/event/idolmaster_idolworld2023_goods/archive/live',
'info_dict': {
'id': 'idolmaster_idolworld2023_goods/archive/live/3aef7110',
'title': 'asobistore_station_1020_serverREC',
'live_status': 'was_live',
'thumbnail': r're:^ht... | Review this code and list any quality issues. | [
{
"issue": "`metadata_available=False` is the default\r\n```suggestion\r\n self.raise_login_required()\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | def _entries(self, query):
"""Get a specified number of results for a query"""
currDate = datetime.datetime.now().date()
search_url = "http://www.nicovideo.jp/search/%s" % query
spans = self._get_spans_for_range(search_url, query, self._START_DATE, currDate)
for (start_date, en... | Review this code and list any quality issues. | [
{
"issue": "Maybe we should try make this function a loop rather than use recursion, and from there maybe a generator?",
"severity": "minor",
"line": 26
}
] | 1 |
python | def reduce_code(code):
code = re.sub(re.compile(r"/\*.*?\*/", re.DOTALL), "", code) # remove all occurance streamed comments
code = re.sub(re.compile(r"//.*?\n"), "", code) # remove all occurance singleline comments
code = re.sub('\n+', '\n', re.sub('\n +', '\n', code)) # remove white spaces
return c... | Review this code and list any quality issues. | [
{
"issue": "Why do we need to convert he length to string?",
"severity": "minor",
"line": 26
}
] | 1 |
python | Special view to facilitate processing job output in the UI.
In order to collapse events and their children, the UI needs to know how
many children exist for a given event.
This view returns a JSON object where the key is the event counter, and the value
is the number of children (and grandchildren) even... | Review this code and list any quality issues. | [
{
"issue": "Even if this method can run in a reasonable amount of time for a high-output job, the _number of keys_ is going to make it difficult to return in the response. If there are a million events, will it even be able to _transmit_ the response before the uWSGI worker dies? As a whole-job endpoint, I find... | 1 |
python | See Also
--------
:class:`BraceBetweenPoints`
Examples
--------
.. manim:: BraceExample
:save_last_frame:
class BraceExample(Scene):
def construct(self):
s = Square()
self.add(s)
for i in np.linspace(0.1,1.0,4):
... | Review this code and list any quality issues. | [
{
"issue": "Might this be typed as `Point3DLike` in the meantime?\r\n```suggestion\r\n direction: Point3DLike = DOWN,\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | import json
import threading
import time
from .common import FileDownloader
from .external import FFmpegFD
from ..networking import Request
from ..utils import DownloadError, str_or_none, truncate_string
from ..utils.traversal import traverse_obj
class NiconicoLiveFD(FileDownloader):
""" Downloads niconico live ... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n opts = info_dict['downloader_options']\r\n quality, ws_extractor, ws_url = opts['max_quality'], opts['ws'], opts['ws_url']\r\n```",
"severity": "major",
"line": 18
}
] | 1 |
python | from .common import InfoExtractor
import re
class MaarivIE(InfoExtractor):
IE_NAME = 'maariv.co.il'
_VALID_URL = r'(https?://)?(www\.)?(m\.)?maariv\.co\.il(?:/[^/]+)*/Article-(?P<id>\d{7})'
_TESTS = [
{
'url': 'https://www.maariv.co.il/news/law/Article-1044008',
'info_dict'... | Review this code and list any quality issues. | [
{
"issue": "And we need updated imports for the helper functions used\r\n```suggestion\r\nfrom ..utils import (\r\n int_or_none,\r\n parse_resolution,\r\n unified_timestamp,\r\n url_or_none,\r\n)\r\nfrom ..utils.traversal import traverse_obj\r\n```",
"severity": "major",
"line": 2
}
] | 1 |
python | self.sf.debug(f"Received event, {eventName}, from {srcModuleName}")
if self.opts["api_key"] == "":
self.sf.error("You enabled sfp_dnsdb but did not set an API key!", False)
self.errorState = True
return None
if eventData in self.results:
self.sf.debug(f"... | Review this code and list any quality issues. | [
{
"issue": "Any chance `.get()` returns `None` here? Might make sense to make this `.get(\"time_last\", 0)` instead.",
"severity": "minor",
"line": 26
}
] | 1 |
python | #!/usr/bin/env python3
# Copyright (c) The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or https://opensource.org/license/mit/.
import os
import shlex
import subprocess
import sys
def run(cmd, **kwargs):
print("+ " + shlex.join(cmd), flush=True)
tr... | Review this code and list any quality issues. | [
{
"issue": "Doing `os.environ['BASE_READ_ONLY_DIR']` would rather raise a `KeyError` and the failure pinpoints the source of failure better",
"severity": "critical",
"line": 26
}
] | 1 |
python | self._attr_native_value = self.entry.runtime_data.getIRTemperature()
elif sensor_type == "rtc_temp":
self._attr_native_value = self.entry.runtime_data.getRTCTemperature()
elif sensor_type == "usage_session":
self._attr_native_value = (
float(se... | Review this code and list any quality issues. | [
{
"issue": "Should we keep this for a followup?",
"severity": "minor",
"line": 26
}
] | 1 |
python | logger.error("Request timeout after waiting for response")
raise RuntimeError(
"Request timeout - Controller may not be running at %s"
% self.config.controller_reply_url
) from e
except zmq.ZMQError as e:
logger.error("ZMQ error: %s", e)
... | Review this code and list any quality issues. | [] | 0 |
python | 'id': 'Ttv1656281400',
'ext': 'mp4',
'title': 'Tagesschau + Sport am Sonntag - 31-07-2022 20:00',
'date': '20220731',
'thumbnail': r're:https://raisudtirol\.rai\.it/img/.+?\.jpg',
'uploader': 'raisudtirol',
}
}]
def _real_extract(self, url):
... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n return {\r\n 'id': video_id,\r\n 'title': join_nonempty(video_title, video_data, delim=' - '),\r\n 'date': unified_strdate(video_data),\r\n 'thumbnail': video_thumb,\r\n 'url': self._proto_relative_url(video_url),\r\n```... | 1 |
python | _DTypeT = TypeVar("_DTypeT", bound=dtype[Any])
_DTypeT_co = TypeVar("_DTypeT_co", bound=dtype[Any], covariant=True)
_ArrayT = TypeVar("_ArrayT", bound=ndarray[Any, Any])
_ScalarT = TypeVar("_ScalarT", bound=generic)
# A subset of `MaskedArray` that can be parametrized w.r.t. `np.generic`
_MaskedArray: TypeAlias = Maske... | Review this code and list any quality issues. | [
{
"issue": "It's also an option to overload on both `a: _Array[_ScalarT]` and `a: ArrayLike`. That would also cover things like (nested) sequences of numpy scalars or arrays, and 🦆-typed things with an `__array__` method.\r\n\r\nBut I'm already happy with this, so feel free to resolve this if you want.",
"... | 1 |
python | assert str(exc.value) == "Device ID not found: 1234"
async def test_mount_reload_unnamed_device(
hass: HomeAssistant,
device_registry: dr.DeviceRegistry,
supervisor_client: AsyncMock,
) -> None:
"""Test reload_mount with unnamed device."""
device = await mount_reload_test_setup(hass, device_regist... | Review this code and list any quality issues. | [
{
"issue": "I don't think this test really works, at least not as a guard against translations, because language is set to English in CI.\n\nI'd modify the test function name and docstring to convey it guards against changes to the model name.\nAlso, I think you should load the `services.yaml` file and check li... | 1 |
python | _TESTS = [{
'url': 'https://app.idagio.com/playlists/personal/99dad72e-7b3a-45a4-b216-867c08046ed8',
'info_dict': {
'id': '99dad72e-7b3a-45a4-b216-867c08046ed8',
'title': 'Test',
'creators': ['1a6f16a6-4514-4d0c-b481-3a9877835626'],
'thumbnail': r're:https... | Review this code and list any quality issues. | [
{
"issue": "same as above\r\n```suggestion\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | 'tbr': float_or_none(video.get('bandwidth'), scale=1000),
'filesize': int_or_none(video.get('size')),
'quality': int_or_none(video.get('id')),
'format_id': traverse_obj(
video, (('baseUrl', 'base_url'), {self._FORMAT_ID_RE.search}, 1),
('id', {str_or_n... | Review this code and list any quality issues. | [
{
"issue": "The patch by GD_Slime tried using `http_dash_segments` to handle segmented multi-video flv, which #6438 previously tried to address.\r\nIt appears that `http_dash_segments` downloader is not meant for this and will cause timestamp problems, and later converting this to a `multi_video` playlist (and ... | 1 |
python | 'ext': 'mp4',
'title': 'Cicatánc',
'description': '',
'thumbnail': r're:^https?://.*\.jpg$',
'uploader': 'cukiajanlo',
'uploader_id': '83729',
'timestamp': 1439193826,
'upload_date': '20150810',
'duration': 72,
'... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n f'https://amfphp.indavideo.hu/SYm0json.php/player.playerHandler.getVideoData/{video_id}/',\r\n video_id, query={'_': time_seconds()})['data']\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | # Copyright 2024 The Aibrix Team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | Review this code and list any quality issues. | [] | 0 |
python | def to_dict(data) -> dict:
if isinstance(data, BaseModel):
data = data.model_dump()
return jsonable_encoder(data)
def dumps(data) -> str:
return json.dumps(to_dict(data))
T = TypeVar("T")
@overload
def loads(data: str | bytes, *args, target_type: Type[T], **kwargs) -> T: ...
@overload
def lo... | Review this code and list any quality issues. | [] | 0 |
python | wait_until: str | None = None,
) -> Any:
"""Navigate to the specified URL."""
# Override goto to return navigation result that `PlaywrightCrawler` expects
return await self._page._page.goto( # noqa: SLF001
url,
referer=referer,
timeout=timeout,
... | Review this code and list any quality issues. | [
{
"issue": "self._page is an instance of `StagehandPage`, right? I don't think it has a close method.\r\n\r\nI guess it is supposed to be self._page._page and this was supposed to rely on `__getattr__` to do the delegation, but since `_page` exists on `self`, the `__getattr__` will not be called.\r\n\r\nThere a... | 1 |
python | Returns
-------
self : :class:`ManimConfig`
This object, after processing the contents of ``parser``.
See Also
--------
:func:`.main_utils.parse_args()`, :meth:`~.ManimConfig.digest_parser`,
:meth:`~.ManimConfig.digest_file`
Notes
-----
... | Review this code and list any quality issues. | [
{
"issue": "Perhaps a comment could be added explaining what happens if `args.file` is `\"-\"`, like how it takes code from stdin",
"severity": "minor",
"line": 26
}
] | 1 |
python | self.pointwise_become_partial(self, buff_proportion, 1 - buff_proportion)
return self
def set_start_and_end_attrs(self, start, end):
# If either start or end are Mobjects, this
# gives their centers
rough_start = self.pointify(start)
rough_end = self.pointify(end)
ve... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n \"\"\"Sets starts and end coordinates of a line.\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | import re
from .common import InfoExtractor
from ..utils import traverse_obj
class WeyyakIE(InfoExtractor):
_VALID_URL = r'https?://weyyak\.com/(?P<lang>\w+)/player/(?P<type>episode|movie)/(?P<id>\d+)(?:/.+)?'
_TESTS = [
{
'url': 'https://weyyak.com/en/player/episode/1341952/Ribat-Al-Hob-... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n _VALID_URL = r'https?://weyyak\\.com/(?P<lang>\\w+)/player/(?P<type>episode|movie)/(?P<id>\\d+)'\r\n```\r\nIt does nothing",
"severity": "minor",
"line": 8
}
] | 1 |
python | from .common import InfoExtractor
from ..utils import traverse_obj, unified_timestamp
class IdagioTrackIE(InfoExtractor):
"""
This extractor is only used internally to extract the info about tracks contained in every recording, album or
playlist
"""
_VALID_URL = r'https?://(?:www\.)?api\.idagio\.c... | Review this code and list any quality issues. | [
{
"issue": "imo. we should not match the API URL, but the URL of the individual track (i.e. `https://app.idagio.com/recordings/30576934?trackId=30576943`)",
"severity": "minor",
"line": 10
}
] | 1 |
python | # Image / Popup
# Display a popup with the large image after clicking on the #image.
# ---
from h2o_wave import site, ui
page = site['/demo']
page['example'] = ui.image_card(
box='1 1 3 4',
title='Image popup',
path='https://via.placeholder.com/600x400',
path_popup='https://via.placeholder.com/1200x80... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n# Display a popup with the large image after clicking on the #image. It's recommended to use a smaller image for `path` and larger (higher quality) image for the `path_popup`.\r\n```",
"severity": "minor",
"line": 2
}
] | 1 |
python | """
@deprecated_arg(
"workflow",
since="1.2",
removed="1.5",
new_name="workflow_type",
msg_suffix="please use `workflow_type` instead.",
)
@deprecated_arg_default("workflow_type", None, "train", since="1.2", replaced="1.4")
def __init__(
self,
con... | Review this code and list any quality issues. | [
{
"issue": "Could you please help add 1 unit test to cover this new arg?\r\n\r\nThanks.",
"severity": "minor",
"line": 26
}
] | 1 |
python | """
from unittest.mock import MagicMock, patch
class TestArchivedWorkflowRunDeletion:
def test_delete_by_run_id_calls_delete_run(self):
from services.retention.workflow_run.delete_archived_workflow_run import ArchivedWorkflowRunDeletion
deleter = ArchivedWorkflowRunDeletion()
repo = Magi... | Review this code and list any quality issues. | [] | 0 |
python | i_g,
i_b,
):
"""
support position for a world direction
"""
g_pos = geoms_state.pos[i_g, i_b]
g_quat = geoms_state.quat[i_g, i_b]
d_mesh = gu.ti_transform_by_quat(d, gu.ti_inv_quat(g_quat))
v_, vid = _func_support_mesh(support_field_info, support_field_static_config, d_mesh, i_g)
v ... | Review this code and list any quality issues. | [
{
"issue": "changing comments are not necessary",
"severity": "minor",
"line": 26
}
] | 1 |
python | @unittest.skipIf(
support.is_emscripten, "process_time present but doesn't exclude sleep"
)
def test_process_time(self):
# process_time() should not include time spend during a sleep
start = time.process_time()
time.sleep(0.100)
stop = time.process_time()
# use 20... | Review this code and list any quality issues. | [] | 0 |
python | """Returns True if the given paths are in local scheme.
Note: The paths must be in same scheme, i.e. it's invalid and
will raise error if paths are mixed with different schemes.
"""
if isinstance(paths, str):
paths = [paths]
if isinstance(paths, pathlib.Path):
paths = [str(paths)]
... | Review this code and list any quality issues. | [
{
"issue": "I'm wondering if we should provide required defaults up-front, so that it can be used for tasks that don't adhere to the standard defaults?\n```suggestion\ndef _validate_head_node_resources_for_local_scheduling(\n ray_remote_args: Dict[str, Any],\n *,\n op_name: str,\n required_num_cpus:... | 1 |
python | # This example shows the various ways to run things before/outside of the normal task execution flow,
# which is very useful for fetching test data.
#
# 1. Locustfile parse time
# 2. Locust start (init)
# M1. CPU & memory usage
# M2. master sent heartbeat to worker 1-N
# M3. worker 1-N received heartbeat from master
# ... | Review this code and list any quality issues. | [
{
"issue": "What's \"M\"? :) Its kind of arbitrary where you put these, but I'd prefer having them after 5.",
"severity": "minor",
"line": 9
}
] | 1 |
python | try:
scene = SceneClass()
scene.render()
except Exception:
console.print_exception()
if config.notify_outdated_version:
manim_info_url = "https://pypi.org/pypi/manim/json"
warn_prompt = "Cannot check if latest release of manim is installed... | Review this code and list any quality issues. | [
{
"issue": "Catching error is fine: you shouldn't raise or exit because Manim should run without internet also.",
"severity": "minor",
"line": 26
}
] | 1 |
python | data_key : str
the data to fetch: DK_*.
proc_func: Callable
please refer to the doc of DataHandler.fetch
Returns
-------
pd.DataFrame:
"""
from .storage import HasingStockStorage
data_storage = self._get_df_by_key(data_key)
if is... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n elif isinstance(data_storage, BaseHandlerStorage):\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | resp.raise_for_status()
else:
raise ValueError("NGC API requires requests package. Please install it.")
model_info = json.loads(resp.text)
return model_info["model"]["latestVersionIdStr"]
def _examine_monai_version(monai_version: str) -> tuple[bool, str]:
"""Examine if the package version is c... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n \"\"\"Get the `monai_version` from the metadata.json and compare if it is smaller than the installed `monai` package version\"\"\"\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | n_parallel_calib_samples=AWQ_DEFAULTS["n_parallel_calib_samples"],
)
# 4. Save AWQ quantized model
temp_awq_path = f"{config.output_path}_awq_temp"
logger.info(f"Saving AWQ model to: {temp_awq_path}")
model.save_quantized(temp_awq_path)
tokenizer.save_pretrained(temp_aw... | Review this code and list any quality issues. | [
{
"issue": "Why do we need this logic 163-170 ?",
"severity": "minor",
"line": 26
}
] | 1 |
python | def num_test_p2p_connections(self):
"""Return number of test framework p2p connections to the node."""
return len([peer for peer in self.getpeerinfo() if peer['subver'] == P2P_SUBVERSION])
def disconnect_p2ps(self):
"""Close all p2p connections to the node.
The state of the peers (s... | Review this code and list any quality issues. | [
{
"issue": "this is only used in `wallet_startup.py` and I fail to see why that wallet must be unnamed.\nWhy do we need this function?",
"severity": "critical",
"line": 26
}
] | 1 |
python | import requests
try: # pragma: no cover
import http.cookiejar as cookiejar
CookieLoadError = (FileNotFoundError, cookiejar.LoadError)
except ImportError: # pragma: no cover
import cookielib as cookiejar
CookieLoadError = IOError
from ._transcripts import TranscriptListFetcher
from ._errors import (
... | Review this code and list any quality issues. | [
{
"issue": "Please add `preserve_formatting` to the docstrings",
"severity": "minor",
"line": 19
}
] | 1 |
python | proxy = GeneratorProxy(iterator())
assert proxy.items == []
assert next(proxy) == 0
assert next(proxy) == 1
assert next(proxy) == 2
with pytest.raises(StopIteration):
next(proxy)
assert proxy.items == [0, 1, 2]
@pytest.mark.unittest
def test_iterator_proxy_iter():
original_iterat... | Review this code and list any quality issues. | [] | 0 |
python | lines: List[str], resolution_wh: Tuple[int, int], with_masks: bool, is_obb: bool
) -> Detections:
if len(lines) == 0:
return Detections.empty()
class_id, relative_xyxy, relative_polygon, relative_xyxyxyxy = [], [], [], []
w, h = resolution_wh
for line in lines:
values = line.split()
... | Review this code and list any quality issues. | [
{
"issue": "If we're doing the same operations inside both `if` branches, let's move them outside.\r\n\r\n```\r\npolygon = _parse_polygon(values=values[1:])\r\nif with_masks:\r\n relative_polygon.append(polygon)\r\n```\r\n\r\ncan be moved above `if is_obb`",
"severity": "minor",
"line": 26
}
] | 1 |
python | })
title = f'{artist} - {track}' if artist else track
if not duration:
duration = float_or_none(self._html_search_meta(
'duration', webpage, default=None))
return {
'id': track_id,
'title': title,
'thumbnail': thumbnail,
... | Review this code and list any quality issues. | [
{
"issue": "`get_elements_by_class` can be fatal, and all metadata extraction should be non-fatal, so let's use traversal instead (which is non-fatal):\r\n```suggestion\r\n 'tags': traverse_obj(webpage, ({find_elements(cls='tag')}, ..., {clean_html})),\r\n```\r\n(import `find_elements` from `..utils... | 1 |
python | """
return self.rotate(
TAU / 2, axis, about_point=about_point, about_edge=about_edge
)
def stretch(
self,
factor: float,
dim: int,
*,
about_point: Point3DLike | None = None,
about_edge: Vector3D | None = None,
) -> Self:
def f... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n about_edge: Vector3DLike | None = None,\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | context,
data,
dt,
)
class Event(namedtuple('Event', ['rule', 'callback'])):
"""
An event is a pairing of an EventRule and a callable that will be invoked
with the current algorithm context, data, and datetime only when the rule
is triggered.
... | Review this code and list any quality issues. | [
{
"issue": "Maybe worth clarifying that the calendar is set on instances of the rule, as opposed to the class?",
"severity": "minor",
"line": 26
}
] | 1 |
python | # 1. all dependencies should be listed here with their version requirements if any
# 2. once modified, run: `make deps_table_update` to update src/diffusers/dependency_versions_table.py
_deps = [
"Pillow", # keep the PIL.Image.Resampling deprecation away
"accelerate>=0.31.0",
"compel==0.1.8",
"datasets... | Review this code and list any quality issues. | [
{
"issue": "To be changed when `peft` has the release.",
"severity": "minor",
"line": 26
}
] | 1 |
python | import asyncio
from crawlee.beautifulsoup_crawler import BeautifulSoupCrawler, BeautifulSoupCrawlingContext
async def main() -> None:
# Create an instance of the BeautifulSoupCrawler class, a crawler that automatically
# loads the URLs and parses their HTML using the BeautifulSoup library.
crawler = Beau... | Review this code and list any quality issues. | [] | 0 |
python | # construct prompt
messages = [_prepare_message(message) for message in work_request.thread.messages]
prompt = "".join(messages) + V2_ASST_PREFIX
parameters = interface.GenerateStreamParameters.from_work_parameters(work_request.parameters)
if settings.use_stop_sequences:
parameters.stop = [
... | Review this code and list any quality issues. | [
{
"issue": "we definitely need to track when this happens and feed it back in the response to the backend, and then to the user",
"severity": "minor",
"line": 26
}
] | 1 |
python | self.generate(node, MIN_BLOCKS_TO_KEEP, sync_fun=self.no_op)
prune(1000)
assert not has_block(2), "blk00002.dat is still there, should be pruned by now"
assert not has_block(3), "blk00003.dat is still there, should be pruned by now"
# stop node, start back up with auto-prune at 550 MiB,... | Review this code and list any quality issues. | [
{
"issue": "As node[5] syncs from node[0], I guess this should have been self.nodes[0}.getblockcount()",
"severity": "minor",
"line": 26
}
] | 1 |
python | },
{
'url': 'https://play.nova.bg/video/ochakvaite/season-0/ochakvaite-2022-07-22-cherry-tazi/606609',
'md5': 'f3e973e2ed1a5b9b3f498b1ab82d01b3',
'info_dict': {
'id': '606609',
'ext': 'mp4',
'title': 'Черешката на тортата - тази... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n self._access_token = self._download_json(\r\n 'https://play.nova.bg/api/client', None, note='Fetching access token')['accessToken']\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | assert result_data["content"] == "Test content"
assert result_data["status"] == "success"
mock_firecrawl.scrape.assert_called_once_with("https://example.com", formats=["html", "text"])
def test_crawl_website(firecrawl_tools, mock_firecrawl):
"""Test crawl_website method."""
# Setup mock response
m... | Review this code and list any quality issues. | [] | 0 |
python | smuggle_url,
srt_subtitles_timecode,
str_or_none,
traverse_obj,
unified_timestamp,
unsmuggle_url,
url_or_none,
urlencode_postdata,
variadic,
)
class BilibiliBaseIE(InfoExtractor):
_FORMAT_ID_RE = re.compile(r'-(\d+)\.m4s\?')
_WBI_KEY_CACHE_TIMEOUT = 30 # exact expire timeout i... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n parsed_qualities = set(traverse_obj(formats, (..., 'quality')))\r\n missing_formats = join_nonempty(*[\r\n traverse_obj(fmt, 'new_description', 'display_desc', 'quality')\r\n for fmt in traverse_obj(play_info, (\r\n 'support_format... | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.