language
string
code-snippit
string
instruction
string
flaws
list
flaw_count
int64
python
doorbell: Camera, hass_client: ClientSessionGenerator, hass_ws_client: WebSocketGenerator, ) -> None: """Test RTSP disabled warning if camera is read-only and it is fixed.""" for channel in doorbell.channels: channel.is_rtsp_enabled = False for user in ufp.api.bootstrap.users.values(): ...
Review this code and list any quality issues.
[]
0
python
(-1)**(2*n)*cos(x + y) """ from sympy.functions.elementary.trigonometric import sin, cos arg = expr.args[0] # The logic is to separate integer multiples of pi/2 to apply trigonometric reduction formulas. k_terms = [] # To store the integral multiples of pi/2. rem_terms = [] # To store the remai...
Review this code and list any quality issues.
[ { "issue": "It would be better to just use `sum()` here", "severity": "minor", "line": 26 } ]
1
python
def _get_ha_mode(vs_mode: str) -> str | None: ha_mode = VS_TO_HA_MODE_MAP.get(vs_mode) if ha_mode is None: _LOGGER.warning("Unknown mode '%s'", vs_mode) return ha_mode class VeSyncHumidifierHA(VeSyncBaseEntity[VeSyncHumidifier], HumidifierEntity): """Representation of a VeSync humidifier.""" ...
Review this code and list any quality issues.
[ { "issue": "self.device is already being set in the base entity. I think it already works now that the generic type is merged", "severity": "minor", "line": 26 } ]
1
python
Args: byor_key: The BYOR key to verify user_id: The user ID for logging purposes Returns: True if the key is valid, False otherwise """ if not (LITE_LLM_API_URL and byor_key): return False try: async with httpx.AsyncClient( verify=httpx_verify_option...
Review this code and list any quality issues.
[ { "issue": "would we get a response code like this or would a `HTTPStatusCode` error be thrown instead?", "severity": "minor", "line": 26 } ]
1
python
raise ValueError("Failed to get a response from the LLM.") @staticmethod def string_to_list(string): """ Converts a string representation of a list into an actual Python list object. """ logger.info("Converting string to list") logger.info(f"Input string: {string}") ...
Review this code and list any quality issues.
[ { "issue": "Why can't we use double quote & json.loads ?", "severity": "minor", "line": 26 } ]
1
python
test_body: ConnectionBody, ) -> ConnectionTestResponse: """ Test an API connection. This method first creates an in-memory transient conn_id & exports that to an env var, as some hook classes tries to find out the `conn` from their __init__ method & errors out if not found. It also deletes the conn...
Review this code and list any quality issues.
[ { "issue": "Not sure would it be better to introduce a new query parameter to distinguish whether to use credentials from the existed connection?\n\nOr maybe we could change the Frontend that only passing `connection_id` and `conn_type`, and the Backend will only fill-up the credentials if `password` and `extr...
1
python
def make_car(producer, description, speed): return TestCar(producer=producer, description=description, speed=speed) CARS = [ make_car("BMW", "Very fast and elegant", 200), make_car("Audi", "Fast & stylish", 170), make_car("Mercedes", "High class but expensive!", 150), make_c...
Review this code and list any quality issues.
[ { "issue": "The wait loop assumes `client.ft(index_name).info()` will always succeed once `FT._LIST` returns the index name, but Dragonfly’s `FT._LIST` returns names from only a single shard and `FT.INFO` errors if *any* shard doesn’t have the index yet. This can still flake during async index creation (the sam...
1
python
# create and build the scene scene = gs.Scene( show_viewer=show_viewer, ) hand = scene.add_entity( gs.morphs.URDF( file="urdf/panda_bullet/hand.urdf", fixed=True, ), ) scene.build() assert scene.rigid_solver.n_equalities == 1 qvel = scene.rigi...
Review this code and list any quality issues.
[ { "issue": "Just pick the usual franka robot example for this. No need to use a drone and franka is the go-to robot for this kind of generic tests.", "severity": "minor", "line": 26 } ]
1
python
video_id = self._match_id(url) return { '_type': 'url_transparent', 'ie_key': 'ThePlatform', 'url': smuggle_url( 'http://link.theplatform.com/s/ExhSPC/media/guid/2655402169/%s?mbr=true&formats=MPEG4,FLV,MP3' % video_id, { 'force_smil_url': ...
Review this code and list any quality issues.
[ { "issue": "The original comment above says the geo-restriction is bypassable?", "severity": "minor", "line": 26 } ]
1
python
'ext': 'm4a', } }, { 'url': 'https://m.qtfm.cn/vchannels/378005/programs/23023573/', 'md5': '2703120b6abe63b5fa90b975a58f4c0e', 'info_dict': { 'id': '23023573', 'title': '【睡前消息488】重庆山火之后,有图≠真相', 'channel_id': '378005', 'channel_name': '...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n 'channel': traverse_obj(info, ('ProgramStore', 'channelInfo', 'title')),\r\n 'uploader': traverse_obj(info, ('ProgramStore', 'podcasterInfo', 'podcaster', 'nickname')),\r\n```", "severity": "minor", "line": 26 } ]
1
python
[[0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0]], ], [[1, 0, 0, 1], [0, 1], [[1], [0], [0], [1]]], [[1, 0, 2, 1], [0, 1, 2], [[0, 1, 0], [1, 0, 0], [0, 0, 1], [0, 1, 0]]], ], ) @pytest.mark.parametrize( "array_namespace, device_, dtype_name", yield_namespace_device_dtype_combinations() ) def...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n # `sparse_output=True` is not allowed for non-NumPy namespaces\r\n```", "severity": "minor", "line": 26 } ]
1
python
_logger.info('Starting web server...') _check_rest_server(port, url_prefix=url_prefix) Experiments().add_experiment( exp_id, port, start_time, nni_manager_args.mode, config.experiment_name, pid=proc.pid, logDir=config.e...
Review this code and list any quality issues.
[ { "issue": "Suggest `.latest` so that it's not flooded by tons of folders in `nni-experiments`, and people can find it with a first glance of `ls -a`.", "severity": "minor", "line": 26 } ]
1
python
assert isinstance(hf_result, str), debug_tag unique_text_pieces = test_convo_tuple.unique_text_pieces assert len(unique_text_pieces) == 3 expected_lines = ( [ "<|user|>", f"{unique_text_pieces[0]}<|end|>", "<|assistant|>", ...
Review this code and list any quality issues.
[]
0
python
}, }] def _real_extract(self, url): video_id, display_id = self._match_valid_url(url).group('id', 'display_id') webpage = self._download_webpage(url, video_id) post = self._search_nextjs_data(webpage, video_id)['props']['pageProps']['ssr_data_posts'] content = self._parse_json(...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n 'timestamp': ((\r\n (('start_date', 'crdate'), {parse_iso8601(delimiter=' ')}),\r\n ('created_at', {parse_iso8601}),\r\n ), any),\r\n```", "severity": "minor", "line": 26 } ]
1
python
@sizeof.register_lazy("scipy") def register_spmatrix(): from scipy import sparse @sizeof.register(sparse.dok_matrix) def sizeof_spmatrix_dok(s): return s.__sizeof__() @sizeof.register(sparse.spmatrix) def sizeof_spmatrix(s): return sum(sizeof(v) for v in s.__dict__.values()) @siz...
Review this code and list any quality issues.
[ { "issue": "Is pyarrow.lib public? Or should this use `pa.Table`?\r\n\r\nsame question for `pa.lib.Column` below.", "severity": "minor", "line": 26 } ]
1
python
self.gguf_writer.add_token_shift_count(1) # required by llama.cpp, unused self.gguf_writer.add_head_count(0) @ModelBase.register("MaincoderForCausalLM") class MaincoderModel(TextModel): model_arch = gguf.MODEL_ARCH.MAINCODER def set_vocab(self): try: self._set_vocab_senten...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n```\r\nMy understanding is that `intermediate_size` vs `intermediate_size_mlp` is for MoEs, for dense models they are the same (and already set in this case).", "severity": "minor", "line": 26 } ]
1
python
) # [1, bs*padfree-len] text_padfree_positions = text_padfree_positions.long().unsqueeze(0).to(torch_device) padfree_inputs_dict["position_ids"] = torch.cat([text_padfree_positions, vision_padfree_positions])[ :, None, : ] if fa_kwarg...
Review this code and list any quality issues.
[]
0
python
if urllib.parse.urlparse(url).netloc in ['www.ntr.nl', 'ntr.nl']: player = self._download_json( 'https://www.ntr.nl/ajax/player/embed/%s' % video_id, video_id, 'Downloading player JSON', query={ 'parameters[elementId]': 'npo' + str(random.randint(0, 999)),...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n player = self._download_json(\r\n f'https://www.ntr.nl/ajax/player/embed/{video_id}', video_id,\r\n 'Downloading player JSON', query={\r\n 'parameters[elementId]': f'npo{random.randint(0, 999)}',\r\n 'pa...
1
python
def prepare_tensors(self): super().prepare_tensors() if self._experts is not None: # flatten `list[dict[str, Tensor]]` into `list[str]` experts = [k for d in self._experts for k in d.keys()] if len(experts) > 0: raise ValueError(f"Unprocessed experts:...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n self.gguf_writer.add_sliding_window(self.hparams[\"local_attention\"])\r\n if (sliding_window_pattern := self.hparams.get(\"global_attn_every_n_layers\")) is not None:\r\n self.gguf_writer.add_sliding_window_pattern(sliding_window_pattern)\r\n```", "sev...
1
python
'id': '5e5305c28f1409847cdc4520b6ad77cf', 'display_id': 'game-of-power-online', 'title': 'Game Of Power', 'duration': 1845, 'ext': 'mp4', 'description': 'Cops arrest Ashraf assuming a prostitute. But she gets away with her new identity, Leela Paswan. Maqsood d...
Review this code and list any quality issues.
[ { "issue": "Inline these values, avoid declaring variables that you only use once", "severity": "minor", "line": 26 } ]
1
python
"""Constant definitions for UniFi Protect Integration.""" from typing import Final from uiprotect.data import ModelType, Version from homeassistant.const import Platform from homeassistant.util.hass_dict import HassKey DOMAIN = "unifiprotect" # Typed key for hass.data access - stores auth retries per config entry ...
Review this code and list any quality issues.
[ { "issue": "Would it not be possible to have a single key, initiated inside `async_setup` (for example with auth_retries as an empty dict, and discovery as False)?", "severity": "critical", "line": 15 } ]
1
python
def test_users_annotated_with_comments_count(self): user_1, user_2, user_3 = User.objects.annotate(Count("comments")).order_by("pk") self.assertEqual(user_1, self.user_1) self.assertEqual(user_1.comments__count, 2) self.assertEqual(user_2, self.user_2) self.assertEqual(user_2.co...
Review this code and list any quality issues.
[]
0
python
r'<span[^>]+class="minustrack-full-title(?:\s+[^"]+)?"[^>]*>([^<]+)', webpage, 'title') duration = parse_duration(self._html_search_regex( r'<span[^>]+class="player-duration(?:\s+[^"]+)?"[^>]*>([^<]+)', webpage, 'duration', fatal=False)) mobj = re.search( r'<div[^>]+c...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n video_url = f'http://x-minus.me/dl/minus?id={video_id}&tkn2={a}f{h:.0f}'\r\n```", "severity": "minor", "line": 26 } ]
1
python
application. If there is no such function, status page content shows only the status of the server.<br/> The signature of the *on_status* callback function must be: - *state*: the `State^` instance of the caller. It must return raw and valid HTML content as a string. """ ...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n and the parameters provided in the call to `get_user_content_url()^`.\r\n```", "severity": "minor", "line": 26 } ]
1
python
if shape_class: shape_class_name = type(shape_class).__name__ if shape_class_name in available_shape_classes.keys(): sys.stderr.write(f"Duplicate shape classes: {shape_class_name}\n") sys.exit(1) available_shape_classes[shape_class_name] = shape_class...
Review this code and list any quality issues.
[ { "issue": "group this import with the one on line 16", "severity": "minor", "line": 26 } ]
1
python
else "\n\n".join(current_chunk_content) ) chunks.append(chunk_text.strip()) current_chunk_content = [] # Split the large paragraph by sentences or fixed size available_size = self.chunk_size - heading_size words...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n # add remaining content\r\n```", "severity": "minor", "line": 26 } ]
1
python
for i in range(obj.shape[1]) ) result = obj.set_axis(new_index, axis=0) tm.assert_equal(expected, result) assert result is not obj # check we DID NOT make a copy if obj.ndim == 1: assert tm.shares_memory(result, obj) else: assert any( ...
Review this code and list any quality issues.
[]
0
python
expected = Series(["foo", "foo", "foo"], dtype=np.object_) elif any_string_dtype.na_value is np.nan: expected = Series([True, True, True], dtype=np.bool_) else: expected = Series([True, True, True], dtype="boolean") tm.assert_series_equal(result, expected) result = s.str.contains("foo")...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n expected_dtype = (\r\n np.bool_ if is_object_or_nan_string_dtype(any_string_dtype) else \"boolean\"\r\n )\r\n expected = Series([False, True, True], dtype=expected_dtype)\r\n```", "severity": "minor", "line": 26 } ]
1
python
process_data: dict[str, object] | None = None, ) -> NodeRunSucceededEvent: return NodeRunSucceededEvent( id="node-exec-id", node_id="assigner", node_type=node_type, start_at=datetime.utcnow(), node_run_result=NodeRunResult( status=WorkflowNodeExecutionStatus.SUCCE...
Review this code and list any quality issues.
[]
0
python
) req_bytes = await request.content.read() charset = request.charset if request.charset is not None else "utf8" req_str = req_bytes.decode(charset) then = datetime.utcnow() loop = asyncio.get_event_loop() formatted_str = await loop.run_in_executor( executor, ...
Review this code and list any quality issues.
[ { "issue": "I wonder if we can just run `black.diff` synchronously here instead of delegating to a process pool.\r\n\r\nFor short files it's going to be probably faster, but if it takes too long it will block the event loop.", "severity": "major", "line": 26 } ]
1
python
# 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. import time import typing as t from unittest.mock import MagicMock from taipy.gui import Gui from taipy.gui._hook import _Hoo...
Review this code and list any quality issues.
[]
0
python
""" self.produce_messages(self.topic_with_single_partitions) share_consume_spec = ShareConsumeBenchWorkloadSpec(0, TaskSpec.MAX_DURATION_MS, self.share_consumer_workload_service.share_consumer_node, self.shar...
Review this code and list any quality issues.
[ { "issue": "nit: `multiple_share_consumers_`", "severity": "minor", "line": 26 } ]
1
python
if not next_url: break def _real_extract(self, url): collection_slug = self._match_id(url) channel = self._call_api( f'https://content.api.nebula.app/content/{collection_slug}/?include=lessons', collection_slug, note='Retrieving channel') if channel....
Review this code and list any quality issues.
[ { "issue": "Expand regex in case they ever decide to add letters\r\n```suggestion\r\n _VALID_URL = rf'{_BASE_URL_RE}/(?P<series>[\\w-]+)/season/(?P<season_number>[\\w-]+)'\r\n```", "severity": "minor", "line": 26 } ]
1
python
year, month, day = map(int, (year, month, day)) if era: # example input: 令和5年3月34日 # even though each era have their end, don't check here year += ERA_TABLE[era] return '%04d%02d%02d' % (year, month, day) @staticmethod def _parse_japanese_duration(text): ...
Review this code and list any quality issues.
[ { "issue": "Are these standard enough to go into parse_duration/unified_strdate?", "severity": "minor", "line": 26 } ]
1
python
""" Update all LLM models in all AI blocks that don't exist in the enum. Note: Only updates top level LlmModel SchemaFields of blocks (won't update nested fields). """ logger.info("Migrating LLM models") # Scan all blocks and search for LlmModel fields llm_model_fields: dict[str, str] = {} # {b...
Review this code and list any quality issues.
[ { "issue": "I had to do a raw query because Prisma doesn't handle:\r\n1. Checking if a key exists in jsonb column (and throws when checks value for non-existing key)\r\n2. Updating individual value for a key in jsonb\r\n\r\n-> 1. would force me to get all AgentNodes (*a lot* of nodes if we remove popular model ...
1
python
] def setup_network(self): """ We'll setup the network to have 3 nodes that all mine with different parameters. But first we need to use one node to create a lot of outputs which we will use to generate our transactions. """ self.add_nodes(3, extra_args=self.extra_ar...
Review this code and list any quality issues.
[ { "issue": "nit: feel free to ignore\n```suggestion\n # We will now mine \"numblocks\" blocks, generating on average 100 transactions between each block\n```\nI think makes it easier to read", "severity": "minor", "line": 26 } ]
1
python
import enum from uuid import uuid4 import sqlalchemy as sa import sqlalchemy.dialects.postgresql as pg from oasst_shared.schemas import inference from sqlmodel import Field, Relationship, SQLModel class WorkerEventType(str, enum.Enum): connect = "connect" class DbWorkerComplianceCheck(SQLModel, table=True): ...
Review this code and list any quality issues.
[]
0
python
@mock.patch("lightning.fabric.utilities.distributed.atexit") @mock.patch("lightning.fabric.utilities.distributed.torch.distributed.init_process_group") def test_init_dist_connection_registers_destruction_handler(_, atexit_mock): _init_dist_connection(LightningEnvironment(), "nccl") atexit_mock.register.assert_c...
Review this code and list any quality issues.
[ { "issue": "Probably `xccl` isn’t available in all PyTorch versions. Let’s see how it goes with CI.", "severity": "minor", "line": 26 } ]
1
python
def init_model( model: str | None = None, interactive: bool = False, ): config = get_config() # get from config if not model: model = (config.chat.model if config.chat else None) or config.get_env("MODEL") if not model: # pragma: no cover # auto-detect depending on if OPENAI_A...
Review this code and list any quality issues.
[]
0
python
forbidden_modules = get_forbidden_modules(model.config, finetuning_args) forbidden_modules.update(COMPOSITE_MODELS[model_type].lora_conflict_keys) module_names = [] for name, _ in model.named_modules(): if any(target_module in name for target_module in target_modules) and not any( ...
Review this code and list any quality issues.
[ { "issue": "this if-else statement can be removed", "severity": "minor", "line": 26 } ]
1
python
n3 = self.nodes[3] self.mini_wallet = MiniWallet(n0) # Mock time for a deterministic chain for n in self.nodes: n.setmocktime(n.getblockheader(n.getbestblockhash())['time']) # Generate a series of blocks that `n0` will have in the snapshot, # but that n1 and n2 don...
Review this code and list any quality issues.
[]
0
python
dataset name, value from [qlib_data, qlib_data_simple], by default qlib_data version: str data version, value from [v0, v1, ..., latest], by default latest interval: str data freq, value from [1d], by default 1d region: str data region, value from [cn, us], by...
Review this code and list any quality issues.
[ { "issue": "Did you consider the situation that the qlib version changes but the data version remains the same?", "severity": "minor", "line": 26 } ]
1
python
@renders("changed_on") def changed_on_delta_humanized(self) -> str: return self.changed_on_humanized @renders("changed_on") def changed_on_dttm(self) -> float: return datetime_to_epoch(self.changed_on) @renders("created_on") def created_on_delta_humanized(self) -> str: retu...
Review this code and list any quality issues.
[ { "issue": "Are we expecting this to fail? In what cases? Not sure if swallowing anything/everything is best here, often if we know something might fail we'd try to swallow just that one particular exception, and maybe `logging.exception(e)` to handle the rest of the pessimisticism, so it's unexcpected, handled...
1
python
# memory usage introspection should not materialize .values N = 100 M = len(ascii_uppercase) index = MultiIndex.from_product( [list(ascii_uppercase), date_range("20160101", periods=N)], names=["id", "date"], ) s = Series(np.random.default_rng(2).standard_normal(N * M), index=index) ...
Review this code and list any quality issues.
[ { "issue": "can you follow the pattern in `test_info_memory()` in this file where you just check that the string is what we expect.\n\nping when green on CI", "severity": "major", "line": 26 } ]
1
python
static_paths_configs: list[StaticPathConfig] = [] for path, should_cache in ( ("service_worker.js", False), ("sw-modern.js", False), ("sw-modern.js.map", False), ("sw-legacy.js", False), ("sw-legacy.js.map", False), ("robots.txt", False), ("onboarding.html", ...
Review this code and list any quality issues.
[]
0
python
class solar(BaseSchedule): """Solar event. A solar event can be used as the ``run_every`` value of a periodic task entry to schedule based on certain solar events. Notes: Available event values are: - ``dawn_astronomical`` - ``dawn_nautical`` - ``dawn_civi...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n lon (Union[float]): The longitude of the observer.\r\n```", "severity": "minor", "line": 26 } ]
1
python
async def edit( self, *, name: str = ..., description: str = ..., channel: Snowflake, start_time: datetime = ..., end_time: Optional[datetime] = ..., privacy_level: PrivacyLevel = ..., entity_type: Literal[EntityType.voice, EntityType.stage_instanc...
Review this code and list any quality issues.
[]
0
python
if channel_banners: uncropped_banner = _get_uncropped(channel_banners[0]['url']) if uncropped_banner: channel_banners.append({ 'url': uncropped_banner, 'id': 'banner_uncropped', 'preference': -5 }) ...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n 'tags': (traverse_obj(data, ('microformat', 'microformatDataRenderer', 'tags', ..., {str}))\r\n```", "severity": "minor", "line": 26 } ]
1
python
"llm_node should only be used with LLM (non-multimodal/realtime APIs) nodes" ) tool_choice = model_settings.tool_choice if model_settings else NOT_GIVEN activity_llm = activity.llm conn_options = activity.session.conn_options.llm_conn_options async with acti...
Review this code and list any quality issues.
[]
0
python
if sid: sids.add(sid) if send_back_only: return sid return list(sids) def __get_sids(self, client_id: str) -> t.Set[str]: return self.__client_id_2_sid.get(client_id, set()) def __get_message_grouping(self): return ( _getscopeattr(sel...
Review this code and list any quality issues.
[]
0
python
import os import typing as t def get_style(style: t.Union[str, t.Dict[str, t.Union[str, t.Dict[str, str]]]]): if isinstance(style, dict): style_arr = [] for k, v in style.items(): if isinstance(v, dict): rules= [] for vk, vv in v.item...
Review this code and list any quality issues.
[ { "issue": "Do you really need a ' real' line skip?", "severity": "minor", "line": 19 } ]
1
python
reasoning_effort=model_settings.get('openai_reasoning_effort', OMIT), user=model_settings.get('openai_user', OMIT), web_search_options=web_search_options or OMIT, service_tier=model_settings.get('openai_service_tier', OMIT), prediction=model_settings.get('...
Review this code and list any quality issues.
[ { "issue": "Do we need this? I'd want it to result in a `ModelResponse` with 0 parts, and this _may_ result in a `TextPart(content='')`", "severity": "minor", "line": 26 } ]
1
python
], ) elif model_name in family_8b: return CacheGenConfig( nlayers=32, kspecs=[ QuantizationSpec(start_layer=0, end_layer=10, bins=32), QuantizationSpec(start_layer=10, end_layer=20, bins=16), Quan...
Review this code and list any quality issues.
[ { "issue": "Is there any support for the default setting (for models other than these five models)? For exmple, we can pass the model_config in vllm (which contains info about the number of layers) or the number of layers directly as the function param, and configure the `CacheGenConfig` dynamically based on th...
1
python
with open(tmpdir / 'test.yml', 'w', encoding='utf8') as fp: JAML.dump(api_to_dict(), fp) with open(tmpdir / 'test.json', 'w', encoding='utf8') as fp: json.dump(api_to_dict(), fp) @pytest.mark.parametrize('cli', ac_table['commands']) def test_help_lookup(cli, capsys): nkw2kw, kw2info = _build_l...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n 'uses', ['jinaai://jina-ai/DummyHubExecutor']\r\n```", "severity": "minor", "line": 26 } ]
1
python
) assert result.exit_code == exit_code, msg class BlackTestCase(BlackBaseTestCase): invokeBlack = staticmethod(invokeBlack) def test_empty_ff(self) -> None: expected = "" tmp_file = Path(black.dump_to_file()) try: self.assertFalse(ff(tmp_file, write_back=black.WriteBac...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n PROJECT_ROOT / \"src/black/__init__.py\"\r\n```", "severity": "minor", "line": 26 } ]
1
python
start_service=start_services, ) ) if start_services: farmer_peer = UnresolvedPeerInfo(block_tools.config["self_hostname"], farmer_service._server.get_port()) else: farmer_peer = None harvester_services = [ await async_exit_stack.enter_async...
Review this code and list any quality issues.
[ { "issue": "did the solver used to connect to the farmer?", "severity": "minor", "line": 26 } ]
1
python
# coding: utf-8 from __future__ import unicode_literals from ..utils import ( parse_duration, parse_count, unified_strdate ) from .common import InfoExtractor class NoodleMagazineIE(InfoExtractor): _VALID_URL = r'https?://(?:www|adult\.)?noodlemagazine\.com/watch/(?P<id>[0-9-_]+)' _TEST = { ...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\nfrom .common import InfoExtractor\r\nfrom ..utils import (\r\n parse_duration,\r\n parse_count,\r\n unified_strdate\r\n)\r\n\r\n```", "severity": "major", "line": 10 } ]
1
python
parse_version, sp_version, ) try: import pytest_run_parallel # noqa:F401 PARALLEL_RUN_AVAILABLE = True except ImportError: PARALLEL_RUN_AVAILABLE = False try: from scipy_doctest.conftest import dt_config except ModuleNotFoundError: dt_config = None if parse_version(pytest.__version__) < pa...
Review this code and list any quality issues.
[ { "issue": "I would remove >= 1.10 here and only say SciPy requires network access to get data", "severity": "minor", "line": 26 } ]
1
python
def encode_urlencoded_data( data: dict, ) -> Tuple[Dict[str, str], ByteStream]: plain_data = [] for key, value in data.items(): if isinstance(value, (list, tuple)): plain_data.extend([(key, primitive_value_to_str(item)) for item in value]) else: plain_data.append((key...
Review this code and list any quality issues.
[ { "issue": "I think we could drop this case, as with [this comment](https://github.com/encode/httpx/pull/2278/files#r905947972).", "severity": "minor", "line": 26 } ]
1
python
def encode_event(self, event: BaseChunk) -> str: return f'data: {event.encode()}\n\n' async def before_stream(self) -> AsyncIterator[BaseChunk]: yield StartChunk() async def before_response(self) -> AsyncIterator[BaseChunk]: if self._step_started: yield FinishStepChunk() ...
Review this code and list any quality issues.
[ { "issue": "Should we set this to `error` in `on_error`?", "severity": "minor", "line": 26 } ]
1
python
'upload_date': '20120822', }, }, { 'url': 'http://biqle.org/watch/-44781847_168547604', 'md5': '7f24e72af1db0edf7c1aaba513174f97', 'info_dict': { 'id': '-44781847_168547604', 'ext': 'mp4', 'title': 'Ребенок в шоке от автоматической мойки', ...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n description = self._html_search_meta('description', webpage, 'Description', default=None)\r\n```", "severity": "minor", "line": 26 } ]
1
python
>>> A = np.array([[2, 1, -1], [-3, -1, 2], [-2, 1, 2]], dtype=float) >>> B = np.array([8, -11, -3], dtype=float) >>> solution = solve_linear_system(np.column_stack((A, B))) >>> np.allclose(solution, np.array([2., 3., -1.])) True >>> solve_linear_system(np.array([[0, 0, 0], [0, 0, 0]], dtype=float))...
Review this code and list any quality issues.
[ { "issue": "Can we have the error say \"Matrix is singular\" instead? \"Not correct\" is very vague. (This will need to be updated in the function docstring as well.)", "severity": "minor", "line": 26 } ]
1
python
from .newgrounds import ( NewgroundsIE, NewgroundsPlaylistIE, NewgroundsUserIE, ) from .newspicks import NewsPicksIE from .newsy import NewsyIE from .nextmedia import ( NextMediaIE, NextMediaActionNewsIE, AppleDailyIE, NextTVIE, ) from .nexx import ( NexxIE, NexxEmbedIE, ) from .nfb ...
Review this code and list any quality issues.
[]
0
python
post_info = { **common_info, 'id': post_id, 'display_id': post_id, **traverse_obj(post_data, { 'title': ('title', {str}), 'description': ('text', {clean_html}), 'like_count': ('likes', {int_or_none}), 'dislik...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n _BASE_URL = 'https://www.floatplane.com'\r\n _IMPERSONATE_TARGET = None\r\n _TESTS = [{\r\n```", "severity": "minor", "line": 26 } ]
1
python
'album': 'Leja Re', 'thumbnail': 'https://c.saavncdn.com/258/Leja-Re-Hindi-2018-20181124024539-500x500.jpg', }, }, { 'url': 'https://www.saavn.com/s/song/hindi/Saathiya/O-Humdum-Suniyo-Re/KAMiazoCblU', 'only_matching': True, }] def _real_extract(self, url): audio...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n 'url': media_data['auth_url'],\r\n 'ext': media_data.get('type'),\r\n 'vcodec': 'none',\r\n```", "severity": "critical", "line": 26 } ]
1
python
def run_service(self): while True: time.sleep(10) def __run_async(self, coro: Coroutine[Any, Any, T]): return asyncio.run_coroutine_threadsafe(coro, self.shared_event_loop) def run_and_wait(self, coro: Coroutine[Any, Any, T]) -> T: future = self.__run_async(coro) re...
Review this code and list any quality issues.
[ { "issue": "registering by service name so k8s can find the service", "severity": "minor", "line": 26 } ]
1
python
from exo.shared.types.text_generation import TextGenerationTaskParams from exo.shared.types.worker.instances import ( BoundInstance, Instance, InstanceId, MlxJacclInstance, MlxRingInstance, ) from exo.shared.types.worker.runners import ( RunnerFailed, RunnerId, RunnerShutdown, ShardA...
Review this code and list any quality issues.
[ { "issue": "can you call it jaccl to make it consistent with exo bench? Or can change to exo bench to rdma.", "severity": "minor", "line": 26 } ]
1
python
'formats': formats, 'chapters': chapters, } class NhkForSchoolSubjectIE(InfoExtractor): IE_DESC = 'Portal page for each school subjects, like Japanese (kokugo, 国語) or math (sansuu/suugaku or 算数・数学)' KNOWN_SUBJECTS = ( 'rika', 'syakai', 'kokugo', 'sansuu', 'seikatsu', 'douto...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n 'playlist_mincount': 16,\r\n```\r\netc", "severity": "minor", "line": 26 } ]
1
python
If *validity_period* is set to None, the data node is always up-to-date. **properties (dict[str, any]): A keyworded variable length list of additional arguments. Returns: The new *in-memory* data node configuration. """ # noqa: E501 @classmethod def configure_pickle_da...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n So it is designed to handle small data values like parameters, and it must be Json serializable.\r\n```", "severity": "minor", "line": 26 } ]
1
python
for value, output in items: with self.subTest(value=value, output=output): self.check_output(strip_spaces_between_tags, value, output) self.check_output(strip_spaces_between_tags, lazystr(value), output) def test_escapejs(self): items = ( ( ...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n (\"\\u007F\", \"\\u007F\"),\r\n```", "severity": "minor", "line": 26 } ]
1
python
async def initiate_work_for_message( *, websocket: fastapi.WebSocket, work_queue: queueing.RedisQueue, message_id: str, worker_id: str, worker_config: inference.WorkerConfig, ) -> inference.WorkRequest: async with deps.manual_create_session() as session: cr = chat_repository.ChatRepo...
Review this code and list any quality issues.
[ { "issue": "In order to avoid logical changes as much as possible, I kept this piece of code here as it was, but that now means that it accesses the internal structure of the `FuturesManager`.\r\n\r\nI'm considering whether it might be nicer to not throw all the futures into a single set, but instead keep one f...
1
python
track_obj.update({ 'app': m_obj.group('app'), 'ext': m_obj.group('ext'), 'play_path': m_obj.group('ext') + ':' + m_obj.group('playpath'), 'rtmp_live': True, 'preference': -2, }) ...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n _VALID_URL = rf'''(?x)\r\n https?://(?P<host>{OpencastBaseIE._INSTANCES_RE})/paella/ui/watch.html\\?\r\n (?:[^#]+&)?id=(?P<id>{OpencastBaseIE._UUID_RE})'''\r\n```", "severity": "minor", "line": 26 } ]
1
python
@pytest.fixture(scope="session") def browser_type_launch_args(request): """ Override the browser_type_launch_args defined by pytest-playwright to support --devtools. NOTE: this has been tested with pytest-playwright==0.3.0. It might break with newer versions of it. """ # this calls the "ori...
Review this code and list any quality issues.
[ { "issue": "this is superfluous. `HTTPServer` is a subclass of `socketserver.SocketServer`, and the class is already stored as `RequestHandlerClass`:\r\nhttps://github.com/antocuni/cpython/blob/deaf509e8fc6e0363bd6f26d52ad42f976ec42f2/Lib/socketserver.py#L201-L206", "severity": "minor", "line": 26 } ]
1
python
starts[1], ends[0], num_samples[1], closed=interval, eager=True ) expected_ns0 = pl.linear_space( starts[0], ends[0], num_samples[0], closed=interval, eager=True ) expected_ns1 = pl.linear_space( starts[1], ends[1], num_samples[0], closed=interval, eager=True ) expected = pl.Lazy...
Review this code and list any quality issues.
[]
0
python
if spec_token_ids is None: return output_token_ids result = [] for out, spec in zip(output_token_ids, spec_token_ids): if len(spec) == 0: continue result.append(out) for i in range(len(spec) - 1): result.append([*result[-1]...
Review this code and list any quality issues.
[ { "issue": "Creating a new tensor for each request inside the loop could be inefficient. Consider creating all stop token tensors once before the loop, or at least reusing tensors where stop token sets are identical across requests. However, this optimization may be acceptable given that stop token sets are typ...
1
python
plan_copy._cache = self._cache.deep_copy() plan_copy._dataset_name = self._dataset_name return plan_copy def initial_num_blocks(self) -> Optional[int]: """Get the estimated number of blocks from the logical plan after applying execution plan optimizations, but prior to fully...
Review this code and list any quality issues.
[ { "issue": "What happens if we don't do this check?", "severity": "minor", "line": 26 } ]
1
python
'Authorization': f'Bearer {access_token}' if access_token else None, 'Content-Type': 'application/json', 'x-vrt-client-name': 'WEB', 'x-vrt-client-version': '1.5.9', 'x-vrt-zone': 'default', })['data']['page'] video_id = metadata['play...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n self.raise_no_formats(f'Unable to extract formats: {code}')\r\n```", "severity": "major", "line": 26 } ]
1
python
########################## entities ########################## plane = scene.add_entity( gs.morphs.Plane(), ) franka = scene.add_entity( gs.morphs.MJCF(file="xml/franka_emika_panda/panda.xml"), visualize_contact=True, ) ########################## build ######################...
Review this code and list any quality issues.
[ { "issue": "This parameter is useless, and no need to pass main as input argument.", "severity": "minor", "line": 26 } ]
1
python
self.algorithm_returns, self.benchmark_returns, ) self.sharpe[dt_loc] = sharpe_ratio( self.algorithm_returns, ) self.downside_risk[dt_loc] = downside_risk( self.algorithm_returns ) self.sortino[dt_loc] = sortino_ratio( self....
Review this code and list any quality issues.
[ { "issue": "How often is this called? Any concern about the speed of making a `DataFrame` here?\r\n\r\nWhen we originally moved the other metrics to empyrical, they slowed down the zipline test suite dramatically because of all the `Series` constructions, whereas zipline had been using raw numpy arrays previous...
1
python
import datetime import json from collections.abc import Sequence from typing import TYPE_CHECKING, Literal, cast import pytest from inline_snapshot import snapshot from pydantic import BaseModel if TYPE_CHECKING: from vcr.cassette import Cassette from pydantic_ai import ( Agent, BinaryContent, Docume...
Review this code and list any quality issues.
[ { "issue": "do you have something against this? I'm generally for marking type-hint-only classes explicitly like this", "severity": "minor", "line": 12 } ]
1
python
raise ValueError(f"Model {arch} is not supported.") except Exception as e: self.logger.error( f"An exception occurred during loading model: {e}, model should be loaded by transformers\n" ) else: model = model_or_path self.mode...
Review this code and list any quality issues.
[ { "issue": "Since there is currently no padding code in our framework, do we need to delete this section of code?", "severity": "minor", "line": 26 } ]
1
python
expected = [ af.lookup_symbol(symbol, as_of) for symbol in symbols ] result = af.lookup_symbols(symbols, as_of) assert_equal(result, expected) def test_fuzzy(self): af = self.asset_finder # FUZZ.Y shouldn't resolve unless fuzzy=True. syms = ['A', 'B', 'F...
Review this code and list any quality issues.
[ { "issue": "should you compare against a comprehension again?", "severity": "minor", "line": 26 } ]
1
python
def __gt__(self, other: npt.ArrayLike, /) -> container[_ShapeT_co, np.dtype[np.bool]]: ... def __ge__(self, other: npt.ArrayLike, /) -> container[_ShapeT_co, np.dtype[np.bool]]: ... # def __len__(self, /) -> int: ... # keep in sync with np.ndarray @overload def __getitem__(self, key: _ArrayInt...
Review this code and list any quality issues.
[]
0
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 sub = self._download_json(f'{domain}{url_sub}', video_id,\r\n note=f'Download subtitle for locale {sub.get(\"name\")} ({locale})',\r\n fatal=False) or {}\r\n sub_url = url_or_none(sub.ge...
1
python
# Hyperparameters in the dropdown table of the HTML representation now include # links to the online documentation. Docstring descriptions are also shown as # tooltips on hover. from sklearn.linear_model import LogisticRegression from sklearn.pipeline import make_pipeline from sklearn.preprocessing import StandardScal...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n# single split takes of the order of 100 ms, compared to ~20 seconds before.\r\n```", "severity": "minor", "line": 26 } ]
1
python
>>> print(res) fun: 176 col_ind: [1 2 3 0] nit: 17 """ if options is None: options = {} method = method.lower() methods = {"faq": _quadratic_assignment_faq, "2opt": _quadratic_assignment_2opt} if method not in methods: raise ValueError(f"metho...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n \"Use of `RandomState` with `quadratic_assignment` is deprecated\"\r\n \" and will result in an exception in SciPy 1.17\",\r\n```", "severity": "minor", "line": 26 } ]
1
python
if player_url: self.report_warning( f'nsig extraction failed: You may experience throttling for some formats\n{phantomjs_hint}' f' n = {query["n"][0]} ; player = {player_url}', video_id=video_id, only_once=True) ...
Review this code and list any quality issues.
[ { "issue": "With 3 chars, we can't tell `web_embedded` etc apart. Maybe use thw whole string?", "severity": "minor", "line": 26 } ]
1
python
response_json_schema=response_schema, response_modalities=modalities, ) return contents, config def _process_response(self, response: GenerateContentResponse) -> ModelResponse: if not response.candidates: raise UnexpectedModelBehavior('Expected at least one candidate...
Review this code and list any quality issues.
[]
0
python
main(["--find-links", "F1", "fake"]) @contextmanager def tmpconfig(option: str, value: Any, section: str = "global") -> Iterator[str]: with NamedTemporaryFile(mode="w", delete=False) as f: f.write(f"[{section}]\n{option}={value}\n") name = f.name try: yield name finally: os...
Review this code and list any quality issues.
[]
0
python
all_keys.add(t.key) external_deps = all_deps - all_keys leafs = all_keys - all_deps if len(leafs) > 1: raise ValueError(f"Cannot fuse tasks with multiple outputs {leafs}") outkey = leafs.pop() return Task( key or outkey, _execute_subgraph, ...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n def __init__(self, key: KeyType | TaskRef, target: Alias | TaskRef | KeyType | None = None):\r\n```", "severity": "minor", "line": 26 } ]
1
python
'ext': 'mp4', 'title': 'An Eagle\'s-Eye View Off Burrard Bridge', 'description': 'Hercules the eagle flies from Vancouver\'s Burrard Bridge down to a nearby park with a mini-camera strapped to his back.', 'upload_date': '20160201', 'timestamp': 1454342820,...
Review this code and list any quality issues.
[ { "issue": "The title we want is the old one. It's the extractor that's wrong, not the test.", "severity": "critical", "line": 26 } ]
1
python
if is_custom_model(config.model.model_name) and not config.model.tokenizer_name: # Keep tokenizer as None for custom models unless `tokenizer_name` is specified. tokenizer = None else: tokenizer = build_tokenizer(config.model) processor: Optional[BaseProcessor] = None if is_image_te...
Review this code and list any quality issues.
[ { "issue": "How does this interact with `training.ddp_find_unused_parameters` ? If they are related/same, should we honor `ddp_find_unused_parameters` or not, and/or log a warning ?", "severity": "minor", "line": 26 } ]
1
python
if x.dtype == float8e4m3fn and x.dtype.descr[0][0] == "e4m3fn": tensor_dtype = TensorProto.FLOAT8E4M3FN elif x.dtype == float8e4m3fnuz and x.dtype.descr[0][0] == "e4m3fnuz": tensor_dtype = TensorProto.FLOAT8E4M3FNUZ elif x.dtype == float8e5m2 and x.dtype.descr[0][0] == "e5m2": ...
Review this code and list any quality issues.
[ { "issue": "Shouldn't we accept onnx datatype enumeration, and convert it to np.dtype?", "severity": "minor", "line": 26 } ]
1
python
value = DecimalNumber(angle.get_value(degrees=True), unit="^{\\circ}") value.next_to(angle, UR) self.add(line1, line2, angle, value) """ if degrees: return self.angle_value / DEGREES return self.angle_value @staticmethod def from_thr...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n Further keyword arguments are passed to :class:`.Angle`\r\n```\r\n\r\nFull sentence.", "severity": "minor", "line": 26 } ]
1
python
self.assertEqual(page_id_list, [16, 18, 19]) def test_ordering_by_unknown_field_gives_error(self): response = self.get_response(order="not_a_field") content = json.loads(response.content.decode("UTF-8")) self.assertEqual(response.status_code, 400) self.assertEqual( cont...
Review this code and list any quality issues.
[]
0
python
sigmoid: If True, apply a sigmoid function to the prediction. softmax: If True, apply a softmax function to the prediction. other_act: if don't want to use `sigmoid` or `softmax`, use other callable function to execute other activation layers, Defaults to ``None``. for example: ...
Review this code and list any quality issues.
[]
0
python
self.play(Create(NumberPlane())) self.play(Create(brace)) self.wait(2) """ def __init__( self, point_1: Optional[Sequence[float]], point_2: Optional[Sequence[float]], direction: Optional[Sequence[float]] = ORIGIN, **kwargs ): ...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n The :class:`ArcBrace` is smaller for arcs with smaller radii.\r\n```", "severity": "minor", "line": 26 } ]
1
python
self.id, payload, ) return AppCommand(data=data, state=state) async def fetch_permissions(self, guild: Snowflake) -> GuildAppCommandPermissions: """|coro| Retrieves this command's permission in the guild. Parameters ----------- guild: :c...
Review this code and list any quality issues.
[ { "issue": "```suggestion\r\n This can also indicate that the permissions are synced with the guild\r\n (i.e. they are unchanged from the default).\r\n```", "severity": "critical", "line": 26 } ]
1
python
with open(fn_path, 'rb') as f: m = hash_func(f.read()) checksums.append(f"{m.hexdigest()} {fn}") return checksums def write_release(version): """ Copy the <version>-notes.rst file to the OUTPUT_DIR, append the md5 and sha256 hashes of the wheels and sdist, and produce README.r...
Review this code and list any quality issues.
[ { "issue": "nitpick:\r\n\r\n```suggestion\r\n notes = Path(NOTES_DIR) / f\"{version}-notes.rst\"\r\n wheel_dir = Path(OUTPUT_DIR) / \"installers\"\r\n target_md = Path(OUTPUT_DIR) / f\"{OUTPUT_FILE}.md\"\r\n target_rst = Path(OUTPUT_DIR) / f\"{OUTPUT_FILE}.rst\"\r\n```\r\n\r\nbut I suppose this coul...
1
python
if not case_sensitive: string_1 = string_1.lower() string_2 = string_2.lower() length_1 = len(string_1) length_2 = len(string_2) distance_matrix = [[0] * (length_2 + 1) for _ in range(length_1 + 1)] for i in range(length_1 + 1): distance_matrix[i][0] = i for j in range(leng...
Review this code and list any quality issues.
[ { "issue": "Suggestion for optimization of space complexity: The current implementation uses a DP approach with space complexity `O(len(string_1) * len(string_2))`. However, the calculation of each row in the `distance_matrix` only depends on the previous row, so we don't need to store the entire matrix, instea...
1