language
string
code-snippit
string
instruction
string
flaws
list
flaw_count
int64
python
{"to_onehot_y": False}, { "input": torch.tensor([[[1.0, 1.0, 0.0], [0.0, 0.0, 1.0]], [[1.0, 0.0, 1.0], [0.0, 1.0, 0.0]]]), "target": torch.tensor([[[1.0, 1.0, 0.0], [0.0, 0.0, 1.0]], [[1.0, 0.0, 1.0], [0.0, 1.0, 0.0]]]), }, 0.3133, ], [ # shape: (2, 2, 3), (2, 2,...
Review this code and list any quality issues.
[]
0
python
self.generate(self.nodes[0], 1) # create a v3 tx to alice and bob outputs = {self.alice.getnewaddress() : 2.0, self.bob.getnewaddress() : 2.0} self.send_tx(self.charlie, [], outputs, 3) alice_v2_unspent = self.alice.listunspent(minconf=1)[0] alice_unspent = self.alice.listunspen...
Review this code and list any quality issues.
[]
0
python
sources.extend( black.gen_python_files_in_dir( path, re.compile(black.DEFAULT_INCLUDES), empty ) ) self.assertEqual(sorted(expected), sorted(sources)) def test_invalid_include_exclude(self) -> None: for option in ["--include", "--exclude"]: ...
Review this code and list any quality issues.
[ { "issue": "mypy complains about this line like so:\r\n```\r\nCannot infer type argument 1 of \"assertIn\" of \"TestCase\"\r\n```\r\nI think it's confused because both arguments are `bytes`. Seems like a bug in mypy to me", "severity": "critical", "line": 26 } ]
1
python
from homeassistant.core import HomeAssistant from tests.common import MockConfigEntry from .conftest import make_mock_module, make_mock_zone ENTITY_ID = "climate.zone_1" async def test_climate_zone_available( hass: HomeAssistant, mock_config_entry: MockConfigEntry, mock_touchlinesl_full_client: MagicMo...
Review this code and list any quality issues.
[ { "issue": "Best me to assert is its current state, to represent what it should not, instead of what it should not be. :)", "severity": "minor", "line": 26 } ]
1
python
'url': 'https://www.filmarchiv.at/de/filmarchiv-on/video/f_0305p7xKrXUPBwoNE9x6mh', 'md5': 'TODO: md5 sum of the first 10241 bytes of the video file (use --test)', 'info_dict': { 'id': 'f_0305p7xKrXUPBwoNE9x6mh', 'ext': 'mkv', 'title': 'Der Wurstelprater zur Kaiserzei...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n og_img = self._html_search_meta('og:image', webpage, 'image URL', fatal=True)\r\n prefix = self._search_regex(\r\n r'/videostatic/([^/]+/[^_]+_[^/]+)/poster.jpg', og_img, 'prefix')\r\n```", "severity": "minor", "line": 26 } ]
1
python
with pytest.raises(ValueError, match="3 != 1"): s + b def test_add_sequence(any_string_dtype, request, using_infer_string): dtype = any_string_dtype if ( dtype != object and dtype.storage == "python" and dtype.na_value is np.nan and HAS_PYARROW and using_infer_s...
Review this code and list any quality issues.
[]
0
python
) -> None: """Test core update sets in_progress immediately when install starts.""" config_entry = MockConfigEntry(domain=DOMAIN, data={}, unique_id=DOMAIN) config_entry.add_to_hass(hass) with patch.dict(os.environ, MOCK_ENVIRON): result = await async_setup_component( hass, ...
Review this code and list any quality issues.
[ { "issue": "Use the patch mock instead to assert update calls.", "severity": "minor", "line": 26 } ]
1
python
# Some of these require _get_real_downloader from .common import FileDownloader from .dash import DashSegmentsFD from .f4m import F4mFD from .hls import HlsFD from .http import HttpFD from .rtmp import RtmpFD from .rtsp import RtspFD from .ism import IsmFD from .youtube_live_chat import YoutubeLiveChatReplayFD from .ex...
Review this code and list any quality issues.
[]
0
python
'episode': 'Om vetenskap, kritiskt tänkande och motstånd', 'age_limit': 15, }, }, { 'url': 'https://urplay.se/program/222967-en-foralders-dagbok-mitt-barn-skadar-sig-sjalv', 'info_dict': { 'id': '222967', 'ext': 'mp4', 'title': 'En förälders da...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n 'categories': 'count:2',\r\n 'tags': 'count:7',\r\n```", "severity": "minor", "line": 26 } ]
1
python
other_expr = str(other) new_inputs = self.inputs else: raise BadBinaryOperator(op, other) return self_expr, other_expr, new_inputs @property def bindings(self): return { "x_%d" % i: input_ for i, input_ in enumerate(self.inputs) } ...
Review this code and list any quality issues.
[ { "issue": "In our other uses of `\\l` it looks like we're putting two leading spaces after the line break. Any reason not to do that here too\"", "severity": "minor", "line": 26 } ]
1
python
from .event import Event class CoreEventConsumerBase(threading.Thread): """Abstract base class for implementing a Core event consumer. This class provides a framework for consuming events from a queue in a separate thread. It should be subclassed, and the `process_event` method should be implemented to d...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n consumer = MyEventConsumer(registration_id, registered_queue)\r\n```", "severity": "minor", "line": 26 } ]
1
python
{'url': _VALID_VIDEO_URL, 'format_id': 'mp4_480_270', 'width': 480, 'height': 270}, {'url': _VALID_VIDEO_URL, 'format_id': 'mp4_640_360', 'width': 640, 'height': 360}, {'url': _VALID_VIDEO_URL, 'format_id': 'mp4_960_540', 'width': 960, 'height': 540}, {'url': _VALID_VIDEO...
Review this code and list any quality issues.
[ { "issue": "Don't use variables in test definition. Hard-code everything", "severity": "minor", "line": 26 } ]
1
python
'title': '315passion_FRAME_only', 'live_status': 'was_live', 'thumbnail': r're:^https?://[\w.-]+/\w+/\w+', }, 'params': { 'skip_download': True, 'ignore_no_formats_error': True, }, }, { 'url': 'https://asobistage.asobistore.jp/event/ido...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n _TOKEN = None\r\n```", "severity": "minor", "line": 26 } ]
1
python
def set_test_params(self): """Use the pregenerated, deterministic chain up to height 199.""" self.num_nodes = 3 self.rpc_timeout = 120 self.extra_args = [ [], [], [], ] def setup_network(self): """Start with the nodes disconnected ...
Review this code and list any quality issues.
[ { "issue": "nit: I would have used this, it's a little more readable and a little more strict\r\n\r\n``` suggestion\r\n assert 'snapshot_blockhash' not in normal\r\n```", "severity": "minor", "line": 26 } ]
1
python
from transformers import ( AutoConfig, AutoModel, AutoModelForCausalLM, AutoModelForSeq2SeqLM, AutoTokenizer, LlamaTokenizer, LlamaForCausalLM, T5Tokenizer, ) from fastchat.constants import CPU_ISA from fastchat.conversation import Conversation, get_conv_template from fastchat.model.com...
Review this code and list any quality issues.
[ { "issue": "sort the imports alphabetically", "severity": "minor", "line": 26 } ]
1
python
datasets=[ DatasetParams( dataset_name="debug_pretraining", dataset_kwargs={"dataset_size": 25, "seq_length": 128}, ) ], stream=True, pack=True, ...
Review this code and list any quality issues.
[]
0
python
# Copyright 2021-2024 Avaiga Private Limited # # 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 agree...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\nlines = \"1 \\n2 \\n3 \\n4 \\n5\"\r\n```", "severity": "minor", "line": 18 } ]
1
python
is_live = status == 2 # Not currently live is 4, other numbers have not been encountered for the time being base_dict = { 'title': title, 'uploader_id': uploader_id, 'is_live': is_live, } if is_live: liveUrl = travers...
Review this code and list any quality issues.
[ { "issue": "again, instead of indenting most of the code in a `if room_id:` block, this `raise` could be moved up like this:\r\n\r\n```py\r\n room_id = self._html_search_regex(r'snssdk\\d*://live\\?room_id=(\\d+)', webpage, 'room ID', default=None)\r\n if not room_id:\r\n raise Extracto...
1
python
phigh = np.where(k == n, 1.0, phigh) return plow, phigh def _binom_wilson_conf_int(k, n, confidence_level, alternative, correction): # This function assumes that the arguments have already been validated. # In particular, `alternative` must be one of 'two-sided', 'less' or # 'greater'. p = k / n ...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n delta = z / denom * np.sqrt(4*n*p*q + z**2)\r\n```", "severity": "minor", "line": 26 } ]
1
python
self._delete_all_files, outputs=[ ingested_dataset, delete_file_button, deselect_file_button, selected_text, ], ) system...
Review this code and list any quality issues.
[ { "issue": "You are returning None in line 451, so the typing check fails with\r\n\r\n```error: Incompatible return value type (got \"None\", expected \"str\") [return-value]````\r\n\r\nYou can just change the return type \r\nfrom\r\n```\r\n-> str:\r\n```\r\nto\r\n```\r\n-> str | None:\r\n```", "severity":...
1
python
formats = [ {'url': format_url} for format_url in orderedSet(format_urls)] if not formats: entries = self._parse_html5_media_entries( url, webpage, video_id) if not entries: error = self._html_search_regex(r'<h1 class="page-title">...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n r'at \\d+:\\d+ UTC on (.+?)\\.', publish_date, 'upload date', fatal=False))\r\n```", "severity": "minor", "line": 26 } ]
1
python
assert_type(np.resize(AR_b, (5, 5)), np.ndarray[tuple[int, int], np.dtype[np.bool]]) assert_type(np.resize(AR_f4, (5, 5)), np.ndarray[tuple[int, int], np.dtype[np.float32]]) assert_type(np.squeeze(b), np.bool) assert_type(np.squeeze(f4), np.float32) assert_type(np.squeeze(f), npt.NDArray[Any]) assert_type(np.squeeze(A...
Review this code and list any quality issues.
[ { "issue": "these are all the same, so something like\r\n\r\n```\r\n_Indices: TypeAlias = tuple[np.ndarray[tuple[int], np.dtype[np.intp]], ...]\r\n```\r\n\r\ncould simplify things a bit.", "severity": "major", "line": 26 } ]
1
python
session = async_get_clientsession(self.hass) webpusher = WebPusher( cast(dict[str, Any], info["subscription"]), aiohttp_session=session ) endpoint = urlparse(subscription["endpoint"]) vapid_claims = { "sub": f"mailto:{self._vapid_email}", ...
Review this code and list any quality issues.
[ { "issue": "Now `_push_message` became async, the call to `save_json` is now a blocking call on the event loop (it does blocking file I/O).", "severity": "minor", "line": 26 } ]
1
python
geoms_state=geoms_state, rigid_global_info=rigid_global_info, static_rigid_sim_config=static_rigid_sim_config, contact_island_state=contact_island_state, ) func_update_acc( update_cacc=False, dofs_state=dofs_state, links_info=links_info, links_state=links_...
Review this code and list any quality issues.
[ { "issue": "Do not add dedicated clear ingredients kernel. This will significantly affect simulation performance. Just add the clearing code in `func_update_force` kernel, at the very end.", "severity": "major", "line": 26 } ]
1
python
from matplotlib.colors import Colormap def test_cm_stub_matches_runtime_colormaps(): runtime_cm = plt.cm runtime_cmaps = { name for name, value in vars(runtime_cm).items() if isinstance(value, Colormap) } cm_pyi_path = Path(__file__).parent.parent / "cm.pyi" assert cm_pyi_...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n \"No colormaps found in cm.pyi\"\r\n```\r\nI‘d leave out the question here as well. It‘s natural to look into the file if we claim something is not found in there.", "severity": "minor", "line": 26 } ]
1
python
keys: Sequence[Any], mrs: Sequence[MemoryRegion], batch_size: int, ) -> Sequence[Sequence[Tuple[bytes, MemoryRegion]]]: lists: List[List[Tuple[bytes, MemoryRegion]]] = [] for key, mr in zip(keys, mrs): if len(lists) == 0 or len(lists[-1]) >= batch_size: li...
Review this code and list any quality issues.
[ { "issue": "Here, if error occurs when we register memory, it seems we still go to self.conn.mget?", "severity": "major", "line": 26 } ]
1
python
) -> bool: return self.run_and_wait( get_user_notification_preference(user_id) ).preferences.get(event_type, True) def _parse_message(self, message: str) -> NotificationEvent | None: try: event = NotificationEventDTO.model_validate_json(message) model = N...
Review this code and list any quality issues.
[ { "issue": "Why are we doing this? What’s the use case here rather than looking up by their id", "severity": "minor", "line": 26 } ]
1
python
schemas = [] for tool_name, endpoint_name in self.tool_to_endpoint.items(): block_fn = self.get_block_fn_from_endpoint_name(endpoint_name) assert block_fn is not None and block_fn.fn is not None # noqa: S101 description, parameters, returns = utils.get_function_description( ...
Review this code and list any quality issues.
[ { "issue": "I think changing the return format of this JSON because the Hugging Face MCP server uses this endpoint to get the schema for MCP Spaces without needing to establish an SSE connection. @evalstate this change would be problematic, yes?\r\n\r\n@freddyaboulton can we just do this logic in the frontend i...
1
python
total = 0 with self.harvester.plot_manager: self.harvester.log.debug("new_signage_point_harvester lock acquired") for try_plot_filename, try_plot_info in self.harvester.plot_manager.plots.items(): # Passes the plot filter (does not check sp filter yet though, since we hav...
Review this code and list any quality issues.
[ { "issue": "this is similar to what we do inside is_v1_phased_out right ?\ni think we should consolidate", "severity": "minor", "line": 26 } ]
1
python
}, }, { # iframe embed 'url': 'http://www.ceskatelevize.cz/porady/10614999031-neviditelni/21251212048/', 'only_matching': True, }] def _real_extract(self, url): playlist_id = self._match_id(url) parsed_url = compat_urllib_parse_urlparse(url) webpage = self._d...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n hash = self._download_webpage(self._IFRAME_HASH_URL, playlist_id)\r\n webpage = self._download_webpage(self._IFRAME_URL, playlist_id, query={'hash': hash, 'origin': 'iVysilani', 'autoStart': 'true', 'IDEC': idec})\r\n```\r\n\r\nAlso, since `_IFRAME_HASH_URL` a...
1
python
run_training(dataset_name_or_id=self.dataset_name_or_id, configuration=config, fold=fold, **kwargs) else: run_training( dataset_name_or_id=self.dataset_name_or_id, configuration=config, fold=fold, num_gpus=len(gpu_id), *...
Review this code and list any quality issues.
[ { "issue": "~~Should `trainer_class_name` be passed to `run_training`?~~\r\n\r\nPlease ignore this comment.", "severity": "minor", "line": 26 } ]
1
python
kwargs : Any Additional arguments to be passed to :class:`Axes`. .. note:: If :attr:`x_length` or :attr:`y_length` are not defined, the plane automatically adjusts its lengths based on the :attr:`x_range` and :attr:`y_range` values to set the unit_size to 1. Examples -------- .. manim...
Review this code and list any quality issues.
[ { "issue": "I think it's a little odd to include these parameters since they don't really have any effect on the scene. It would be a little more concise if this was removed here. Someone who's just trying to get a hold of what `NumberPlane` does would have to parse what this means.", "severity": "minor", ...
1
python
Authenticated git URL if credentials are available, otherwise regular HTTPS URL """ try: repository = await self.verify_repo_provider( repo_name, is_optional=is_optional ) except AuthenticationError: raise Exception('Git provider authentication...
Review this code and list any quality issues.
[ { "issue": "```suggestion\n allow_insecure = bool(os.environ.get('ALLOW_INSECURE_GIT_ACCESS', False))\n```", "severity": "minor", "line": 26 } ]
1
python
def is_offset_reached( start: datetime.datetime, offset_time: datetime.timedelta ) -> bool: """Have we reached the offset time specified in the event title.""" if offset_time == datetime.timedelta(): return False return start + offset_time <= dt_util.now(start.tzinfo) class CalendarEntityDescr...
Review this code and list any quality issues.
[ { "issue": "```suggestion\n _attr_initial_color: str | None\n```", "severity": "minor", "line": 26 } ]
1
python
self.base_model = base_model self.evaluator: Evaluator = evaluator self.applied_mutators = applied_mutators self.strategy = strategy self._dispatcher = None self._dispatcher_thread = None def _run_strategy(self, base_model_ir: Model, applied_mutators: List[Mutator]) -> None...
Review this code and list any quality issues.
[ { "issue": "expanduser should be handled in canonicalize.", "severity": "minor", "line": 26 } ]
1
python
def construct(self): text = Tex("Alice and Bob").scale(3) self.add(text) self.play(Unwrite(text, reverse=False)) """ def __init__( self, vmobject: VMobject, rate_func: Callable[[float], float] = linear, reverse: bool = True, ...
Review this code and list any quality issues.
[ { "issue": "Not sure whether I understand this comment, it could probably be removed.", "severity": "minor", "line": 26 } ]
1
python
def test_multi_trial(): evaluator_kwargs = { 'max_epochs': 1 } to_test = [ # (model, evaluator) _mnist_net('simple', evaluator_kwargs), _mnist_net('simple_value_choice', evaluator_kwargs), _mnist_net('value_choice', evaluator_kwargs), _mnist_net('repeat', eva...
Review this code and list any quality issues.
[ { "issue": "experiment can quickly release the port after `stop()`? (I don't know, maybe `local` don't have to wait for the port release)", "severity": "minor", "line": 26 } ]
1
python
'linear': 'is_live', 'live': 'is_live', }.get(response.get('type')) audio_quality_func = qualities(('1', '0')) formats, subtitles = [], {} drm_formats = False for source in traverse_obj(response, ('sources', lambda _, v: v['src'])): if source.get('key_sy...
Review this code and list any quality issues.
[ { "issue": "do we need `geo_verification_headers` here too?", "severity": "minor", "line": 26 } ]
1
python
net_id=None, meta_file=None, key_in_ckpt="", use_trace=False, input_shape=None, converter_kwargs={}, ) parser = ConfigParser() parser.read_config(f=config_file_) meta_file_ = ( os.path.join(bundle_root_, "configs", "metadata.json") if meta_file_ is None ...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n raise ValueError(f'Network definition \"{net_id_}\" cannot be found in \"{config_file_}\", specify name with argument \"net_id\".') from e\r\n```", "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 ...
Review this code and list any quality issues.
[ { "issue": "nit: it would be great to a have more detailed description.", "severity": "minor", "line": 26 } ]
1
python
class Gunicorn(_Network): _icon = "gunicorn.png" class Haproxy(_Network): _icon = "haproxy.png" class Internet(_Network): _icon = "internet.png" class Istio(_Network): _icon = "istio.png" class Jbossas(_Network): _icon = "jbossas.png" class Jetty(_Network): _icon = "jetty.png" class ...
Review this code and list any quality issues.
[]
0
python
raise SyntaxError( f"Invalid regular expression provided: '{regex_search}'" ) from exc return [dset_name for dset_name in self._data_sets if pattern.search(dset_name)] def exists_in_catalog(self, dataset_name: str) -> bool: """Check if a dataset exists in the catalog as ...
Review this code and list any quality issues.
[ { "issue": "I think this comment is left over from the previous implementation and should be removed.", "severity": "minor", "line": 26 } ]
1
python
# coding: utf-8 from .common import InfoExtractor class CableAVIE(InfoExtractor): _VALID_URL = r'https://cableav\.tv/(?P<id>[a-zA-Z0-9]+)/' _TESTS = [{ 'url': 'https://cableav.tv/lS4iR9lWjN8/', 'md5': '7e3fe5e49d61c4233b7f5b0f69b15e18', 'info_dict': { 'id': 'lS4iR9lWjN8', ...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n _VALID_URL = r'https://cableav\\.tv/(?P<id>[a-zA-Z0-9]+)'\r\n```", "severity": "minor", "line": 6 } ]
1
python
(True, answer_evaluator_int, "output"), (False, answer_evaluator_int, "output"), (True, answer_evaluator_int_dict, "42"), (False, answer_evaluator_int_dict, "42"), ], ) def test_evaluate_python_function(self, data_file, use_pf_client, function, column): # data...
Review this code and list any quality issues.
[]
0
python
spatial_border: specified size for every spatial border. it can be 3 shapes: - single int number, pad all the borders with the same size. - length equals the length of image shape, pad every spatial dimension separately. for example, image shape(CHW) is [1, 4, 4], spat...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n Padd.__init__(self, keys, padder=padder, mode=mode, allow_missing_keys=allow_missing_keys, lazy=lazy)\r\n```\r\nSame", "severity": "minor", "line": 26 } ]
1
python
return self.connection def check_connection(self) -> StatusResponse: """ Check connection to the handler. Returns: HandlerStatusResponse """ response = StatusResponse(False) try: api_session = self.connect() shopify.ShopifyResour...
Review this code and list any quality issues.
[ { "issue": "As I understand here a rest api error is checked. \r\nIt is better not convert exception to string (and check substrings) but check attributes and types.\r\nHere you can check \r\n```\r\nfrom pyactiveresource.connection import Error\r\nif isinstance(e, Error):\r\n ...\r\n```", "severity": "min...
1
python
WalletStateTransition( pre_block_balance_updates={ "xch": { "<=#spendable_balance": -5, "<=#max_send_amount": -5, ">=#pending_change": 1, # any amount increase "pending_coin_removal_count...
Review this code and list any quality issues.
[]
0
python
def data_received(self, t): if self.test_type == TestType.EARLY_KEY_RESPONSE: # check that data can be received on recvbuf only when mismatch from V1_PREFIX happens (magic_sent = True) assert self.v2_state.can_data_be_received and self.v2_state.magic_sent else: super(...
Review this code and list any quality issues.
[ { "issue": "do you think it would make sense to use `test_earlykeyresponse` here and then make `test_v2disconnection` into `run_test`", "severity": "minor", "line": 26 } ]
1
python
hls_url = hydration['base_url_hls'].replace('[node:field_asset_id]', asset_id) else: hls_url = traverse_obj(hydration, ('channel', 'hls')) metadata = traverse_obj(hydration, { 'title': 'title', 'description': 'description', 'thumbnail': ((('channel', 'ima...
Review this code and list any quality issues.
[ { "issue": "using transformations like this is more readable imo\r\n```suggestion\r\n 'episode_number': ('chapter_number', {float_or_none}, {int_or_none}),\r\n 'season_number': ('season', {int_or_none}),\r\n```\r\nand `season_number` needs `int_or_none`", "sever...
1
python
provider_uri = "~/.qlib/qlib_data/cn_data" # target_dir qlib.init(provider_uri=provider_uri, region=REG_CN) def testCSI300(self): close_p = D.features(D.instruments('csi300'), ['$close']) size = close_p.groupby('datetime').size() cnt = close_p.groupby('datetime').count() si...
Review this code and list any quality issues.
[ { "issue": "Why adding the abs in this line?", "severity": "minor", "line": 26 } ]
1
python
Frequency of appearance of the letters. .. tip:: This is currently only possible for class:`~.Text` and not for class:`~.MathTex` """ def __init__( self, text: Text, suspend_mobject_updating: bool = False, int_func: Callable[[np.ndarray], np.ndarray] = np.ceil, ...
Review this code and list any quality issues.
[ { "issue": "Personally I'd prefer a shorter error message (e.g., `f\"The text mobject {text} does not seem to contain any characters.\"`) and remove the comment about the video file (which is a consequence the user does not strictly need to know about).", "severity": "minor", "line": 26 } ]
1
python
parent = NoFields() child = NullableFields(auto_field=parent, integer_field=88) NoFields.objects.bulk_create([parent]) NullableFields.objects.bulk_create([child]) child = NullableFields.objects.get(integer_field=88) self.assertEqual(child.auto_field, parent) def test_unsaved...
Review this code and list any quality issues.
[]
0
python
) tm.assert_frame_equal(result, expected, check_dtype=False) assert str(expr) == expected_str def test_invalid() -> None: df = pd.DataFrame({"a": [1, 2], "b": [3, 4]}) with pytest.raises(ValueError, match=r"did you mean one of \['a', 'b'\] instead"): df.assign(c=pd.col("c").mean()) df = pd...
Review this code and list any quality issues.
[]
0
python
cls.tmpdir.getpath( 'example_data/expected_perf/%s' % pd.__version__.replace('.', '-'), ), serialization='pickle', ) @parameter_space( example_name=sorted(EXAMPLE_MODULES), benchmark_returns=[read_checked_in_benchmark_data(), None] ...
Review this code and list any quality issues.
[ { "issue": "should we precompute this in the init like `self.no_benchmark_expected_perf`?", "severity": "minor", "line": 26 } ]
1
python
------- list[float] List containing possible parameters for the given point on the given bezier curve. This usually only contains one or zero elements, but if the point is, say, at the beginning/end of a closed loop, may return a list with more than 1 ...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n\r\n control_points = np.array(control_points)\r\n```", "severity": "minor", "line": 26 } ]
1
python
unique_id = usb_unique_id_from_service_info(discovery_info) await self.async_set_unique_id(unique_id) self._abort_if_unique_id_configured( updates={CONF_DEVICE: discovery_info.device} ) discovery_info.device = await self.hass.async_add_executor_job( usb.get_seri...
Review this code and list any quality issues.
[ { "issue": "The USB discovery flow doesn't validate the dongle path before presenting the confirmation dialog. While validation does occur later when async_step_manual is called, it would provide a better user experience to validate the discovered device immediately and abort with \"cannot_connect\" if the devi...
1
python
def test_client_caching(self): """Test that clients are cached via @cached_property""" # Get clients multiple times sync1 = self.client.sync_client sync2 = self.client.sync_client async1 = self.client.async_client async2 = self.client.async_client # Should return...
Review this code and list any quality issues.
[]
0
python
Args: input_value: The input number to process Returns: List of results from parallel execution """ result = await parallel_test_graph.run( state=GraphState(), inputs=input_value, ) return result async def test_beta_graph_paralle...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n output = await client.execute_workflow(\r\n```", "severity": "minor", "line": 26 } ]
1
python
'url': 'https://video.nest.com/live/4fvYdSo8AX', 'only_matching': True, }] _WEBPAGE_TESTS = [{ 'url': 'https://www.pacificblue.biz/noyo-harbor-webcam/', 'info_dict': { 'id': '4fvYdSo8AX', 'ext': 'mp4', 'title': 'startswith:Outside ', 'alt_t...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n 'https://video.nest.com/api/dropcam/cameras.get_by_public_token',\r\n video_id, query={'token': video_id})\r\n```", "severity": "minor", "line": 26 } ]
1
python
Get a form Field for a database Field that has declared choices. """ # If the field is named as a radio_field, use a RadioSelect if db_field.name in self.radio_fields: # Avoid stomping on custom widget/choices arguments. if "widget" not in kwargs: kwargs["...
Review this code and list any quality issues.
[ { "issue": "I'm not sure this is realistic, wouldn't we have failed well before this?", "severity": "critical", "line": 26 } ]
1
python
# Copyright (C) 2021 Mandiant, Inc. All Rights Reserved. # 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: [package root]/LICENSE.txt # Unless required by applicable law or agreed to in writing...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n -t TAG, --tag TAG filter on rule meta field values (ruleid)\r\n \r\nRequires:\r\n - sarif_om v1\r\n - jschema_to_python v1\r\n```", "severity": "minor", "line": 18 } ]
1
python
("condition", "overcast clouds"), ], test_mock={ "get_request": lambda url, json: { "main": {"temp": 21.66, "humidity": 32}, "weather": [{"description": "overcast clouds"}], } }, ) def run(self, inpu...
Review this code and list any quality issues.
[ { "issue": "move to /jina folder and reuse the _auth.py there", "severity": "critical", "line": 26 } ]
1
python
with pytest.raises(ValueError): group.addoption("-x", action="store_true") assert len(group.options) == 0 group._addoption("-x", action="store_true") assert len(group.options) == 1 def test_parser_addoption(self, parser: parseopt.Parser) -> None: group = parser.getgroup(...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n # Warning ignore because of:\r\n # https://github.com/python/cpython/issues/85308\r\n # Can be removed once Python<3.12 support is dropped.\r\n @pytest.mark.filterwarnings(\"ignore:'encoding' argument not specified\")\r\n```", "severity": "minor", "line": 26 }...
1
python
from controllers.web import web_ns from controllers.web.error import ( AppUnavailableError, AudioTooLargeError, CompletionRequestError, NoAudioUploadedError, ProviderModelCurrentlyNotSupportError, ProviderNotInitializeError, ProviderNotSupportSpeechToTextError, ProviderQuotaExceededError...
Review this code and list any quality issues.
[ { "issue": "This import path is inconsistent with other web controllers. All other files in the `controllers/web/` directory use the absolute import `from controllers.web.wraps import WebApiResource`. The relative import `from ..web.wraps` is unnecessarily going up one level and back down to the same directory....
1
python
n_dofs = entities_info.n_dofs[i_e] # Step 1: Solve w st. L^T @ w = y for i_d_ in range(n_dofs): i_d = entity_dof_end - i_d_ - 1 out[i_d, i_b] = vec[i_d, i_b] for j_d in range(i_d + 1, entity_dof_end): ou...
Review this code and list any quality issues.
[]
0
python
ext = 'm4a' formats = [{ 'url': url, 'ext': ext, 'format_id': 'audio', 'vcodec': 'none', }] subtitles = {} else: if ride_data.get('vod_stream_url'): url = 'https://members.onepeloton.c...
Review this code and list any quality issues.
[ { "issue": "I still don't understand what this code is supposed to do", "severity": "minor", "line": 26 } ]
1
python
Resolves to a tuple of available ``ImageWriter`` in ``SUPPORTED_WRITERS`` according to the filename extension key ``ext_name``. Args: ext_name: the filename extension of the image. As an indexing key it will be converted to a lower case string. error_if_not_found: whether to raise a...
Review this code and list any quality issues.
[ { "issue": "I would suggest making this a global variable at the top of the file as `RECOMMENDED_PACKAGES`, this would allow future code to possibly add items here.", "severity": "minor", "line": 26 } ]
1
python
self.particles_reordered[i_p, i_b].drho = drho @ti.func def _task_divergence_solver_iteration(self, i, j, ret: ti.template(), i_b): # Fluid neighbors b_j = self.particles_reordered[j, i_b].drho k_j = b_j * self.particles_reordered[j, i_b].dfsph_factor k_sum = ( self....
Review this code and list any quality issues.
[]
0
python
.. describe:: bool(b) Returns whether any flag is set to ``True``. Attributes ---------- value: :class:`int` The raw value. You should query flags via the properties rather than using this raw value. """ @flag_value def contains_explicit_media(self): """:cl...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\nclass InviteFlags(BaseFlags):\r\n```\r\nkinda unnecessary imo", "severity": "minor", "line": 26 } ]
1
python
).values_list("group", flat=True) q |= Q(groups__in=add_groups) & Q(pk=instance.owner_id) return ( get_user_model() ._default_manager.filter(is_active=True) .filter(q) .distinct() ) def users_with_permission_for_instance( self, a...
Review this code and list any quality issues.
[ { "issue": "As mentioned in https://github.com/wagtail/wagtail/issues/12628#issuecomment-2559800970, while we're here, we should also add the `bulk_delete` permission here to be consistent with other \"user has any page permission\" checks", "severity": "critical", "line": 26 } ]
1
python
html, escape_value=False) def get_elements_by_attribute(*args, **kwargs): """Return the content of the tag with the specified attribute in the passed HTML document""" return [content for content, _ in get_elements_text_and_html_by_attribute(*args, **kwargs)] def get_elements_html_by_attribute(*args, **kwarg...
Review this code and list any quality issues.
[ { "issue": "Would this not work?\r\n```suggestion\r\n # Do not use re.verbose since value may contain unescaped spaces\r\n partial_element_re = (\r\n r'''<(?P<tag>[a-zA-Z0-9:._-]+)(?:\\s(?:[^>\"']|\"[^\"]*\"|'[^']*')*)?\\s%(attribute)s\\s*=\\s*(?P<_q>['\"]%(vqo)s)(?:%(value)s)(?P=_q)'''\r\n ...
1
python
delete_bad_runs(args.run_paths, delete_bad_runs_config) else: raise ValueError("Run paths not provided for run cleaning") else: raise NotImplementedError(args.op) def _add_cached_path_r2_client(r2_account_id: str): endpoint_url = f"https://{r2_account_id}.r2.cloudflarestorage.com" ...
Review this code and list any quality issues.
[ { "issue": "How does authentication work for this? It reads environment variables? Then I assume there is no way to have both R2 and S3 work at the same time, because they read auth information from the same place?", "severity": "critical", "line": 26 } ]
1
python
downloader.add_option( '-r', '--limit-rate', '--rate-limit', dest='ratelimit', metavar='RATE', help='Maximum download rate in bytes per second, e.g. 50K or 4.2M') downloader.add_option( '--throttled-rate', dest='throttledratelimit', metavar='RATE', help='Minimum downl...
Review this code and list any quality issues.
[]
0
python
'thumbnail': r're:(?:https?://)(?:www\.)?musescore\.com/.*\.png[^$]+', 'uploader': 'ClassicMan', 'creator': 'Ludwig van Beethoven (1770–1827)', } }] def _real_extract(self, url): webpage = self._download_webpage(url, None) url = self._og_search_url(webpage) or ur...
Review this code and list any quality issues.
[ { "issue": "I don't think this is accurate extraction; it should give you `Download and print in PDF or MIDI free sheet music for <title> Theme by <author of song> arranged by <uploader> for <instrument> (<formation>)` according to its HTML. Using `_search_json_ld` is the easiest way I think", "severity": "...
1
python
node0, node1, node2 = self.nodes self.wallet = MiniWallet(test_node=node0) if self.is_bdb_compiled(): self.import_deterministic_coinbase_privkeys() self.check_addmultisigaddress_errors() self.log.info('Generating blocks ...') self.generate(self.wallet, 149) ...
Review this code and list any quality issues.
[ { "issue": "Curious: Is it common to test the correctness of a test utility function against the response from the bitcoin node?", "severity": "major", "line": 26 } ]
1
python
from .parquet import parquet from .spark import spark from .sql import sql # noqa F401 from .text import text def _hash_python_lines(lines: List[str]) -> str: filtered_lines = [] for line in lines: line = re.sub(r"#.*", "", line) # remove comments if line: filtered_lines.append(l...
Review this code and list any quality issues.
[ { "issue": "I think you can remove this\r\n\r\n```suggestion\r\n```\r\n\r\nThe packaged modules listed are are to be used with `load_dataset`. But I don't think we should recommend/implement something like\r\n```python\r\nload_dataset(\"spark\", df=df)\r\n```\r\nespecially given that `load_dataset` returns a di...
1
python
@csp_report_only_override({}) def technical_404_response(request, exception): """Create a technical 404 error response. `exception` is the Http404.""" try: error_url = exception.args[0]["path"] except (IndexError, TypeError, KeyError): error_url = request.path_info[1:] # Trim leading slash ...
Review this code and list any quality issues.
[ { "issue": "Using an empty tuple will avoid the slight cost of creating a list in the path where `tried` is empty.\r\n```suggestion\r\n for inner_tried in itertools.chain(*tried or ()):\r\n```", "severity": "minor", "line": 26 } ]
1
python
"pandas", # for downloading datasets over HTTPS "requests>=2.19.0", # progress bars in download and scripts "tqdm>=4.62.1", # for fast hashing "xxhash", # for better multiprocessing "multiprocess", # to get metadata of optional dependencies such as torch or tensorflow for Python vers...
Review this code and list any quality issues.
[]
0
python
assert set(ev["data"] for ev in events) == set(keys) keys = await produce_expiring_keys(async_client) await async_client.config_set("notify_keyspace_events", "") with pytest.raises(asyncio.TimeoutError): async with async_timeout.timeout(1): await collect_expiring_events(pclient, keys) ...
Review this code and list any quality issues.
[ { "issue": "There is `DfInstance.metrics` that is even async, you just need to get the `df_server` fixture", "severity": "minor", "line": 26 } ]
1
python
'subtitles': {}, 'age_limit': 0, 'webpage_url': 'https://areena.yle.fi/1-2158940' } } ] def generate_api_headers( self): """Prepare requested site header""" headers = { 'origin': 'https://areena.yle.fi', 're...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n video_id, headers=real_headers)\r\n```\r\nit is the default", "severity": "minor", "line": 26 } ]
1
python
current_height = node.getblock(node.getbestblockhash())['height'] # Create a fork somewhere below our current height, invalidate the tip # of that fork, and then ensure that waitforblockheight still # works as expected. # # (Previously this was broken based on setting # ...
Review this code and list any quality issues.
[ { "issue": "In commit \"rpc: add test for waitforblock and waitfornewblock\" (a18cb7adf192bae481c879fe865f1c159b2b8622)\r\n\r\nI don't think I understand what this test is checking for. Maybe there could be a comment that describes what the test setup is doing what a failed result might look like. It seems like...
1
python
compression: Optional[str] = None, max_attempts: int = 1, initial_backoff: float = 0.5, max_backoff: float = 0.1, backoff_multiplier: float = 1.5, results_in_order: bool = False, stream: bool = False, **kwargs, ): try: self.compression = ( ...
Review this code and list any quality issues.
[ { "issue": "Small issue that we can fix later. This default value is different than the default value in the `.post` method. I forgot to update the default here last time.", "severity": "minor", "line": 26 } ]
1
python
class TestSupersetAppInitializer: @patch("superset.initialization.logger") def test_init_app_in_ctx_calls_sync_config_to_db(self, mock_logger): """Test that initialization calls app.sync_config_to_db().""" # Setup mock_app = MagicMock() mock_app.config = { "SQLALCHEMY...
Review this code and list any quality issues.
[]
0
python
"django.contrib.contenttypes", "admin_scripts", ] settings_file.write("INSTALLED_APPS = %s\n" % apps) if sdict: for k, v in sdict.items(): settings_file.write("%s = %s\n" % (k, v)) def _ext_backend_paths(self): ...
Review this code and list any quality issues.
[ { "issue": "If black exists in multiple places on the path, we'd have to iterate this algorithm to keep patching it out. Not sure it's worth it.", "severity": "minor", "line": 26 } ]
1
python
raise fastapi.HTTPException(status_code=400, detail="Parent message is not an assistant message") if msg_dict[parent_id].state != inference.MessageState.complete: raise fastapi.HTTPException(status_code=400, detail="Parent message is not complete") message = models.DbMessage( ...
Review this code and list any quality issues.
[]
0
python
if current_size_bytes > target_size_bytes: resize_factor = (target_size_bytes / current_size_bytes) ** 0.5 new_width = math.floor(image.width * resize_factor) new_height = math.floor(image.height * resize_factor) resized_image = image.resize((new_width, new_height)) ...
Review this code and list any quality issues.
[ { "issue": "why is there a default for max_image_size_mb? is this for the moderation API?", "severity": "minor", "line": 26 } ]
1
python
disable_dropout_in_model(model) if ref_model is not None: disable_dropout_in_model(ref_model) self.finetuning_args = finetuning_args self.reference_free = False self.use_dpo_data_collator = True # hack to avoid warning self.generate_during_eval = False # di...
Review this code and list any quality issues.
[ { "issue": "```\n # trl\n # Not all losses require a KL calculation\n self.calculate_KL = True\n if self.loss_type in [\"apo_zero_unpaired\"]:\n self.calculate_KL = False\n```\n\nPlease comment why it's set to True for others to understand the difference between trl and LF...
1
python
"""A selection of rate functions, i.e., *speed curves* for animations. Please find a standard list at https://easings.net/. Here is a picture for the non-standard ones .. manim:: RateFuncExample :save_last_frame: class RateFuncExample(Scene): def construct(self): x = VGroup() f...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n t_range=[0, 1, .01],\r\n```", "severity": "minor", "line": 23 } ]
1
python
self._run_script(request.rerun_data) request = self._requests.on_scriptrunner_ready() if request.type != ScriptRequestType.STOP: raise RuntimeError( f"Unrecognized ScriptRequestType: {request.type}. This should never happen." ) # Send a SHUTDOWN even...
Review this code and list any quality issues.
[]
0
python
# but it causes an issue with readonly files on windows # see: https://bugs.python.org/issue26660. # So on error, we will attempt to clear the readonly bits and re-attempt the cleanup shutil.rmtree(tmpdir, onerror=_remove_readonly) # Obtain config, either from a file or from interactive user prompts. ...
Review this code and list any quality issues.
[ { "issue": "Is it true that it will be shown when using with starter? Where no tools allowed?", "severity": "minor", "line": 26 } ]
1
python
sys_msg = traverse_obj(video, ('sys', 'msg')) if sys_msg: self.report_warning(sys_msg, video_id=video_id) if video.get('live') == 0: live_status = 'not_live' if video.get('livestream_has_dvr') is None else 'was_live' elif video.get('live') == 1: live_status =...
Review this code and list any quality issues.
[ { "issue": "sp\r\n```suggestion\r\n # With default query params returns m3u8 variants which are duplicates, without returns tar files\r\n```", "severity": "major", "line": 26 } ]
1
python
raise ValueError("Matrix has bad dimensions") return lambda point: np.dot(point, transposed_matrix) def get_piece_movement(self, pieces: list | tuple | np.ndarray): """ This method returns an animation that moves an arbitrary mobject in "pieces" to its corresponding .target value. ...
Review this code and list any quality issues.
[ { "issue": "i don't think that this is a good option. This might cause another errors in another part of the library. As far as i know during \"refactoring\" library should make as less changes as it is possible", "severity": "major", "line": 26 } ]
1
python
output_dtype = _find_matching_floating_dtype(a, weights, xp=xp) a = xp.astype(a, output_dtype) if weights is None: return (xp.mean if normalize else xp.sum)(a, axis=axis) weights = xp.astype(weights, output_dtype) sum_ = xp.sum(xp.multiply(a, weights), axis=axis) if not normalize: ...
Review this code and list any quality issues.
[ { "issue": "MIght be worth putting this into a helper function like we have is numpy namespace?", "severity": "major", "line": 26 } ]
1
python
raise ExtractorError('Could not find asset_id nor program playlist nor podcast episodes') return self.playlist_result([ self.url_result(episode['file'], url_transparent=True, **traverse_obj(episode, { 'title': 'title', 'description': (...
Review this code and list any quality issues.
[ { "issue": "`traverse_obj(..., {})` always returns a dict\r\n```suggestion\r\n entries = [\r\n self.url_result(\r\n urljoin(url, episode['slug']), url_transparent=True,\r\n **traverse_obj(season, {\r\n 'season': 'title',\r\n ...
1
python
# Flag to turn on/off fuzzy-matching which can be time consuming and # slow down plugins like `kedro-viz` if suggest: matches = difflib.get_close_matches( data_set_name, self._data_sets.keys() ) if matche...
Review this code and list any quality issues.
[ { "issue": "I think this definitely conflicts with `_suggest_resume_scenario`, can you try to test with a fail pipeline and see if it breaks it?", "severity": "critical", "line": 26 } ]
1
python
async_add_entities: AddConfigEntryEntitiesCallback, ) -> None: """Add sensors if new.""" ecowitt = entry.runtime_data def _new_sensor(sensor: EcoWittSensor) -> None: """Add new sensor.""" if sensor.stype not in ECOWITT_SENSORS_MAPPING: return # Ignore metrics that are n...
Review this code and list any quality issues.
[ { "issue": "```suggestion\n if sensor.key in _ROLLING_WINDOW_RAIN_COUNT_SENSORS:\n```", "severity": "minor", "line": 26 } ]
1
python
url = f'{self.BASE_URL}/search/repositories' params = { 'per_page': per_page, 'sort': sort, 'order': order, } if public: url_parts = query.split('/') if len(url_parts) < 4: return [] org = url_parts[3] ...
Review this code and list any quality issues.
[ { "issue": "Would this work locally (we only have installations in saas mode)? \n\nMaybe we still call `get_user_organizations()` when running locally?", "severity": "minor", "line": 26 } ]
1
python
"""Get the area within the region.""" return self.width * self.height @property def origin(self) -> Offset: """Get the start point of the region.""" return Offset(self.x, self.y) @property def size(self) -> Size: """Get the size of the region.""" return Size(sel...
Review this code and list any quality issues.
[]
0
python
xyxy = np.array(xyxy) if len(xyxy) > 0 else np.empty((0, 4)) for k in set(class_names): if k not in extended_classes: extended_classes.append(k) class_id = np.array( [extended_classes.index(class_name) for class_name in class_names] ) if with_masks: annotation = Dete...
Review this code and list any quality issues.
[ { "issue": "Let's drop that logic altogether.", "severity": "minor", "line": 26 } ]
1
python
if not is_uniformly_triggered[i]: # One anchor lies to the left of the line # whilst another lies to the right continue tracker_state = has_any_left_trigger[i] if tracker_id not in self.tracker_state: self.tracker_state[tracker_id]...
Review this code and list any quality issues.
[ { "issue": "We prefer methods like this to live in `utils.py`.\r\n\r\nPlease move it there and remove leading underscore `_`.", "severity": "minor", "line": 26 } ]
1