id
stringlengths
30
32
content
stringlengths
139
2.8k
codereview_new_python_data_6341
def incremental_update_mb_metadata_cache(use_lb_conn: bool): def cleanup_mbid_mapping_table(): - """ Find msids which are mapped to mbids that are now absent from mb_metadata_cache because - those have been merged (redirects) or deleted from MB. """ query = """ UPDATE mbid_mapping mm ...
codereview_new_python_data_6342
def _get_playable_recommendations_list(mbids_and_ratings_list): } } - These changes are done because to show cover art of a particular listen its recording_mbid and then its release_mbid, caa_id , caa_release_mbid are needed in order to perform the frontend logic ...
codereview_new_python_data_6343
def add_do_not_recommend(): Currently, the supported entity types are ``artist``, ``release``, ``release_group`` and ``recording``. The ``until`` key in the json body is optional. If absent, the don't recommend entry will be added forever. If present, it should - be an epoch timestamp in seconds denotin...
codereview_new_python_data_6346
def run(self, no_swap=False, no_analyze=False): total_rows = curs.rowcount log(f"{self.table_name}: fetch {total_rows:,} rows") while True: - batch = curs.fetchmany(1000) if len(batch) == 0: ...
codereview_new_python_data_6347
def msb_transfer_db(): @cli.command() def generate_playlists(): - """ Generate daily playlists for users after checking timezone settings """ run_daily_jams_troi_bot() I think this option should have a more descriptive name and desc. We should make it clear that this is an internal function as part of our...
codereview_new_python_data_6348
def get_sitewide_fresh_releases(pivot_release_date: date, release_date_window_da , artist_credit_name , release_name""" - psycopg2.extras.register_uuid() with psycopg2.connect(current_app.config["MB_DATABASE_URI"]) as conn: with conn.cursor(cursor_factor...
codereview_new_python_data_6349
def get_sitewide_fresh_releases(pivot_release_date: date, release_date_window_da , artist_credit_name , release_name""" - psycopg2.extras.register_uuid() with psycopg2.connect(current_app.config["MB_DATABASE_URI"]) as conn: with conn.cursor(cursor_factor...
codereview_new_python_data_6350
def select_timezone(): try: update_timezone = str(form.timezone.data) db_usersetting.set_timezone(current_user.id, update_timezone) - flash.info("timezone reset") except DatabaseException: flash.error("Something went wrong! Unable to update timezone r...
codereview_new_python_data_6352
def select_timezone(): flash.error("Something went wrong! Unable to update timezone right now.") return redirect(url_for("profile.info")) - if form.csrf_token.errors: flash.error('Unable to update timezone.') return redirect(url_for('profile.info')) Should likely be form...
codereview_new_python_data_6354
def insert(feedback: Feedback): with db.engine.connect() as connection, connection.begin(): # delete the existing feedback and then insert new feedback. we cannot use ON CONFLICT DO UPDATE - # because it is possible for a user to submit the feedback using recording_msid only and then - # ...
codereview_new_python_data_6513
"-DUSES_P080", # Dallas iButton "-DUSES_P081", # Cron "-DUSES_P082", # GPS -# "-DUSES_P085", # AcuDC24x "-DUSES_P098", # PWM motor -# "-DUSES_P100", # Pulse Counter - DS2423 # "-DUSES_P087", # Serial Proxy # "-DUSES_P094", # CUL Reader # "-DUSES_P095", # TFT ILI9341 For E...
codereview_new_python_data_6525
"-DUSE_TRIGONOMETRIC_FUNCTIONS_RULES", "-DUSE_CUSTOM_PROVISIONING", "-DUSE_SETTINGS_ARCHIVE" ] I don't think this comment makes sense here, as it suggests the p2p feature is somehow deprecated. "-DUSE_TRIGONOMETRIC_FUNCTIONS_RULES", "-DUSE_CUSTOM_PROVISIONING", + "-DFEATURE_ESPE...
codereview_new_python_data_6536
def test_minmax_frame(mm, res): # See issue #3406 DT = dt.Frame(range(5)) assert mm(DT)[0,0] == res - #assert_equals(DT_minmax, DT.min()) - #------------------------------------------------------------------------------- # sum This line can be safely removed? def test_minmax_frame(mm, res): ...
codereview_new_python_data_6543
def get_versions(): versions = [] strip_versions = [] versions.append("Release_1_8_20") - pre = "Release_1_9_" for o in shlex.split(raw_versions): if o.startswith(pre): - if len(o.replace(pre,"")) == 1 or len(o.replace(pre,"")) == 2: - strip_versions.append(int...
codereview_new_python_data_6551
name='flatbuffers', version='22.11.23', license='Apache 2.0', - license_files='LICENSE.txt', author='Derek Bailey', author_email='derekbailey@google.com', url='https://google.github.io/flatbuffers/', Can we just reference the license in `../LICENSE.txt` instead of making a copy of it ...
codereview_new_python_data_6559
def glob(path, pattern): flatc( NO_INCL_OPTS - + DART_OPTS - + ["--go"], schema="include_test/include_test1.fbs", include="include_test/sub", ) flatc( NO_INCL_OPTS - + DART_OPTS - + ["--go"], schema="include_test/sub/include_test2.fbs", include="include_test", ) Why d...
codereview_new_python_data_6701
def init_settings(self, jupyter_app, kernel_manager, contents_manager, log.warning(_("""Alternatively use `%s` when working on the notebook's Javascript and LESS""") % 'npm run build:watch') warnings.warn(_("The `ignore_minified_js` flag is deprecated and will be removed in Notebook 6.0"), De...
codereview_new_python_data_6869
def leInt(i1, i2): # noqa: N802 def mlEquals( # noqa: N802 term1: KInner, term2: KInner, - sort1: Union[str, KSort] = Sorts.K, - sort2: Union[str, KSort] = Sorts.K, ) -> KApply: - return KLabel('#Equals', sort1, sort2)(term1, term2) def mlEqualsTrue(term: KInner) -> KApply: # noqa: N802 I...
codereview_new_python_data_6871
from ..kast import EMPTY_ATT, KAst, KDefinition, KFlatModuleList, KRequire from ..kastManip import remove_generated_cells -from ..ktool import KompileBackend, _kprove from .kprove_test import KProveTest ```suggestion from ..ktool.kompile import KompileBackend, _kprove ``` from ..kast import EMPTY_ATT,...
codereview_new_python_data_6872
from .kompile import KompileBackend, kompile -from .kprint import ( - KPrint, - _kast, - applied_label_str, - build_symbol_table, - indent, - paren, - pretty_print_kast, - unparser_for_production, -) -from .kprove import KProve, _kprove -from .krun import KRun, _krun We really shouldn't be en...
codereview_new_python_data_6873
def __init__(self, definition_dir: Path, use_directory: Optional[Path] = None) - self.definition_hash = hash_str(self.definition) def kore_to_kast(self, kore: Kore) -> KAst: - output = _kast(self.definition_dir, kore.text, input='kore') return KAst.from_dict(json.loads(output)['term']) ...
codereview_new_python_data_6874
def pretty_print_kast(kast: KAst, symbol_table: SymbolTable, debug=False): if type(kast) is KProduction: if 'klabel' not in kast.att and kast.klabel: kast = kast.update_atts({'klabel': kast.klabel.name}) - sort_str = pretty_print_kast(kast.sort, symbol_table, debug=debug) - if ...
codereview_new_python_data_6875
def pretty_print_kast(kast: KAst, symbol_table: SymbolTable, debug=False): kast = kast.update_atts({'klabel': kast.klabel.name}) syntax_str = 'syntax ' + pretty_print_kast(kast.sort, symbol_table, debug=debug) if kast.items: - syntax_str += ' '.join([pretty_print_kast(pi, symb...
codereview_new_python_data_6876
def dict(self) -> Dict[str, Any]: @property def text(self) -> str: - return self.name class Pattern(Kore, ABC): This change in how `SortApp.text` works is needed in order to get these tests passing, because the frontend does not want to parse sorts with `{}` behind them: https://github.com/run...
codereview_new_python_data_6878
class PrettyPrintKastTest(TestCase): (KRule(TRUE), 'rule true\n '), (KRule(TRUE, ensures=TRUE), 'rule true\n '), (KRule(TRUE, ensures=KApply('_andBool_', [TRUE, TRUE])), 'rule true\n ensures ( true\n andBool ( true\n ))\n '), - (Subst({'X': TRUE, 'Y': KApply('_andB...
codereview_new_python_data_6879
def unapply(self, term: KInner) -> KInner: new_term = KRewrite(lhs, rhs).replace(new_term) return new_term - def pretty_print(self, kprint) -> str: - return '\n'.join(key + ' |-> ' + kprint.pretty_print(value) for key, value in self.items()) @final What do you think about `prett...
codereview_new_python_data_6880
class EdgeLike(ABC): @abstractmethod def pretty(self, kprint: KPrint) -> Iterable[str]: - assert False, 'Must be overridden' def __lt__(self, other): if not isinstance(other, KCFG.EdgeLike): ```suggestion ... ``` class EdgeLike(ABC): @a...
codereview_new_python_data_6881
def kompile( hook_namespaces: Iterable[str] = (), emit_json=False, concrete_rules: Iterable[str] = (), - additional_args: Iterable[str] = () ) -> Path: check_file_path(main_file) This is a matter of personal preference, but I like to add the trailing comma to such lists. It is easier to exte...
codereview_new_python_data_6882
def _ml_impl(antecedents: Iterable[KInner], consequents: Iterable[KInner]) -> KI return mlImplies(antecedent, consequent, Sorts.GENERATED_TOP_CELL) - def with_constraint(self, new_constraint: KInner) -> 'CTerm': return CTerm(mlAnd([self.config, new_constraint] + list(self.constraints), Sorts.G...
codereview_new_python_data_6883
def syntax_productions(self) -> List[KProduction]: @staticmethod def _is_non_free_constructor(label: str) -> bool: is_cell_map_constructor = label.endswith('CellMapItem') or label.endswith('CellMap_') - is_builtin_data_constructor = label in ['_Set_', '_List_', '_Map_', 'SetItem', 'ListItem',...
codereview_new_python_data_6884
def resolve(node_id: str) -> str: for verified_ids in dct.get('verified') or []: cfg.add_verified(resolve(verified_ids['source']), resolve(verified_ids['target'])) - for alias, id in (dct.get('aliases') or {}).items(): cfg.add_alias(name=alias, id=id) return cfg ...
codereview_new_python_data_6885
def resolve(node_id: str) -> str: for verified_ids in dct.get('verified') or []: cfg.add_verified(resolve(verified_ids['source']), resolve(verified_ids['target'])) - for alias, id in (dct.get('aliases') or {}).items(): cfg.add_alias(name=alias, id=id) return cfg ...
codereview_new_python_data_6886
def resolve(node_id: str) -> str: for verified_ids in dct.get('verified') or []: cfg.add_verified(resolve(verified_ids['source']), resolve(verified_ids['target'])) - for alias, id in (dct.get('aliases') or {}).items(): cfg.add_alias(name=alias, id=id) return cfg ...
codereview_new_python_data_6888
def applyByNode(requestContext, seriesList, nodeNum, templateFunction, newName=N """ prefixes = set() for series in seriesList: - prefix = '.'.join(series.name.split('.')[:nodeNum + 1]) prefixes.add(prefix) results = [] newContext = requestContext.copy() ```suggestion if nodeNum > len(node...
codereview_new_python_data_6889
def _decode_stability_pool_event( event.event_type = HistoryEventType.STAKING event.event_subtype = HistoryEventSubType.REWARD event.counterparty = CPT_LIQUITY - event.notes = f"Collect {event.balance.amount} {event.asset.symbol_or_name(...
codereview_new_python_data_6890
-from typing import TYPE_CHECKING -from rotkehlchen.constants.timing import DATA_UPDATES_REFRESH -from rotkehlchen.db.updates import LAST_DATA_UPDATES_KEY from rotkehlchen.serialization.deserialize import deserialize_timestamp from rotkehlchen.utils.misc import ts_now if TYPE_CHECKING: from rotkehlchen.db.db...
codereview_new_python_data_6891
-from typing import TYPE_CHECKING -from rotkehlchen.constants.timing import DATA_UPDATES_REFRESH -from rotkehlchen.db.updates import LAST_DATA_UPDATES_KEY from rotkehlchen.serialization.deserialize import deserialize_timestamp from rotkehlchen.utils.misc import ts_now if TYPE_CHECKING: from rotkehlchen.db.db...
codereview_new_python_data_6892
ETH_PROTOCOLS_CACHE_REFRESH = DAY_IN_SECONDS * 3 DATA_UPDATES_REFRESH = DAY_IN_SECONDS To be consistent with naming perhaps ```suggestion EVM_ACCOUNTS_DETECTION_REFRESH = DAY_IN_SECONDS ``` ETH_PROTOCOLS_CACHE_REFRESH = DAY_IN_SECONDS * 3 DATA_UPDATES_REFRESH = DAY_IN_SECONDS +EVM_ACCOUNTS_DETECTION_REFR...
codereview_new_python_data_6893
class WSMessageType(Enum): PREMIUM_STATUS_UPDATE = auto() DB_UPGRADE_STATUS = auto() # Used for evm address migration after new chain integration - EVM_ADDRESS_MIGRATION = auto() # Used for when a new token is found and saved via processing evm transactions NEW_EVM_TOKEN_DETECTED = auto() ...
codereview_new_python_data_6894
class WSMessageType(Enum): PREMIUM_STATUS_UPDATE = auto() DB_UPGRADE_STATUS = auto() # Used for evm address migration after new chain integration - EVM_ADDRESS_MIGRATION = auto() # Used for when a new token is found and saved via processing evm transactions NEW_EVM_TOKEN_DETECTED = auto() ...
codereview_new_python_data_6895
-from typing import TYPE_CHECKING -from rotkehlchen.constants.timing import DATA_UPDATES_REFRESH -from rotkehlchen.db.updates import LAST_DATA_UPDATES_KEY from rotkehlchen.serialization.deserialize import deserialize_timestamp from rotkehlchen.utils.misc import ts_now if TYPE_CHECKING: from rotkehlchen.db.db...
codereview_new_python_data_6967
# known checksums for different PACE versions. used to validate the download. checksums = { \ - 'v.2021.2.3.upd2': '8fd1162724d349b930e474927197f20d', - 'v.2021.4.9': '4db54962fbd6adcf8c18d46e1798ceb5', - 'v.2021.9.28': 'f98363bb98adc7295ea63974738c2a1b', - 'v.2021.10.25': 'a2ac3315c41a1a4a5c912bcb1bc9...
codereview_new_python_data_6969
def compat_kw(*args, **kw): ) elif dtype.kind == "c": result = st.complex_numbers( - width=8 * dtype.itemsize, # convert from bytes to bits **compat_kw( "min_magnitude", "max_magnitude", Sould we do this instead, much like in the float ...
codereview_new_python_data_6970
def complex_numbers( the system ``sqrt`` function. The width argument specifies the maximum number of bits of precision - required to represent the entire generated complex. Valid values are 64 or 128, which correspond to the real and imaginary components having width 32 or 64, respectively. ...
codereview_new_python_data_6971
def complex_numbers( check_type(bool, allow_subnormal, "allow_subnormal") if width not in (64, 128): raise InvalidArgument( - f"Got width={width!r}, but the only valid values are the integers 64 and 128. " - "Other data types like complex32 or complex256 are not supported." ...
codereview_new_python_data_6972
import sys from copy import copy -from functools import lru_cache from types import SimpleNamespace from typing import Tuple Looks like this import is unused now, once you delete it feel free to merge! import sys from copy import copy from types import SimpleNamespace from typing import Tuple
codereview_new_python_data_6973
def xfail( condition: bool = True, *, reason: str = "", - raises: Union[Type[BaseException], Tuple[Type[BaseException], ...]] = BaseException, ) -> "example": """Mark this example as an expected failure, like pytest.mark.xfail(). ```suggestion raises: Union[ ...
codereview_new_python_data_6974
def my_hook(): if r in RANDOMS_TO_MANAGE.values(): return - if not PYPY: # PYPY does not have `sys.getrefcount` gc.collect() if not gc.get_referrers(r): ```suggestion if not PYPY: # pragma: no branch ``` def my_hook(): if r in RANDOMS_TO_MANAGE.values(): ...
codereview_new_python_data_6975
def key(name): if __name__ == "__main__": # This would be really really annoying to write automated tests for, so I've # done some manual exploratory testing: `pip install grequests gevent==21.12.0`, - # delete gevent from the known-ftz set and reverse-alphabetical sort so we land - # on grequests bef...
codereview_new_python_data_6976
with warnings.catch_warnings(): # We ignore all warnings here as many array modules warn on import warnings.simplefilter("ignore") - # We go through the steps described in README.md to define `xp_xps_parais`, - # which contains the array module(s) to be ran against the test suite along # with the...
codereview_new_python_data_6977
def complex_numbers( it is an error to enable ``allow_infinity``. ``allow_subnormal`` is applied to each part of the complex number - separately. The magnitude constraints are respected up to a relative error of (around) floating-point epsilon, due to implementation via ```suggestion s...
codereview_new_python_data_6978
def test_minmax_magnitude_equal(data, mag): def _is_subnormal(x): - return -sys.float_info.min < x < sys.float_info.min @pytest.mark.parametrize( Not quite - this would incorrectly say that +/- zero is subnormal. I prefer `0 < abs(x) < sys.float_info.min`. def test_minmax_magnitude_equal(data, mag): ...
codereview_new_python_data_6979
def scan(self, timeout=None): for p, test_case in product( self.state_paths, self.configuration.test_cases): log_automotive.info("Scan path %s", p) - terminate = False if kill_time is None else \ - kill_time <= time.monotonic() ...
codereview_new_python_data_6980
class GTPHeader(Packet): def post_build(self, p, pay): p += pay if self.length is None: tmp_len = len(p) - 4 if self.version == 2 else len(p) - 8 p = p[:2] + struct.pack("!H", tmp_len) + p[4:] return p Could you explain how a test on the version fixes your iss...
codereview_new_python_data_6981
def itom(x): def decode_locale_str(x): # type: (bytes) -> str return x.decode(encoding=locale.getlocale()[1] or "utf-8", errors="replace") Could you add a docstring? def itom(x): def decode_locale_str(x): # type: (bytes) -> str + """ + Decode bytes into a string using the system local...
codereview_new_python_data_6982
def _flush_inout(self): def destroy(self): # type: () -> None if self.started.locked(): raise ValueError("Can't close running Automaton ! Call stop() beforehand") self._flush_inout() Could you add a docstring? def _flush_inout(self): def destroy(self): ...
codereview_new_python_data_6983
def _get_initial_requests(self, **kwargs): def __reduce__(self): # type: ignore f, t, d = super(ServiceEnumerator, self).__reduce__() # type: ignore try: - for k, v in d["_request_iterators"].items(): d["_request_iterators"][k] = list(v) except KeyError: ...
codereview_new_python_data_6984
def _get_initial_requests(self, **kwargs): def __reduce__(self): # type: ignore f, t, d = super(ServiceEnumerator, self).__reduce__() # type: ignore try: - for k, v in d["_request_iterators"].items(): d["_request_iterators"][k] = list(v) except KeyError: ...
codereview_new_python_data_6985
class STUNGenericTlv(Packet): def dispatch_hook(cls, _pkt=None, *args, **kwargs): if _pkt and len(_pkt) >= 2: t = struct.unpack("!H", _pkt[:2])[0] - return _stun_tlv_class.get(t, "STUNGenericTlv") return cls def guess_payload_class(self, payload): ```suggestion ...
codereview_new_python_data_6986
-# SPDX-License-Identifier: GPL-2.0-or-later # This file is part of Scapy # See https://scapy.net/ for more information # Copyright (C) 2018 antoine.torre <torreantoine1@gmail.com> This should be GPL-2.0-only +# SPDX-License-Identifier: GPL-2.0-only # This file is part of Scapy # See https://scapy.net/ for mor...
codereview_new_python_data_6987
class RandClasslessStaticRoutesField(RandField): """ def _fix(self): - return "%s/%d:%s" % (RandIP(), RandByte(), RandIP()) class ClasslessFieldListField(FieldListField): ```suggestion return "%s/%d:%s" % (RandIP(), RandNum(0, 32), RandIP()) ``` class RandClasslessStaticRoutesField...
codereview_new_python_data_6988
no_restore=False) # Build the APK -precommands.execute([]) # Remove the aab files as we don't need them, this saves space output_dir = const.PUBDIR Does the build get the `NuGet.config` another way now? You probably would need at least the dotnet8 feed: ```xml <?xml version="1.0" encoding...
codereview_new_python_data_6989
''' from shared.const import PUBDIR from shared.runner import TestTraits, Runner -from shared.versionmanager import versionsreadjsonfilesaveenv EXENAME = 'MauiAndroidDefault' if __name__ == "__main__": - versionsreadjsonfilesaveenv(rf".\{PUBDIR}\versions.json") traits = TestTraits(exename=EXENAM...
codereview_new_python_data_6990
import os import subprocess -def versionswritejson(versiondict: dict, outputfile = 'versions.json'): with open(outputfile, 'w') as file: json.dump(versiondict, file) -def versionsreadjson(inputfile = 'versions.json'): with open(inputfile, 'r') as file: return json.load(file) -def ve...
codereview_new_python_data_7102
def move_to_element(self, to_element): def move_to_element_with_offset(self, to_element, xoffset, yoffset): """Move the mouse by an offset of the specified element. Offsets are - relative to the top-left corner of the element. :Args: - to_element: The WebElement to move to. ...
codereview_new_python_data_7107
def run(args: Tuple[str, str, str]) -> str: - args: the components of the command being executed. :Returns: The log string containing the driver location. """ - logger.debug(f"Executing selenium manager with: {args}") completed_proc = subprocess.run(args, stdout=subprocess.P...
codereview_new_python_data_7108
def run(args: Tuple[str, str, str]) -> str: - args: the components of the command being executed. :Returns: The log string containing the driver location. """ - logger.debug(f"Executing selenium manager with: {args}") completed_proc = subprocess.run(args, stdout=subprocess.P...
codereview_new_python_data_7120
# under the License. -__version__ = "4.4.4" Please do not bump the version as we do not know if this will be 4.4.4 or 4.5.0 # under the License. +__version__ = "4.4.3"
codereview_new_python_data_7121
from .common.proxy import Proxy # noqa from .common.keys import Keys # noqa -__version__ = '4.4.4' # We need an explicit __all__ because the above won't otherwise be exported. __all__ = [ Please do not bump the version as we do not know if this will be 4.4.4 or 4.5.0 from .common.proxy import Proxy # no...
codereview_new_python_data_7124
'project_urls': { 'Bug Tracker': 'https://github.com/SeleniumHQ/selenium/issues', 'Changes': 'https://github.com/SeleniumHQ/selenium/blob/trunk/py/CHANGES', - 'Documentation': 'https://seleniumhq.github.io/selenium/docs/api/py/api.html', 'Source Code': 'https://github.com/Seleniu...
codereview_new_python_data_7125
'project_urls': { 'Bug Tracker': 'https://github.com/SeleniumHQ/selenium/issues', 'Changes': 'https://github.com/SeleniumHQ/selenium/blob/trunk/py/CHANGES', - 'Documentation': 'https://seleniumhq.github.io/selenium/docs/api/py/api.html', 'Source Code': 'https://github.com/Seleniu...
codereview_new_python_data_7126
def __init__(self, host, firefox_profile, firefox_binary=None, timeout=30): self.binary.launch_browser(self.profile, timeout=timeout) _URL = "http://%s:%d/hub" % (HOST, PORT) - super().__init__(URL, keep_alive=True) def quit(self, sessionId=None): self.execute(Command.QUIT, {...
codereview_new_python_data_7127
def import_devtools(ver): devtools_path = pathlib.Path(__file__).parents[1].joinpath("devtools") versions = tuple(f.name for f in devtools_path.iterdir() if f.is_dir()) latest = max((int(x[1:]) for x in versions)) - logger.debug(f"Falling back to loading `devtools`: v{latest}") ...
codereview_new_python_data_7128
def test_missing_cdp_devtools_version_falls_back(caplog): - with caplog.at_level(logging.DEBUG, logger="trio_cdp"): assert isinstance(import_devtools("will_never_exist"), types.ModuleType) # assert the fallback occurred successfully offered up a v{n} option. assert re.match(r"Falling back to...
codereview_new_python_data_7236
def test_skip(rule_runner: RuleRunner) -> None: assert not result -@pytest.mark.skipif( - not (has_python_version("3.7")), reason="Missing requisite Python" -) def test_3rdparty_plugin(rule_runner: RuleRunner) -> None: rule_runner.write_files( { ```suggestion not has_python_version("3....
codereview_new_python_data_7237
def _is_default(self, __name: str) -> bool: assert isinstance(v, OptionsInfo) return ( self.options.is_default(__name.lstrip("_")) and resolve_environment_sensitive_option(v.flag_names[0], self) is None ) Interesting. What was the issue here? ...
codereview_new_python_data_7238
async def _go_search_paths( AsdfPathString.LOCAL.value: asdf_result.local_tool_paths, } expanded: list[str] = [] for s in paths: if s == "<PATH>": - expanded.extend(await Get(PathEnvironmentVariable, {})) # noqa: PNT30: Linear search elif s in special_strings: ...
codereview_new_python_data_7239
def _is_default(self, __name: str) -> bool: assert isinstance(v, OptionsInfo) return ( self.options.is_default(__name.lstrip("_")) and resolve_environment_sensitive_option(v.flag_names[0], self) is None ) ```suggestion # vars ...
codereview_new_python_data_7240
class GlobalOptions(BootstrapOptions, Subsystem): default=[], ) - work_dir = StrOption( - advanced=True, - default="", - help=softwrap( - """ - Specs on the command line are relative to the `work_dir`. - - Prefix specs with `//` to make them abso...
codereview_new_python_data_7241
class GlobalOptions(BootstrapOptions, Subsystem): default=[], ) - work_dir = StrOption( - advanced=True, - default="", - help=softwrap( - """ - Specs on the command line are relative to the `work_dir`. - - Prefix specs with `//` to make them abso...
codereview_new_python_data_7242
class Lambdex(PythonToolBase): default_main = ConsoleScript("lambdex") register_interpreter_constraints = True - default_interpreter_constraints = ["CPython<4,>=3.7"] register_lockfile = True default_lockfile_resource = ("pants.backend.python.subsystems", "lambdex.lock") I think it would ma...
codereview_new_python_data_7243
class PythonSetup(Subsystem): def interpreter_constraints(self) -> tuple[str, ...]: # TODO: In 2.17.0.dev0 we should set the default above to None and tweak the message here # appropriately. - if not self.options.is_default("interpreter_constraints"): warn_or_error( ...
codereview_new_python_data_7244
def help_text(val: str | Callable[[], str]) -> str | Callable[[], str]: def docstring(doc: str | Callable[[], str]) -> Callable[[Callable[P, R]], Callable[P, R]]: def wrapper(func: Callable[P, R]) -> Callable[P, R]: func.__doc__ = strval(doc) return func Could you add a ... docstring ... t...
codereview_new_python_data_7245
def is_path_glob(spec: str) -> bool: """Check if `spec` should be treated as a `path` glob.""" - return len(spec) > 0 and spec[0].isalnum() or spec[0] in "_.:/*" def glob_to_regexp(pattern: str, snap_to_path: bool = False) -> str: ```suggestion return len(spec) > 0 and (spec[0].isalnum() or spec[0...
codereview_new_python_data_7246
async def resolve_plugins( internal_only=True, python=python, requirements=requirements, description=f"Resolving plugins: {', '.join(requirements.req_strings)}", ), ) This was `None` and thats a no-no. However there's no type hint for this param so `my...
codereview_new_python_data_7247
def rules(): - return [*pyenv_rules()] ```suggestion return pyenv_rules() ``` def rules(): + return pyenv_rules()
codereview_new_python_data_7248
async def get_python( # they should list a more precise IC. ), ) - specific_python = which_python_result.stdout.decode("ascii").strip() shim_digest = await Get( Digest, Can remove the "ascii" here too async def get_python( # they should list a more precise ...
codereview_new_python_data_7249
def __init__( object.__setattr__(self, "digest", digest) object.__setattr__(self, "args", tuple(args)) object.__setattr__(self, "extra_env", FrozenDict(extra_env or {})) - object.__setattr__(self, "immutable_input_digests", FrozenDict(immutable_input_digests)) - object.__setatt...
codereview_new_python_data_7250
async def run_in_sandbox_request( runnable_dependencies = execution_environment.runnable_dependencies extra_env: dict[str, str] = dict(run_request.extra_env or {}) - extra_path = extra_env.get("PATH", None) - if extra_path is not None: - del extra_env["PATH"] extra_sandbox_contents = []...
codereview_new_python_data_7251
async def _prepare_process_request_from_target( fetch_env_vars=shell_command.get(ShellCommandExtraEnvVarsField).value or (), append_only_caches=merged_extras.append_only_caches, supplied_env_var_values=FrozenDict(extra_env), - immutable_input_digests=FrozenDict(merged_extras.immutable...
codereview_new_python_data_7252
async def export( env={"PATH": environment.get("PATH", ""), **cmd.extra_env}, run_in_workspace=True, ) - ipr = await Effect( # noqa: PNT30: requires triage - InteractiveProcessResult, InteractiveProcess, ip - ) if ipr.exi...
codereview_new_python_data_7253
class DistBuildResult: wheel_config_settings = {wheel_config_settings_str} sdist_config_settings = {sdist_config_settings_str} -# Python 2.7 doesn't have the exist_ok arg on os.makedirs(), so we have to emulate it. -def safe_mkdir(path): - if not os.path.exists(path): - parent = os.path.split(path)[0] - ...
codereview_new_python_data_7254
def strval(val: str | Callable[[], str]) -> str: return val else: return val() This should probably just use a ternary? def strval(val: str | Callable[[], str]) -> str: return val else: return val() + + +def help_text(val: str | Callable[[], str]) -> str | Callable[[], ...
codereview_new_python_data_7255
class RunShellCommandWorkdirField(StringField): help = softwrap( "Sets the current working directory of the command that is `run`. Values that begin with " "`.` are relative to the directory you are running Pants from. Values that begin with `/` " - "are from the root of your filesystem."...
codereview_new_python_data_7256
class PythonSetup(Subsystem): advanced=True, ) tailor_py_typed_targets = BoolOption( - default=False, help=softwrap( """ If true, add `resource` targets for marker files named `py.typed` with the `tailor` goal. I followed what we have set for other similar ...
codereview_new_python_data_7257
def path(self) -> str: """Returns the build root for the current workspace.""" if self._root_dir is None: # Do not remove/change this env var without coordinating with `pantsbuild/scie-pants` as - # it is being used when running Pants from sources on a repo. overr...
codereview_new_python_data_7258
from pants.backend.python.framework.stevedore import python_target_dependencies from pants.backend.python.framework.stevedore import rules as stevedore_rules -from pants.backend.python.framework.stevedore import setup_py_kwargs, target_types_rules -from pants.backend.python.framework.stevedore.target_types import ...
codereview_new_python_data_7259
async def infer_stevedore_namespaces_dependencies( for namespace, entry_points in distribution_entry_points.explicit_modules.items() for name, entry_point in entry_points.items() ] - all_module_owners = iter( - await MultiGet( - Get(PythonModuleOwners, PythonModuleOwnersRequ...
codereview_new_python_data_7260
def test_no_expand_when_no_aliases() -> None: pytest.raises( CliAliasCycleError, match=( - r"CLI alias cycle detected in `\[cli\]\.alias` option:" + r"other-alias -> cycle -> other-alias" ), ), Now the...
codereview_new_python_data_7261
def test_does_not_infer_dependency_when_docker_build_arg_overwrites( ) tgt = rule_runner.get_target(Address("src/downstream", target_name="image")) - rule_runner.set_options(["--docker-build-args=BASE_IMAGE=alpine:3.17.0"]) inferred = rule_runner.request( InferredDependencies, [In...