id stringlengths 30 32 | content stringlengths 139 2.8k |
|---|---|
codereview_new_python_data_11587 | def _is_alarm_supported(self, alarm_details: MetricAlarm) -> bool:
def get_metric_alarm_details_for_alarm_arn(alarm_arn: str) -> Optional[MetricAlarm]:
alarm_name = arns.extract_resource_from_arn(alarm_arn).split(":", 1)[1]
client = get_cloudwatch_client_for_region_of_alarm(alarm_arn)
- response = client... |
codereview_new_python_data_11588 | def test_macro_deployment(
create_lambda_function(
func_name=func_name,
handler_file=macro_function_path,
- runtime=Runtime.python3_8,
client=lambda_client,
- timeout=1,
)
stack_with_macro = deploy_cfn_template(
nit: I'd suggest... |
codereview_new_python_data_11589 |
from collections import OrderedDict
from typing import Final
from localstack.services.stepfunctions.backend.execution import Execution
from localstack.services.stepfunctions.backend.state_machine import StateMachine
from localstack.services.stores import AccountRegionBundle, BaseStore, LocalAttribute
class... |
codereview_new_python_data_11590 |
from localstack.utils.files import load_file
-from tests.integration.apigateway import OPENAPI_SPEC_PULUMI_JSON
def test_import_rest_api(import_apigw, snapshot):
Not too exhaustive for now because we will be moving "import api" tests from existing modules.
+import os
+
from localstack.utils.files import load... |
codereview_new_python_data_11591 | def check_invocations():
cleanup(sm_arn, state_machines_before, stepfunctions_client)
events.delete_event_bus(Name=bus_name)
- def test_create_state_machines_in_parallel(self, stepfunctions_client):
"""
Perform a test that creates a series of state machines in parallel. Without... |
codereview_new_python_data_11592 |
# Default bucket name of the s3 bucket used for local lambda development
# This name should be accepted by all IaC tools, so should respect s3 bucket naming conventions
-DEFAULT_BUCKET_MARKER_LOCAL = "hot-reloading-bucket"
-OLD_DEFAULT_BUCKET_MARKER_LOCAL = "__local__"
# user that starts the opensearch process ... |
codereview_new_python_data_11593 | def start(self, env_vars: dict[str, str]) -> None:
)
if self.function_version.config.package_type == PackageType.Zip:
if self.function_version.config.code.is_hot_reloading():
- # this basically means hot reloading
container_config.env_vars["LOCALSTACK_HOT_... |
codereview_new_python_data_11594 | def _subresources(resource_id, resources, resource_type, func, stack_name):
kwargs["uri"] = uri
- integration_responses = []
- if kwargs.get("integrationResponses"):
- integration_responses = kwargs["integrationResponses"]
- d... |
codereview_new_python_data_11595 | def test_generic_destination_routing(
self, lambda_client, logs_client, deploy_cfn_template, cfn_client, on_success, on_failure
):
"""
- This fairly simple template lets us choose between the 4 different destinations for both OnSuccess as well as OnSuccess.
The template chooses b... |
codereview_new_python_data_11596 | def test_render_template_values():
('"""', '\\"\\"\\"'),
('{"foo": 123}', '{\\"foo\\": 123}'),
('{"foo"": 123}', '{\\"foo\\"\\": 123}'),
- (1, 1),
- (None, None),
)
for string, expected in escape_tests:
escaped = util.escapeJavaScript(string)
Shouldn't this ... |
codereview_new_python_data_11597 | def factory(name: str) -> None:
@pytest.fixture
-def ses_configuration_set_event_destination(ses_client):
event_destinations = []
def factory(config_set_name: str, event_destination_name: str, topic_arn: str) -> None:
There seems to be 4 different destinations possible, maybe this should have `sns` i... |
codereview_new_python_data_11598 | def add_xray_header(request, **kwargs):
] = "Root=1-3152b799-8954dae64eda91bc9a23a7e8;Parent=7fa8c0f79203be72;Sampled=1"
try:
- # TODO this needs to be removed again!
sns_client.meta.events.register("before-send.sns.Publish", add_xray_header)
topic = sns_c... |
codereview_new_python_data_11599 | def get_docker_image_to_start():
"The localstack/localstack-full image is deprecated. Please remove this environment variable."
)
image_name = constants.DOCKER_IMAGE_NAME_FULL
- if os.environ.get("LOCALSTACK_API_KEY") and os.environ.get("LOCALSTACK_API_KEY").strip():
... |
codereview_new_python_data_11600 | def _clear_bucket_from_store(self, bucket: BucketName):
def on_after_init(self):
apply_moto_patches()
- # registering of virtual host routes happens with the hook on_infra_ready
register_website_hosting_routes(router=ROUTER)
register_custom_handlers()
def __init__(self) ... |
codereview_new_python_data_11601 | def generate_random(
self, context: RequestContext, request: GenerateRandomRequest
) -> GenerateRandomResponse:
number_of_bytes = request.get("NumberOfBytes")
- if not number_of_bytes:
raise ValidationException("NumberOfBytes is required.")
- if number_of_bytes > 1024:... |
codereview_new_python_data_11602 |
-from localstack.services.awslambda.invocation.runtime_executor import RuntimeExecutorPlugin
class DockerRuntimeExecutorPlugin(RuntimeExecutorPlugin):
we're still importing this entire import path when we start localstack. which includes the lambda API, and everything under `localstack.services.awslambda.invocat... |
codereview_new_python_data_11603 | def test_publish_get_delete_message_batch(self, sqs_client, sqs_create_queue):
assert "Messages" not in confirmation.keys()
@pytest.mark.aws_validated
- def test_delete_message_batch_invalid_msg_id(self, sqs_create_queue, sqs_client, snapshot):
self._add_error_detail_transformer(snapshot)
... |
codereview_new_python_data_11604 | def delete_lambda_function(function_name: str) -> Dict[None, None]:
def get_lambda_url_config(api_id: str, region: str = None):
- store = get_awslambda_store()
url_configs = store.url_configs.values()
lambda_url_configs = [config for config in url_configs if config.get("CustomId") == api_id]
ret... |
codereview_new_python_data_11605 |
from localstack.utils.strings import short_uid
-# Domain deployment in AWS takes too much time
-@pytest.mark.only_localstack
def test_domain(deploy_cfn_template, opensearch_client, cfn_client):
name = f"domain-{short_uid()}"
```suggestion
```
the tests aren't run against AWS by default anyway
from... |
codereview_new_python_data_11606 | def execute(event, context):
lambda_handler = execute
if runtime.startswith("go1") and not use_docker():
- go_installer = awslambda_go_runtime_package.get_installer()
- if not go_installer.is_installed():
- go_installer.install()
ensure_readab... |
codereview_new_python_data_11607 |
class LambdaStore(BaseStore):
functions: dict[str, Function] = LocalAttribute(default=dict)
event_source_mappings: dict[str, EventSourceMapping] = LocalAttribute(default=dict)
code_signing_configs: dict[str, CodeSigningConfig] = LocalAttribute(default=dict)
layers: dict[str, Layer] = LocalAttr... |
codereview_new_python_data_11608 | def prepare_version(function_version: FunctionVersion) -> None:
target_code = get_code_path_for_function(function_version)
target_code.mkdir(parents=True, exist_ok=True)
with NamedTemporaryFile() as file:
file.write(function_version.config.code.get_lambda_archive())
... |
codereview_new_python_data_11609 |
"sqs",
"ssm",
"stepfunctions",
- "stores",
]
CloudFormation is a bit of a special case - the `models` package is more intended for the CFn resource model implementations (e.g., `AWS::Lambda::Function`, etc).
I understand that the name clashes with the general convention of putting stores into `... |
codereview_new_python_data_11610 | def stop(self, quiet: bool = False) -> None:
def start_thread(method, *args, **kwargs) -> FuncThread: # TODO: find all usages and add names...
"""Start the given method in a background thread, and add the thread to the TMP_THREADS shutdown hook"""
_shutdown_hook = kwargs.pop("_shutdown_hook", True)
- # ... |
codereview_new_python_data_11611 | def send_events():
record["Data"] = to_str(base64.b64encode(record["Data"]))
last_sequence_number = record["SequenceNumber"]
if not records:
- # on AWS this is approximately 5 sec, however since this is not async, it's a blocking call
- # put... |
codereview_new_python_data_11612 | def create_cluster(
# FIXME: in AWS, the Endpoint is set once the cluster is running, not before (like here), but our tests and
# in particular cloudformation currently relies on the assumption that it is set when the domain is created.
status = region.opensearch_domains[domain_key.domain_name]
st... |
codereview_new_python_data_11613 | def handler(event, context):
protocol = "https" if os.environ.get("USE_SSL") else "http"
endpoint_url = "{}://{}:{}".format(protocol, os.environ["LOCALSTACK_HOSTNAME"], EDGE_PORT)
s3 = boto3.client("s3", endpoint_url=endpoint_url, verify=False)
- # print(f"{os.environ['BUCKET_NAME']}")
s... |
codereview_new_python_data_11614 | def cmd_logs(follow: bool):
if not DOCKER_CLIENT.is_container_running(container_name):
console.print("localstack container not running")
- with open(logfile) as fd:
- for line in fd:
- console.print(line.rstrip("\n\r"))
sys.exit(1)
if follow:
We could i... |
codereview_new_python_data_11616 | def _entity_as_text(self):
@property
def _boolean_as_text(self):
if self.value:
- return (_("Yes"))
- return (_("No"))
@property
def value_as_html(self):
why not ```_("Yes")```?
def _entity_as_text(self):
@property
def _boolean_as_text(self):
if se... |
codereview_new_python_data_11618 | def test_choose_param_value_objective(objective_alias):
@pytest.mark.parametrize('collection', ['1d_np', '2d_np', 'pd_float', 'pd_str', '1d_list', '2d_list'])
@pytest.mark.parametrize('dtype', [np.float32, np.float64])
-def test__list_to_1d_numpy(collection, dtype):
collection2y = {
'1d_np': np.rando... |
codereview_new_python_data_11619 | def fit(
eval_sample_weight: Optional[List[_DaskVectorLike]] = None,
eval_init_score: Optional[List[_DaskVectorLike]] = None,
eval_group: Optional[List[_DaskVectorLike]] = None,
- eval_metric: Optional[Union[_LGBM_ScikitCustomEvalFunction, str, List[Union[_LGBM_ScikitCustomEvalFunctio... |
codereview_new_python_data_11622 | def train_fn():
assert eval_result['valid']['l2'][1] > eval_result['valid']['l2'][0] # valid didn't
else:
with pytest.warns(UserWarning, match='Only training set found, disabling early stopping.'):
- train_fn()
@pytest.mark.parametrize('first_metric_only', [True, False])
```sug... |
codereview_new_python_data_11626 | def c_str(string: str) -> ctypes.c_char_p:
return ctypes.c_char_p(string.encode('utf-8'))
-def c_array(ctype: type, values: List[ctypes.c_char_p]) -> ctypes.Array:
"""Convert a Python array to C array."""
return (ctype * len(values))(*values)
I believe this is universal function, not just for str... |
codereview_new_python_data_11627 | def _choose_param_value(main_param_name: str, params: Dict[str, Any], default_va
params = deepcopy(params)
aliases = _ConfigAliases.get_sorted(main_param_name)
- aliases = [a for a in aliases if a in params.keys() and a != main_param_name]
# if main_param_name was provided, keep that value and re... |
codereview_new_python_data_11665 | def set_have_nest():
def have_computronium() -> bool:
- """Do we have a planet with a computronium moon, which is set to research focus?"""
return _get_planet_catalog().have_computronium
def computronium_candidates() -> List[PlanetId]:
- """Returns list of own planets that have a computronium moon... |
codereview_new_python_data_11671 | def systems_connected_to_system(system_id: SystemId) -> Set[SystemId]:
@cache_for_current_turn
def within_n_jumps(system_id: SystemId, n: int) -> FrozenSet[SystemId]:
if n < 1:
return frozenset({system_id})
- inner_tier = within_n_jumps(system_id, n - 1)
- result = set(inner_tier)
- for sys_... |
codereview_new_python_data_11676 | def test_s2nd_falls_back_to_full_connection(managed_process, tmp_path, cipher, c
@pytest.mark.parametrize("cipher", ALL_TEST_CIPHERS, ids=get_parameter_name)
@pytest.mark.parametrize("curve", ALL_TEST_CURVES, ids=get_parameter_name)
@pytest.mark.parametrize("certificate", ALL_TEST_CERTS, ids=get_parameter_name)
-@p... |
codereview_new_python_data_11695 | def test_s2n_server_tls12_signature_algorithm_fallback(managed_process, cipher,
# extension.
#
# This is inferred from the rfc- https://www.rfc-editor.org/rfc/rfc5246#section-7.4.1.4.1
- expected_signature_algorithm_tls12 = (Signatures.ECDSA_SHA1, Signatures.RSA_SHA1)[
- signature == Signature... |
codereview_new_python_data_11696 | def _zip(x): return L(x).zip()
@docs
@funcs_kwargs
class DataBlock():
- """
- Generic container to quickly build `Datasets` and `DataLoaders`.
- """
get_x=get_items=splitter=get_y = None
blocks,dl_type = (TransformBlock,TransformBlock),TfmdDL
_methods = 'get_items splitter get_y get_x'.split... |
codereview_new_python_data_11700 |
SEARCH_USER_LIMIT = 10
-@api_bp.route('/playlist/search/users/', methods=['GET', 'OPTIONS'])
@crossdomain
@ratelimit()
def search_user():
search_term = request.args.get("search_term")
user = validate_auth_header()
user_id = user.id
if search_term:
- users = db_user.search(search_term... |
codereview_new_python_data_11701 | def fetch_playlist_recording_metadata(playlist: Playlist):
caa_id = row.get("caa_id")
caa_release_mbid = row.get("caa_release_mbid")
if caa_id and caa_release_mbid:
- # TODO: Discuss image vs additional_metadata, what to permit caa.org link archive.org link etc?
rec.a... |
codereview_new_python_data_11702 |
USERS_PER_MESSAGE = 5
-FRESH_RELEASES_ENDPOINT = "https://test-api.listenbrainz.org/1/explore/fresh-releases/"
def load_all_releases():
Is this still desired?
USERS_PER_MESSAGE = 5
+FRESH_RELEASES_ENDPOINT = "https://api.listenbrainz.org/1/explore/fresh-releases/"
def load_all_releases(): |
codereview_new_python_data_11703 | def test_create_full_db(self):
# make sure that the dump contains a full listens dump, a public and private dump (postgres),
# a public and private dump (timescale) and a spark dump.
archive_count = 0
- print(os.listdir(os.path.join(self.tempdir, dump_name)))
for file_name in... |
codereview_new_python_data_11704 | def test_index(self):
def test_downloads(self):
resp = self.client.get(url_for('index.downloads'))
- self.assertEqual(resp.status_code, 302)
- self.assertEqual(resp.location, url_for('index.data'))
def test_data(self):
resp = self.client.get(url_for('index.data'))
we didn... |
codereview_new_python_data_11705 | def assertRedirects(self, response, location, message=None, permanent=False):
not_redirect = "HTTP Status %s expected but got %d" % (valid_status_code_str, response.status_code)
self.assertIn(response.status_code, valid_status_codes, message or not_redirect)
- self.assertTrue(response.locati... |
codereview_new_python_data_11706 | 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_11782 |
"-DUSES_CHART_JS",
"-DUSE_SETTINGS_ARCHIVE",
"-DUSE_CUSTOM_PROVISIONING"
]
This should be enabled by default to be backward compatible with current feature set, and be undefined at will. The regular builds should still include the P2P feature.
Maybe it would be better to change this from a `b... |
codereview_new_python_data_11786 | def test_reduce_prod():
[2, -7, 65]]
def test_reduce_prod_same_column():
- # See issue #3390
- f0 = dt.Frame({"ints" : [0, 1, 0, 0, 1, 2]})
- f1 = f0[:, {"prod" : prod(f.ints)}, f.ints]
- frame_integrity_check(f1)
- assert_equals(f1, dt.Frame({"ints" : [0, 1, 2], "prod" :... |
codereview_new_python_data_11791 | def flatc_annotate(schema, include=None, data=None, cwd=tests_path):
)
# Run the generate_grpc_examples script
-# generate_grpc_examples.GenerateGRPCExamples()
Can you undo this?
def flatc_annotate(schema, include=None, data=None, cwd=tests_path):
)
# Run the generate_grpc_examples script
+generate_grpc_exa... |
codereview_new_python_data_11911 |
-from unittest import TestCase
-
-from pyk.kast import KApply, KSequence, KVariable
-from pyk.kastManip import splitConfigFrom
-
-
-class SplitConfigTest(TestCase):
- def test_splitConfigFrom(self):
- k_cell = KSequence([KApply('foo'), KApply('bar')])
- term = KApply('<k>', [k_cell])
- config, ... |
codereview_new_python_data_11912 | def setUp(self):
self.kprove = KProve(self.kompiled_dir, kprove_main_file, Path(self.KPROVE_USE_DIR))
self.kprove.prover_args += list(chain.from_iterable(['-I', include_dir] for include_dir in kprove_include_dirs))
- # force computation of the symbol_table before updating it
- if self... |
codereview_new_python_data_11913 | def vattr(sort: str) -> KAtt:
'==Int',
KToken('N ==Int 1', 'Bool'),
KApply('_==Int_', KVariable('N', vattr('Int')), intToken(1)),
- ), # noqa
)
for (name, token, expected) in tests:
`# noqa` can be removed here.
def vattr(sort: str) ... |
codereview_new_python_data_11914 | def vattr(sort: str) -> KAtt:
return KAtt(FrozenDict({'org.kframework.kore.Sort': FrozenDict({'node': 'KSort', 'name': sort})}))
tests: Iterable[Tuple[str, KToken, KInner]] = (
- ('variable', KToken('N', 'Int'), KVariable('N', vattr('K'))), # TODO: This should parse as an int. # n... |
codereview_new_python_data_11915 | def test(self):
class BooleanTest(TestCase):
- def test_bool_simplify(self):
# Given
bool_test_1 = Bool.andBool([Bool.false, Bool.true])
bool_test_2 = Bool.andBool([KApply('_==Int_', [intToken(3), intToken(4)]), Bool.true])
```suggestion
def test_simplify_bool(self):
```
def... |
codereview_new_python_data_11916 |
-from typing import cast
-from ..kast import KAst
-from ..ktool.kprint import KPrint, prettyPrintKast
-
-class MockKPrint:
- def pretty_print(self, term: KAst) -> str:
- return prettyPrintKast(term, symbol_table={})
-
-
-def mock_kprint() -> KPrint:
- return cast(KPrint, MockKPrint())
Did you conside... |
codereview_new_python_data_11917 | def nonempty_str(x: Any) -> str:
def add_indent(indent: str, lines: Iterable[str]) -> List[str]:
- return list(map(lambda line: indent + line, lines))
def is_hexstring(x: str) -> bool:
```suggestion
return [indent + line for line in lines]
```
def nonempty_str(x: Any) -> str:
def add_indent(... |
codereview_new_python_data_11918 | 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_11919 | def buildRule(ruleId, initConstrainedTerm, finalConstrainedTerm, claim=False, pr
return (minimizeRule(rule, keepVars=newKeepVars), vremapSubst)
-def abstract_term_safely(kast, base_name='V'):
vname = hash_str(kast)[0:8]
return KVariable(base_name + '_' + vname)
Please add type hints.
def buildR... |
codereview_new_python_data_11920 | def _print_subgraph(indent: str, curr_node: KCFG.Node, prior_on_trace: List[KCFG
edges_from = sorted(self.edge_likes(source_id=curr_node.id))
if curr_node in processed_nodes:
- if len(edges_from) == 0:
return ret
if curr_node in prior_on_... |
codereview_new_python_data_11921 | def deconstruct_short_hash(h: str) -> Tuple[str, str]:
x = h.lower()
if is_hash(x):
return (x, x)
- (l, sep, r) = x.partition('...')
- if sep == '...' and is_hexstring(l) and is_hexstring(r):
- return (l, r)
(l, sep, r) = x.partition('..')
if sep == '..' and is_hexstring(l) an... |
codereview_new_python_data_11922 | def node_dicts(n: int) -> List[Dict[str, Any]]:
def edge_dicts(*edges: Tuple[int, int]) -> List[Dict[str, Any]]:
- def make_edge_dict(i, j, depth=1):
return {'source': nid(i), 'target': nid(j), 'condition': TRUE.to_dict(), 'depth': depth}
- return [make_edge_dict(*edge) for edge in edges]
def ... |
codereview_new_python_data_11923 | 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(nod... |
codereview_new_python_data_11924 | def get_value_stats(
bindings: list[Any],
) -> tuple[FVal, list[tuple[str, FVal, FVal]]]:
"""Returns the sum of the USD value at the time of acquisition and the amount received
- by asset"""
usd_value = ZERO
try:
query = 'SELECT SUM(CAST(usd_value AS REA... |
codereview_new_python_data_11925 |
-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_11926 | def test_curve_remove_imbalanced(database, ethereum_transaction_decoder):
@pytest.mark.vcr()
@pytest.mark.parametrize('ethereum_accounts', [['0x6Bb553FFC5716782051f51b564Bb149D9946f0d2']])
def test_deposit_multiple_tokens(ethereum_transaction_decoder, ethereum_accounts):
_populate_curve_pools(ethereum_transact... |
codereview_new_python_data_11940 | def xfail(
condition: bool = True,
*,
reason: str = "",
- raises: Union[Type[BaseException], Tuple[BaseException, ...]] = BaseException,
) -> "example":
"""Mark this example as an expected failure, like pytest.mark.xfail().
```suggestion
raises: Union[Type[Ba... |
codereview_new_python_data_11941 | def _boolean_dtypes(xp: Any) -> st.SearchStrategy[DataType]:
def _real_dtypes(xp: Any) -> st.SearchStrategy[DataType]:
- """Return a strategy for all real dtype objects."""
return st.one_of(
_integer_dtypes(xp),
_unsigned_integer_dtypes(xp),
```suggestion
"""Return a strategy for a... |
codereview_new_python_data_11942 | def complex_dtypes(
namespace = StrategiesNamespace(**kwargs)
try:
- _args_to_xps[(xp, api_version)] = namespace
except TypeError:
pass
We want to cache the `api_version=None` case too, so let's add:
```python
if inferred_version:
_args_to_xps[(xp, None)] = na... |
codereview_new_python_data_11943 |
from hypothesistooling.projects.hypothesispython import PYTHON_SRC
from hypothesistooling.scripts import pip_tool, tool_path
-PYTHON_VERSIONS = [f"3.{v}" for v in range(7, 11)]
def test_mypy_passes_on_hypothesis():
I think I'd prefer to write these out as literals, unless we can pull them out of the autoupda... |
codereview_new_python_data_11944 |
-# SPDX-License-Identifier: GPL-2.0-only
# This file is part of Scapy
# See https://scapy.net/ for more information
# Copyright (C) 2009 Jochen Bartl
This should be GPL-2.0-or-later
+# SPDX-License-Identifier: GPL-2.0-or-later
# This file is part of Scapy
# See https://scapy.net/ for more information
# Copyri... |
codereview_new_python_data_11977 | def __init__(self, webelement) -> None:
Select(driver.find_element(By.TAG_NAME, "select")).select_by_index(2)
"""
if webelement.tag_name.lower() != "select":
- raise UnexpectedTagNameException(
- "Select only works on <select> elements, not on <%s>" %
- ... |
codereview_new_python_data_11978 |
setup_args = {
'cmdclass': {'install': install},
'name': 'selenium',
- 'version': "4.4.4",
'license': 'Apache 2.0',
'description': 'Python bindings for Selenium',
'long_description': open(join(abspath(dirname(__file__)), "README.rst")).read(),
Please do not bump the version as we do not k... |
codereview_new_python_data_12060 |
'3rdParty/mingw/vcpkg/buildtrees/*.log',
'3rdParty/Windows/vcpkg/buildtrees/*.log',
'android/BOINC/app/build/reports/',
]
def prepare_7z_archive(archive_name, target_directory, files_list):
@talregev, please remove all changes but this line and I'll merge this PR
'3rdParty/mingw/vcpkg/buildt... |
codereview_new_python_data_12062 | def dest(*dirs):
'run_in_ops',
'sign_executable',
'stage_file',
- 'run_stage_file',
'update_versions',
'xadd',
]
I think `stage_file_native` is better name
def dest(*dirs):
'run_in_ops',
'sign_executable',... |
codereview_new_python_data_12065 | class TestPluginCanHandleUrlTelemadrid(PluginCanHandleUrl):
should_match = [
"https://www.telemadrid.es/",
"https://www.telemadrid.es/emision-en-directo/",
]
I forgot about VODs. Please add one VOD URL to the matcher tests, so that it's clear that this is supported by the plugin. For examp... |
codereview_new_python_data_12066 |
|
bloomberght.com/tv
|
- showmax\.com\.tr/(canli-yayin|canliyayin)
|
- showturk\.com\.tr/(canli-yayin|canliyayin)(/showtv)?
)/?
""", re.VERBOSE))
class CinerGroup(Plugin):
The regex should be simplified and unnecessary capture groups be avoided.
```suggestio... |
codereview_new_python_data_12067 | def _get_live_url2(self):
return live_url
def _get_streams(self):
- root = self.session.http.get(self.url, schema=validate.Schema(
- validate.parse_html(),
- ))
- live_url = self._get_live_url(root) or self._get_live_url2(root)
if not live_url:
retu... |
codereview_new_python_data_12068 | class Picarto(Plugin):
def get_live(self, username):
channel, multistreams, loadbalancer = self.session.http.get(
- self.API_URL_LIVE.format(username=username), schema=validate.Schema(
validate.parse_json(),
{
"channel": validate.any(Non... |
codereview_new_python_data_12069 | class TestPluginCanHandleUrlAtpChallenger(PluginCanHandleUrl):
__plugin__ = AtpChallengerTour
should_match = [
- 'https://www.atptour.com/en/atp-challenger-tour/challenger-tv/challenger-tv-search-results/'
- + '2022-2785-ms005-zug-alexander-ritschard-vs-dominic-stricker/2022/2785/all',
- ... |
codereview_new_python_data_12070 |
$type live, vod
"""
-import logging
import re
from streamlink.plugin import Plugin, pluginmatcher
from streamlink.plugin.api import validate
-log = logging.getLogger(__name__)
-
@pluginmatcher(re.compile(
r"https?://(?:www\.)?atptour\.com/(?:en|es)/atp-challenger-tour/challenger-tv"
Please remove t... |
codereview_new_python_data_12087 | class SpecsParser:
class BadSpecError(Exception):
"""Indicates an unparseable command line selector."""
- def __init__(self, root_dir: str | None = None, work_dir: str | None = None) -> None:
self._root_dir = os.path.realpath(root_dir or get_buildroot())
self._work_dir = (
... |
codereview_new_python_data_12088 | async def export_codegen(
{
tgt_type.alias
for tgt_type in registered_target_types.types
- for input_source, _ in inputs_to_outputs
if tgt_type.class_has_field(input_source, union_membership=union_membership)
}
)
not ... |
codereview_new_python_data_12089 | async def pyupgrade_fix(request: PyUpgradeRequest.Batch, pyupgrade: PyUpgrade) -
# (Technically we could not do this. It doesn't break Pants since the next run on the CLI would
# use the new file with the new digest. However that isn't the UX we want for our users.)
input_digest = request.snapshot.diges... |
codereview_new_python_data_12090 | async def build_go_package(
# Put the source file paths into a file and pass that to `go tool compile` via a config file using the
# `@CONFIG_FILE` syntax. This is necessary to avoid command-line argument limits on macOS. The arguments
# may end up to exceed those limits when compiling standard library ... |
codereview_new_python_data_12091 | class PythonDependencyVisitorRequest:
class PythonDependencyVisitor:
"""Wraps a subclass of _pants_dep_parser.DependencyVisitorBase."""
- digest: Digest # The content of the subclass
classname: str # The full classname, e.g., _my_custom_dep_parser.MyCustomVisitor
env: FrozenDict[str, str] # Set... |
codereview_new_python_data_12092 | def error_on_imports(build_file_content: str, filepath: str) -> None:
continue
raise ParseError(
f"Import used in {filepath} at line {lineno}. Import statements are banned in "
- "BUILD files because they can easily break Pants caching and lead to stale results. "
- ... |
codereview_new_python_data_12093 | async def prepare_shell_command_process(
def _output_at_build_root(process: Process, bash: BashBinary) -> Process:
- working_directory = process.working_directory
- if working_directory is None:
- working_directory = ""
output_directories = process.output_directories
output_files = proces... |
codereview_new_python_data_12094 | def test_output_path() -> None:
)
pants_run.assert_success()
dist_output_path = os.path.join(dist_dir, output_path)
- dist_entires = os.listdir(os.path.join(dist_dir, output_path))
- assert len(dist_entires) == 2
- for entry in dist_entires:
assert os.path.i... |
codereview_new_python_data_12095 | async def make_cgo_compile_wrapper_script(
path="wrapper",
content=textwrap.dedent(
"""\
- export sandbox_root="$(/bin/pwd)"
- ln -s "${sandbox_root}" __pants_sandbox_root__
- declare -a args
- ... |
codereview_new_python_data_12096 | async def _prepare_process_request_from_target(shell_command: Target) -> ShellCo
)
-def _parse_outputs_from_command(shell_command, description):
outputs = shell_command.get(ShellCommandOutputsField).value or ()
output_files = shell_command.get(ShellCommandOutputFilesField).value or ()
output_di... |
codereview_new_python_data_12097 | def test_sources_and_files(rule_runner: RuleRunner) -> None:
"tee",
],
output_files=["message.txt"],
- output_directories=["res/"],
command="./script.sh",
)
Do we need the trailing slash? If not, lets omi... |
codereview_new_python_data_12098 | def compilation_failure(exit_code: int, stdout: str | None, stderr: str | None)
)
test_pkg_build_request = maybe_test_pkg_build_request.request
- # Determine the direct dependencies of the generated main package. The test package itself it always a
# dependency. Add the xtests package as well i... |
codereview_new_python_data_12334 | def foo(input, weight, bias):
foo(*inps)
# Autotuning checks correctness of each version
- self.assertEqual(counters["inductor"]["choice_caller_benchmarked"], 13)
@patches
def test_mm(self):
```suggestion
self.assertEqual(counters["inductor"]["select_algorithm_autotune"... |
codereview_new_python_data_12448 | def start_cmd(self, node):
cmd = "export KAFKA_LOG4J_OPTS=\"-Dlog4j.configuration=file:%s\"; " % EndToEndLatencyService.LOG4J_CONFIG
if node.version.consumer_supports_bootstrap_server():
cmd += "KAFKA_OPTS=%(kafka_opts)s %(kafka_run_class)s %(java_class_name)s " % args
- cmd +... |
codereview_new_python_data_12574 | def __init__(
self.msg = msg
self.type_map = type_map
self.options = options
- self.builtins: set[str] = set()
builtins_mod = names.get("__builtins__", None)
if builtins_mod:
assert isinstance(builtins_mod.node, MypyFile)
- self.builtins = set... |
codereview_new_python_data_12575 | def prepare_method_signature(self, func: FuncDef, info: TypeInfo, has_self_type:
func.is_class = True
if not func.arguments:
self.fail(
- "Method must have at least one argument. Did you forget the self argument?",
func,
... |
codereview_new_python_data_12576 | def run_benchmark(compiled_dir: str, check_dir: str) -> float:
cmd += glob.glob(os.path.join(abschk, "mypy/*.py"))
cmd += glob.glob(os.path.join(abschk, "mypy/*/*.py"))
t0 = time.time()
subprocess.run(cmd, cwd=compiled_dir, env=env)
return time.time() - t0
Is it worth using `time.perf_count... |
codereview_new_python_data_12577 | def _get_imported_symbol_names(runtime: types.ModuleType) -> frozenset[str] | No
return None
if not source.strip():
- return None
try:
module_symtable = symtable.symtable(source, runtime.__name__, "exec")
When does inspect.getsource return an empty str? Should this be `return fr... |
codereview_new_python_data_12578 | def typeddict_key_must_be_string_literal(self, typ: TypedDictType, context: Cont
def typeddict_key_not_found(
self, typ: TypedDictType, item_name: str, context: Context, setitem: bool = False
) -> None:
- """Handles error messages for TypedDicts that have unknown keys.
Note, that w... |
codereview_new_python_data_12579 | def verify_typealias(
"__annotations__",
"__path__", # mypy adds __path__ to packages, but C packages don't have it
"__getattr__", # resulting behaviour might be typed explicitly
# TODO: remove the following from this list
"__author__",
"__version__",
"_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.