id
stringlengths
24
28
content
stringlengths
121
2.08k
codereview_python_data_10108
for key, value in query.items(): if key in redis.connection.URL_QUERY_ARGUMENT_PARSERS: - query[key] = redis.connection.URL_QUERY_ARGUMENT_PARSERS[key](value) # Query parameters override other parameters connparams.update(query) This line is longer than 80 charact...
codereview_python_data_10111
return 'text/html', html -@add_handler('spawn_output') def qute_spawn_output(_url): - """Handler for qute://spawn_output.""" html = jinja.render('pre.html', title='spawn output', content=spawn_output) return 'text/html', html This *might* work, but having underlines in URLs looks a bit weird I'd p...
codereview_python_data_10114
iterator_stmt = setgen.new_set_from_set( iterator_view, preserve_scope_ns=True, ctx=scopectx) - ptr_target = inference.infer_type(iterator_stmt, ctx.env) - anytype = ptr_target.find_any(ctx.env.schema) if anytype is not None: raise errors...
codereview_python_data_10117
return_inverse=True ) - if new_categories[0] == _sortable_sentinel: # f_to_use return _sortable_sentinel for locations that should be # missing values in our output. Since np.unique returns the uniques # in sorted order, and since _sortable_sentinel so...
codereview_python_data_10118
shard_outputs = [] for pipeline in pipelines: pipe_outputs = pipeline.run() - if device == 'gpu': - shard_outputs.append( - tuple(result.as_cpu().as_array() for result in pipe_outputs)) - else: - shard_outputs.append( ...
codereview_python_data_10119
arn_to_lambda[arn].cwd = lambda_cwd -def add_event_source(function_name, source_arn, enabled, batch_size=10): mapping = { 'UUID': str(uuid.uuid4()), 'StateTransitionReason': 'User action', Instead of encoding the default value in the function signature, I'd rather handle the default case in...
codereview_python_data_10121
corpus_directories.insert(0, merge_directory) if use_minijail: - target = '/' + MERGE_DIRECTORY_NAME - minijail_chroot.add_binding( - minijail.ChrootBinding(merge_directory, target, True)) merge_result = runner.merge( corpus_directories, Please use the helper bind_corpus_dirs...
codereview_python_data_10122
if depth not in self.arch_settings: raise KeyError(f'invalid depth {depth} for darknet') - assert not (init_cfg and pretrained), \ - 'init_cfg and pretrained cannot be setting at the same time' - self.depth = depth self.out_indices = out_indices self.fr...
codereview_python_data_10123
raise TypeError('`amount` must be an int') if amount < 1: raise AmountError('`amount` must be greater than 0') - if amount > 9 * 10 ** 18: - raise AmountError('`amount` must be <= 9000000000000000000') self.fulfillment = fulfillment self.amount = am...
codereview_python_data_10126
'sleep_max', 'watchdog', 'pending_contact'])) - @aiohttp_apispec.response_schema(AgentSchema(only=[]), descrip...
codereview_python_data_10129
def fallback_chord_unlock(self, header_result, body, countdown=1, **kwargs): kwargs['result'] = [r.as_tuple() for r in header_result] - body_type = body.get('type', None) queue = body.options.get('queue', getattr(body_type, 'queue', None)) priority =...
codereview_python_data_10132
LEVEL = 1 # warn about all errors level 1 or higher -def _write_file_encode(file,line): try: file.write(line) except UnicodeEncodeError: - file.write(line.encode('ascii','replace')) def message(position, message, level=1): Space after comma, please. Also in the calls below. LEVEL = 1 # wa...
codereview_python_data_10133
self.dummy_cycle(m, 1, b"") assert len(m.view) == i - @mock.patch('mitmproxy.tools.console.signals.add_log', side_effect=mock_add_log) - def test_run_script_once(self, test_func): m = self.mkmaster() f = tflow.tflow(resp=True) - with mitmproxy.test.tutils.raises(...
codereview_python_data_10135
"""Open main startpage in current tab.""" self.openurl(config.val.url.start_pages[0]) - def _selection_callback(self, s): - try: - self._run_userscript(s) - except cmdexc.CommandError as e: - message.error(str(e)) - - def _run_userscript(self, selection): ...
codereview_python_data_10141
@LOSSES.register_module() -class AELoss(nn.Module): """Associative Embedding Loss. More details can be found in Using the full name `AssociativeEmbeddingLoss` seems better. @LOSSES.register_module() +class AssociativeEmbeddingLoss(nn.Module): """Associative Embedding Loss. More details can be fo...
codereview_python_data_10144
"ownedassetsresource", ), ) - assert_proper_response_with_result(response) - data = response.json() - assert data['message'] == '' - assert set(data['result']) == {'ETH', 'BTC', 'EUR', A_RDN.identifier} def test_ignored_assets_modification(rotkehlchen_api_server_with_...
codereview_python_data_10147
ious = np.zeros((0, img_proposal.shape[0]), dtype=np.float32) else: ious = bbox_overlaps( - gts[i], img_proposal[:prop_num, :4], extra_length=extra_length) all_ious.append(ious) all_ious = np.array(all_ious) recalls = _recalls(all_ious, proposal_nums,...
codereview_python_data_10152
If min_value is not None then all generated values are no less than min_value. If max_value is not None then all generated values are no greater than max_value. min_value and max_value may be anything accepted - by the :python:`fractions.Fraction` constructor. If max_denominator is not None the...
codereview_python_data_10153
(target_h + eps)) # view(..., -1) does not work for empty tensor loss_comb = torch.stack([loss_dx, loss_dy, loss_dw, loss_dh], - dim=-1).view(loss_dx.size(0), -1) loss = torch.where(loss_comb < beta, 0.5 * loss_comb * loss_comb / beta, ...
codereview_python_data_10166
self.psk_secret = psk self.psk_mode = psk_mode if handle_session_ticket is None: - handle_session_ticket = (session_ticket_file is not None) if handle_session_ticket: session_ticket_file = session_ticket_file or get_temp_file() self.handle_session_tic...
codereview_python_data_10173
@pytest.mark.parametrize("dtype", _DTYPES) -@pytest.mark.parametrize("shape", [(3, 3,), (3, 3, 1), (3, 3, 3), (4, 3, 3, 3)]) def test_equalize_dtype_shape(dtype, shape): image = np.ones(shape=shape, dtype=dtype) equalized = color_ops.equalize(tf.constant(image)).numpy() If you're using a `random`, use a fi...
codereview_python_data_10175
class OptimScheduler(LossRecorder): - ''' - Learning rate Scheduler for training involving multiple phases. - ''' def __init__(self, layer_opt, phases, nb_batches, stop_div = False): self.phases, self.nb_batches, self.stop_div = phases, nb_batches, stop_div Could you put all the one-liner docs ...
codereview_python_data_10179
# Step 2. edge softmax to compute attention scores graph.edata['sa'] = edge_softmax(graph, graph.edata['a']) - # Step 3. Broadcast softmax value to each edge, and then attention is done - graph.apply_edges(fn.u_mul_e('ft', 'sa', 'attn')) - - # Step 4. Aggregate attention to dst,us...
codereview_python_data_10184
if win_id and count: raise TypeError("Argument marked as both count/win_id!") if zero_count and not count: - raise TypeError("Zero_count Argument cannot exist without count!") self.win_id = win_id self.count = count self.zero_count = zero_count nitpi...
codereview_python_data_10188
if tx_dict['operation'] in [Transaction.CREATE, Transaction.GENESIS]: # TODO: Maybe replace this call to a call to get_asset_by_id asset = list(bigchain.get_assets([tx_dict['id']]))[0] - asset.pop('id') tx_dict.update({'asset': asset}) return cls.from_...
codereview_python_data_10189
from mmdet.utils import Registry -IOUCALCULATOR = Registry('iou_calculator') We may rename to `IOU_CALCULATOR`. from mmdet.utils import Registry +IOU_CALCULATOR = Registry('iou_calculator')
codereview_python_data_10194
""" Sets the status message of the task to message, i.e., invokes _status_message_callback if it is a callable. This propagates the message down to the scheduler. """ if hasattr(self._status_message_callback, "__call__"): self._status_message_callback(message) ...
codereview_python_data_10197
return self.text else: try: - return self.translations.filter(locale=locale).first().text - except AttributeError: return None def __str__(self): Can there be several translations for a single term? If so, what makes you sure that the `...
codereview_python_data_10207
async def start(self): loop = asyncio.get_event_loop() tcp = self.get_config('app.contact.tcp') - loop.create_task(asyncio.start_server(self.tcp_handler.accept, '127.0.0.1', tcp.split(':')[1], loop=loop)) loop.create_task(self.operation_loop()) async def operation_loop(self):...
codereview_python_data_10211
for include in self.parse_dependencies(filename)[1]: include_path = join_path(os.path.dirname(filename), include) if not path_exists(include_path): - include_path = self.context.find_include_file(include, (FileSourceDescriptor(filename),)) if include_path: ...
codereview_python_data_10213
if not isinstance(self._client_stat, ClientStatistic): raise RuntimeError("Bad Statistic obj") random.seed() - self.file_name = check_fs(is_dir=False, fs_name=file_name) if file_name is not None else None # Copied from Plenum def random_string(self, sz: int) -> str: Wher...
codereview_python_data_10215
Parameters ---------- row_labels : list-like, slice or label - The indices for the rows to extract. col_labels : list-like, slice or label - The indices for the columns to extract. Returns ------- docstring seems to be wrong now Para...
codereview_python_data_10223
'strcmp', 'strcpy', 'strlen', - 'tcmalloc', - 'tc_malloc', ] IGNORE_CONTAINS_IF_SYMBOLIZED = [ 'libc.so', instead of these 2, better to use '/tcmalloc/', similar to jemalloc above. see file paths section. 'strcmp', 'strcpy', 'strlen', ] IGNORE_CONTAINS_IF_SYMBOLIZED = [ ...
codereview_python_data_10225
else: res = http.get(self.url) - status = _status_re.search(res.text).group(1) - if status != 'true': self.logger.info("Stream currently unavailable.") return This will raise `AttributeError: 'NoneType' object has no attribute 'group'` if the page does not ...
codereview_python_data_10227
if not os.path.exists(FLAGS.output_path): os.makedirs(output_path) output_path = os.path.abspath(output_path) - _upload_csv_to_gcs(output_path, now_utc, csv_file.name) # Send summary email. if FLAGS.email_recipient is not None: ...
codereview_python_data_10229
tokens[-1] = fn._to_snake_case(tokens[-1]) return '.'.join(tokens) def name_sort(op_name): _, module, name = ops._process_op_name(op_name) return '.'.join(module + [name.upper()]) Maybe add `to_fn_module`, I see that `module_name.replace('.ops', '.fn')` appears several times in this file. to...
codereview_python_data_10230
import unittest import luigi from luigi.contrib.k8s_job import KubernetesJobTask try: from pykube.config import KubeConfig from pykube.http import HTTPClient Remove last 2 lines please. :) import unittest import luigi +import logging from luigi.contrib.k8s_job import KubernetesJobTask +logger = loggi...
codereview_python_data_10251
if action_config.get("type"): return self._parse_dict_action(action_config) block = self._get_execution_block(action_config) - if block and len(block) == 1: name, param = (block[0], action_config.get(block[0])) else: na...
codereview_python_data_10254
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd"> <metadata> <id>LightGBM</id> - <version>{version, datetime.datetime.now().year}</version> <authors>Guolin Ke</authors> <owners>Guolin Ke</owners> <licenseUrl>https://github.com/microsoft/Ligh...
codereview_python_data_10255
) # normalize to get smoothed representation - degs = graph.in_degrees().float().clamp(min=1) - norm = th.pow(degs, -0.5) - norm = norm.to(feat.device).unsqueeze(1) feat = feat * norm graph.ndata["h"] = feat Should edge weigh...
codereview_python_data_10259
g : DistGraph The distributed graph. nodes : tensor or dict - Node ids to sample neighbors from. fanout : int The number of sampled neighbors for each node. edge_dir : str, optional Add docstring for dict g : DistGraph The distributed graph. nodes : tens...
codereview_python_data_10267
def is_tax_known(self): return self.method.is_tax_known @property def charge_excl_tax(self): raise NotImplemented() `self.discount` property will fail, because it requires price with the tax. Couple lines above: ``` @property def discount(self): return self.get_discount()['discount'] d...
codereview_python_data_10273
""" self.rule_book = BigqueryRuleBook(self._load_rule_definitions()) - # TODO: The naming is confusing and needs to be fixed in all scanners. def find_violations(self, parent_project, bq_acl, force_rebuild=False): """Determine whether Big Query datasets violate rules. Please remove t...
codereview_python_data_10277
return platforms.Platforms(config_instance) -@pytest.fixture -def _instance_with_platform_name(config_instance): - return platforms.Platforms(config_instance, platform_name="instance-1") - - def test_instances_property(_instance): x = [ {"groups": ["foo", "bar"], "name": "instance-1", "children":...
codereview_python_data_10279
[2.], [3.]]) """ - assert g.batch_size == 1, \ - 'reverse is not supported for a BatchedDGLGraph object' g_reversed = DGLGraph(multigraph=g.is_multigraph) g_reversed.add_nodes(g.number_of_nodes()) g_edges = g.all_edges(order='eid') Can support instead? just set t...
codereview_python_data_10283
Returns ------- - numpy.array - array of the centroid frame indices """ raise NotImplementedError("Class {0} doesn't implement __call__()" .format(self.__class__.__name__)) This method doesn't return anything, it raises a NotImple...
codereview_python_data_10285
"Couldn't compute ratio for dividend sid=2, ex_date=1990-10-19," " amount=0.100", )) self.assertTrue(self.log_handler.has_warning( 'Dividend ratio <= 0 for dividend sid=1, ex_date=1990-10-17,' ' amount=0.510', For paranoia's sake, can we also check ...
codereview_python_data_10296
"The mitmproxy certificate authority has expired!\n" "Please delete all CA-related files in your ~/.mitmproxy folder.\n" "The CA will be regenerated automatically after restarting mitmproxy.\n" - "Then make sure all your clients have the new CA installed...
codereview_python_data_10301
disposition='attachment', content_id=None): """Create a SendGrid attachment. - Email connector attachments file content must be base64 encoded. Args: file_location (str): The path of the file. Revert to `SendGrid` since in this class, that is correct. ...
codereview_python_data_10307
) def _resolve_hooks(self, hooks): - return DelegatingHooks(list(hooks) + self._default_hooks) we talked in person, and decided to put the defaults first. ) def _resolve_hooks(self, hooks): + if hooks is None: + hooks = [] + return DelegatingHooks(self._defa...
codereview_python_data_10308
def test_config_py_arg_source(self, commands, config_py_arg, config_stub): assert config_stub.val.content.javascript.enabled - config_stub.val.search.ignore_case = 'always' config_py_arg.write_text('c.content.javascript.enabled = False\n', encoding='utf-8'...
codereview_python_data_10311
def _community(G, u, community): """Get the community of the given node.""" - if community not in G.node[u]: raise nx.NetworkXAlgorithmError('No community information') - return G.node[u][community] ``` python node_u = G.node[u] try: return node_u[community] except KeyError: raise nx.NetworkXAlgor...
codereview_python_data_10319
asset.sid, dt, column ) - if result == 0 or np.isnan(result): - if column == "volume": return 0 - - if not ffill: - return np.nan # we are looking for price, and didn't find one. have to go hunting. last_traded_dt = \ ...
codereview_python_data_10321
def union(G, H, rename=(None, None)): """Return the union of graphs G and H. - Graphs G and H must be disjoint, otherwise an exception is raised. Parameters ---------- This is a good change -- but it might need a deprecation warning until v3.0 because it is a change in the API. If we decide that is ...
codereview_python_data_10325
out[in_size-1, in_size-1, c] = c return [out] - pipe = Pipeline(1, 3, 0) input = fn.external_source(source=get_data, device=device) rotated = fn.warp_affine(input, matrix=[-1, 0, in_size, 0, -1, in_size], I would set prefetch_queue_depth to 1 to reduce the number of output buffers. out[in_si...
codereview_python_data_10328
If the config has a special prefix for emails then this function adds this prefix. """ - prefix = email().prefix - if prefix is not None and prefix != '': return "{} {}".format(email().prefix, subject) else: return subject Thanks. Though these two lines can be simplified to ...
codereview_python_data_10337
content = fds.read() target_lines = [ - "var_loc_keys=self.loc_mng.get_locator([{'name':'btn1',}],30.0)self.driver.find_element" "(var_loc_keys[0],var_loc_keys[1]).click()", - "var_loc_keys=self.loc_mng.get_locator([{'id':'Id_123',}],30.0)self.driver.find_element...
codereview_python_data_10341
The platform that the code is running on. By default this will be the string 'zipline'. This can allow algorithms to know if they are running on the Quantopian platform instead. Returns ------- What does the star mean here? ...
codereview_python_data_10343
class PersistenceContext: def __init__(self, state_dir: str = None, lock: rwlock.RWLockable = None): # state dir (within DATA_DIR) of currently processed API in local file system - self.state_dir: str = state_dir # read-write lock for concurrency control of incoming requests - self...
codereview_python_data_10344
except Exception: pass -try: - from collections import OrderedDict # For Py 2.7+ -except ImportError: - from ordereddict import OrderedDict # Works only on 2.6 - """ Add alias for python2 and python3 libs and functions. """ can we also move this import to the if sys.version check below? except Excep...
codereview_python_data_10345
def set_key_columns(self, frame): if frame.ncols == 0: return - nkeys = random.randint(1, frame.ncols) keys = random.sample(range(0, frame.ncols), nkeys) names = [frame.names[i] for i in keys] Randomly chosen columns may or may not be valid for setting a key. However...
codereview_python_data_10352
v_k_0 = 0 for n in G: weighted_cost += d[n] * (arborescence.degree(n) - 2) - if arborescence.degree(n) - 2 == 0: - v_k_0 += 1 if weighted_cost < min_k_d_weight: min_k_d_weight = weighte...
codereview_python_data_10360
self.clear_keychain() self.mode = usertypes.KeyMode.normal self.left.emit(mode, self.mode, self._win_id) - if mode in [usertypes.KeyMode.prompt, usertypes.KeyMode.yesno]: self.enter(self._prev_mode, reason='restore mode before {}'.format(mode.name))...
codereview_python_data_10366
from google.cloud.security.notifier import notifier from google.cloud.security.common.data_access import csv_writer -from google.cloud.security.scanner.audit import fw_rules_engine -from google.cloud.security.common.gcp_type import resource_util from google.cloud.security.common.data_access import firewall_rule_dao ...
codereview_python_data_10368
logs_file.close() except: print "Unknown error while writing logs file!" colorHex = { 'red': '91m', Don't do this blind exception swallow. Let exceptions be raised if any error happens on logging to file, please. logs_file.close() except: print "Unknown error while writing logs file!" + ra...
codereview_python_data_10370
def validate_transaction_schema(tx): - """ Validate a transaction dict """ - _validate_schema(TX_SCHEMA, tx) if tx['operation'] == 'TRANSFER': _validate_schema(TX_SCHEMA_TRANSFER, tx) else: This would be a good place to explain why the 3 different schemas def validate_transaction_schema(tx)...
codereview_python_data_10373
@raises(RuntimeError) -def test_python_operator_error(): pipeline = Pipeline(1, 1, 0, 0) with pipeline: output = fn.python_function(function=lambda: np.zeros((3, 3, 3))) it's not clear to me what is the expected error. Maybe the name of the test case should say it @raises(RuntimeError) +def test_...
codereview_python_data_10380
@given(st.data()) def test_constructor_is_more_important(data): - """Constructor types should take presence over all other annotations.""" data.draw(st.builds(AnnotatedConstructor)) Oops, I missed this one in review :sweat_smile: @given(st.data()) def test_constructor_is_more_important(data): + """Cons...
codereview_python_data_10389
fitted = mda.Universe(PSF, outfile) # ensure default file exists - with mda.Writer(os.path.join(tmpdir, "rmsfit_align_test.dcd"), n_atoms=fitted.atoms.n_atoms) as w: w.write(fitted.atoms) not calling `str()` is messing up the py2.7 tests fitted =...
codereview_python_data_10393
auth_action: AbstractAuthAction=None): is_role_accepted = self.is_role_accepted(request, auth_constraint) if is_role_accepted is None: - return False, "role is not found" if not is_role_accepted: return False, "role is not accepted" if not s...
codereview_python_data_10394
def _make_csv_file(filenames): def _csv_file_maker( - filename=TEST_CSV_FILENAME, row_size=NROWS, force=True, delimiter=",", Does this occur when files with the same names are created in parallel in different processes? def _make_csv_file(filenames): def _csv_file_maker( ...
codereview_python_data_10396
self.connector = email_factory.EmailFactory( self.notification_config).get_connector() except Exception: - LOGGER.exception( - 'Error occurred to instantiate connector.') raise InvalidInputError(self.notifier_config) def _make_at...
codereview_python_data_10407
class MoveToFort(BaseTask): def should_run(self): - if not self.bot.has_space_for_loot(): logger.log("Not moving to any forts as there aren't enough space. You might want to change your config to recycle more items if this message appears consistently.", 'yellow') - return (self.bot.has...
codereview_python_data_10410
dead_letter_source_queues = [] for k, v in queues.items(): for i, j in v.items(): - if(i == 'RedrivePolicy'): f = json.loads(v[i]) queue_url_split = queue_url.split('/') if(queue_url_split[len(queue_url_split) - 1] in f['deadLetterTargetAr...
codereview_python_data_10426
def UniprotIterator(handle, alphabet=Alphabet.ProteinAlphabet(), return_raw_comments=False): - """Parse UniProt XML as SeqRecord objects. parses an XML entry at a time from any UniProt XML file returns a SeqRecord for each iteration How about "Iterate over UniProt XML as SeqRecord objects."? def Unipro...
codereview_python_data_10434
<h1>Error 503 Backend is unhealthy</h1> <p>Backend is unhealthy</p> <h3>Guru Mediation:</h3> - <p>Details: cache-sea4457-SEA 1645542722 1213049562</p> <hr> <p>Varnish cache server</p> </body> Have you tried to see how many seconds a delete may take? Because right now after 25 seconds, th...
codereview_python_data_10441
def check_if_installed(self): self.log.debug("Trying Gatling...") try: - out, err = self.call([self.tool_path, '--help'], env={"JAVA_OPTS": "-Dtaurus.dummy=1"}) self.log.debug("Gatling check output: %s", out) except CALL_PROBLEMS as exc: self.log.info...
codereview_python_data_10443
# Get the projects for which we will retrieve the buckets. try: - raw_buckets = self.dao.get_raw_buckets( - 'buckets', self.cycle_timestamp) except data_access_errors.MySQLError as e: raise inventory_errors.LoadDataPipelineError(e) can we replace the ha...
codereview_python_data_10445
""" self.coco = COCO(ann_file) - self.cat_ids = [] - - # make cat_ids consistent with the order of class_name - for class_name in self.CLASSES: - self.cat_ids.append(self.coco.get_cat_ids(cat_names=class_name)[0]) - self.cat2label = {cat_id: i for i, cat_id in ...
codereview_python_data_10447
try: entry_args = [v() if isinstance(v, BeatLazyFunc) else v for v in (entry.args or [])] - entry_kwargs = {k: v() if isinstance(v, BeatLazyFunc) else v for k, v in (entry.kwargs.items() or {})} if task: return task.apply_async(entry_args, entry_kwargs, ...
codereview_python_data_10457
We use __ here to avoid accidentally overriding it in subclasses. """ - if self.hasSelectedText(): - # Let __on_selection_changed handle it - return - if new < self._promptlen: self.setCursorPosition(self._promptlen) Why not just replace this with `s...
codereview_python_data_10459
return scenarios def convert_path(self, swagger_path): with open(swagger_path) as swagger_fd: return self.convert(swagger_fd) You ate the friendly error message, it will fail with ugly "IOError" instead. return scenarios def convert_path(self, swagger_path): + ...
codereview_python_data_10470
import asyncio from marshmallow.schema import SchemaMeta from typing import Any is there a way we can pre-process `data` to look up adversaries, planners, and other nested schema objects by ID and then load the appropriate data? import asyncio +import copy from marshmallow.schema import SchemaMeta from typing i...
codereview_python_data_10475
variables = re.findall(self.re_variable, decoded_test) if variables: relevant_facts = await self._build_relevant_facts([x for x in variables if '_' not in x], facts) - if all([x for x in relevant_facts]): good_facts = [await RuleSet(rules=ru...
codereview_python_data_10477
elif (num_first_testcase_hangs == self.MAX_FIRST_HANGS_WITH_DEFERRED_FORKSERVER): - environment.set_value(constants.AFL_DRIVER_DONT_DEFER, 1) print('Instructing AFL not to defer forkserver.\nIf this fixes the ' 'fuzzer, you should add this to the .o...
codereview_python_data_10478
import copy import json import sys -import signal from bigchaindb.common import crypto from bigchaindb.common.exceptions import (StartupError, DatabaseAlreadyExists, Seems like `signal` is not used in this module. import copy import json import sys + from bigchaindb...
codereview_python_data_10483
pos_decoded_target_preds.detach(), is_aligned=True).clamp(min=1e-6) bbox_weights_ini = iou_targets_ini.clone().detach() - iou_targets_ini_avg_per_gpu = reduce_mean( - bbox_weights_ini.sum()).item() - bbox_avg_factor_ini = max(iou_targets_ini_avg_per_gpu, 1.0) ...
codereview_python_data_10485
- filename - name of mmCIF file, OR an open text mode file handle """ - with warnings.catch_warnings(): if self.QUIET: warnings.filterwarnings("ignore", category=PDBConstructionWarning) You need to remove this new blank line, it is one of the reason the style c...
codereview_python_data_10488
progress_queue.put('Running {}...'.format( scanner.__class__.__name__)) except Exception: # pylint: disable=broad-except - log_message = 'Error running scanner: {}'.format( - scanner.__class__.__name__) - progress_queue...
codereview_python_data_10494
"--platform-name", "-p", default=MOLECULE_PLATFORM_NAME, - help=f"Name of the platform to target only. ({MOLECULE_PLATFORM_NAME} means all)", ) @click.option( "--driver-name", This will say "{whatever is in env} means all" which is probably not what's intended. Am I reading this correctly? Sho...
codereview_python_data_10495
def serialize_pipeline(pipeline): try: return pipeline.serialize() - except: - print("Error during pipeline initialization. Note that some operators (e.g. Python Operators) " - "cannot be used with tensorflow data set API and DALIIterator.") - raise def DALIIteratorWrapper(pipeline = None, ser...
codereview_python_data_10503
* The output of its forward function is the logits for the predicted node/graph classes. - See also the example below. num_hops : int The number of hops for GNN information aggregation. lr : float, optional But eweight is also required right? Does it have to be a keyword a...
codereview_python_data_10507
def clear_keystring(self): """Clear the currently entered key sequence.""" if self._keystring: - self._debug_log("discarding keystring '{}'.".format(self._keystring)) self._keystring = '' self.keystring_updated.emit(self._keystring) I think this could cause `...
codereview_python_data_10511
self, sampling_probability: TensorLike, time_major: bool = False, - seed: Optional[TensorLike] = None, - next_inputs_fn: Optional[Callable] = None ): """Initializer. ```suggestion seed: Optional[int] = None, ``` Maybe too? I'm not sure. self, sa...
codereview_python_data_10513
records = [] with openany(filename) as data: for line in data: - if line.startswith('#'): - continue records.append(map(float, line.split())) - self.timeseries = np.array(records).T - try: - self.qavg = np.loadtxt...
codereview_python_data_10519
the matches list. Args: - key (dict): plist key. names (list[str]): names of the keys to match. matches (list[str]): keys with matching names. """ Do we know what is in the dict? e.g. `dict[str, object]` the matches list. Args: + key (dict[str, object]): plist key. ...
codereview_python_data_10522
class Template: - def __init__(self, variables=None): - if dict: - self.variables = variables - else: - self.variables = {} self.tmpl = Apply("") def apply(self, template): This should probably have been `if variables` or `if variables is not None`. class Templat...
codereview_python_data_10529
query = """SELECT * FROM listens WHERE uid = %(uid)s AND """ + \ range_keys(len(date_range)) + \ """ AND id > %(from_id)s AND id < %(to_id)s - ORDER BY id """ + ORDER_TEXT[order] + """ LIMIT %(limit)s;""" fetched_rows = 0 # Total number of rows fetc...
codereview_python_data_10536
</ItemGroup> </Project> """ - target_str = f""" <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> <EnableLightGBMUnsupportedPlatformTargetCheck Condition="'$(EnableLightGBMUnsupportedPlatformTargetCheck)' == ''">true</EnableLightGBMUnsupportedPlat...
codereview_python_data_10538
pass else: return - echo(format.format(**vars(self)), replace=self.dynamic, newline=newline) This will break a lot of progmeter code using the old formatting style that's needs to be updated as well. It should also be mentioned in the changelog explicitly ...