language string | code-snippit string | instruction string | flaws list | flaw_count int64 |
|---|---|---|---|---|
python | if not sp_version < parse_version("1.15.0"):
from scipy.differentiate import derivative
def f(x):
return np.sin(x)
X = np.atleast_2d(np.linspace(0, 10, 30)).T
X2 = np.atleast_2d([2.0, 4.0, 5.5, 6.5, 7.5]).T
y = np.array(f(X).ravel() > 0, dtype=int)
fX = f(X).ravel()
y_mc = np.empty(y.shape, dtype=int) # mu... | Review this code and list any quality issues. | [
{
"issue": "Why is this change needed? I would expect the tests to be well-defined even when using `*` operator notation instead, no?",
"severity": "minor",
"line": 26
}
] | 1 |
python | if prompt_embeds is not None and negative_prompt_embeds is not None:
if prompt_embeds.shape != negative_prompt_embeds.shape:
raise ValueError(
"`prompt_embeds` and `negative_prompt_embeds` must have the same shape when passed directly, but"
f" got: `pr... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n if isinstance(prompt, list) and len(prompt) > 1:\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | include: list[ResponseItemInclude] | None = None,
limit: int | None = 20,
order: Order | None = Order.desc,
) -> ListOpenAIResponseInputItem:
"""List input items for a given OpenAI response.
:param response_id: The ID of the response to retrieve input items for.
:param after... | Review this code and list any quality issues. | [] | 0 |
python | result = build_chat_template("test_template")
assert result == expected
mock_load_file.assert_called_once()
@pytest.mark.parametrize(
"model_name, trust_remote_code, expected_result",
[
("MlpEncoder", False, False), # Custom model
("CnnClassifier", False, False), # Custom mo... | Review this code and list any quality issues. | [] | 0 |
python | WithSeededRandomPipelineEngine,
WithMakeAlgo,
ZiplineTestCase,
):
@classmethod
def init_class_fixtures(cls):
super(PipelineSequenceTestCase, cls).init_class_fixtures()
def make_algo_kwargs(self, **overrides):
return self.merge_with_inherited_algo_kwargs(
PipelineSequenc... | Review this code and list any quality issues. | [
{
"issue": "style: I'd remove this blank line.",
"severity": "major",
"line": 26
}
] | 1 |
python | """
return self.remover
def prepare_animation(
anim: Animation | mobject._AnimationBuilder,
) -> Animation:
r"""Returns either an unchanged animation, or the animation built
from a passed animation factory.
Examples
--------
::
>>> from manim import Square, FadeIn
>>... | Review this code and list any quality issues. | [
{
"issue": "Given that this method only returns the value of an attribute, is it really needed?",
"severity": "minor",
"line": 26
}
] | 1 |
python | if pad_start_idx == -1:
pad_start_idx = 0
features_info = PlaceholderFeaturesInfo(
modality="audio",
item_idx=0,
start_idx=pad_start_idx,
tokens=audio_len * [audio_pad_id],
is_embed=None,
)
return expanded_ids, {"audio": [f... | Review this code and list any quality issues. | [
{
"issue": "qq: do we need to define a new model class and entry in registry for `SupportsRealtime` to work?\nNot necessarily against this kind of separation, but this is still the same model in terms of weights and config",
"severity": "minor",
"line": 26
}
] | 1 |
python | # flags: --minimum-version=3.14
x = t"foo"
x = t'foo {{ {2 + 2}bar {{ baz'
# output
x = t"foo"
x = t"foo {{ {2 + 2}bar {{ baz" | Review this code and list any quality issues. | [
{
"issue": "Totally random person here with T-String issues in black :)\r\n\r\nConsider adding test case for multi-line t-strings as well (as in t\"\"\" \"\"\"), because I am using some tools that have an issue specifically with this construction.",
"severity": "minor",
"line": 1
}
] | 1 |
python | "in1d",
"intersect1d",
"isin",
"mask_cols",
"mask_rowcols",
"mask_rows",
"masked_all",
"masked_all_like",
"median",
"mr_",
"ndenumerate",
"notmasked_contiguous",
"notmasked_edges",
"polyfit",
"row_stack",
"setdiff1d",
"setxor1d",
"stack",
"union1d"... | Review this code and list any quality issues. | [
{
"issue": "Ruff `PYI014` wouldn't accept this I think, which is pretty arbitrary if you ask me.\r\n\r\n```suggestion\r\ndef masked_all(shape, dtype=float): ... # noqa: PYI014\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | import foo
foo.bar()
"""
)
with zipfile.ZipFile(os.path.join(temp_dir, 'zipmodule.zip'), 'w') as zf:
zf.writestr('foo.py', zipmodule)
with open(os.path.join(temp_dir, 'script.py'), 'w') as f:
f.write(script)
... | Review this code and list any quality issues. | [
{
"issue": "The two breaks on two async functions use the exact same mechanism. You don't need to test it twice. Just make the test simple and easy to understand.",
"severity": "minor",
"line": 26
}
] | 1 |
python | self.assertEqual(dts[1],
self.data_portal.get_last_traded_dt(
asset, dts[1], 'minute'))
# Case: No data on dt, but data occuring before dt.
self.assertEqual(dts[4],
self.data_portal.get_last_traded_dt(
... | Review this code and list any quality issues. | [] | 0 |
python | 'series_id': '14694',
'episode': '次世代リアクション王発掘トーナメント',
'episode_number': 335,
'episode_id': '14694_2090934_1000117476',
'timestamp': 1749547434,
'upload_date': '20250610',
'release_timestamp': 1749646802,
'release_date': '20250611',
... | Review this code and list any quality issues. | [
{
"issue": "filter out `['']`\r\n```suggestion\r\n 'cast': ('credit', ..., 'name', ..., 'value', {clean_html}, any, {lambda x: x.split(',')}, ..., {str.strip}, filter, all, filter),\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | warnings.warn(msg, UndefinedMetricWarning)
return float("nan")
xp, _, device_ = get_namespace_and_device(y_proba)
y_proba = check_array(
y_proba, ensure_2d=False, dtype=supported_float_dtypes(xp, device=device_)
)
if sample_weight is not None:
sample_weight = ensure_common_names... | Review this code and list any quality issues. | [
{
"issue": "Maybe we could add a `dtype` param to the one hot encoding helpers.",
"severity": "major",
"line": 26
}
] | 1 |
python | company_id = webpage_json_data['company_id']
meta_url = self._META_URL % (company_id, video_id)
meta = self._download_json(meta_url, video_id)['video']
format_url = meta['video_m3u8']
formats = self._extract_m3u8_formats(
format_url, video_id, 'mp4', m3u8_id='hls',
... | Review this code and list any quality issues. | [
{
"issue": "`traverse_obj` is especially useful for inline metadata extraction; we can use dict key traversal here. Using set syntax, we can expect types (e.g. `{str}`) and perform transformations (`{callable}`)\r\n\r\nI changed `channel` to `series`, since that seems more accurate? Although if you have rationa... | 1 |
python | if scale_tips:
super().scale(factor, **kwargs)
self.set_stroke_width_from_length()
return self
has_tip = self.has_tip()
has_start_tip = self.has_start_tip()
if has_tip or has_start_tip:
old_tips = self.pop_tips()
super().scale(factor, **k... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n >>> np.around(Arrow().get_normal_vector(), decimals=4) + 0. # add 0. to avoid negative 0 in output\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | columns.append(_PandasDataAccessor.__INDEX_COL)
fullrowcount = len(df)
# filtering
filters = payload.get("filters")
if isinstance(filters, list) and len(filters) > 0:
query = ""
vars = []
for fd in filters:
col = fd.get("col")
... | Review this code and list any quality issues. | [
{
"issue": "we want this to work for **any** action",
"severity": "minor",
"line": 26
}
] | 1 |
python | self.storage_providers.pop(creds_key, None)
def add_to_used_creds(self, creds_key: Optional[str]):
if creds_key is None or creds_key in self.used_creds_keys:
return False
self.used_creds_keys.add(creds_key)
return True
def tobytes(self) -> bytes:
d = {
"... | Review this code and list any quality issues. | [
{
"issue": "prevent adding 2 entries for ENV",
"severity": "minor",
"line": 26
}
] | 1 |
python | assert key is not None, "Not able to determine model policy automatically. Please provide policy."
if key.group(1).lower() in unsupported:
return False
return True
def get_layers(parent, module):
layer_list = []
for key, submodule in module._modules.items():
... | Review this code and list any quality issues. | [] | 0 |
python | headers={'Referer': 'http://www.amadeus.tv/'}
)
transcode_list = traverse_obj(video_data, ('videoInfo', 'transcodeList'), default=[])
formats = []
for video in transcode_list:
format_info = {
'url': video['url'],
'format_id': 'http-%d' % video... | Review this code and list any quality issues. | [
{
"issue": "Can be written like so:\r\n```suggestion\r\n return {\r\n 'id': video_id,\r\n 'display_id': display_id,\r\n 'formats': formats,\r\n **traverse_obj(video_data, {\r\n 'title': ('videoInfo', 'basicInfo', 'name'),\r\n 'thum... | 1 |
python | if not include_background:
y_pred, y = ignore_background(y_pred=y_pred, y=y)
# Reducing only spatial dimensions (not batch nor channels), compute the intersection and non-weighted denominator
reduce_axis = list(range(2, y_pred.dim()))
intersection = torch.sum(y * y_pred, dim=reduce_axis)
y_o = ... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n # Compute the weighted numerator and denominator, summing along the class axis when sum_over_classes is True\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | from enum import StrEnum
import logging
import time
from typing import Any
from propcache.api import cached_property
import voluptuous as vol
from homeassistant.const import ATTR_DEVICE_ID, ATTR_ID, ATTR_NAME
from homeassistant.core import Context, HomeAssistant, callback
from homeassistant.helpers import (
area_... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\nNO_TIMER_COMMAND_RESPONSE = \"no_timer_command\"\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | This class is abstract and cannot be instantiated directly.
The builtin tools are passed to the model as part of the `ModelRequestParameters`.
"""
kind: str = 'unknown_builtin_tool'
"""Built-in tool identifier, this should be available on all built-in tools as a discriminator."""
def __init_subcl... | Review this code and list any quality issues. | [
{
"issue": "I see some tools (e.g. `UrlContextTool`) that are _not_ dataclasses, and will not be supported by Pydantic. Is that expected?",
"severity": "minor",
"line": 26
}
] | 1 |
python | handler: RequestHandler. A callable to handle the route.
defaults: dict. Optional defaults parameter to be passed
into the RedirectRoute object.
Returns:
RedirectRoute. A RedirectRoute object for redirects.
"""
if defaults is None:
defaults = {}
name = regex_route.re... | Review this code and list any quality issues. | [
{
"issue": "I think this should be the correct path, right?\r\n\r\n``<topic_url_fragment>/story/<story_url_fragment> ``",
"severity": "minor",
"line": 26
}
] | 1 |
python | # Check that the helper entity is linked to the expected source device
switch_entity_entry = entity_registry.async_get("switch.test_unique")
generic_hygrostat_entity_entry = entity_registry.async_get(
"humidifier.my_generic_hygrostat"
)
assert generic_hygrostat_entity_entry.device_id == expected... | Review this code and list any quality issues. | [] | 0 |
python | #
# 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 permissions and
# limitations under the License.
#
... | Review this code and list any quality issues. | [
{
"issue": "Any reason for changing the order of these classmethods?",
"severity": "minor",
"line": 26
}
] | 1 |
python | def joystick_alert(CP: car.CarParams, CS: car.CarState, sm: messaging.SubMaster, metric: bool, soft_disable_time: int, personality) -> Alert:
gb = sm['carControl'].actuators.accel / 4.
steer = sm['carControl'].actuators.torque
vals = f"Gas: {round(gb * 100.)}%, Steer: {round(steer * 100.)}%"
return NormalPerman... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n text = \"Switch to Traffic-Aware Cruise Control to engage\"\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | """
Calculates the percent change in close price over the given window_length.
**Default Inputs**: [EquityPricing.close]
"""
inputs = [EquityPricing.close]
window_safe = True
def _validate(self):
super(Returns, self)._validate()
if self.window_length < 2:
raise Valu... | Review this code and list any quality issues. | [
{
"issue": "Looks like other factors mention `**Default Window Length**: None`, might be worth adding that here too.",
"severity": "minor",
"line": 26
}
] | 1 |
python | # Meta / Notification
# Show notification.
# ---
from telesync import site, ui
page = site['/demo']
page['meta'] = ui.meta_card(box='')
page['example'] = ui.markdown_card(
box='1 1 2 2',
title='Notification',
content='Allow browser notifcations in order to see them.',
)
page['meta'].notification = 'Proce... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\npage.save()\r\n\r\ntime.sleep(5)\r\npage['meta'].notification = 'And now for something completely different!'\r\n```",
"severity": "minor",
"line": 15
}
] | 1 |
python | result = pytester.runpytest_inprocess(
"--collect-only",
"--keep-duplicates",
"top1/test_1.py::test_3",
"top1/test_1.py",
)
result.stdout.fnmatch_lines(
[
"<Dir *>",
" <Package top1>",
# NOTE: Th... | Review this code and list any quality issues. | [
{
"issue": "Would put this right above `test_cli_enables` so it's closer to where it's used.",
"severity": "minor",
"line": 26
}
] | 1 |
python | }]
def _real_extract(self, url):
video_id = self._match_id(url)
json_data = self._call_api(f'match/{video_id}', video_id)
formats = []
tbr_resolution_mapping = {'6000': '1080p', '2400': '720p', '1500': '480p', '800': '360p'}
for video in traverse_obj(json_data, ('videos', 0,... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n teams = traverse_obj(json_data, ('teams', ..., 'shortcut', {str}, {orderedSet}))\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | )
return contents, config
def _process_response(self, response: GenerateContentResponse) -> ModelResponse:
if not response.candidates:
raise UnexpectedModelBehavior('Expected at least one candidate in Gemini response') # pragma: no cover
candidate = response.candidates[0]
... | Review this code and list any quality issues. | [
{
"issue": "See https://github.com/pydantic/pydantic-ai/issues/3289#issuecomment-3469324408 -- I think we can drop this error entirely, and just continue when we get an empty response or a failure finish reason. This PR can then likely also close that issue.\r\n\r\nThat should also let us drop the tests, as we'... | 1 |
python | EventName = log.OnroadEvent.EventName
EVENT_TO_INT = EventName.schema.enumerants
class DriverCameraView(CameraView):
def _calc_frame_matrix(self, rect: rl.Rectangle):
base = super()._calc_frame_matrix(rect)
driver_view_ratio = 1.5
base[0, 0] *= driver_view_ratio
base[1, 1] *= driver_view_ratio
... | Review this code and list any quality issues. | [
{
"issue": "no circular references to self. this allows the widget's ref count to drop to 0 and deletes PubMaster and frees CameraView in `__del__`",
"severity": "minor",
"line": 26
}
] | 1 |
python | parser.add_argument("--no-deepspeed", dest="deepspeed", action="store_false")
parser.add_argument("--wandb-entity", type=str, default="open-assistant")
parser.add_argument("--per-digit-tokens", action="store_true")
parser.set_defaults(deepspeed=False)
if notebook:
args, remaining = parser.parse... | Review this code and list any quality issues. | [
{
"issue": "i would move this to the config.yaml instead of args",
"severity": "major",
"line": 26
}
] | 1 |
python | duration = float_or_none(try_get(
ptmd, lambda x: x['attributes']['duration']['value']), scale=1000)
return {
'extractor_key': ZDFIE.ie_key(),
'id': content_id,
'duration': duration,
'formats': formats,
'subtitles': self._extract_subtitles... | Review this code and list any quality issues. | [
{
"issue": "Don't remove tests\r\nif the url no longer exists then add it as matching only",
"severity": "minor",
"line": 26
}
] | 1 |
python | device=0,
pickle_module="pickle",
pickle_protocol=pickle.HIGHEST_PROTOCOL,
)
assert_allclose(items[0], p(np.arange(0, np.prod(shape)).reshape(shape)))
ds1 = GDSDataset(items, transform=_InplaceXform(), cache_dir=tempdir, device=0)
... | Review this code and list any quality issues. | [] | 0 |
python | RectBivariateSpline :
a bivariate spline over a rectangular mesh
bisplrep :
a function to find a bivariate B-spline representation of a surface
bisplev :
a function to evaluate a bivariate B-spline and its derivatives
Notes
-----
The length of `x`, `y` and `z` should be at l... | Review this code and list any quality issues. | [
{
"issue": "Can you change this to point to this page instead please \r\nhttps://docs.scipy.org/doc/scipy/tutorial/interpolate/interp_transition_guide.html",
"severity": "minor",
"line": 26
}
] | 1 |
python | np.random.BitGenerator,
np.random.RandomState,
]
# dtypes
NpDtype = Union[str, np.dtype, type_t[Union[str, complex, bool, object]]]
Dtype = Union["ExtensionDtype", NpDtype]
AstypeArg = Union["ExtensionDtype", "npt.DTypeLike"]
# DtypeArg specifies all allowable dtypes in a functions its dtype argument
DtypeArg = Un... | Review this code and list any quality issues. | [
{
"issue": "probably needs to move inside the TYPE_CHECKIG block as it is None at runtime (see failing tests).",
"severity": "critical",
"line": 26
}
] | 1 |
python | from .common import InfoExtractor
from ..utils import (
get_element_html_by_class,
get_elements_html_by_class,
)
class ViouslyIE(InfoExtractor):
_VALID_URL = False
_API_URL = 'https://www.viously.com/video/hls/{0:}/index.m3u8'
_WEBPAGE_TESTS = [{
'url': 'http://www.turbo.fr/videos-voiture/... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\nimport base64\r\nimport re\r\n\r\nfrom .common import InfoExtractor\r\nfrom ..utils import extract_attributes, int_or_none, parse_iso8601\r\nfrom ..utils.traversal import traverse_obj\r\n```",
"severity": "major",
"line": 5
}
] | 1 |
python | model_list = [
model_option
for model_option in await get_model_list(client)
if not model_option["value"].startswith(tuple(DEPRECATED_MODELS))
]
self._model_list_cache[entry.entry_id] = model_list
if "opus" in model:
family = "... | Review this code and list any quality issues. | [
{
"issue": "The suggested_model can be None if no models match the family filter. This None value would cause an error when used in the schema's suggested_value. Add validation to handle the case when no matching models are found, or provide a fallback default model.\n```suggestion\n\n if suggested_model... | 1 |
python | assert result["type"] is FlowResultType.ABORT
assert result["reason"] == "not_ipv4_address"
async def test_form_zeroconf_correct_oui(
hass: HomeAssistant, doorbird_api: DoorBird
) -> None:
"""Test we can setup from zeroconf with the correct OUI source."""
result = await hass.config_entries.flow.async... | Review this code and list any quality issues. | [] | 0 |
python | class VKPlayBaseIE(InfoExtractor):
_RESOLUTIONS = {
'tiny': '256x144',
'lowest': '426x240',
'low': '640x360',
'medium': '852x480',
'high': '1280x720',
'full_hd': '1920x1080',
'quad_hd': '2560x1440',
}
def _extract_initial_state(self, url, video_id):
... | Review this code and list any quality issues. | [
{
"issue": "fixing typo from my suggestion\r\n```suggestion\r\n elif format_id == 'dash':\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | 'season': 'Season 2015',
'season_number': 2015,
'media_type': 'Excerpt',
},
}, {
'url': 'http://www.cbc.ca/player/play/2164402062',
'md5': '33fcd8f6719b9dd60a5e73adcb83b9f6',
'info_dict': {
'id': '2164402062',
'ext': 'mp4',
... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n 'categories': ['News/Canada/Windsor'],\r\n 'location': 'Windsor',\r\n 'tags': ['cancer'],\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | def test_set_max_leverage(self):
# Set max leverage to 0 so buying one share fails.
def handle_data(algo, data):
algo.order(algo.sid(self.sidint), 1)
algo.record(latest_time=algo.get_datetime())
algo = SetMaxLeverageAlgorithm(0, sim_params=self.sim_params,
... | Review this code and list any quality issues. | [
{
"issue": "All the `handle_data` functions we define in this method are functionally the same. Is there a reason we're defining a separate one each time?",
"severity": "minor",
"line": 26
}
] | 1 |
python | @frames_comparison(last_frame=False)
def test_ShrinkToCenter(scene):
square = Square()
scene.play(ShrinkToCenter(square))
@frames_comparison(last_frame=False)
def test_Restore(scene):
square = Square()
circle = Circle()
scene.play(Transform(square, circle))
square.save_state()
scene.play(s... | Review this code and list any quality issues. | [] | 0 |
python | if cache_key in self._textures:
return self._textures[cache_key]
with as_file(ASSETS_DIR.joinpath(asset_path)) as fspath:
image_obj = self._load_image_from_path(fspath.as_posix(), width, height, alpha_premultiply, keep_aspect_ratio)
texture_obj = self._load_texture_from_image(image_obj)
self.... | Review this code and list any quality issues. | [] | 0 |
python | @property
def _point_getter(self):
if self.dims == 3 and self._z:
return self._get_point_3d
elif self.dims == 3 and self.hasm:
return self._get_point_3d_m
elif self.dims == 4 and self._z and self.hasm:
return self._get_point_4d
return self._get_poi... | Review this code and list any quality issues. | [] | 0 |
python | 'age_limit': 18,
'availability': 'premium_only',
'duration': 2710,
'cast': 'count:3',
'tags': 'count:29',
'thumbnail': r're:^https?://cdn-image\.gtflixtv\.com.*\.jpg.*$',
'subtitles': 'count:6'
},
'params': {
'skip_downl... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n subtitles = {country_code: [{\r\n 'url': f'https://pornbox.com/contents/{video_id}/subtitles/{country_code}',\r\n 'ext': 'srt'\r\n }] for country_code in traverse_obj(public_data, ('subtitles', ..., {str}))}\r\n```",
"severity": "minor",
... | 1 |
python | else:
index = np.arange(len(batch))
trajectory_info = await get_trajectory_info(
batch.meta_info.get("global_steps", -1), index, batch.meta_info.get("validate", False)
)
if not partial_output_list:
partial_output_list = [None] * len(batch)
try:
... | Review this code and list any quality issues. | [] | 0 |
python | labeldistance: float | None = ...,
startangle: float = ...,
radius: float = ...,
counterclock: bool = ...,
wedgeprops: dict[str, Any] | None = ...,
textprops: dict[str, Any] | None = ...,
center: tuple[float, float] = ...,
frame: bool = ...,
rotatelabels: ... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n elinestyle: LineStyleType | None = ...,\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | with tempfile.TemporaryDirectory() as tmpdir:
pipe.save_pretrained(tmpdir)
pipe_loaded = self.pipeline_class.from_pretrained(tmpdir, torch_dtype=torch.float16)
for component in pipe_loaded.components.values():
if hasattr(component, "set_default_attn_processor"):
... | Review this code and list any quality issues. | [] | 0 |
python | extractor = VivisectFeatureExtractor(vw, path)
for function in extractor.get_functions():
for bb in extractor.get_basic_blocks(function):
for insn in extractor.get_instructions(function, bb):
for feature, address in extractor.extract_insn_features(... | Review this code and list any quality issues. | [
{
"issue": "Rather than a comment that describes *what* is done, please add a comment that describes why you make this copy. I don't quite understand it yet, so this context would be useful to any future reader.",
"severity": "minor",
"line": 26
}
] | 1 |
python | def __hash__(self):
return hash((self.source_id, self.sink_id, self.source_name, self.sink_name))
class Node(BaseDbModel):
block_id: str
input_default: BlockInput = {} # dict[input_name, default_value]
metadata: dict[str, Any] = {}
input_links: list[Link] = []
output_links: list[Link] = [... | Review this code and list any quality issues. | [
{
"issue": "What if we do that here autogpt_platform/backend/backend/server/rest_api.py\r\n```python\r\n@contextlib.asynccontextmanager\r\nasync def lifespan_context(app: fastapi.FastAPI):\r\n await backend.data.db.connect()\r\n await backend.data.block.initialize_blocks()\r\n await backend.data.user.m... | 1 |
python | @override
@property
def name(self) -> str | None:
return self._name
@override
@classmethod
async def open(
cls,
*,
id: str | None = None,
name: str | None = None,
configuration: Configuration | None = None,
storage_client: BaseStorageClient | ... | Review this code and list any quality issues. | [] | 0 |
python | # Create a transaction spending the coinbase output with an invalid (null) signature
tx = CTransaction()
tx.vin.append(CTxIn(COutPoint(self.block1.vtx[0].txid_int, 0), scriptSig=b""))
tx.vout.append(CTxOut(49 * 100000000, CScript([OP_TRUE])))
block102 = create_block(self.tip, create_coi... | Review this code and list any quality issues. | [
{
"issue": "nit in 9ecaadc94a5a4a61263aa17ddaba23ee5d155042: Think there is some value in benefit from nodes starting up in parallel with the python code running. Would prefer starting them all here or even sooner, before the loop generating 2100 blocks above.\r\n\r\nSorry if my suggestion in https://github.com... | 1 |
python | for block in self.blocks:
x = block(x)
x = self.ln_post(x)
# """
# TODO:
# I think we need to transpose the result here to make it fit whisper.cpp memory order.
# However, even doing this, the results are still wrong. Kind of less wrong compared to
# not tra... | Review this code and list any quality issues. | [] | 0 |
python | _attr_has_entity_name = True
def __init__(
self,
coordinator: UptimeKumaDataUpdateCoordinator,
monitor: str | int,
entity_description: UptimeKumaSensorEntityDescription,
) -> None:
"""Initialize the entity."""
super().__init__(coordinator)
self.monitor =... | Review this code and list any quality issues. | [
{
"issue": "This change introduces new behavior for device `configuration_url` (dashboard URL, and monitor-specific URLs when `monitor` is an `int`, plus `None` for local instances). There are existing tests for this integration, but none appear to assert the device registry's `configuration_url`. Please add te... | 1 |
python | class Example1Text(Scene):
def construct(self):
text = Text('Hello world').scale(3)
self.add(text)
.. manim:: TextColorExample
:save_last_frame:
class TextColorExample(Scene):
def construct(self):
text1 = Text('Hello world', c... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n self.add(text0, text1, text2, text3, text4)\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | import copy
from collections import defaultdict
from typing import TYPE_CHECKING, Dict, List, Literal, Optional, Union
from ray.actor import ActorHandle
from ray.util.annotations import DeveloperAPI, PublicAPI
if TYPE_CHECKING:
from ray.data import DataIterator, Dataset, ExecutionOptions, NodeIdStr
def _get_exe... | Review this code and list any quality issues. | [
{
"issue": "What happens if we import these under `if TYPE_CHECKING`? If that doesn't work, what happens if we import these in the function definitions (e.g., in the `DataConfig` constructor?)",
"severity": "minor",
"line": 25
}
] | 1 |
python | class XAttrMetadataPP(PostProcessor):
"""Set extended attributes on downloaded file (if xattr support is found)
More info about extended attributes for media:
http://freedesktop.org/wiki/CommonExtendedAttributes/
http://www.freedesktop.org/wiki/PhreedomDraft/
http://dublincore.org/docum... | Review this code and list any quality issues. | [
{
"issue": "maybe `com.apple.metadata:kMDItemWhereFroms` should go after `description` since even without any url it's already longer than many videos' description strings?",
"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": "Is this related to the mentioned https://www.shellcheck.net/wiki/SC2086? Because we need split to handle quotes and escaping properly?",
"severity": "minor",
"line": 26
}
] | 1 |
python | class X(Expr):
_diff_wrt = True
assert X().diff(X()) == 1
assert (2*X()).diff(X()) == 2
def test_noncommutative_issue_15131():
x = Symbol('x', commutative=False)
t = Symbol('t', commutative=False)
fx = Function('Fx', commutative=False)(x)
ft = Function('Ft', commutative=False)(t)
A... | Review this code and list any quality issues. | [
{
"issue": "It would be better to write\r\n```\r\nassert diff(S**2, t) == Derivative(S**2, t)\r\n```\r\ni.e. to assert exactly what the output should be.",
"severity": "minor",
"line": 26
}
] | 1 |
python | Returns
-------
:class:`float`
Returns signed area.
"""
x = x_y[:, 0]
y = x_y[:, 1]
area = 0.5 * np.array(np.dot(x, np.roll(y, 1)) - np.dot(y, np.roll(x, 1)))
return area
def shoelace_direction(x_y: np.ndarray) -> str:
"""
Uses the area determined by the shoelace method to ... | Review this code and list any quality issues. | [
{
"issue": "The typehint is wrong, it should be List, np.ndarray, List of lists, List of ndarrays, ndarray of ndarrays or ndarray or lists",
"severity": "critical",
"line": 26
}
] | 1 |
python | --------
>>> mi = pd.MultiIndex.from_product([range(2), list("ab")])
>>> mi
MultiIndex([(0, 'a'),
(0, 'b'),
(1, 'a'),
(1, 'b')],
)
>>> mi[2:]
MultiIndex([(1, 'a'),
(1, 'b')],
... | Review this code and list any quality issues. | [
{
"issue": "What fails when this is `True`?",
"severity": "critical",
"line": 26
}
] | 1 |
python | # functions and function_call are deprecated and are replaced by tools and tool_choice.
# if both are provided, tools and tool_choice are used and functions and function_call are ignored.
if tools:
# TODO: add validate_tools
params["tools"] = tools
# TODO: add validat... | Review this code and list any quality issues. | [
{
"issue": "if presence_penalty is not None:",
"severity": "minor",
"line": 26
}
] | 1 |
python | ):
"""Create a Button widget.
Args:
label: The text that appears within the button.
variant: The variant of the button.
name: The name of the button.
id: The ID of the button in the DOM.
classes: The CSS classes of the button.
disa... | Review this code and list any quality issues. | [
{
"issue": "Good catch. Might it be worth adding a snapshot test for buttons with multi-line labels?",
"severity": "minor",
"line": 26
}
] | 1 |
python | assert solveset_real(Abs(x) + 2, x) is S.EmptySet
assert solveset_real(Abs(x + 3) - 2*Abs(x - 3), x) == \
FiniteSet(1, 9)
assert solveset_real(2*Abs(x) - Abs(x - 1), x) == \
FiniteSet(-1, Rational(1, 3))
sol = ConditionSet(
x,
And(
Contains(b, Interva... | Review this code and list any quality issues. | [
{
"issue": "The previous answer here evaluates to:\r\n```python\r\nIn [1]: Union(\r\n ...: Intersection(Interval(0, oo), Union(\r\n ...: Intersection(ImageSet(Lambda(n, 2*n*pi + 3*pi/2), S.Integers),\r\n ...: Interval(-oo, 0)),\r\n ...: Intersection(ImageSet(Lambda(n,... | 1 |
python | _CommandGroupApplicationCommandInteractionDataOption,
_ValueApplicationCommandInteractionDataOption,
]
class _BaseApplicationCommandInteractionData(TypedDict):
id: Snowflake
name: str
resolved: NotRequired[ResolvedData]
guild_id: NotRequired[Snowflake]
class ChatInputApplicationCommandInteractio... | Review this code and list any quality issues. | [] | 0 |
python | text_pos = rl.Vector2(rect.x + 58, text_y)
rl.draw_text_ex(self._font_regular, self._net_type, text_pos, FONT_SIZE, 0, Colors.WHITE)
def _draw_metrics(self, rect: rl.Rectangle):
metrics = [(self._temp_status, 338), (self._panda_status, 496), (self._connect_status, 654)]
for metric, y_offset in metrics:
... | Review this code and list any quality issues. | [
{
"issue": "Maybe I should do `text_y += text_size.y`",
"severity": "minor",
"line": 26
}
] | 1 |
python | try:
# Copy config file to output directory
assert (
test_config.config_path.exists()
), f"{test_tag} Path doesn't exist: {test_config.config_path}"
assert (
test_config.config_path.is_file()
), f"{test_tag} Path is not a file: {test_config.config_path}"
... | Review this code and list any quality issues. | [
{
"issue": "nit: Note that this should be possible now: https://github.com/oumi-ai/oumi/pull/1430",
"severity": "minor",
"line": 26
}
] | 1 |
python | import functools
import re
from .common import InfoExtractor
from ..networking import HEADRequest
from ..utils import (
InAdvancePagedList,
clean_html,
determine_ext,
float_or_none,
int_or_none,
join_nonempty,
make_archive_id,
mimetype2ext,
orderedSet,
remove_end,
smuggle_ur... | Review this code and list any quality issues. | [
{
"issue": "Oh, and you can add this to the imports from above sorted alphabetically",
"severity": "minor",
"line": 26
}
] | 1 |
python | # and return the block height which listsinceblock now exposes since a5e7795.
transactions = self.nodes[0].listsinceblock(nodes1_last_blockhash)['transactions']
found = next(tx for tx in transactions if tx['txid'] == senttx)
assert_equal(found['blockheight'], self.nodes[0].getblockheader(nodes2_... | Review this code and list any quality issues. | [
{
"issue": "Seems easier to rename the file than to change its permissions?",
"severity": "critical",
"line": 26
}
] | 1 |
python | from .webui.interface import run_web_demo
run_web_demo()
elif command == "webui":
from .webui.interface import run_web_ui
run_web_ui()
elif command == "env":
print_env()
elif command == "version":
print(WELCOME)
elif command == "help":
print(USAGE)
... | Review this code and list any quality issues. | [
{
"issue": "do not delete the ending blank line",
"severity": "minor",
"line": 26
}
] | 1 |
python | TEST_CASE_DEEP_SUPERVISION.append(test_case)
class TestDynUNet(unittest.TestCase):
@parameterized.expand(TEST_CASE_DYNUNET_3D)
def test_shape(self, input_param, input_shape, expected_shape):
net = DynUNet(**input_param).to(device)
if "alphadropout" in input_param.get("dropout"):
se... | Review this code and list any quality issues. | [
{
"issue": "Since this part is removed, related import can be removed (https://github.com/Project-MONAI/MONAI/pull/6399/files#diff-8f2debbe9c6aa7e8c0b4f65cf36df76bcc5097ce006af6638ae37fb14950ec5eL25)",
"severity": "minor",
"line": 26
}
] | 1 |
python | webpage = self._download_webpage(url, video_id)
data_json = self._search_json(r'<script>\s*var app\s*=', webpage, 'data json', video_id)
delivery_status = data_json.get('delivery_status')
archive_mode = data_json.get('archive_mode')
release_timestamp = try_call(lambda: unified_timestam... | Review this code and list any quality issues. | [
{
"issue": "Don't raise, issue warning try to extract as-if `is_live`.",
"severity": "major",
"line": 26
}
] | 1 |
python | {"User-Agent": "python-myclient/0.2.1", "Another-Header": "AThing"}
)
second_response = client.get(url)
assert first_response.status_code == 200
assert first_response.json() == {
"headers": {
"accept": "*/*",
"accept-encoding": "gzip, deflate, br, zstd",
"con... | Review this code and list any quality issues. | [] | 0 |
python | .update_query(self.extra_authorize_data)
)
async def async_resolve_external_data(self, external_data: Any) -> dict:
"""Resolve the authorization code to tokens."""
request_data: dict = {
"grant_type": "authorization_code",
"code": external_data["code"],
"... | Review this code and list any quality issues. | [
{
"issue": "I suggest we raise a new exception when token refresh fails, that integration can catch and handle appropriately in each case. We don't know that we can raise a `ConfigEntryAuthFailed`.\n\nThis will be a breaking change for integrations that we need to handle in a non breaking way during a deprecati... | 1 |
python | )
# Get all stored sandboxes for the current user
stmt = await self._secure_select()
result = await self.db_session.execute(stmt)
stored_sandboxes = result.scalars().all()
# Check each sandbox's runtime data for matching session_api_key
for stored_sandbox in stored_sand... | Review this code and list any quality issues. | [
{
"issue": "🟡 Suggestion: Similar implicit commit issue as above. The hash is backfilled but not explicitly persisted. While SQLAlchemy likely handles this, explicit persistence would make the code clearer and ensure the optimization works on subsequent lookups.",
"severity": "minor",
"line": 26
}
] | 1 |
python | dist = _SimpleStudentT(dof)
prob = _get_pvalue(t, dist, alternative, xp=np)
# For backwards compatibility, return scalars when comparing 2 columns
if rs.shape == (2, 2):
res = SignificanceResult(rs[1, 0], prob[1, 0])
res.correlation = rs[1, 0]
return res
else:
rs[variabl... | Review this code and list any quality issues. | [] | 0 |
python | }, info_dict)
def _prepare_external_frag_download(self, ctx):
if 'live' not in ctx:
ctx['live'] = False
if not ctx['live']:
total_frags_str = '%d' % ctx['total_frags']
ad_frags = ctx.get('ad_frags', 0)
if ad_frags:
total_frags_str += '... | Review this code and list any quality issues. | [
{
"issue": "not good design. better to let args be (a list of) dicts/tuples",
"severity": "minor",
"line": 26
}
] | 1 |
python | label_properties = self._get_label_properties(detections, labels)
xyxy = label_properties[:, :4]
if self.smart_positions:
xyxy = spread_out_boxes(xyxy)
label_properties[:, :4] = xyxy
self._draw_labels(
scene=scene,
labels=labels,
labe... | Review this code and list any quality issues. | [
{
"issue": "It is a lot cleaner! 🔥 I know we usually do not include docstrings for private / protected methods but I'd do it this time.",
"severity": "minor",
"line": 26
}
] | 1 |
python | # coding: utf-8
from __future__ import unicode_literals
import base64
import time
import uuid
from .common import InfoExtractor
from ..compat import (
compat_HTTPError,
compat_str,
)
from ..utils import (
ExtractorError,
int_or_none,
)
class MGTVIE(InfoExtractor):
_VALID_URL = r'https?://(?:w(?:... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n 'subtitles': self.extract_subtitles(video_id, stream_domain),\r\n }\r\n\r\n def _get_subtitles(self, video_id, domain):\r\n```",
"severity": "major",
"line": 26
}
] | 1 |
python | video_id = traverse_obj(query, ('show', 0, {int_or_none}))
if not video_id:
video_id = traverse_obj(query, ('id', 0, {int_or_none}))
webpage = self._download_webpage(url, video_id)
player_data, media_data = self._html_search_regex(
r'LR\.audio\.Player\s*\([^{]*(?P<play... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n if id_.startswith('v') and not title:\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | chat_history_input_name = next(
iter([input_name for input_name, value in flow.inputs.items() if value.is_chat_history]), None
)
if (
not chat_history_input_name
and CHAT_HISTORY in flow.inputs
and flow.inputs[CHAT_HISTORY].is_chat_history is not False
):
chat_history... | Review this code and list any quality issues. | [
{
"issue": "create negative tests for these error msgs?",
"severity": "minor",
"line": 26
}
] | 1 |
python | headers = {
'X-Av-Code': '23',
'X-Country': 'IN',
'X-Platform': 'android',
'X-App-Version': '1370001318',
'X-Resolution': '3840x2160',
}
data_json = self._download_json(f'{API_URL}{type}/{video_id}', display_id, headers=headers)['profile']
... | Review this code and list any quality issues. | [
{
"issue": "use `group` instead `groups`\r\n```suggestion\r\n video_type, display_id, video_id = self._match_valid_url(url).group('type', 'display_id', 'id')\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | body = content.encode("utf-8") if isinstance(content, str) else content
content_length = str(len(body))
headers = {"Content-Length": content_length} if body else {}
return headers, ByteStream(body)
elif isinstance(content, Iterable):
headers = {"Transfer-Encoding": "chunked"}
... | Review this code and list any quality issues. | [] | 0 |
python | # Test for a non-textual custom model (CNNClassifier).
import tempfile
from pathlib import Path
from typing import Optional, Union
import numpy as np
import pandas as pd
import torch
from torch.utils.data import DataLoader
from typing_extensions import override
from oumi.builders import build_dataset, build_model
fro... | Review this code and list any quality issues. | [
{
"issue": "Do we need to define this class here? Why not under oumi/datasets?",
"severity": "minor",
"line": 21
}
] | 1 |
python | window_length,
perspective_offset,
rounding_places=None,
)
def inspect(self):
"""
Return a string representation of the data stored in this array.
"""
return dedent(
"""\
Adjusted Array ({dtype}):
Data:
... | Review this code and list any quality issues. | [
{
"issue": "I might call this something like `update_labels` to imply that this operates in place.",
"severity": "minor",
"line": 26
}
] | 1 |
python | try:
if answer.lower() in cbs:
return cbs[answer.lower()](convo)
elif answer != '':
return {'user_input': answer}
except TokenLimitError as e:
if is_root_task and answer.lower() not in cbs and answer != '':
... | Review this code and list any quality issues. | [
{
"issue": "Have in mind that before on all places in code we were checking\r\n`self.ipc_client_instance is None or self.ipc_client_instance.client is None`\r\nand now we are checking the opposite.",
"severity": "minor",
"line": 26
}
] | 1 |
python | 'id': 'ABD6213',
'title': 'Cuties',
},
'playlist_mincount': 2,
}, {
'url': 'https://motherless.com/GVBCF7622',
'info_dict': {
'id': 'BCF7622',
'title': 'Vintage',
},
'playlist_count': 0,
}, {
'url': 'https://motherless.c... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n _VALID_URL = r'https?://(?:www\\.)?motherless\\.com/u/(?P<id>\\w+)/?(?:$|[?#])'\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | class TestInspectView(TestCase, WagtailTestUtils):
fixtures = ["modeladmintest_test.json"]
def setUp(self):
self.login()
img = Image.objects.create(
title="LOTR cover",
file=get_test_image_file(),
)
book = Book.objects.get(title="The Lord of the Rings")
... | Review this code and list any quality issues. | [] | 0 |
python | """A connection to Snowflake using the Snowflake Connector for Python.
For standard connections, create an instance of this using
``st.connection("snowflake")`` or
``st.connection("<name>", type="snowflake")``. Connection parameters for a
SnowflakeConnection can be specified using ``secrets.toml`` and/... | Review this code and list any quality issues. | [] | 0 |
python | ----------
other : ManimColor
The other ManimColor to be used for interpolation
alpha : float
A point on the line in rgba colorspace connecting the two colors i.e. the interpolation point
0 corresponds to the current ManimColor and 1 corresponds to the other ManimCol... | Review this code and list any quality issues. | [
{
"issue": "Minor improvement, plus added indication that the value is a ratio.\r\n\r\n```suggestion\r\n The factor (as a float ratio) by which the color should be darker. By default 0.2,\r\n which results in a slightly darker color.\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | # Act
result = recaptcha_service.create_assessment(
token='invalid-token',
action='LOGIN',
user_ip='192.168.1.1',
user_agent='Mozilla/5.0',
)
# Assert
assert result.allowed is False
assert result.valid is False
def test_should... | Review this code and list any quality issues. | [] | 0 |
python | # Form / Range Slider
# Use a range slider to allow users to set a value within a specific range from both extremes.
# ---
from h2o_q import Q, listen, ui
async def main(q: Q):
if q.args.show_inputs:
q.page['example'].items = [
ui.text(f'range_slider={q.args.range_slider}'),
ui.tex... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n# Use a range slider to allow users to select a value range (from, to).\r\n```",
"severity": "minor",
"line": 2
}
] | 1 |
python | from lib.classes.tts_engines.common.preset_loader import load_engine_presets
class Tortoise(TTSUtils, TTSRegistry, name='tortoise'):
def __init__(self, session:DictProxy):
try:
self.session = session
self.cache_dir = tts_dir
self.speakers_path = None
self.sp... | Review this code and list any quality issues. | [
{
"issue": "`self.load_engine()` runs before `self.model_path` is computed, but `load_engine()` now depends on `self.model_path` for `self.tts_key` and `_load_api()`. This will crash with `AttributeError` in `__init__`. Resolve `iso_dir/sub` and set `self.model_path` before calling `load_engine()` (or keep the ... | 1 |
python | use_redis: bool = False
use_supabase: bool = False
def __init__(self):
self.uri = None
@classmethod
@abstractmethod
def get_port(cls) -> int:
pass
@classmethod
def get_host(cls) -> str:
return os.environ.get(f"{cls.service_name.upper()}_HOST", Config().pyro_host)
... | Review this code and list any quality issues. | [] | 0 |
python | - *state*: the `State^` instance of the caller.
"""
self.on_page_load: t.Optional[t.Callable] = None
"""This callback is invoked just before the page content is sent to the front-end.
It defaults to the `on_page_load()` global function defined in the Python
application. If there... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n - *params* (Optional): the query parameters provided in the URL.\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | if first_block or content_details.has_content():
if content_details.has_citations():
content_details.delete_empty()
yield {"native": content_details}
content_details = ContentDetails()
content... | Review this code and list any quality issues. | [] | 0 |
python | http = self._state.http
await adapter.delete_original_interaction_response(
self.application_id,
self.token,
session=self._session,
proxy=http.proxy,
proxy_auth=http.proxy_auth,
)
class InteractionResponse:
"""Represents a Discord interac... | Review this code and list any quality issues. | [
{
"issue": "Rename this attribute to something clearer, like `_response_type`.",
"severity": "minor",
"line": 26
}
] | 1 |
python | f'https://api.idagio.com/v1.8/content/track/{track_id}', track_id,
query={
'quality': '0',
'format': '2',
'client_type': 'web-4',
})
return {
'ext': 'mp3',
'id': track_id,
'url': traverse_obj(content_inf... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n _VALID_URL = r'https?://(?:www\\.)?app\\.idagio\\.com/recordings/(?P<id>\\d+)(?![^#]*[&?]trackId=\\d+)'\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.