language string | code-snippit string | instruction string | flaws list | flaw_count int64 |
|---|---|---|---|---|
python | camera_to_sock_mapping = {
"driver": "livestreamDriverEncodeData",
"wideRoad": "livestreamWideRoadEncodeData",
"road": "livestreamRoadEncodeData",
}
def __init__(self, camera_type: str):
dt = DT_DMON if camera_type == "driver" else DT_MDL
super().__init__(camera_type, dt)
self._sock = mess... | Review this code and list any quality issues. | [
{
"issue": "don't do this, just set a default in the constructor. in general, avoid getattr unless absolutely necessary",
"severity": "minor",
"line": 26
}
] | 1 |
python | U = rng.standard_normal(size=(op.shape[-1], k), dtype=data_dtype)
if complex_data:
U = U + (1j * rng.standard_normal(size=(op.shape[-1], k), dtype=data_dtype))
V = rng.standard_normal(size=(op.shape[-2], k), dtype=data_dtype)
if complex_data:
V = V + (1j * rng.standard_n... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\n rtol = 1e-12 if np.finfo(data_dtype).eps < 1e-8 else 5e-4\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | assert config_entry.state is ConfigEntryState.LOADED
await hass.config_entries.async_unload(config_entry.entry_id)
assert config_entry.state is ConfigEntryState.NOT_LOADED
async def test_setup_entry_exception(hass: HomeAssistant) -> None:
"""Validate that setup entry also configure the client."""
co... | Review this code and list any quality issues. | [] | 0 |
python | ) -> Tuple[str, dict]:
prepared_urlpath = []
prepared_storage_options = {}
for hop in urlpath.split("::"):
hop, storage_options = _prepare_single_hop_path_and_storage_options(hop, download_config=download_config)
prepared_urlpath.append(hop)
prepared_storage_options.update(storage_op... | Review this code and list any quality issues. | [
{
"issue": "I think we also need to update `DownloadConfig.storage_options`' type hint.",
"severity": "minor",
"line": 26
}
] | 1 |
python | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
from pathlib import Path
from setuptools_scm import get_version
__version__ = get_version(root="..", relative_to=__file__)
__version__bak = __version__ # This version is backup for QlibConfig.reset_qlib_version
import logging
import os
import p... | Review this code and list any quality issues. | [
{
"issue": "get_version shouldn’t be used at runtime - editable install should be used for doc building/testing",
"severity": "minor",
"line": 10
}
] | 1 |
python | self.gguf_writer.add_token_types(toktypes)
special_vocab = gguf.SpecialVocab(self.dir_model, load_merges=True)
special_vocab._set_special_token("eos", tokenizer.get_added_vocab()["<|endoftext|>"])
special_vocab._set_special_token("eot", tokenizer.get_added_vocab()["<|user|>"])
special_vo... | Review this code and list any quality issues. | [
{
"issue": "Would it make sense to move this together with the other rope handling in base `set_gguf_parameters`?",
"severity": "major",
"line": 26
}
] | 1 |
python | t = threading.Thread(target=_get_ip, args=(ip,))
threads.append(t)
t.start()
for t in threads:
t.join(timeout)
for r in results:
if r:
return r
def convert_tuple_to_list(d: Dict):
"""
Convert all the tuple type values from a dict to list.
:param d: Di... | Review this code and list any quality issues. | [
{
"issue": "we need to change it to private method",
"severity": "minor",
"line": 26
}
] | 1 |
python | def hasAsyncPlotlyJs(dash_duo):
return any(
"dash_core_components/async-plotlyjs" in s for s in get_script_sources(dash_duo)
)
def hasWindowPlotly(dash_duo):
return dash_duo.driver.execute_script("return !!window.Plotly")
@pytest.mark.parametrize("is_eager", [True, False])
def test_scri001_scrip... | Review this code and list any quality issues. | [] | 0 |
python | self,
method,
url,
headers=None,
allow_redirects=True,
max_redirects=10,
*args,
**kwargs,
) -> req.Response:
# Validate URL and get pinned URL + original hostname
pinned_url, original_hostname = validate_url(url, self.trusted_origins)
... | Review this code and list any quality issues. | [
{
"issue": "nit:\r\n```suggestion\r\n if (pinned_hostname := urlparse(pinned_url).hostname) not in self.trusted_origins:\r\n headers[\"Host\"] = original_hostname\r\n else:\r\n headers[\"Host\"] = pinned_hostname\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | return 0, video_frame_total
def detect_video_resolution(video_path : str) -> Optional[Resolution]:
if is_video(video_path):
video_capture = get_video_capture(video_path)
if video_capture.isOpened():
with thread_semaphore():
width = video_capture.get(cv2.CAP_PROP_FRAME_WIDTH)
height = video_capture.ge... | Review this code and list any quality issues. | [
{
"issue": "Introduce `Scale : TypeAlias = float`",
"severity": "minor",
"line": 26
}
] | 1 |
python | else:
phi = np.arctan(y / x)
if x < 0:
phi += PI
# Undo old rotation (in reverse order)
self.rotate(-self._current_phi, Z_AXIS, about_point=ORIGIN)
self.rotate(-self._current_theta, Y_AXIS, about_point=ORIGIN)
# Do new rotation
self.rotate(theta,... | Review this code and list any quality issues. | [
{
"issue": "Same as with the constructor: make sure to copy the direction rather than referencing it.\n```suggestion\n self.direction = np.array(direction)\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | This method is deprecated and will be removed in future versions. Use `add` instead.
Adds the data from the given URL to the vector db.
Loads the data, chunks it, create embedding for each chunk
and then stores the embedding to vector database.
:param source: The data to embed, can be ... | Review this code and list any quality issues. | [
{
"issue": "because metdatas is used now, you should remove the _underscore.",
"severity": "minor",
"line": 26
}
] | 1 |
python | result: dict[str, Any] = {
"config": async_redact_data(entry.data, TO_REDACT),
"coordinator": {
"last_update_success": coordinator.last_update_success,
"last_exception": (
str(coordinator.last_exception) if coordinator.last_exception else None
),
... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n```\r\nisn't this the same as bellow?",
"severity": "minor",
"line": 26
}
] | 1 |
python | force means whether to force refresh the cache and is treated as False by default,
except force = True is passed to the decorated function.
timeout of cache is set to CACHE_DEFAULT_TIMEOUT seconds by default,
except cache_timeout = {timeout in seconds} is passed to the decorated function.
:param key: ... | Review this code and list any quality issues. | [] | 0 |
python | {
'url': 'https://news.cgtn.com/news/2021-03-09/Up-and-Out-of-Poverty-Ep-1-A-solemn-promise-YuOUaOzGQU/index.html',
'info_dict': {
'id': 'YuOUaOzGQU',
'ext': 'mp4',
'title': 'Up and Out of Poverty Ep. 1: A solemn promise',
'thumbnai... | Review this code and list any quality issues. | [
{
"issue": "add `skip_download` to the tests",
"severity": "minor",
"line": 26
}
] | 1 |
python | 'url': 'https://www.arte.tv/fr/videos/109067-000-A/la-loi-de-teheran/',
'info_dict': {
'id': '109067-000-A',
'ext': 'mp4',
'description': 'md5:d2ca367b8ecee028dddaa8bd1aebc739',
'timestamp': 1713927600,
'thumbnail': 'https://api-cdn.arte.tv/img/v2/imag... | Review this code and list any quality issues. | [
{
"issue": "Don't remove this test unless you can add another age-restricted test video",
"severity": "major",
"line": 26
}
] | 1 |
python | 'mode': mode,
},
},
}
await self.send_as_json(payload)
async def client_connect(self) -> None:
payload = {
'op': self.CLIENT_CONNECT,
'd': {
'audio_ssrc': self._connection.ssrc,
},
}
await self... | Review this code and list any quality issues. | [
{
"issue": "`seq` is received, not sent (except for heartbeats and resume)",
"severity": "minor",
"line": 26
}
] | 1 |
python | SqlMetric(metric_name="c", expression="{{ metric('b') }}"),
],
table_name="test_dataset",
database=database,
schema="my_schema",
sql=None,
)
mock_g = mocker.patch("superset.jinja_context.g")
mock_g.form_data = {"datasource": {"id": 1}}
DatasetDAO = mocker.patch("... | Review this code and list any quality issues. | [] | 0 |
python | async def setup_wallet_node(
self_hostname: str,
consensus_constants: ConsensusConstants,
local_bt: BlockTools,
spam_filter_after_n_txs: Optional[int] = 200,
xch_spam_amount: int = 1000000,
full_node_port: Optional[uint16] = None,
introducer_port: Optional[uint16] = None,
key_seed: Optio... | Review this code and list any quality issues. | [] | 0 |
python | self.load_state()
@staticmethod
def _is_special_text(text):
return text.isdigit() or text.isspace()
def _make_new_book(self, book):
new_book = epub.EpubBook()
new_book.metadata = book.metadata
new_book.spine = book.spine
new_book.toc = book.toc
return new_bo... | Review this code and list any quality issues. | [
{
"issue": "resultTxtList -> result_txt_list",
"severity": "minor",
"line": 26
}
] | 1 |
python | 'client_id': 'tennis-tv-web',
'redirect_uri': 'https://tennistv.com',
'response_mode': 'fragment',
'response_type': 'code',
'scope': 'openid'
})
post_url = self._html_search_regex(r'action=["\'](.+?)["\']\s+?method=["\']post["\']', login_page, None)
... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n 'code': urllib.parse.parse_qs(handle.geturl())['code'][-1],\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | # coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from yt_dlp import utils
class QingTingIE(InfoExtractor):
IE_NAME = 'QingTing'
_VALID_URL = r'''(?x)
(?:https?://)?(?:www\.)?
(?P<m>m\.)?(?:qingting\.fm|qtfm\.cn)/(?(m)v|)
... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\nfrom .common import InfoExtractor\r\n```\r\nnot needed",
"severity": "major",
"line": 4
}
] | 1 |
python | --------
>>> import numpy as np
Dimensions as individual arguments
>>> for index in np.ndindex(3, 2, 1):
... print(index)
(0, 0, 0)
(0, 1, 0)
(1, 0, 0)
(1, 1, 0)
(2, 0, 0)
(2, 1, 0)
Same dimensions - but in a tuple ``(3, 2, 1)``
>>> for index in np.ndindex((3, 2, ... | Review this code and list any quality issues. | [
{
"issue": "This should be in a release note rather than here. See the comments in `doc/release/upcoming_changes/README.rst`",
"severity": "minor",
"line": 26
}
] | 1 |
python | return _symbol(x, default, **assumptions)
_uniquely_named_symbol = uniquely_named_symbol
# XXX: We need type: ignore below because Expr and Boolean are incompatible as
# superclasses. Really Symbol should not be a subclass of Boolean.
class Symbol(AtomicExpr, Boolean): # type: ignore
"""
A symbolic variab... | Review this code and list any quality issues. | [
{
"issue": "We should specify that this is referring to multiplication: this doesn't affect whether addition commutes.",
"severity": "minor",
"line": 26
}
] | 1 |
python | Examples
--------
.. manim:: FadeToColor
:quality: low
class FadeToColor(Scene):
def construct(self):
self.play(ScaleInPlace(Text("Hello World!"), 2))
"""
def __init__(self, mobject: Mobject, scale_factor: float, **kwargs) -> None:
super().__init__... | Review this code and list any quality issues. | [
{
"issue": "Wrong animation class.\r\n```suggestion\r\n .. manim:: ShrinkToCenterExample\r\n :quality: low\r\n\r\n class ShrinkToCenterExample(Scene):\r\n```",
"severity": "critical",
"line": 26
}
] | 1 |
python | Parameters
----------
mobjects
The mobject or array of mobjects that the camera will focus on.
margin
The width of the margin that is added to the frame (optional, 0 by default).
only_mobjects_in_frame
If set to ``True``, only allows focusing on mobj... | Review this code and list any quality issues. | [
{
"issue": "Is there actually a reason why you use `operator.not_` instead of simply `not self.is_in_frame(m)`?\r\n\r\n```suggestion\r\n only_mobjects_in_frame and not self.is_in_frame(m)\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | self._server._ws.emit(
"message",
payload,
to=self.__get_ws_receiver(),
)
time.sleep(0.001)
except Exception as e: # pragma: no cover
_warn(f"Exception raised in WebSocket communication in '{self.__f... | Review this code and list any quality issues. | [
{
"issue": "@dinhlongviolin1 I'd like your input on this ...",
"severity": "minor",
"line": 26
}
] | 1 |
python | return "mdi:alert"
return "mdi:heating-coil"
@property
def native_value(self) -> int | None:
"""Return the state of the floor terminal block mechanical channel valve position."""
channel = next(
channel
for channel in self._device.functionalChannels
i... | Review this code and list any quality issues. | [] | 0 |
python | args, _ = set_pod_parser().parse_known_args(
[
"--uses",
os.path.join(
os.path.dirname(__file__), "SampleColbertExecutor", "config.yml"
),
"--provider",
"azure",
"serve",
]
)
with Pod(args):
resp = re... | Review this code and list any quality issues. | [] | 0 |
python | ...
def release(self) -> None:
self.renderer.release()
def post_construct(self) -> None:
"""Run post-construct hooks, and clean up the file writer."""
if self.file_writer.num_plays:
self.file_writer.finish()
# otherwise no animations were played
elif config.... | Review this code and list any quality issues. | [] | 0 |
python | 'architect': ['architecture'],
'tech_lead': ['development_planning'],
'full_stack_developer': ['coding'],
'dev_ops': ['environment_setup'],
'code_monkey': ['coding']
}
STEPS = [
'project_description',
'user_stories',
'user_tasks',
'architecture',
'environment_setup',
'development... | Review this code and list any quality issues. | [
{
"issue": "This fixes problems when people create a Python virtual environment within a project, irrespective of how they name the directory. There's at least a couple of reported case of this exact reason for TokenLimitError, including in telemetry and discord.",
"severity": "minor",
"line": 26
}
] | 1 |
python | async def test_df_crash_on_memcached_error(df_factory):
master = df_factory.create(
memcached_port=11211,
proactor_threads=2,
)
replica = df_factory.create(
memcached_port=master.mc_port + 1,
proactor_threads=2,
)
master.start()
replica.start()
c_master = m... | Review this code and list any quality issues. | [] | 0 |
python | micro_batches = mini_batch.split(self.config.ppo_micro_batch_size_per_gpu)
self.actor_optimizer.zero_grad()
global_snis_denom = None
try:
if (
"rollout_is_weights" in mini_batch.batch.keys()
and "rollou... | Review this code and list any quality issues. | [
{
"issue": "Can we move `global_snis_denom` calculation to `verl/trainer/ppo/mismatch_helper.py`? Better to keep `update_policy` function concise.",
"severity": "major",
"line": 26
}
] | 1 |
python | from zipline.finance.slippage import SlippageModel
from zipline.utils.sentinel import sentinel
class TestingSlippage(SlippageModel):
"""
Slippage model that fills a constant number of shares per tick, for
testing purposes.
Parameters
----------
filled_per_tick : int or TestingSlippage.ALL
... | Review this code and list any quality issues. | [
{
"issue": "We should probably add a test that exercises this if it's going to live in zipline.",
"severity": "minor",
"line": 5
}
] | 1 |
python | owners = self.symbol_ownership_map[
company_symbol,
share_class_symbol,
]
assert owners, 'empty owners list for %r' % symbol
except KeyError:
# no equity has ever held this symbol
raise SymbolNotFound(symbol=symbol)
if not ... | Review this code and list any quality issues. | [] | 0 |
python | results = ds_with_downloads.take_all()
assert len(results) == len(sample_data)
for i, result in enumerate(results):
assert result["content"] == sample_data[i]
assert result["file_id"] == f"id_{i}"
assert result["file_uri"] == f"local://{file_paths... | Review this code and list any quality issues. | [
{
"issue": "Consider using 1 file. 2 files aren't necessary for this test, and writing minimally passing tests is a good practice: https://learn.microsoft.com/en-us/dotnet/core/testing/unit-testing-best-practices#write-minimally-passing-tests\n```suggestion\n sample_data = [b\"File 1 content with custom ... | 1 |
python | def angle_of_vector(vector: Sequence[float]) -> float:
"""Returns polar coordinate theta when vector is projected on xy plane.
Parameters
----------
vector
The vector to find the angle for.
Returns
-------
float
The angle of the vector projected.
"""
if config.rende... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n This angle will always be between 0 and pi\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | if is_remote_uri(test_data):
# Pass through ARM id or remote url
return test_data
if os.path.exists(test_data): # absolute local path, upload, transform to remote url
data_type = _get_data_type(test_data)
test_data = _upload_and_generate_remote_uri(
... | Review this code and list any quality issues. | [
{
"issue": "why do we need to extract environment varibales for prompty?",
"severity": "major",
"line": 26
}
] | 1 |
python | 'duration': 455,
'tags': [],
}
}, {
'url': 'https://cellebrite.com/en/how-to-lawfully-collect-the-maximum-amount-of-data-from-android-devices/',
'info_dict': {
'id': '29018255',
'ext': 'mp4',
'duration': 134,
'tags': [],
... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n formats = [{'url': url} for url in traverse_obj(json_data, ('mp4', ..., 'url')) or []]\r\n subtitles = {}\r\n\r\n for url in traverse_obj(json_data, ('hls', ..., 'url')) or []:\r\n```\r\n\r\nThe headers from the main infodict will be automatically used for each... | 1 |
python | "version": config.awq_version,
}
logger.info(f"⚙️ AWQ config: {quant_config}")
logger.info(f"📊 Using {config.calibration_samples} calibration samples")
logger.info("🧮 Starting AWQ calibration and quantization...")
# 3. Perform AWQ quantization with calibration
model.... | Review this code and list any quality issues. | [
{
"issue": "It looks like we're saving the model twice? Here and in line 89",
"severity": "minor",
"line": 26
}
] | 1 |
python | 'age_limit': 0,
'comment_count': int,
'upload_date': '20181003',
'thumbnail': 'https://i.ytimg.com/vi_webp/yiDOExw2aSA/maxresdefault.webp',
'availability': 'public',
'playable_in_embed': True,
'channel_id': 'UCKL5hAuzgFQsyrsQKgU0Qng',
'... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n return self.url_result(youtube_id, YoutubeIE, youtube_id)\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | )
)
elif isinstance(value, enum.Enum):
return lit(value.value, dtype=dtype)
if dtype:
return wrap_expr(plr.lit(value, allow_object, is_scalar=True)).cast(dtype)
if _check_for_numpy(value) and isinstance(value, np.generic):
# note: the item() is a py-native datetime/timedel... | Review this code and list any quality issues. | [
{
"issue": "It's probably better match against `np.generic` instead of just `np.number` here",
"severity": "minor",
"line": 26
}
] | 1 |
python | import hashlib
import logging
import os
import quopri
from textwrap import dedent
from bs4 import BeautifulSoup
try:
from llama_index import download_loader
except ImportError:
raise ImportError("Notion requires extra dependencies. Install with `pip install embedchain[community]`") from None
from embedchain.... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\nclass GmailLoader(BaseLoader):\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | Parameters
----------
degrees
A boolean to decide the unit (deg/rad) in which the value of the angle is returned.
Returns
-------
:class:`float`
The value in degrees/radians of an angle of the :class:`Angle` class.
Examples
--------
... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n value.next_to(angle, UR, buff=0)\r\n```\r\nAs seen here: https://manimce--1881.org.readthedocs.build/en/1881/reference/manim.mobject.geometry.Angle.html#manim.mobject.geometry.Angle , the number crosses with the angle which makes for an anesthetic look. I still f... | 1 |
python | 'series': 'GTA 5',
'timestamp': 1740612872,
'modified_timestamp': 1740613037,
'upload_date': '20250226',
'modified_date': '20250226',
},
}]
# From _app.js
CLIENT_ID = 'TlwKp1zmF6eKFpcisn3FyR18WkhcPkZtzwPVEEC3'
CLIENT_SCRET = 'Kp7tYlUN7LXvtcSpwYvIi... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n 'client_id': self._CLIENT_ID,\r\n 'client_secret': self._CLIENT_SECRET,\r\n```",
"severity": "critical",
"line": 26
}
] | 1 |
python | from .common import InfoExtractor
from ..utils import (
js_to_json,
urlencode_postdata,
)
class JioSaavnBaseInfoExtractor(InfoExtractor):
def extract_initial_data_as_json(self, url, id):
webpage = self._download_webpage(url, id)
init_data_re = r'window.__INITIAL_DATA__\s*=\s*(?P<json>.+?);... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n return self._search_json(\r\n r'window\\.__INITIAL_DATA__\\s*=', webpage,\r\n 'init json', audio_id, transform_source=js_to_json)\r\n```",
"severity": "minor",
"line": 16
}
] | 1 |
python | use_orig_params: bool = False,
ignored_parameters: Optional[Iterable[torch.nn.Parameter]] = None,
):
super().__init__()
self.fsdp_kwargs = dict(sharding_strategy=sharding_strategy,
cpu_offload=cpu_offload,
auto_wrap_polic... | Review this code and list any quality issues. | [
{
"issue": "As FSDP controls precision itself, I think it cannot support \"fp16_apex\". Besides, torch doesn't support fp8 natively (see https://pytorch.org/docs/main/tensor_attributes.html?highlight=dtype#torch.dtype). I think this plugin also doesn't support \"fp8\".",
"severity": "minor",
"line": 26
... | 1 |
python | 'info_dict': {
'id': 'jetlag_15',
},
'playlist_count': 6,
}, {
'url': 'https://nebula.tv/jetlag/season/14',
'info_dict': {
'id': 'jetlag_14',
},
'playlist_mincount': 6,
}, {
'url': 'https://nebula.tv/jetlag/season/10',
'only... | Review this code and list any quality issues. | [
{
"issue": "For the playlist entries:\r\n- we should use the base `_extract_video_metadata` method and return `url_transparent` results\r\n- we should mimic the other playlist extractors' strategy of using `smuggle_data` to smuggle the `id` in the URL. If we do this along with returning the metadata in a `url_t... | 1 |
python | _validate_confidence(self.confidence, n)
def get_top_k(self, k: int) -> Tuple[np.ndarray, np.ndarray]:
"""
Retrieve the top k class IDs and confidences, ordered in descending order by confidence.
Args:
k (int): The number of top class IDs and confidences to retrieve.
R... | Review this code and list any quality issues. | [
{
"issue": "Looks like:\r\n\r\n```python\r\nconfidence = self.confidence.copy()\r\nclass_ids = self.class_id.copy()\r\n```\r\n\r\nis redundant. We do not need to do it.",
"severity": "minor",
"line": 26
}
] | 1 |
python | def is_allowlisted(cmd: str) -> bool:
for match in cmd_regex.finditer(cmd):
for group in match.groups():
if group and group not in allowlist_commands:
return False
return True
def _find_quotes(cmd: str) -> list[tuple[int, int]]:
"""Find all quoted regions in a command s... | Review this code and list any quality issues. | [] | 0 |
python | pagination_list = self._search_regex(
r'(?s)class="[^"]*pagination-list[^"]*"[^>]*>(.+?)</ul>', webpage, 'pagination_list', fatal=False,
default=None)
if pagination_list:
last_page = max(map(int_or_none, re.findall(r'(\d+)', pagination_list)))
return last_page
... | Review this code and list any quality issues. | [
{
"issue": "these thin wrapper functions aren't really needed since they are only used once",
"severity": "minor",
"line": 26
}
] | 1 |
python | make_even,
resize_array,
resize_preserving_order,
resize_with_interpolation,
)
from ..utils.paths import straight_path
from ..utils.simple_functions import get_parameters
from ..utils.space_ops import (
angle_between_vectors,
angle_of_vector,
normalize,
rotation_matrix_transpose,
)
class O... | Review this code and list any quality issues. | [
{
"issue": "Why are the class attributes needed as well as the instance ones?",
"severity": "minor",
"line": 26
}
] | 1 |
python | def update(self, left=None, bottom=None, right=None, top=None,
wspace=None, hspace=None):
"""
Update the dimensions of the passed parameters. *None* means unchanged.
"""
if ((left if left is not None else self.left)
>= (right if right is not None else self.... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n \"\"\"Restore the subplot positioning parameters to the default rcParams values\"\"\"\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | 'ext': 'mp4',
'title': 'Just Out Of The Shower JOI - Shooshtime',
'thumbnail': 'https://i.shoosh.co/contents/videos_screenshots/284000/284002/preview.mp4.jpg',
'height': 720,
'age_limit': 18,
},
},
]
def report_following_redire... | Review this code and list any quality issues. | [
{
"issue": "```py\r\n fragment_query = self._configuration_arg('fragment_query', [None], casesense=True)[0]\r\n if fragment_query is not None:\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | self.available = self._on_action is not None
except Exception:
_LOGGER.exception("An unknown error occurred")
self._control = None
self.state = MediaPlayerState.OFF
self.available = self._on_action is not None
async def async_update(self) -> None:
"""... | Review this code and list any quality issues. | [
{
"issue": "`except AttributeError, TypeError:` is invalid syntax in Python 3. Use `except (AttributeError, TypeError):`.",
"severity": "minor",
"line": 26
}
] | 1 |
python | from __future__ import annotations
import abc
import dataclasses
import functools
import os.path
from ._utils import _get_exe_version_output, detect_exe_version, int_or_none
# NOT public API
def runtime_version_tuple(v):
# NB: will return (0,) if `v` is an invalid version string
return tuple(int_or_none(x, d... | Review this code and list any quality issues. | [
{
"issue": "Maybe this? We could allow people using `--js-runtimes deno:` to mean current workdir?\n```suggestion\n if path is None:\n```",
"severity": "minor",
"line": 17
}
] | 1 |
python | for l in lines:
row = json.loads(l)
if row["type"] == action_type:
return row
def process_data(row, action_type, all_ips):
# Initialize local counters
ct_invalid_conv_id = 0
ct_invalid = 0
ct_network_error = 0
try:
if action_type in ["chat", "upvote", "downvote... | Review this code and list any quality issues. | [
{
"issue": "I think we should just put the data in a dictionary rather than a tuple of dict, int, int, int",
"severity": "minor",
"line": 26
}
] | 1 |
python | max_epochs=num_epochs,
default_root_dir=tmpdir,
overfit_batches=2,
)
result = trainer.fit(model)
assert result == 1
metrics = trainer.progress_bar_dict
# metrics added in training step should be unchanged by epoch end method
assert metrics['step_metric'] == -1
# a metric sha... | Review this code and list any quality issues. | [
{
"issue": "@SeanNaren flake8 found this bug, but it was still merged, could pls fix it in #5666\r\nmost likely `on_train_epoch_end` >> `on_train_epoch_start` as `*_end` is here twice",
"severity": "critical",
"line": 26
}
] | 1 |
python | 'only_matching': True,
}]
def _get_sign_func(self, room_id, video_id):
return self._download_json(
f'https://www.douyu.com/swf_api/homeH5Enc?rids={room_id}', video_id,
note='Getting signing script')['data'][f'room{room_id}']
def _extract_stream_formats(self, stream_formats)... | Review this code and list any quality issues. | [
{
"issue": "Looking over this again, I realize we should do this:\r\n```suggestion\r\n ext = determine_ext(stream_url)\r\n formats.append({\r\n 'url': stream_url,\r\n 'format_id': str_or_none(rate_id),\r\n 'ext': 'mp4' if ext... | 1 |
python | >>> chunks[0].id # Returns "chunk_3e25960a79d_1" (hash-based)
"""
import hashlib
from abc import ABC, abstractmethod
from enum import Enum
from typing import List, Optional
from agno.knowledge.document.base import Document
class ChunkingStrategy(ABC):
"""Base class for all chunking strategies.
All chunkin... | Review this code and list any quality issues. | [
{
"issue": "Chunk ID from document.id, name, or content hash - prevents None IDs in database.",
"severity": "minor",
"line": 26
}
] | 1 |
python | * `--consumer.config <config-file>` - (DEPRECATED) consumer config properties (typically empty). This option will be removed in a future version. Use --command-config instead.
* `--command.config <config-file>` - consumer config properties
Environment variables:
* `LOG_DIR` - log output directory. Typically not need... | Review this code and list any quality issues. | [
{
"issue": "Shouldn't this be `--command-config` also?",
"severity": "minor",
"line": 26
}
] | 1 |
python | extra={
'does_webhook_exist_on_resource': does_webhook_exist_on_resource,
'status': status,
'resource_id': resource_id,
'resource_type': resource_type,
},
)
self.determine_if_rate_limited(status)
if does_webhook_exist_o... | Review this code and list any quality issues. | [] | 0 |
python | block = block_cls()
except Exception as e:
# If we can't create a block instance, assume it's not OAuth-only
logger.error(f"Error creating block instance for {block_cls.__name__}: {e}")
return True
logger.debug(
f"Checking if block {block_cls.__name__} has a valid provider config... | Review this code and list any quality issues. | [
{
"issue": "Skipping the checks seems risky: it allows misconfigured credential inputs to still show up in the UI if optional.",
"severity": "critical",
"line": 26
}
] | 1 |
python | self.log.debug('Setting up network thread')
self.network_thread = NetworkThread()
self.network_thread.start()
if self.options.usecli:
if not self.supports_cli:
raise SkipTest("--usecli specified but test does not support using CLI")
self.skip_if_no_cli()
... | Review this code and list any quality issues. | [
{
"issue": "Used repurposed test script (556b4646985d4313925bf060692e7a690d396629) from #30660 to see how things behave.\r\n\r\nCleaner shutdowns when failing can be achieved by also avoiding stop-attempts here:\r\n```suggestion\r\n if self.success == TestStatus.FAILED:\r\n self.log.info(\"Not... | 1 |
python | pl.DataFrame({"a": 1, "b": 2}),
)
# With `pl.struct()`
lf = pl.LazyFrame({"a": 1, "b": 2}).select(pl.struct(pl.all())).unnest("a")
q = lf.filter(pl.col("a") == 1)
plan = q.explain()
assert "FILTER" in plan
assert plan.index("FILTER") < plan.index("UNNEST")
assert_frame_equal(
... | Review this code and list any quality issues. | [] | 0 |
python | sign_in = self._download_json(
f'{self._BASE_URL}/web_api/signin', None, 'Logging in', headers={
'Accept': 'application/json',
'Content-Type': 'application/json',
}, data=json.dumps({
'session': {
'email': username,
... | Review this code and list any quality issues. | [
{
"issue": "I think technically we want the last value in the query. Sorry, this is very pedantic\r\n```suggestion\r\n query = {k: v[-1] for k, v in parse_qs(url).items() if v}\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | def make_mock_module(zones: list) -> MagicMock:
"""Return a mock module with the given zones."""
module = MagicMock()
module.id = "deadbeef"
module.name = "Foobar"
module.type = "SL"
module.version = "1.0"
module.zones = AsyncMock(return_value=zones)
module.schedules = AsyncMock(return_v... | Review this code and list any quality issues. | [
{
"issue": "If I am not mistaken, this in already in the `conftest.py`?",
"severity": "minor",
"line": 26
}
] | 1 |
python | # ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
from promptflow._utils.async_utils import async_run_allowing_running_loop
from promptflow.evals.common.constants import EvaluationMetrics
t... | Review this code and list any quality issues. | [
{
"issue": "Any downside if we also move content safety base to common?",
"severity": "minor",
"line": 8
}
] | 1 |
python | 'duration': ('duration', {int_or_none}),
'episode_number': ('number', {int_or_none}),
'series': ('season', 'serial', 'title', {str_or_none}),
'thumbnails': ('images', ..., ..., {'url': ('url', {url_or_none})}),
})
info_dict['description'] = clean_html(dict_get(video, ... | Review this code and list any quality issues. | [
{
"issue": "Can't we just not match URLs that contain a date?\r\n```suggestion\r\n _VALID_URL = r'https?://vod\\.tvp\\.pl/(?P<category>[a-z\\d-]+,\\d+)/[a-z\\d-]+(?<!-odcinki)(?:-odcinki,\\d+/odcinek-\\d+,S\\d+E\\d+)?,(?P<id>\\d+)/?(?:[?#]|$)'\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | get_response = get(reverse('api:job_template_detail', kwargs={'pk': jt_copy_edit.pk}), user=rando)
assert get_response.status_code == 200
post_data = get_response.data
post_data['name'] = '%s @ 12:19:47 pm' % post_data['name']
post_response = post(reverse('api:job_template_list'), user=rando, data=post... | Review this code and list any quality issues. | [] | 0 |
python | class Socket(object):
""" Create a new socket using the given address family, socket type and protocol number. """
def __init__(self, socket_family=socket.AF_INET, socket_type=socket.SOCK_STREAM, proto=0, fileno=None):
self.socket = socket.socket(socket_family, socket_type, proto, fileno)
def conne... | Review this code and list any quality issues. | [
{
"issue": "I think this should only be used with receive_data, so the comment is not exactly right.",
"severity": "minor",
"line": 26
}
] | 1 |
python | wfid = str(uuid.uuid4())
with SetWorkflowID(wfid):
# DBOSAgent already wraps the `run` function as a DBOS workflow, so we can just call it directly.
result = await complex_dbos_agent.run(
'Tell me: the capital of the country; the weather there; the product name', deps=Deps(country='Mexic... | Review this code and list any quality issues. | [
{
"issue": "@qianl15 Any idea why this change would cause `event_stream_handler` to be called an extra time, without us also having an extra `BasicSpan(content='ctx.run_step=1')` in the span tree below?",
"severity": "minor",
"line": 26
}
] | 1 |
python | self._test_pathname(os.path.join("..", "foo", ".", "bar"))
self._test_pathname(os.path.join("..", "foo", "..", "bar"))
self._test_pathname("foo" + os.sep + os.sep + "bar")
self._test_pathname("foo" + os.sep + os.sep, "foo", dir=True)
def test_abs_pathnames(self):
if sys.platform ==... | Review this code and list any quality issues. | [] | 0 |
python | self.instructions = instructions
# Whether to allow more than one function tool call generated per turn.
self.parallel_tool_calls = parallel_tool_calls
# Max number of total calls to built-in tools that can be processed in a response
self.max_tool_calls = max_tool_calls
self.reas... | Review this code and list any quality issues. | [
{
"issue": "Tiny nit: `self.store` gets assigned twice in `__init__` (first `self.store = store`, then immediately overwritten by the `bool(store)` normalization).\n\nNot blocking, but worth cleaning up while we’re in here.",
"severity": "minor",
"line": 26
}
] | 1 |
python | ``self``
See also
--------
:meth:`move_to`
"""
if config["use_opengl_renderer"]:
self.apply_points_function(
lambda points: scale_factor * points,
works_on_bounding_box=True,
**kwargs,
)
return ... | Review this code and list any quality issues. | [
{
"issue": "The last part is here not rendered in the docs:\r\n\r\nDo you know why?\r\nMaybe to long?",
"severity": "minor",
"line": 26
}
] | 1 |
python | if os.name == "posix":
# Must have render node
if not os.path.exists("/dev/dri/renderD128"):
return False
# Prefer Level Zero runtime check
if has_cmd("sycl-ls"):
out = try_cmd("sycl-ls").lower()
... | Review this code and list any quality issues. | [
{
"issue": "The variable `msg` may not be initialized in certain code paths. Specifically, when entering the else block at line 393 and when no hardware detection conditions match (e.g., for MPS at lines 595-598, or when the CPU fallback at line 603 is reached), `msg` is never set before being referenced at lin... | 1 |
python | if len(self._mouse_events) > 0:
self._last_mouse_event = self._mouse_events[-1]
# Skip rendering when screen is off
if not self._should_render:
if PC:
rl.poll_input_events()
time.sleep(1 / self._target_fps)
yield False
continue
if s... | Review this code and list any quality issues. | [
{
"issue": "The render loop prints the full widget stack every frame (`print('widget stack', ...)`). This is extremely expensive at 20/60 FPS and will flood logs/stdout. Please remove it or guard it behind an explicit debug/trace flag.",
"severity": "critical",
"line": 26
}
] | 1 |
python | import functools
import random
import re
import string
import time
from .common import InfoExtractor
from ..aes import aes_cbc_encrypt_bytes
from ..utils import (
ExtractorError,
float_or_none,
determine_ext,
int_or_none,
js_to_json,
traverse_obj,
urljoin,
)
class TencentBaseIE(InfoExtrac... | Review this code and list any quality issues. | [
{
"issue": "Avoid variables only used once\r\n\r\n```python\r\nif api_response.get('code') != '0.0' and msg is not None:\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | stores = config_dict["storage"]["stores"]
assert "prompts" in stores
assert stores["prompts"]["namespace"] == "prompts"
# Verify config can be parsed back
parsed = parse_and_maybe_upgrade_config(config_dict)
assert parsed.image_name == "providers-run"
def test_providers_flag_generates_config_with... | Review this code and list any quality issues. | [
{
"issue": "why create a Mock here? why not pass a legitimate `arg namespace` object by having the parser actually parse? why are you even constructing the `StackRun` object btw?",
"severity": "minor",
"line": 26
}
] | 1 |
python | """
if capture_output:
stdout = stderr = subprocess.PIPE
try:
proc = subprocess.run(
command, env=env,
timeout=timeout, check=check,
stdout=stdout, stderr=stderr,
text=text
)
except BlockingIOError:
if sys.platform == "cygwin":
... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n if proc.stdout:\r\n _log.debug(f\"Subprocess output:\\n{proc.stdout}\")\r\n if proc.stderr:\r\n _log.debug(f\"Subprocess error:\\n{proc.stderr}\")\r\n```\r\n\r\nIn the happy case where the process returns cleanly we tend to then look at stdout/stderr to check fo... | 1 |
python | # ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
import copy
import inspect
import types
from dataclasses import dataclass
from functools import partial
from pathlib import Path
from typin... | Review this code and list any quality issues. | [
{
"issue": "import path should be `from promptflow.connections import ConnectionProvider`",
"severity": "minor",
"line": 23
}
] | 1 |
python | # Copyright (C) 2020 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": "Can you explain the “.add(1)” portion of this?",
"severity": "minor",
"line": 23
}
] | 1 |
python | 'album': traverse_obj(album, 'name', 'title'),
'album_artist': traverse_obj(album, 'artistsNames', 'artists_names'),
}
def _real_initialize(self):
if not self.get_param('cookiefile') and not self.get_param('cookiesfrombrowser'):
self._request_webpage(self.get_api_with_signat... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n for item in items or []:\r\n```\r\nsee below comment",
"severity": "minor",
"line": 26
}
] | 1 |
python | get_elements_html_by_class,
)
class ViouslyIE(InfoExtractor):
_VALID_URL = False
_API_URL = 'https://www.viously.com/video/hls/{0:}/index.m3u8'
_WEBPAGE_TESTS = [{
'url': 'http://www.turbo.fr/videos-voiture/454443-turbo-du-07-09-2014-renault-twingo-3-bentley-continental-gt-speed-ces-guide-achat-da... | Review this code and list any quality issues. | [
{
"issue": "I think we can just\r\n```suggestion\r\n viously_players = re.findall(r'<div[^>]*class=\"(?:[^\"]*\\s)?v(?:iou)?sly-player(?:\\s[^\"]*)?\"[^>]*>', webpage)\r\n if not viously_players:\r\n return\r\n\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | choices_dialog = [ui.choice(str(i), f'Option {i}') for i in range(1, 102)]
@app('/demo')
async def serve(q: Q):
if q.args.show_inputs:
q.page['example'].items = [
ui.text(f'dropdown={q.args.dropdown}'),
ui.text(f'dropdown_multi={q.args.dropdown_multi}'),
ui.text(f'dropd... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n ui.dropdown(name='dropdown_popup_never', label='Never show popup even when choices > 100', value='1',\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | confidence: the confidence coefficient of the sparsity inference. This value is
actually used as the batchsize of the dummy_input.
"""
def __init__(self, model, dummy_input, masks_file, map_location=None,
batch_dim=0, confidence=8):
assert confidence > 1
# The auto infe... | Review this code and list any quality issues. | [
{
"issue": "This failed to pass lint checker. Suggest change to:\r\n```python\r\nif isinstance(masks_file, (str, Path)) and Path(masks_file).exists():\r\n```",
"severity": "critical",
"line": 26
}
] | 1 |
python | Parameters
----------
label : str
The header or title for the metric. The label can optionally
contain GitHub-flavored Markdown of the following types: Bold, Italics,
Strikethroughs, Inline Code, Links, and Images. Images display like
icons, with a max hei... | Review this code and list any quality issues. | [
{
"issue": "In theory, this also just supports the limited set of markdown directives we support in all labels. However, copy-pasting the specifics for `value` & `delta` as done in `label` seems a bit much. Maybe we need to find a shorter version on how to explain the limitations or mention that its the same su... | 1 |
python | WithMakeAlgo,
ZiplineTestCase,
):
@classmethod
def init_class_fixtures(cls):
super(PipelineSequenceTestCase, cls).init_class_fixtures()
def make_algo_kwargs(self, **overrides):
return self.merge_with_inherited_algo_kwargs(
PipelineSequenceTestCase,
suite_overrid... | Review this code and list any quality issues. | [
{
"issue": "Since you're not using the inputs here, I would just make inputs an empty tuple. You can also specify `window_length = 1` at class scope here instead of having to pass it to the instance below, though I don't have a super strong preference between either of those styles since there's only one call-s... | 1 |
python | if not entries:
raise ExtractorError('Could not find any videos')
return self.playlist_result(entries, playlist_id, playlist_title)
class SteamCommunityBroadcastIE(InfoExtractor):
_VALID_URL = r'https?://steamcommunity\.(?:com)/broadcast/watch/(?P<id>\d+)'
_TESTS = [{
'url': 'http... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n formats, subtitles = self._extract_mpd_formats_and_subtitles(json_data['url'], video_id)\r\n\r\n format_, subs = self._extract_m3u8_formats_and_subtitles(json_data['hls_url'], video_id)\r\n formats.extend(format_)\r\n self._merge_subtitles(subs, target=s... | 1 |
python | 'episode': 'Episode 0',
'episode_number': 0,
'duration': 442,
},
}]
def _extract_video_formats_and_subtitles(self, api_response, video_id, video_quality):
video_response = api_response['vl']['vi'][0]
video_width = video_response.get('vw')
video_height = v... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n 'url': f'{video_format[\"url\"]}{video_response[\"fn\"]}?vkey={video_response[\"fvkey\"]}',\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | 'url': 'https://zoom.iprima.cz/10-nejvetsich-tajemstvi-zahad/posvatna-mista-a-stavby',
'only_matching': True,
}, {
'url': 'https://krimi.iprima.cz/mraz-0/sebevrazdy',
'only_matching': True,
}, {
'url': 'https://cool.iprima.cz/derava-silnice-nevadi',
'only_matching': True,... | Review this code and list any quality issues. | [
{
"issue": "inline this too\r\n```suggestion\r\n token_data = self._download_json(\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | :param session: The session object
"""
def _get_sentry_integration(executor: BaseExecutor) -> str:
try:
sentry_integration = executor.sentry_integration
except AttributeError:
# Old executor interface hard-codes the supports_sentry flag.
... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n # This is possible to hit if a DagRun was in progress during a 2->3 upgrade\r\n if not ti.dag_version_id:\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | data = await process_repair_fix_flow(
http_client, flow_id, json={"next_step_id": "confirm"}
)
assert data["type"] == "create_entry"
await hass.async_block_till_done()
assert len(client.async_send_command_no_wait.call_args_list) == 1
assert client.async_send_command_no_wait.call_args[0][0... | Review this code and list any quality issues. | [
{
"issue": "Please complete the type annotation of all parameters.",
"severity": "minor",
"line": 26
}
] | 1 |
python | is_gif_format(),
self.includes_sound,
)
# handle sound
if self.includes_sound and config.format != "gif":
sound_file_path = movie_file_path.with_suffix(".wav")
# Makes sure sound file length will match video file
self.add_audio_segment(AudioSegmen... | Review this code and list any quality issues. | [
{
"issue": "In the case where rendering with `--format=mp4 --transparent`, we internally construct a `.mov`, but keep the `config.format` value to be `.mp4`. This would cause manim stepping inside this conditional, which is probably not intended (but still works, apparently).\r\n\r\nShould we (still) just compa... | 1 |
python | action="store_true",
help=(
"When batch processing is used, all plugged OpenSK devices will "
"be programmed the same way. Otherwise (default) only the first seen "
"device will be programmed."),
)
parser.add_argument(
"--board",
type=str,
choices=["nrf52840dk_o... | Review this code and list any quality issues. | [
{
"issue": "Copy paste? s/configure/upgrade/",
"severity": "minor",
"line": 26
}
] | 1 |
python | from __future__ import annotations
import re
from typing import TYPE_CHECKING
from bs4 import BeautifulSoup, NavigableString, PageElement, Tag
if TYPE_CHECKING:
from collections.abc import Iterable
SKIP_TAGS = {'script', 'style', 'canvas', 'svg', 'noscript', 'title'}
BLOCK_TAGS = {
'p',
'h1',
'h2',
... | Review this code and list any quality issues. | [
{
"issue": "I would prefer moving this to e.g. `crawlee/beautifulsoup_crawler/_utils.py` to avoid the need for try-except imports here.",
"severity": "minor",
"line": 2
}
] | 1 |
python | # Pseudonyms for more general get_critical_point method
def get_edge_center(self, direction):
return self.get_critical_point(direction)
def get_corner(self, direction):
return self.get_critical_point(direction)
def get_center(self):
"""Center coordinates the mobject"""
ret... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\r\n \"\"\"Bottom center coordinate of the :class:`~.Mobject`.\"\"\"\r\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | # ),
# )
# with sklearn.config_context(array_api_dispatch=True):
# cv_results = cross_validate(ridge_pipeline_gpu, features, target)
#
#
# See `full notebook on Google Colab
# <https://colab.research.google.com/drive/1ztH8gUPv31hSjEeR_8pw20qShTwViGRx?usp=sharing>`_
# for more details. On this pa... | Review this code and list any quality issues. | [
{
"issue": "```suggestion\n# Note that CPython 3.14 is strongly advised (vs 3.13) because a number of\n```",
"severity": "minor",
"line": 26
}
] | 1 |
python | prev_from = None
total_tokens = 0
for conv in conversations:
_from = conv["from"]
total_tokens += estimate_num_tokens(conv["value"])
# consecutive rounds (gpt followed by gpt, human followed by human, ..)
if prev_from == _from:
return True
# too long convers... | Review this code and list any quality issues. | [] | 0 |
python | Exception. The given role does not exist.
"""
user_settings = get_user_settings(user_id, strict=True)
if feconf.ROLE_ID_MOBILE_LEARNER in user_settings.roles:
raise Exception('The role of a Mobile Learner cannot be changed.')
if role in feconf.ALLOWED_DEFAULT_USER_ROLES_ON_REGISTRATION:
... | Review this code and list any quality issues. | [] | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.