language string | code-snippit string | instruction string | flaws list | flaw_count int64 |
|---|---|---|---|---|
python | 'url': 'https://n1info.rs/vesti/cuta-biti-u-kosovskoj-mitrovici-znaci-da-te-docekaju-eksplozivnim-napravama/',
'info_dict': {
'id': '1332368',
'ext': 'mp4',
'title': 'Ćuta: Biti u Kosovskoj Mitrovici znači da te dočekaju eksplozivnim napravama',
'upload_date': '20... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n site_id = re.search(r'site:(\\d+)', webpage).group(1)\r\n for video_data in re.findall(r'\\$bp\\(\"Brid_\\d+\", (.+)\\);', webpage):\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | if tf & TexFlags.NORMAL:
self._bind_texture(material.normalTexture, "material.normal_texture", program)
if tf & TexFlags.OCCLUSION:
self._bind_texture(material.occlusionTexture, "material.occlusion_texture", program)
if tf & TexFlags.EMISSIVE:
self... | Review this code and list any quality issues. | [] | 0 |
python | The height along the height axis (given by direction) to start and end on.
show_ends
Whether to show the end caps or not.
resolution
The number of samples taken of the :class:`Cylinder`. A tuple can be used
to define different resolutions for ``u`` and ``v`` respectively.
Examples
... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\n v_range: tuple[float, float] = (0, TAU),\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | The architecture to be exported.
Examples
--------
To obtain a state dict of a chosen architecture, you can use the following code::
# Train or load a random one-shot strategy
experiment.run(...)
best_arch = experiment.export_top_models()[0]
fro... | Review this code and list any quality issues. | [
{
"issue": "the method name \"get_arch_state_dict\" of \"get_state_dict_of_arch\" might be better, but not in this release.",
"severity": "minor",
"line": 26
}
] | 1 |
python | should_split_rhs=line.should_split_rhs,
magic_trailing_comma=line.magic_trailing_comma,
)
string_leaf = Leaf(token.STRING, string_value)
insert_str_child(string_leaf)
string_line.append(string_leaf)
old_rpar_leaf = None
if is_valid_index(string_idx + 1):
... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n # followed by a RPAR but its opening bracket is lambda's, not\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | # TODO: (raushan) doesn't make sense to allow kwargs and `generation_config`. Should be mutually exclusive!
# TODO (joao): per-model generation config classes.
if generation_config is None:
# Users may modify `model.config` to control generation. This is a legacy behavior and is not support... | Review this code and list any quality issues. | [
{
"issue": "Ah, that is what you meant earlier. I assumed that `generation_config` at this point will already be `self.generation_config`\n\nBtw, if a few lines above we create not `generation_config = GenerationConfig()` but `generation_config = self.generation_config` it will be much easier. I can't think of... | 1 |
python | df["labels"] = df["a"].map(label_mappings)
df["expected_labels"] = Series(["A", "B", "A", "B"], index=df.index)
# All labels should be filled now
tm.assert_series_equal(df["labels"], df["expected_labels"], check_names=False)
def test_map_counter():
s = Series(["a", "b", "c"], index=[1, 2, 3])
coun... | Review this code and list any quality issues. | [] | 0 |
python | """
import importlib
import os
from pathlib import Path
from typing import Any, Union
_PYPROJECT = "pyproject.toml"
def load_obj(obj_path: str, default_obj_path: str = "") -> Any:
"""Extract an object from a given path.
Args:
obj_path: Path to an object to be extracted, including the object name.
... | Review this code and list any quality issues. | [] | 0 |
python | import torch
import librosa
import threading
from pyannote.audio import Model
from pyannote.audio.pipelines import VoiceActivityDetection
from lib.conf import tts_dir
from lib.models import default_voice_detection_model
_PIPELINE_CACHE = {}
_PIPELINE_LOCK = threading.Lock()
class BackgroundDetector:
def __init__... | Review this code and list any quality issues. | [
{
"issue": "The removal of the docstring from `_get_pipeline` eliminates important documentation about thread safety and caching behavior. This method implements a double-checked locking pattern for pipeline caching, and the docstring explaining this pattern should be retained to help future maintainers underst... | 1 |
python | raise ValueError(42)
except Exception as e:
exc = e
""")
code = compile(src, "<does not exist>", "exec")
g, l = {}, {}
exec(code, g, l)
err = self.get_report(l['exc'])
exp = ' File "<does not exist>", line 3, in <module>\nValueError: 42\n... | Review this code and list any quality issues. | [] | 0 |
python | #
# 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, software
# distributed under ... | Review this code and list any quality issues. | [
{
"issue": "So it seems like `_get_contract_center` and `get_contract_center` now mean different things. `_get_contract_center` returns what we would choose as the active contract with just the info we would have on `dt`, while `get_contract_center` returns the center given the calculated rolls (where in the ba... | 1 |
python | kwargs['query'] = query
try:
return super()._download_json(*args, **kwargs)
except ExtractorError as e:
if isinstance(e.cause, HTTPError) and e.cause.status in (401, 403):
self._store_client_id(None)
self._update_client_id()... | Review this code and list any quality issues. | [
{
"issue": "In current impl, this is unreachable, no?",
"severity": "minor",
"line": 26
}
] | 1 |
python | @pytest.mark.usefixtures("enable_experimental_triggers_conditions")
@pytest.mark.parametrize(
("trigger_target_config", "entity_id", "entities_in_target"),
parametrize_target_entities("vacuum"),
)
@pytest.mark.parametrize(
("trigger", "states"),
[
*parametrize_trigger_states(
trigger... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\n trigger=\"vacuum.started_returning\",\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | state_id,
set_message,
[f"requesting Wikipedia failed: {req.status_code}", idx],
)
# invoked by the on_action on the chat control when the user press the send button
def send_message(state: State, id: str, payload: dict):
args = payload.get("args", [])
# display request
st... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n for m in re.finditer(r\"(\\d+)\", request):\r\n```\r\nShorted and less constrained... may be not what you really want.",
"severity": "minor",
"line": 26
}
] | 1 |
python | return Noop()
return torch.distributed.reduce(tensor=tensor, dst=dst, op=self._reduce_op(op), group=group, async_op=async_op)
@disable_compiler_collective
def reduce_scatter(self, output, input_list, op=ReduceOp.SUM, group=None, async_op=False):
if DS_COMM_REDUCE_SCATTER_OFF:
if int... | Review this code and list any quality issues. | [] | 0 |
python | app_label="contenttypes_tests", model="renamedfoo"
).exists()
)
call_command(
"migrate",
"contenttypes_tests",
"zero",
database="default",
interactive=False,
verbosity=0,
)
self.assertTrue(
Co... | Review this code and list any quality issues. | [
{
"issue": "Our usual practice is to use the whole exception message, so let's keep doing that here.",
"severity": "minor",
"line": 26
}
] | 1 |
python | def extra_ldflags(self):
ccl_root_path = os.environ.get("CCL_ROOT")
if ccl_root_path is None:
raise ValueError(
"Didn't find CCL_ROOT, install oneCCL from https://github.com/oneapi-src/oneCCL and source its environment variable"
)
else:
return ... | Review this code and list any quality issues. | [
{
"issue": "Since directory (`riscv64`, `x86_64`) already distinguish different architecture, suggest to use same file name under the directory for symmetry. An example looks like the following.\r\n```\r\n# a line of code assert self.machine in ['riscv64', 'x86_64']\r\nsrc_files.append(f'csrc/cpu/comm/{self.ma... | 1 |
python | filesrc = config.get_dir("images_dir") / filename
else:
raise ValueError("Invalid combination of render flags received.")
rendered_template = jinja2.Template(TEMPLATE).render(
clsname=clsname,
clsname_lowercase=clsname.lower(),
hide_source=hide_source,
... | Review this code and list any quality issues. | [
{
"issue": "it's a csv file right? Please use CSV https://docs.python.org/3/library/csv.html module :)",
"severity": "minor",
"line": 26
}
] | 1 |
python | # http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing p... | Review this code and list any quality issues. | [
{
"issue": "[optional] could add a comment above:\r\n```\r\n# using lazy_gettext since initialization happens prior to the request scope and confuses flask-babel\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | pl_testing = pytest.importorskip("polars.testing")
class TestPolars(object):
def test_polars(self, duckdb_cursor):
df = pl.DataFrame(
{
"A": [1, 2, 3, 4, 5],
"fruits": ["banana", "banana", "apple", "apple", "banana"],
"B": [5, 4, 3, 2, 1],
... | Review this code and list any quality issues. | [] | 0 |
python | def test_config_import_extras(self, sane_config):
"""Test kedro_datasets default path to the dataset class"""
sane_config["catalog"]["boats"]["type"] = "pandas.CSVDataset"
assert DataCatalog.from_config(**sane_config)
def test_config_missing_class(self, sane_config):
"""Check the er... | Review this code and list any quality issues. | [] | 0 |
python | stats = qmc_quad.stats
if not callable(func):
message = "`func` must be callable."
raise TypeError(message)
# a, b will be modified, so copy. Oh well if it's copied twice.
a = xpx.atleast_nd(a, ndim=1, xp=xp)
b = xpx.atleast_nd(b, ndim=1, xp=xp)
a, b = xp.broadcast_arrays(a, b)
... | Review this code and list any quality issues. | [
{
"issue": "Perhaps the docs for `func` should be undated to reflect this?",
"severity": "minor",
"line": 26
}
] | 1 |
python | f'{k}={v} is not substitutable or badly referred'
)
else:
setattr(target, k, v)
# `name` is important as it serves as an identifier of the executor
# if not given, then set a name by the rule
if not getattr(target, 'name', N... | Review this code and list any quality issues. | [] | 0 |
python | current_tool_call.arguments += event.delta
elif isinstance(event, LLMResponseWebSearchCallSearchingEvent):
yield {"role": "assistant"}
elif isinstance(event, LLMResponseFunctionCallArgumentsDoneEvent):
if current_tool_call is not None:
current_tool_call.status =... | Review this code and list any quality issues. | [
{
"issue": "The response object is being checked as both a potential None and a dictionary with string key access. Consider using a more type-safe approach with attribute access if the response object has a structured type, or add type narrowing to clarify when dictionary access is appropriate.",
"severity"... | 1 |
python | Hook for any steps to run before the job/task starts
"""
instance.log_lifecycle("pre_run")
# Before task is started, ensure that job_event partitions exist
create_partition(instance.event_class._meta.db_table, start=instance.created)
def post_run_hook(self, instance, status):
... | Review this code and list any quality issues. | [
{
"issue": "This could throw a `ValueError` if the plugin returns invalid or out-of-spec json.",
"severity": "minor",
"line": 26
}
] | 1 |
python | # Call turn_on with brightness=51 (20% when normalized)
await hass.services.async_call(
LIGHT_DOMAIN,
SERVICE_TURN_ON,
{"entity_id": entity_id, ATTR_BRIGHTNESS: 51},
blocking=True,
)
# set_intensity called once; turn_on should not be used in this path
assert mock_light.s... | Review this code and list any quality issues. | [
{
"issue": "The `mock_pyvlx` fixture yields a `MagicMock` (see `tests/components/velux/conftest.py`), but these tests type it as `AsyncMock`. Updating the annotation to `MagicMock` (or `Any`) will keep the type hints accurate and avoid confusion for future test maintenance.",
"severity": "minor",
"line"... | 1 |
python | import gradio as gr
import time
def greet():
gr.Info("Warning in 1 second")
time.sleep(1)
gr.Warning("Error in 1 second")
time.sleep(1)
raise Exception("test")
with gr.Blocks() as demo:
with gr.Tab("Accordions"):
with gr.Row(height=1500):
gr.Markdown("Scroll down to see U... | Review this code and list any quality issues. | [
{
"issue": "Nice @pngwn ! Let's add this demo to the [list](https://github.com/gradio-app/gradio/blob/03024f8cae5d1a35be8fe6a988ae3917eefba662/scripts/copy_demos.py#L15) of deployed spaces so we can test for regressions before we release.\r\n\r\nIn order for the demo to work you should change the value of all t... | 1 |
python | import warnings
# 2018-05-29, PendingDeprecationWarning added to matrix.__new__
# 2020-01-23, numpy 1.19.0 PendingDeprecatonWarning
warnings.warn("Importing from numpy.matlib is deprecated since 1.19.0. "
"The matrix subclass is not the recommended way to represent "
"matrices or deal with ... | Review this code and list any quality issues. | [
{
"issue": "you could also do something like\r\n\r\n```py\r\n__all__ = ['rand', 'randn', 'repmat']\r\n__all__ += np.__all__\r\n```\r\n\r\nwhich I believe should be accepted",
"severity": "minor",
"line": 22
}
] | 1 |
python | x = 123456789 .bit_count()
x = (123456).__abs__()
x = .1.is_integer()
x = 1. .imag
x = 1E+1.imag
x = 1E-1.real
x = 123456789.123456789.hex()
x = 123456789.123456789E123456789 .real
x = 123456789E123456789 .conjugate()
x = 123456789J.real
x = 123456789.123456789J.__add__(0b1011.bit_length())
x = 0XB1ACC.conjugate()
x = ... | Review this code and list any quality issues. | [] | 0 |
python | # `additionalProperties` in the JSON Schema
if single_arg_name is not None and not description:
# if the tool description is not set, and we have a single parameter, take the description from that
# and set it on the tool
description = json_schema.pop('description', None)
return Functio... | Review this code and list any quality issues. | [
{
"issue": "Still used in one other place in Pydantic AI, will see how this can be cleaned up in a future PR.",
"severity": "minor",
"line": 26
}
] | 1 |
python | 'name': asset_name,
'format': cast(ImageFormat, asset_format),
'size': asset_size,
'path': asset_path,
'metadata': extract_image_metadata(asset_path)
})
if media_type == 'video':
ASSET_STORE[session_id][asset_id] = cast(VideoAsset,
{
'id': asset_id,
'created_at': created_at,
'expires_at': e... | Review this code and list any quality issues. | [
{
"issue": "Dict[AssetId, AudioAsset | ImageAsset | VideoAsset] <- don't we have an alias for that? like Optional[AssetSet]",
"severity": "minor",
"line": 26
}
] | 1 |
python | from typing import Any
from prisma.enums import ContentType
from backend.data.block import BlockType
from backend.data.db import query_raw_with_schema
logger = logging.getLogger(__name__)
# Blocks excluded from CoPilot standalone execution and search indexing
# NOTE: This does NOT affect the Builder UI which uses l... | Review this code and list any quality issues. | [
{
"issue": "The constants EXCLUDED_BLOCK_TYPES and EXCLUDED_BLOCK_IDS are duplicated across three files (find_block.py, run_block.py via import, and content_handlers.py). This violates the DRY principle and creates a maintenance burden where updates must be synchronized across multiple locations.\n\nConsider cr... | 1 |
python | if video_category and video_category.endswith('-Auth'):
resource = self._get_mvpd_resource(
requestor_id, title, video_id, rating)
query['auth'] = self._extract_mvpd_auth(
url, video_id, requestor_id, resource)
media_url = update_url_query(media_url, query... | Review this code and list any quality issues. | [
{
"issue": "`parse_age_limit` is called twice?",
"severity": "minor",
"line": 26
}
] | 1 |
python | if dst and dst[-1] != "\n":
dst += "\n"
f.write(dst)
elif write_back in (WriteBack.DIFF, WriteBack.COLOR_DIFF):
now = datetime.utcnow()
src_name = f"STDIN\t{then} +0000"
dst_name = f"STDOUT\t{now} +0000"
d = diff(src, dst, src_name, dst... | Review this code and list any quality issues. | [
{
"issue": "The `pass_num` kwarg in `assert_equivalent` is now unused and could be cleaned up",
"severity": "minor",
"line": 26
}
] | 1 |
python | '_torctlport': 9051,
'__logstdout': False
}
def test_opts(self):
module = sfp_base64()
self.assertEqual(len(module.opts), len(module.optdescs))
def test_setup(self):
"""
Test setup(self, sfc, userOpts=dict())
"""
sf = SpiderFoot(self.default_options)... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n def test_handleEvent_event_data_url_containing_base64_string_should_return_event(self):\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | pass
@pytest.fixture
def cert_prefix():
cur_dir = os.path.dirname(os.path.abspath(__file__))
return f'{cur_dir}/../../../unit/serve/runtimes/gateway/grpc/cert/'
@pytest.fixture
def cert_pem(cert_prefix):
"""This is the cert entry of a self-signed local cert"""
return cert_prefix + '/server.crt'
@p... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n ['jinaai+sandbox://jina-ai/DummyHubExecutor'],\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | element_alignment_corner: Sequence[float] = DR,
left_bracket: str = "[",
right_bracket: str = "]",
bracket_config: dict = {},
**kwargs,
):
"""
Parameters
----------
matrix
A numpy 2d array or list of lists.
v_buff
Verti... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n The mobject class used to construct the elements, by default :class:`~.MathTex`.\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | from .common import InfoExtractor
from ..utils import (
clean_html,
merge_dicts,
str_or_none,
traverse_obj,
unified_timestamp,
url_or_none,
)
class LRTBaseIE(InfoExtractor):
def _extract_js_var(self, webpage, var_name, default=None):
return self._search_regex(
fr'{var_n... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\nfrom .common import InfoExtractor\r\n```",
"severity": "major",
"line": 2
}
] | 1 |
python | scene_contact_info = self._solver.collider.contact_data.to_torch(gs.device)
n_contacts = self._solver.collider.n_contacts.to_torch(gs.device)
if exclude_self_contact:
valid_mask = torch.logical_xor(
torch.logical_and(
scene_contact_info["geom_a"] >= self.... | Review this code and list any quality issues. | [
{
"issue": "to reduce repeated code, can you do?\r\n\r\n```\r\nlogical_operation = torch.logical_xor if exclude_self_contact else torch.logical_or\r\nvalid_mask = logical_operation(...)\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | cmd = [str(jailer_binary), *jailer.construct_param_list()]
processes.append(
subprocess.Popen(
cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=False
)
)
deltas = []
for i, p in enumerate(processes):
r = p.communicate()[0]
e, s =... | Review this code and list any quality issues. | [
{
"issue": "I think we should emit the datapoints directly as we do in all other tests and let the consumer compute the statistics.",
"severity": "minor",
"line": 26
}
] | 1 |
python | path,
"vs.initialize",
{
"tensor_params": "default"
if tensor_params is not None
else tensor_params,
"embedding_function": True if embedding_function is not None else False,
"num_workers": num_workers,
... | Review this code and list any quality issues. | [
{
"issue": "Can we replace this with:\r\n```suggestion\r\n creds = {}\r\n if \"creds\" in kwargs:\r\n creds = {\"creds\": kwargs.pop(\"creds\")}\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | if args.save_path:
os.makedirs(os.path.dirname(args.save_path), exist_ok=True)
else:
logging.warning("Results can not be saved. Please provide a -o/--save_path")
predictions = []
ground_truths = []
metrics = defaultdict(list)
dataset = NougatDataset(
dataset_path=args.dataset... | Review this code and list any quality issues. | [] | 0 |
python | upcast_before_saving (`bool`, defaults to `False`):
Whether to cast the underlying model to `torch.float32` before serialization.
safe_serialization (`bool`, *optional*, defaults to `True`):
Whether to save the model using `safetensors` or the traditional PyTorch way with `pi... | Review this code and list any quality issues. | [] | 0 |
python | "If specified, the prefix cache will be salted with the provided "
"string to prevent an attacker to guess prompts in multi-user "
"environments. The salt should be random, protected from "
"access by 3rd parties, and long enough to be "
"unpredictable (e.g., 43 character... | Review this code and list any quality issues. | [
{
"issue": "Can you mention that the request will be ended early if such a repetition is detected, and describe a scenario where this is useful?",
"severity": "minor",
"line": 26
}
] | 1 |
python | def construct(self):
title = Title("A Quote from Newton")
quote = Text(
"If I have seen further than others, \n"
"it is by standing upon the shoulders of giants.",
color=BLUE,
).scale(0.75)
box = ... | Review this code and list any quality issues. | [
{
"issue": "Is there a reason it needs to be a `VGroup` over a normal `Group`? With `VGroup`, all arguments must be `VMobjects` whereas `Group` works with any `Mobject`.",
"severity": "minor",
"line": 26
}
] | 1 |
python | right_dot = Dot(ORIGIN, radius=dot_radius, color=dot_color)
dot_anchor = (
inter
+ (self.get_center() - inter)
/ np.linalg.norm(self.get_center() - inter)
* radius
/ dot_distance
)
right_dot.move_to(dot_a... | Review this code and list any quality issues. | [
{
"issue": "If you change the documentation above, don't forget to change it here. Or maybe someone with more sphinx knowledge than I have can talk about specifying parameter inheritance or something.",
"severity": "minor",
"line": 26
}
] | 1 |
python | )
assert rows_same(input_df, output_df)
@pytest.mark.parametrize("override_num_blocks", [None, 2])
def test_json_roundtrip(
ray_start_regular_shared,
tmp_path,
override_num_blocks,
target_max_block_size_infinite_or_default,
):
df = pd.DataFrame({"one": [1, 2, 3], "two": ["a", "b", "c"]})
... | Review this code and list any quality issues. | [] | 0 |
python | capa.ida.helpers.inform_user_ida_ui("Cached results were generated using different capas rules")
logger.warning(
"capa is showing you cached results from a previous analysis run. Your rules have changed since and you should reanalyze the program to see new results."
... | Review this code and list any quality issues. | [
{
"issue": "I see what you're trying to do here by re-using `self.extractor` for both the program analysis view and rule generator view. But let's keep this code to keep both extractors separate as setting the slot in line `738` (right) also affects the rule generator UX.",
"severity": "major",
"line": ... | 1 |
python | 'release_date': '20231012',
'modified_timestamp': 1698381162,
'modified_date': '20231027',
'channel': 'アイドルマスター',
'channel_id': 'idolmaster',
},
}, {
'url': 'https://asobichannel.asobistore.jp/watch/redigiwnjzqj',
'md5': '229fa8fb5c591c75ce8c37... | Review this code and list any quality issues. | [
{
"issue": "Should this token be saved in case of multiple requests?\r\nAlso maybe move to `_real_initialize`?",
"severity": "minor",
"line": 26
}
] | 1 |
python | if self.failure_count:
s = "s" if self.failure_count > 1 else ""
report.append(
click.style(f"{self.failure_count} file{s} {failed}", fg="red")
)
return ", ".join(report) + "."
def parse_ast(src: str) -> Union[ast.AST, ast3.AST, ast27.AST]:
filename = "<... | Review this code and list any quality issues. | [
{
"issue": "Python should be capitalized here as well.",
"severity": "minor",
"line": 26
}
] | 1 |
python | # You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the Li... | Review this code and list any quality issues. | [] | 0 |
python | video_id = self._match_id(url)
status = self._download_json(
'https://truthsocial.com/api/v1/statuses/' + video_id,
video_id
)
# Pull out video
url = status['media_attachments'][0]['url']
# Return the stuff
uploader_id = strip_or_none(traverse_ob... | Review this code and list any quality issues. | [
{
"issue": "If it's only used once, it probably shouldn't be a var\r\n```suggestion\r\n uploader_id = strip_or_none(traverse_obj(status, ('account', 'username')))\r\n \r\n return {\r\n 'id': video_id,\r\n 'url': status['media_attachments'][0]['url'],\r\n 'ti... | 1 |
python | if config["write_to_movie"] and allow_write:
self.close_movie_pipe()
def write_frame(self, frame_or_renderer):
"""
Used internally by Manim to write a frame to
the FFMPEG input buffer.
Parameters
----------
frame : np.array
Pixel array of the... | Review this code and list any quality issues. | [] | 0 |
python | 'timestamp': 1264608000,
'description': 'md5:03d1ffebec3139aa4bafe302369269c5',
'subtitles': {'lyrics': [{'ext': 'lrc'}]},
'duration': 229,
'alt_title': '说出愿望吧(Genie)',
'thumbnail': r're:^http.*\.jpg',
'average_rating': int,
'album': 'O... | Review this code and list any quality issues. | [
{
"issue": "nested func doesn't need the underscore prefix\r\n```suggestion\r\n def collect_lyrics(lrc):\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | """
return self.client.describe_index_stats()["total_vector_count"]
def _get_or_create_db(self):
"""Called during initialization"""
return self.client
def reset(self):
"""
Resets the database. Deletes all embeddings irreversibly.
"""
# Delete all data fr... | Review this code and list any quality issues. | [
{
"issue": "Can we make the logic as part of the `get()` function? Seems like that is the only place where we are using it.",
"severity": "minor",
"line": 26
}
] | 1 |
python | and amount == spend.coin_amount
)
self.additions_since_fork[child_coin_id] = ForkAdd(
child_coin, block.height, timestamp, hint, False, same_as_parent
)
self.include_reward_coins(block)
def include_block(
self,
... | Review this code and list any quality issues. | [
{
"issue": "this looks suspicious. Is there ever a case where `coin.parent_coin_info` is *not* in `spent_coins`?\r\nIn case `coin.parent_coin_info` isn't, I can't imagine this expression being correct.\r\nIf it's always expected to be in there, it should be an `assert`.",
"severity": "minor",
"line": 26... | 1 |
python | def unspecialize(self):
"""
Unspecialize a column to its generic form.
This is equivalent to ``column.specialize(GENERIC)``.
"""
return self.specialize(GENERIC)
@coerce_types(currency=(str, Currency))
def fx(self, currency):
"""
Construct a currency-conv... | Review this code and list any quality issues. | [
{
"issue": "I think we probably want to use `self.qualname` in the error message.",
"severity": "minor",
"line": 26
}
] | 1 |
python | # Generated by Django 3.2.13 on 2022-06-21 21:29
from django.db import migrations
import logging
logger = logging.getLogger("awx")
def forwards(apps, schema_editor):
InventorySource = apps.get_model('main', 'InventorySource')
sources = InventorySource.objects.filter(update_on_project_update=True)
for sr... | Review this code and list any quality issues. | [
{
"issue": "it seems a little in-congruent to not have a log here (like for the project change). Even if it's a lower level, like `logger.info`, that would be good to add.",
"severity": "minor",
"line": 15
}
] | 1 |
python | entities_df["human_readable_id"] += max_vals["entities"] + 1
entities_df["title"] = entities_df["title"].apply(
lambda x, index_name=index_name: x + f"-{index_name}"
)
entities_df["id"] = entities_df["id"].apply(
lambda x, index_name=index_name: x + f"-{index_name}"
... | Review this code and list any quality issues. | [] | 0 |
python | except ModelCurrentlyNotSupportError:
raise ProviderModelCurrentlyNotSupportError()
except InvokeError as e:
raise CompletionRequestError(e.description)
return code_result
@console_ns.route("/rule-structured-output-generate")
class RuleStructuredOutputGenerateApi(Resource):
... | Review this code and list any quality issues. | [] | 0 |
python | """Get value from in-memory cache, checking TTL."""
if key in cache_storage:
cached_data = cache_storage[key]
if time.time() - cached_data.timestamp < ttl_seconds:
logger.debug(
f"Cache hit for {target_func.__name__} args: {key[0]} ... | Review this code and list any quality issues. | [] | 0 |
python | is_cloud = config.is_cloud
if not is_cloud:
logger.debug("Applying database migrations")
try:
from mindsdb.migrations import migrate
migrate.migrate_to_head()
except Exception as e:
logger.error(f"Error! Something went wrong during DB migrations: {e}")
... | Review this code and list any quality issues. | [
{
"issue": "In this line you have two projects with `is_default=True` (initial one and from line 320). \r\n\r\nAll this block may be simpler:\r\n```python\r\ncurrent_default_project = project_controller.get(metadata={'is_default': True})\r\nif current_default_project.name != config.get('default_project'):\r\n ... | 1 |
python | 'url': 'https://francaisfacile.rfi.fr/fr/actualit%C3%A9/20250307-argentine-le-sac-d-un-alpiniste-retrouv%C3%A9-40-ans-apr%C3%A8s-sa-mort',
'md5': 'b8c3a63652d4ae8e8092dda5700c1cd9',
'info_dict': {
'id': '20250307',
'title': 'Argentine: le sac d\'un alpiniste retro... | Review this code and list any quality issues. | [
{
"issue": "Instead of blindly searching for a URL that looks like this I would extract the actual json data:\r\n```suggestion\r\n data = self._search_json(\r\n r'<script[^>]+\\bdata-media-id=[^>]+\\btype=\"application/json\"[^>]*>',\r\n webpage, 'audio data', audio_id)\r\n```\r\nTh... | 1 |
python | Args:
spatial_dims: spatial dimension of the input data. Defaults to 3.
in_channels: number of input channels for the network. Defaults to 1.
The value should meet the condition that ``16 % in_channels == 0``.
out_channels: number of output channels for the network. Defaults to 1.
... | Review this code and list any quality issues. | [
{
"issue": "thanks for the PR, would be great to keep this argument backward compatible for a while -- when the user specifies `dropout_prob=` or relies on the default value, it can still work but generates warnings about the code changes. (docstring should be updated as well)\r\n\r\nplease see an example of ha... | 1 |
python | 'title': r're:^The National \| Biden’s trip wraps up, Paltrow testifies, Bird flu [0-9\-: ]+',
'description': 'March 24, 2023 | President Biden’s Ottawa visit ends with big pledges from both countries. Plus, Gwyneth Paltrow testifies in her ski collision trial.',
'live_status': 'is_live'... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n video_info = traverse_obj(\r\n video_info, (('freeTv', ('streams', ...)), 'items', lambda _, v: v['key'] == video_id, {dict}),\r\n get_all=False, default={})\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | }]
def _get_authenticity_token(self):
signin_page = self._download_webpage(self._LOGIN_URL, video_id=self.display_id,
note='Getting authenticity token')
authenticity_token = self._html_search_regex(
r'name=["\']authenticity_token["\'] value=[... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n response = self._download_webpage(\r\n self._LOGIN_URL, video_id=None, note='Logging in', data=urlencode_postdata({\r\n 'email': username,\r\n 'password': password,\r\n 'authenticity_token': self._get_authenticity_token(),\r\n ... | 1 |
python | from tests.common import async_fire_time_changed
@pytest.mark.usefixtures("init_integration")
async def test_sensor(
hass: HomeAssistant,
mock_waterfurnace_client: Mock,
freezer: FrozenDateTimeFactory,
) -> None:
"""Test states of the sensor."""
state = hass.states.get("sensor.wf_test_gwid_12345_t... | Review this code and list any quality issues. | [] | 0 |
python | images = new_images
image_inputs = image_processor(
images, do_pad=True, max_slice_nums=image_processor.max_slice_nums, return_tensors="pt"
)
mm_inputs.update(image_inputs)
if len(videos) != 0:
videos = self._regularize_videos(
vi... | Review this code and list any quality issues. | [] | 0 |
python | assert entity2.platform is not None
async def test_invalid_entity_id_report_usage(
hass: HomeAssistant, caplog: pytest.LogCaptureFixture
) -> None:
"""Test that setting an invalid entity_id reports usage."""
platform = MockEntityPlatform(hass)
entity = MockEntity(entity_id="invalid_entity_id", unique_... | Review this code and list any quality issues. | [
{
"issue": "This test only validates that a warning is logged but doesn't verify that the entity is actually added successfully to the platform. Given that the implementation has a bug where it still raises an error after the warning, this test is passing a false positive.\n\nThe test should include assertions ... | 1 |
python | """
if rgbas is None and color is None:
color = YELLOW
self.append_points(points)
# rgbas array will have been resized with points
if color is not None:
if opacity is None:
opacity = self.data["rgbas"][-1, 3]
new_rgbas = np.repeat([colo... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n mob.set_rgba_array_direct(mob.rgbas[thin_func()])\r\n mob.set_points(mob.points[thin_func()])\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | import inspect
from metagpt.utils.parse_docstring import GoogleDocstringParser, remove_spaces
PARSER = GoogleDocstringParser
def convert_code_to_tool_schema(obj, include: list[str] = None):
docstring = inspect.getdoc(obj)
assert docstring, "no docstring found for the objects, skip registering"
if inspe... | Review this code and list any quality issues. | [
{
"issue": "maybe no need for this function",
"severity": "minor",
"line": 26
}
] | 1 |
python | app = JupyterFrontEnd()
def _create_cell_with_text(text: str) -> None:
# Noted this only works with Notebook >7.0 or Jupyter Lab. It doesn't work with
# VS Code Notebook due to imcompatible backends.
app.commands.execute("notebook:insert-cell-below")
app.commands.execute("notebook:r... | Review this code and list any quality issues. | [
{
"issue": "I think this should say something like \"if you encounter unexpected behaviour or would like to suggest feature enhancements, add it under this github issue <link>\"",
"severity": "minor",
"line": 26
}
] | 1 |
python | # This situation is temporary. Eventually, those two flags will be mutually exclusive.
#
# if args.use_jsep and args.use_webgpu:
# raise BuildError("JSEP (--use_jsep) and WebGPU (--use_webgpu) cannot be enabled at the same time.")
if not args.use_webgpu:
if args.use_external_dawn:
... | Review this code and list any quality issues. | [
{
"issue": "it doesn't seem like this TODO was addressed",
"severity": "minor",
"line": 26
}
] | 1 |
python | advertised_fee: uint64
advertised_cost: uint64
@dataclass(frozen=True, order=True)
class TransactionQueueEntry:
"""
A transaction received from peer. This is put into a queue, and not yet in the mempool.
"""
transaction: SpendBundle = field(compare=False)
transaction_bytes: bytes | None = fie... | Review this code and list any quality issues. | [
{
"issue": "this name seems a bit questionable to me. It's a `TransactionPriorityQueue` perhaps?\r\n\"normal\" doesn't really help explain what it does.",
"severity": "minor",
"line": 26
}
] | 1 |
python | from .common import InfoExtractor
from ..utils import (
int_or_none,
parse_iso8601,
unescapeHTML,
)
class PeriscopeBaseIE(InfoExtractor):
_M3U8_HEADERS = {
'Referer': 'https://www.periscope.tv/'
}
def _call_api(self, method, query, item_id):
return self._download_json(
... | Review this code and list any quality issues. | [
{
"issue": "move this into the return (inline)",
"severity": "major",
"line": 24
}
] | 1 |
python | 'modified_date': '20230608',
'release_timestamp': 1686308700,
'timestamp': 1685145600,
'modified_timestamp': 1686252600,
'release_year': 2023,
'episode': 'Episode 0',
'episode_id': '1608990335',
'episode_number': 0,
'season'... | Review this code and list any quality issues. | [
{
"issue": "Oh this should have just been:\r\n```suggestion\r\n self.report_drm(video_id)\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | c_replica.execute_command("REPLTAKEOVER 5"),
timeout=20, # Should complete within 20 seconds
)
elapsed = time.time() - start_time
logging.info(f"Takeover completed in {elapsed:.1f}s")
except asyncio.TimeoutError:
elapsed = time.time() - start_time
pytest.fail(
... | Review this code and list any quality issues. | [
{
"issue": "nit: no need specifying port. you can get it via `async_client.connection_pool.connection_kwargs[\"port\"]`",
"severity": "minor",
"line": 26
}
] | 1 |
python | transaction_time_ceiling=transaction_time,
transaction_count_limit=transaction_count_limit,
transaction_type=transaction_type,
)
@v1_router.get(
path="/credits/refunds",
tags=["credits"],
summary="Get refund requests",
dependencies=[Security(requires_user)],
)
async def get_refund_... | Review this code and list any quality issues. | [] | 0 |
python | """
def __init__(self, vmobject, **kwargs):
VGroup.__init__(self, **kwargs)
tuples = vmobject.get_cubic_bezier_tuples()
for tup in tuples:
part = VMobject()
part.set_points(tup)
part.match_style(vmobject)
self.add(part)
class DashedVMobject(... | Review this code and list any quality issues. | [
{
"issue": "Echoing @kolibril13's comment: spelling out what the range produces doesn't seem necessary.\r\n```suggestion\r\n for dashes in range(2, 12): \r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | def get_capa_results(args):
"""
run capa against the file at the given path, using the given rules.
args is a tuple, containing:
rules (capa.rules.RuleSet): the rules to match
signatures (List[str]): list of file system paths to signature files
format (str): the name of the sample file fo... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n rules, sigpaths, format, os_, path = args\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | """Built-in tool identifier, this should be available on all built-in tools as a discriminator."""
def __init_subclass__(cls, **kwargs: Any) -> None:
super().__init_subclass__(**kwargs)
_BUILTIN_TOOL_TYPES[cls.kind] = cls
@classmethod
def __get_pydantic_core_schema__(
cls, _source_... | Review this code and list any quality issues. | [
{
"issue": "Feels like we should raise an error if there is no value for `kind` here, I worry that the error will be confusing if you have data that refers to a builtin tool that hasn't been imported or doesn't exist. Obviously this could happen if you create custom ones, which is weird, but it could also happe... | 1 |
python | assert_equal(len(res2['hash_serialized_3']), 64)
self.log.info("Test gettxoutsetinfo returns the same result after invalidate/reconsider block")
node.reconsiderblock(b1hash)
res3 = node.gettxoutsetinfo()
# The field 'disk_size' is non-deterministic and can thus not be
# compare... | Review this code and list any quality issues. | [
{
"issue": "This logs seems a bit vague, a more descriptive log would be useful",
"severity": "minor",
"line": 26
}
] | 1 |
python | }''',
'variables': json.dumps({
'name': permalink,
'oneApp': True,
'userId': '0',
}),
})['data']['bonanzaPage']['metadata']
query = {
'mbr': 'true',
'manifest': 'm3u',
}
... | Review this code and list any quality issues. | [
{
"issue": "Add a comment here why `or` is intentionally not used; so that someone else doesn't try to refactor it in the future\r\n\r\n```suggestion\r\n # Empty string or 0 can be valid values for these. So the check must be `is None`\r\n```",
"severity": "major",
"line": 26
}
] | 1 |
python | def _download_cryptojs_md5(self, video_id):
for url in [
'https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.2/rollups/md5.js',
'https://cdn.bootcdn.net/ajax/libs/crypto-js/3.1.2/rollups/md5.js',
]:
js_code = self._download_webpage(
url, video_id, no... | Review this code and list any quality issues. | [
{
"issue": "pls explain the comment to me. I think I understand below regex, but cant seem to understand what the comment is saying",
"severity": "minor",
"line": 26
}
] | 1 |
python | pytest.param(
AudioUrl(url='gs://pydantic-ai-dev/openai-alloy.wav'),
'The content describes the basic concept of the sun rising in the east and setting in the west.',
id='AudioUrl (gs)',
),
pytest.param(
DocumentUrl(url='gs://pydantic-ai-dev/Gemini_1_5_Pro... | Review this code and list any quality issues. | [] | 0 |
python | generated_ids = []
decoded_text = ""
for stream_response in stream_events:
if stream_response.is_error:
logger.error(f"Error from inference server: {stream_response.error}")
utils.send_response(
ws,
inference.ErrorResponse(
requ... | Review this code and list any quality issues. | [] | 0 |
python | 'id': '36d8c00L1vEFwF01aF1cRKQs8nblgegMda8YR9CE3wejk',
'title': '36d8c00L1vEFwF01aF1cRKQs8nblgegMda8YR9CE3wejk',
'formats': 'mincount:1',
'ext': 'mp4',
'_type': 'video',
},
'params': {
# m3u8 download
'skip_download': True,
... | Review this code and list any quality issues. | [
{
"issue": "Not needed\r\n```suggestion\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | """
with SecureTarArchive(
path, "r", bufsize=BUF_SIZE, password=password
) as backup_file:
compressed = False
ha_tar_name = "homeassistant.tar"
try:
ha_tar = backup_file.tar.extractfile(ha_tar_name)
except KeyError:
compressed = True
h... | Review this code and list any quality issues. | [
{
"issue": "Is this still the expected exception?",
"severity": "minor",
"line": 26
}
] | 1 |
python | self.time_embedding: TimeEmbedding = TimeEmbedding(
dim=self.config.text_config.hidden_size
)
audio_config = self.tokenizer.instruct.audio_encoder.audio_config
self.n_delay_tokens = audio_config.num_delay_tokens
# for realtime transcription
@classmethod
async def buffer... | Review this code and list any quality issues. | [
{
"issue": "This is better as we don't have an unnecessary audio -> byte parsing anymore",
"severity": "minor",
"line": 26
}
] | 1 |
python | :param logger: logger
:type logger: Logger
:param readers: metric reader list
:type readers: List[opentelemetry.sdk.metrics.export.MetricReader]
:param common_dimensions: common dimensions for all metrics
:type common_dimensions: Dict[str, str]
"""
self.logger = l... | Review this code and list any quality issues. | [] | 0 |
python | tbr = int_or_none(published_url.get('kbps'))
a_format = {
'url': video_url,
'format_id': join_nonempty('http', published_url.get('cdn_name')).lower(),
'tbr': tbr or None,
}
vtt_subs, hls_subs = {}, {}
if media_format == 'vt... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n manifest_json = self._download_json(\r\n video_url, video_id, note='Downloading manifest JSON', errnote=False)\r\n if manifest_json:\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | ) # ["Sheet1", "Sheet2"]
path_2 = os.path.join(
pathlib.Path(__file__).parent.resolve(), "data_sample/example_2.xlsx"
) # ["Sheet1", "Sheet2", "Sheet3"]
dn = ExcelDataNode(
"foo",
Scope.SCENARIO,
properties={"default_path": path_1, "exposed_type... | Review this code and list any quality issues. | [] | 0 |
python | display_id = enc_id(program)
date_str = self._search_regex(
rf'{program_id}0?(\d{{6}})', m3u8_url, 'date string', default=None)
return {
'display_id': display_id,
'formats': self._extract_m3u8_formats(m3u8_url, raw_id, headers=self._HEADERS),
'http_header... | Review this code and list any quality issues. | [
{
"issue": "same\r\n```suggestion\r\n 'tags': ('hashtag_list', ..., {str}, filter),\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | print("No blockchain found. Exiting.")
return
peak_height = blockchain_state["peak"].height
assert peak_height is not None, "Blockchain peak height is None"
if end_height is None:
end_height = blockchain_state["peak"]["height"]
print("Connected to Full Node")
... | Review this code and list any quality issues. | [
{
"issue": "it's not a big deal, but by making requests in batches, and then wait for all of them before issuing the next batch, you actually stall the pipeline and will likely be a lot slower than if you would just \"stream\" the requests. i.e. make sure there are `concurrent_requests` tasks in the pipeline at... | 1 |
python | assert isinstance(node.feature, frzf.FormatFeature)
def test_match_node_from_capa():
node = rdoc.node_from_capa(capa.features.common.MatchedRule(""))
assert isinstance(node, rdoc.FeatureNode)
assert isinstance(node.feature, frzf.MatchFeature)
def test_characteristic_node_from_capa():
node = rdoc.nod... | Review this code and list any quality issues. | [] | 0 |
python | 'url': 'https://www.nzonscreen.com/title/shoop-shoop-diddy-wop-cumma-cumma-wang-dang-1982',
'md5': 'a0375e9b6f14b235438506cb0aee974c',
'info_dict': {
'id': 'shoop-shoop-diddy-wop-cumma-cumma-wang-dang-1982',
'ext': 'mp4',
'title': 'Monte Video - "Shoop Shoop, Diddy Wo... | Review this code and list any quality issues. | [
{
"issue": "`_search_json` would be more robust here, but I won't insist",
"severity": "minor",
"line": 26
}
] | 1 |
python | Maximum corner of the bounding box [x, y, z].
envs_idx : array_like, optional
Environment indices. If None, uses first environment for position query.
Returns
-------
particles_idx_local : torch.Tensor, shape (n_in_bbox,)
Local particle indices within the boundin... | Review this code and list any quality issues. | [
{
"issue": "Please vectorise these computations:\n```python\nin_bbox = (bbox_min <= poss & poss <= bbox_max).all(dim=-1)\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | report_to.append("wandb")
if self.enable_tensorboard:
report_to.append("tensorboard")
if len(report_to) == 0:
report_to.append("none")
return report_to
def __post_init__(self):
"""Verifies params."""
self.run_name = sanitize_run_name(self.run_name)
... | Review this code and list any quality issues. | [
{
"issue": "I'm assuming comments like these are to aid in review only and will be removed before submission?",
"severity": "minor",
"line": 26
}
] | 1 |
python | # then issues a CREATE TABLE, rather than doing CREATE TABLE IF NOT
# EXISTS
session = backend.ResultSession()
session.close()
with patch_app, patch_execute, patch_factory:
try:
yield test_app
finally:
# Clear event loop to tear down each celery insta... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\ndef setup_dagrun_with_success_and_fail_tasks(dag_maker):\n```",
"severity": "critical",
"line": 26
}
] | 1 |
python | # coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
import urllib.parse
from ..utils import (
ExtractorError,
unified_timestamp,
urlencode_postdata,
random_uuidv4,
)
class TennisTVIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?tennistv\.com/videos/(?P... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n random_uuidv4,\r\n unified_timestamp,\r\n urlencode_postdata,\r\n```",
"severity": "minor",
"line": 12
}
] | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.