id
stringlengths
24
28
content
stringlengths
121
2.08k
codereview_python_data_916
total_epochs = 12 dist_params = dict(backend='nccl') log_level = 'INFO' -work_dir = './work_dirs/faster_rcnn_r50_fpn_1x' load_from = None resume_from = None workflow = [('train', 1)] Use the same name as the config file. total_epochs = 12 dist_params = dict(backend='nccl') log_level = 'INFO' +work_dir = './w...
codereview_python_data_917
spotipy_call = getattr(spotipy_client, endpoint) recently_played = spotipy_call(**kwargs) break - except (AttributeError, TypeError) as err: - current_app.logger.critical("Invalid spotipy endpoint or arguments:", err, exc_info=True) return None ...
codereview_python_data_926
def declare_var(self, name, type, pos, cname = None, visibility = 'private', - api = 0, in_pxd = 0, is_cdef = True, - walrus_target = False): - if walrus_target: - # should be declared in the parent scope instead - entry = self...
codereview_python_data_927
self.props_file = None self.class_path = [] self._tools = [] - self.hamcrest_path = "~/.bzt/selenium-taurus/tools/junit/hamcrest-core.jar" - self.json_jar_path = "~/.bzt/selenium-taurus/tools/junit/json.jar" - self.selenium_server_path = "~/.bzt/selenium-taurus/selenium-s...
codereview_python_data_935
# pylint: disable=redefined-outer-name # XXX chord is also a class in outer scope. stack = deque(self.tasks) - i = 0 while stack: task = maybe_signature(stack.popleft(), app=self._app).clone() if isinstance(task, group): Perhaps minor, but I think ...
codereview_python_data_937
model.eval() print("start eval") embed = model(test_graph, test_node_id, test_rel, test_norm) - mrr = utils.calc_filtered_mrr(embed, model.w_relation, torch.LongTensor(train_data), - valid_data, test_data, hits=[1, 3, 10]) ...
codereview_python_data_940
values = data_handler.get_additional_values_for_variable( name, testcase.job_type, testcase.fuzzer_name) - # TODO(ochang): Find a less hacky way of concatenating multiple values. return values + data_handler.get_additional_values_for_variable( name + '_1', testcase.job_type, testcase.fuzzer_name) ...
codereview_python_data_942
If the graph is homogeneous, one can directly pass the above formats. Otherwise, the argument must be a dictionary with keys being node types and values being the nodes. - store_raw_ids : bool, optional If True, it will store the raw IDs of the extracted nodes and edges in the ``n...
codereview_python_data_944
image with shape (N, 4). bbox_weights (Tensor): BBox weights of all anchors in the image with shape (N, 4) - pos_inds (Tensor): Inds of postive anchor with shape (num_pos,). - neg_inds (Tensor): Inds of negativ...
codereview_python_data_945
self.dedup_names() return True - # This is a noop operation for the python data def shallow_copy(self): self.df_shallow_copy = self.df.copy() self.df_deep_copy = copy.deepcopy(self.df) Does `copy.deepcopy` even works on a Frame? self.dedup_names() return T...
codereview_python_data_953
class TestResidueGroup(object): # Legacy tests from before 363 - # def setUp(self): - # """Set up the standard AdK system in implicit solvent.""" - # self.universe = mda.Universe(PSF, DCD) - # self.rg = self.universe.residues - @pytest.fixture() def universe(self): retur...
codereview_python_data_956
lock. metadata (dict): Metadata to be stored along with the Transaction. """ if operation not in Transaction.ALLOWED_OPERATIONS: allowed_ops = ', '.join(self.__class__.ALLOWED_OPERATIONS) This should not be removed but we could c...
codereview_python_data_962
return no_js = config.val.hints.find_implementation != 'javascript' rect = self.elem.rect_on_view(no_js=no_js) - if rect.y()<0 and (rect.y()+rect.height()-15>0): - self.move(rect.x(), rect.y()+rect.height()-15) - else: - self.move(rect.x(), rect.y()) ...
codereview_python_data_967
h[:], edges[:] = np.histogramdd(coord, bins=bins, range=arange, normed=False) grid += h # accumulate average histogram - start, stop, step = u.trajectory.check_slice_indices(start, stop, step) n_frames = len(range(start, stop, step)) grid /= float(n_frames) The slice check should come b...
codereview_python_data_978
# explicit relative cimport # error of going beyond top-level is handled in cimport node relative_to = self - while relative_level > 0 and relative_to and self._is_package_scope_or_module(): relative_to = relative_to.parent_module relat...
codereview_python_data_982
tags = params.get("Tags") or [] topic_name = params.get("TopicName") if dedup is not None: - attributes["ContentBasedDeduplication"] = ( - "true" if str(dedup).lower() == "true" else "false" - ) if display_name: ...
codereview_python_data_984
return [obj['comment']['content']] if obj['comment'] else [] def parse_entity(obj, section_comment=[]): - translation = FTLSerializer().dumpEntity(obj).split(' = ', 1)[1] self.entities[obj['id']['name']] = L20NEntity( obj['id']['name'], tra...
codereview_python_data_985
if action_data is not None: groupdata.append(action_data) groups.append('\n'.join(groupdata)) - # pylint: enable=protected-access options = '\n'.join(groups) # epilog if parser.epilog is not None: I think you can move the disable/enable around the `for group in ...
codereview_python_data_989
can handle negative edge weights. If a negative cycle is detected, you can use :func:`find_negative_cycle` - to return the cycle and examine it. Shoftest paths are not defined when a negative cycle exists because once reached, the path can cycle forever to build up arbitrarily low weights. ```su...
codereview_python_data_993
selected_scale = ProtParamData.gravy_scales.get(scale, -1) if selected_scale == -1: - raise ValueError("scale: {} not know".format(scale)) total_gravy = sum(selected_scale[aa] for aa in self.sequence) Typo: know -> known Style: Please use an f-string rather than the format method ...
codereview_python_data_994
def __init__(self, name, cname, typedef_flag, namespace=None, doc=None): self.name = name - if doc is None: - self.doc = "An enumeration." - else: - self.doc = doc self.cname = cname self.values = [] self.typedef_flag = typedef_flag The strin...
codereview_python_data_997
} ] ) - time.sleep(3) resp = cfn.describe_stacks(StackName=stack_name) stack_outputs = [stack['Outputs'] for stack in resp['Stacks'] if stack['StackName'] == stack_name] Let's better use this here, instead of hardcoding a sleep time: ``` _await_stack_comp...
codereview_python_data_1001
mode_manager = objreg.get('mode-manager', scope='window', window=self._win_id) if (result.cmdline[0] != 'repeat-command' and - result.cmd.mode_allowed(mode_manager.mode)): last_command[mode_manager.mode] = ( ...
codereview_python_data_1003
return result, log_output - def port(self): - """ Return a randomly container port""" - return self.port - class ContainerInfo: """ I think we should remove that method, looks like it is not being used. (also, it potentially aliases the variable `self.port` with the same name) ...
codereview_python_data_1004
wrapper = os.path.join(get_full_path(__file__, step_up=2), "resources", "locustio-taurus-wrapper.py") self.env.set({"LOCUST_DURATION": dehumanize_time(load.duration)}) self.log_file = self.engine.create_artifact("locust", ".log") args = [sys.executable, wrapper, '-f', self.script] B...
codereview_python_data_1009
output, _ = docker_client.exec_in_container( container_info.container_id, env_vars=env, command=["env"] ) - print(output) output = output.decode(config.DEFAULT_ENCODING) assert "MYVAR" not in output nit: could be removed output, _ = docker_client.exec_i...
codereview_python_data_1013
ex_info.match("can have one and only one SCHEMA with name GVT and version 1.0'") -def test_submit_schema_without_role(looper, public_repo_for_client, - schema): with pytest.raises(OperationError) as ex_info: looper.run( public_repo_for_client.submit...
codereview_python_data_1015
__all__ = [ 'RegNet', 'ResNet', 'ResNetV1d', 'ResNeXt', 'SSDVGG', 'HRNet', 'Res2Net', - 'Hourglass' ] HourglassNet might be more appropriate. __all__ = [ 'RegNet', 'ResNet', 'ResNetV1d', 'ResNeXt', 'SSDVGG', 'HRNet', 'Res2Net', + 'HourglassNet' ]
codereview_python_data_1018
method = lambda x: None # noqa: E731 if f: p = os.path.join(tutorial_base, f) - method.__doc__ = "%s\n\n>>> import os\n>>> os.chdir(%r)\n%s\n" % ( - n, - p, - d, - ) else: ...
codereview_python_data_1028
def _adjust_cbar(self, cbar, label, dim): noalpha = math.floor(self.style[self.cyclic_index].get('alpha', 1)) == 1 - for label in ['clabel', 'labels']: - labelsize = self._fontsize(label, common=False).get('fontsize') if labelsize is not None: break This lo...
codereview_python_data_1029
.. deprecated:: 2.6 Use `partition_quality` instead. - The *performance* of a partition is the ratio of the number of intra-community edges plus inter-community non-edges divided by the total number of potential edges. The original wording had "the ratio of" which implies the division of the ...
codereview_python_data_1034
def get_domain_arn(domain_name: str, region: str = None, account_id: str = None) -> str: - region = region or aws_stack.get_region() - account_id = account_id or TEST_AWS_ACCOUNT_ID - return "arn:aws:es:%s:%s:domain/%s" % (region, account_id, domain_name) def parse_domain_arn(arn: str): nit: could also reus...
codereview_python_data_1036
return bool(data.draw_bits(1)) -def biased_coin(data, p, forced=None): """Return True with probability p (assuming a uniform generator), shrinking towards False. If ``forced`` is set to a non-None value, this will always return that value but will write choices appropriate to having I'd consider ma...
codereview_python_data_1042
elif self.client_type == 'kerberos': from hdfs.ext.kerberos import KerberosClient return KerberosClient(url=self.url) - elif self.client_type == 'token': - import hdfs - return hdfs.TokenClient(url=self.url, token=self.token) else: ra...
codereview_python_data_1047
``` """ if mode not in ['multiclass', 'multilabel']: - raise TypeError('mode must be: [multiclass, multilabel]') if threshold is None: threshold = tf.reduce_max(y_pred, axis=-1, keepdims=True) nit: mode must be: `multiclass` or `multilabel`. The current way looks as though it takes ...
codereview_python_data_1050
def test_get_wrong_n_atoms(self): with pytest.raises(ValueError, match=r"Supplied n_atoms *"): - mda.Universe(TRZ, n_atoms = 8080) class TestTRZWriter(RefTRZ): ```suggestion mda.Universe(TRZ, n_atoms=8080) ``` def test_get_wrong_n_atoms(self): with pytest.raises(ValueError, mat...
codereview_python_data_1052
@raises( RuntimeError, - glob="Assert on \"HasArgument(name)\" failed: Argument \"preprocessed_annotations_dir\" is not supported by operator \"readers__COCO\".") def test_invalid_args(): pipeline = Pipeline(batch_size=2, num_threads=4, device_id=0) with pipeline: 1. Don't include assertion conditi...
codereview_python_data_1054
self.data_layout = data_layout if self.data_layout == "DHWC": - D, H, W = self.data_shape[0], self.data_shape[1], self.data_shape[2] elif self.data_layout == "CDHW": - D, H, W = self.data_shape[1], self.data_shape[2], self.data_shape[3] elif self.data_layout == ...
codereview_python_data_1071
'playbook': 'playbook.yml', 'raw_ssh_args': [ '-o UserKnownHostsFile=/dev/null', - '-o IdentitiesOnly=yes', '-o ControlMaster=auto', '-o ControlPersist=60s', '-o IdentitiesOnly=yes', ...
codereview_python_data_1075
print('Done saving data into cached files.') def _get_hash(self): return abs(hash(self._hash_key)) @property I think, you need to put a example here. print('Done saving data into cached files.') def _get_hash(self): + """Compute the hash of the input tu...
codereview_python_data_1076
input_ = InputCell(1) output = ComputeCell([input_], lambda inputs: inputs[0] + 1) - def callback1(value): - return value output.add_callback(callback1) input_.value = 3 - self.assertEqual(output.expect_callback_values(callback1), [4]) def test_callbacks...
codereview_python_data_1079
import json import os from pokemongo_bot.base_task import BaseTask from pokemongo_bot.worker_result import WorkerResult from pokemongo_bot.tree_config_builder import ConfigException Excuse my python noobishness, but what is the difference between `class _Item:` and `class _Item(object):`? import json import os...
codereview_python_data_1094
pruner_stats['edge_coverage'], pollinator_stats['edge_coverage'], pruner_stats['feature_coverage'], pollinator_stats['feature_coverage']) - result = CorpusPruningResult( coverage_info=coverage_info, crashes=list(crashes.values()), fuzzer_binary_name=fuzzer_binary_name, rev...
codereview_python_data_1101
<h1>Error 503 Backend is unhealthy</h1> <p>Backend is unhealthy</p> <h3>Guru Mediation:</h3> - <p>Details: cache-sea4478-SEA 1645522606 3883447466</p> <hr> <p>Varnish cache server</p> </body> I noticed in the IAM & Admin -> Quotas dashboard, under "All Quotas", that there doesn't seem to...
codereview_python_data_1103
"**": ["globaltoc.html", "relations.html", "sourcelink.html", "searchbox.html"] } -issues_github_path = "modin-project/modin" \ No newline at end of file ```suggestion issues_github_path = "modin-project/modin" ``` "**": ["globaltoc.html", "relations.html", "sourcelink.html", "searchbox.html"] } \ No newl...
codereview_python_data_1108
self.engine.aggregator.add_listener(self) disable = str(self.settings.get('disable', 'auto')).lower() - if (disable == 'true') or ((disable == 'auto') and (not is_tty())): self.disabled = True return for case of "true" you'll get boolean value of option. This cond...
codereview_python_data_1118
as a weight. If None, then each edge has weight 1. The degree is the sum of the edge weights adjacent to the node. n_communities: int - desired number of communities, defaults to 1 and falls back to 1 if - the given number is larger than the initial amount of communities Returns ...
codereview_python_data_1127
self.coords = coords n = reference_coords.shape m = coords.shape - if n != m or not n[1] == m[1] == 3: raise Exception("Coordinate number/dimension mismatch.") self.n = n[0] Is this definitely equivalent? The comparison of three terms is in itself perhaps not the...
codereview_python_data_1135
return Layout([self, obj]) def __radd__(self, other): - if isinstance(other, list): # Hack for Annotators? - return NotImplemented if isinstance(other, int): raise TypeError("unsupported operand type(s) for +: 'int' and 'Overlay'. " "If ...
codereview_python_data_1136
ds_layout = None -class graph_redim(redim): """ Extension for the redim utility that allows re-dimensioning Graph objects including their nodes and edgepaths. """ def __call__(self, specs=None, **dimensions): - redimmed = super(graph_redim, self).__call__(specs, **dimensions) ...
codereview_python_data_1141
""" # ensure we get a 200 - success, service_error, resp = self.get_metadata('instance/compute', is_health=False) - if not success: - raise ValueError(resp) - data = json.loads(ustr(resp, encoding="utf-8")) compute_info = ComputeInfo() set_properties('...
codereview_python_data_1143
forest.union(u, v) -def _kruskal_mst_partition_edges( G, minimum, weight="weight", keys=True, data=True, ignore_nan=False, - partition="partition", ): """ Iterate over edge of a Kruskal's algorithm min/max spanning tree with Add a "Yields" section to the doc...
codereview_python_data_1155
return worker_ip_to_port -def _find_random_open_port(): """Find a random open port on the machine. Returns we've been trying to use type hints everywhere in the Dask module, in a step towards #3756 can you please add this return hint? ```suggestion def _find_random_open_port() -> int: ``` return w...
codereview_python_data_1158
def test_parse_upstream_auth(): tutils.raises("Invalid upstream auth specification", cmdline.parse_upstream_auth, "") assert cmdline.parse_upstream_auth( "test:test") == "Basic" + " " + base64.b64encode("test:test") def test_parse_setheaders(): I'm not sure what the RFC says, but are these allowed...
codereview_python_data_1164
config_obj.changed.connect(self.set_colors) QTimer.singleShot(0, self.autohide) config_obj.changed.connect(self.autohide) config_obj.changed.connect(self.on_tab_colors_changed) def __repr__(self): This won't get called when `hide-always` is updated because of the `@config.chang...
codereview_python_data_1180
except OSError: self.log.debug("JMeter check failed.") return False - except ValueError: - raise def install(self): dest = os.path.dirname(os.path.dirname(os.path.expanduser(self.tool_path))) Why have it? Let it be just silently raised :) exc...
codereview_python_data_1185
"""Test if the CLI hits specific client methods.""" tmp_config = os.path.join(self.test_dir, '.forseti') with mock.patch.dict( - os.environ, {'FORSETI_CLIENT_CONFIG': tmp_config}) as mock_config: for commandline, client_func, func_args,\ func_kwargs, c...
codereview_python_data_1187
env = BetterDict() env.merge(dict(os.environ)) - java_opts = "".join([" -D%s=%s" % (key, params_for_scala[key]) for key in params_for_scala]) - java_opts += " " + env.get("JAVA_OPTS", "") + " " + properties.get("java-opts", "") env.merge({"JAVA_OPTS": java_opts}) it should be "...
codereview_python_data_1193
except Exception: yield None finally: - devnull.close() def array_to_bytes(buff): # Python 3.9 removed the tostring() method on arrays, the new alias is tobytes() if open raises devnull will be None, so devnull.close() would raise except Exception: ...
codereview_python_data_1209
last_required_arg = max_positional_args-1 if max_positional_args > num_posonly_args: code.putln('switch (pos_args) {') - for i, arg in enumerate(all_args[:last_required_arg+1]): - if i < num_posonly_args: - continue ...
codereview_python_data_1214
'DISTINCT len(ObjectType.name) failed to filter out dupplicates') async def test_edgeql_expr_setop_12(self): await self.assert_query_result( r'''SELECT DISTINCT (SELECT ({1,2,3}, ()) FILTER .0 > 1).1;''', [[]], Let's also add the explicit set literal case `SELECT DI...
codereview_python_data_1215
# The METIS runs on the symmetric graph to generate the node assignment to partitions. start = time.time() sym_gidx = _CAPI_DGLMakeSymmetric_Hetero(g._graph) - sym_g = DGLHeteroGraph(gidx=sym_gidx, ntypes=['_N'], etypes=['_E']) print('Convert a graph into a bidirected graph: {:.3f} seconds'.forma...
codereview_python_data_1223
-import sys - import dask.array as da from distributed import Client, LocalCluster from sklearn.datasets import make_blobs If the examples were working on Mac, can we remove this check until something breaks? These are supposed to be examples that teach users how to use `lightgbm.dask`, and I'm really uncomfortable...
codereview_python_data_1231
def clear(self): "Clears the file archive" - return self._files.clear() Don't think `dict.clear()` returns anything ```suggestion self._files.clear() ``` def clear(self): "Clears the file archive" + self._files.clear()
codereview_python_data_1233
d = self.__dict__ for field_name, factory in self._field_factories: - value = factory() - d[field_name] = value d.update(kwargs) I'm not sure if unconditionally calling `factory()` is better than checking if `field_name not in kwargs` first. I mean it can be slightly fa...
codereview_python_data_1236
""" if self.metadata or self._try_cache(): - if self.metadata_expire != -1 \ and self._check_config_file_age \ and self.repofile \ and dnf.util.file_age(self.repofile) < self.metadata._age: hmm, what about `< 0`? """ ...
codereview_python_data_1243
url(r"^pontoon\.js$", pontoon_js_view), url(r"^static/js/pontoon\.js$", pontoon_js_view), # Include URL configurations from installed apps url(r"^translations/", include("pontoon.translations.urls")), url(r"", include("pontoon.teams.urls")), url(r"", include("pontoon.tour.urls")), - url...
codereview_python_data_1244
sampled = param.Boolean(default=False, doc=""" Allows defining a DynamicMap in closed mode without defining the - dimension bounds or values. Useful for allowing to let a HoloMap - in a composite plot to define the dimension sampling. """) def __init__(self, callback, initial_items...
codereview_python_data_1256
if n < 0: n = max(0, len(self.index) + n) if n == 0: - index = self.index[:0] else: index = self.index[-n:] if self._is_transposed: shouldn't this be `pandas.Index([])`? This can return a `RangeIndex` where `start` and `stop` are 0, which isn't w...
codereview_python_data_1257
y_true: TensorLike, y_pred: TensorLike, margin: FloatTensorLike = 1.0, - angular: bool = False, soft: bool = False, ) -> tf.Tensor: """Computes the triplet loss with hard negative and hard positive mining. please move this to the last arg. y_true: TensorLike, y_pred: TensorLike,...
codereview_python_data_1261
], ) def test_update_conda_requirements(setup_commands_source): - major = sys.version_info.major - minor = sys.version_info.minor - micro = sys.version_info.micro - python_version_lower = f"python>{major}.{minor}" - python_version_higher = f"python<={major}.{minor}.{micro}" with mock.patch( ...
codereview_python_data_1262
log.error("MICROSOFT_TRANSLATOR_API_KEY not set") return JsonResponse({ 'status': False, - 'message': 'Bad Request: {error}'.format(error='Missing api key.'), }, status=400) # Validate if locale exists in the database to avoid any potential XSS attacks. Hehe, I g...
codereview_python_data_1263
pass model = _init_model(miscmodels.BookmarkCompletionModel, 'url') _instances[usertypes.Completion.bookmark_by_url] = model - model = _init_model(miscmodels.BookmarkCompletionModel, 'title') @pyqtSlot() This seems unneeded, as the "bookmark by title" model isn't used anywhere. pass ...
codereview_python_data_1268
Raises: InvalidHash: If the block's id is not corresponding to its data. - InvalidSignature: If the block's signature is not corresponding - to it's data or `node_pubkey`. """ # Validate block id block = block_body['block'] I g...
codereview_python_data_1269
assert crashes[0].security_flag == c.security_flag self.crashes = crashes - fully_qualified_fuzzer_name = context.fuzzer_name if context.fuzz_target: fully_qualified_fuzzer_name = context.fuzz_target.fully_qualified_name() self.main_crash, self.one_time_crasher_flag = find_main_crash( ...
codereview_python_data_1271
Return only the value for nodes u distance : edge attribute key, optional (default=None) Use the specified edge attribute as the edge distance in shortest - path calculations Returns ------- What happens when `distance=None`? The docs should tell the user what to expect. Retur...
codereview_python_data_1273
shutil.rmtree(self.tmp_dir, ignore_errors=True) def _get_backups(self): - files = [os.path.join(self.backup_dir, file) - for file in os.listdir(self.backup_dir)] - files = [file for file in files if os.path.isfile( - file) and self.backup_name_prefix in file] ...
codereview_python_data_1275
functools.partial(self._on_title_changed, tab)) tab.icon_changed.connect( functools.partial(self._on_icon_changed, tab)) - tab.search_match_changed.connect( - functools.partial(self._on_search_match_changed, tab)) tab.pinned_changed.connect( fun...
codereview_python_data_1285
async def test_constraints_ddl_07(self): await self.con.execute(""" SET MODULE test; - CREATE TYPE Test { CREATE PROPERTY first_name -> str; CREATE PROPERTY last_name -> str; CREATE CONSTRAINT exclusive on (__subject__.first_name);...
codereview_python_data_1287
n_tags = potentials.shape[-1] transition_params = tf.random.normal([n_tags, n_tags]) - backpointers, last_score = text.crf_decode_forward( inputs, initial_state, transition_params, sequence_length_less_one ) Since the variable `last_score` is not used in the context. The standard way to hand...
codereview_python_data_1296
def asnumpy(a): return a.cpu().numpy() - -def reduce_sum(a): - if isinstance(a, list): - return sum(a) - elif isinstance(a, Tensor): - return torch.sum(a, 0, keepdim=True) - else: - raise Exception("reduce_sum only supports input of type Tensor or list of Tensor") These functions ar...
codereview_python_data_1298
f'revision {last_tested_revision}.') return fuzz_target = testcase.get_fuzz_target() if fuzz_target: fuzz_target_name = fuzz_target.binary Do we need to refetch testcase to avoid race updates. Same for some branches like line 88, line 81 f'revision {last_tested_re...
codereview_python_data_1306
booster.best_iteration = earlyStopException.best_iteration + 1 evaluation_result_list = earlyStopException.best_score break - booster._reverse_update_params() booster.best_score = collections.defaultdict(dict) for dataset_name, eval_name, score, _ in evaluation_result...
codereview_python_data_1312
<h1>Error 503 Backend is unhealthy</h1> <p>Backend is unhealthy</p> <h3>Guru Mediation:</h3> - <p>Details: cache-sea4435-SEA 1645523407 485524714</p> <hr> <p>Varnish cache server</p> </body> Can you please rewrite this `return` in a different way so that it's easier for our ide debugger ...
codereview_python_data_1314
"""Check whether the anchors are inside the border Args: - flat_anchors (torch.Tensor): Flatten anchors - valid_flags (torch.Tensor): An existing valid flags of anchors - img_shape (tuple(int)): Shape of current image allowed_border (int, optional): The border to allow the valid ...
codereview_python_data_1340
gi.from_networkx(graph_data) return gi -def _map_to_subgraph_nid(gi, v): - return _CAPI_DGLGraphSubgraphMapVFromParent(gi._handle, v) - _init_api("dgl.graph_index") You can directly put in `DGLSubGraph`. It is not necessary that all the CAPI calls should be in GraphIndex. gi.from_networkx(g...
codereview_python_data_1341
class Brabex(ExchangeBase): async def get_rates(self, ccy): - json = await self.get_json('exchange.brabex.com.br', 'api/v1/BRL/ticker?crypto_currency=BTC') return {'BRL': Decimal(json['last'])} ```suggestion json = await self.get_json('exchange.brabex.com.br', '/api/v1/BRL/ticker?crypto_currency=...
codereview_python_data_1347
if (((len(plot) == 1 and not plot.dynamic) or (len(plot) > 1 and self.holomap is None) or (plot.dynamic and len(plot.keys[0]) == 0)) or - not unbound_dimensions(plot.streams, plot.dimensions, False)): fmt = fig_formats[0] if self.fig=='auto'...
codereview_python_data_1348
label = create_method_name(request.label[:40]) elif isinstance(request, SetVariables): body = self._gen_set_vars(request) - label = "set_variables" else: return If user sets label himself - can we use it? labe...
codereview_python_data_1354
code.putln('{') all_args = tuple(positional_args) + tuple(kw_only_args) non_posonly_args = [arg for arg in all_args if not arg.pos_only] - do_generate_kw_unpacking = bool(non_posonly_args) or self.starstar_arg - if do_generate_kw_unpacking: - code.putln("static PyObje...
codereview_python_data_1355
from google.cloud.forseti.services.utils import to_full_resource_name from google.cloud.forseti.services import db from google.cloud.forseti.services.utils import get_sql_dialect -from google.cloud.forseti.common.util import log_util -LOGGER = log_util.get_logger(__name__) POOL_RECYCLE_SECONDS = 300 PER_YIELD = 10...
codereview_python_data_1365
def gen_parameter_code( config_hpp: Path, config_out_cpp: Path -) -> Tuple[List, List]: """Generate auto config file. Parameters ```suggestion ) -> Tuple[List[Tuple[str, int]], List[List[Dict[str, Any]]]]: ``` def gen_parameter_code( config_hpp: Path, config_out_cpp: Path +) -> Tuple[L...
codereview_python_data_1367
add_event(name=AGENT_NAME, version=CURRENT_VERSION, op=WALAEventOperation.HeartBeat, is_success=True, message=msg, log_event=False) - - logger.periodic_info(logger.EVERY_HALF_DAY, "[PERIODIC] Incarnation: {0}; ContainerId: {2}", - ...
codereview_python_data_1369
axis = self._dataframe._get_axis_number(axis) # FIXME: this should be converted into a dict to ensure simplicity # of handling resample parameters at the query compiler level. - self.resample_args = { "rule": rule, "axis": axis, "closed": closed, ...
codereview_python_data_1371
msg = "File %s exceeds maximum size quota of %s and won't be included into upload" self.log.warning(msg, filename, max_file_size) - for filename in logs: zfh.write(filename, os.path.basename(filename)) return mfile def __upload_...
codereview_python_data_1373
"It seems as though you've passed an incompable object type!" "Please check the type being passed again" ) except ValueError: six.raise_from( There is a missing `)` here, this is why tests fail. "It seems as though y...
codereview_python_data_1375
inds = torch.nonzero(labels >= 1).squeeze() if inds.numel() > 0: bin_labels[inds, labels[inds] - 1] = 1 - bin_label_weights = label_weights.view(-1, 1).expand( - label_weights.size(0), label_channels) return bin_labels, bin_label_weights This function cannot be deleted since it is use...
codereview_python_data_1376
super(NdWidget, self).__init__(**params) self.id = plot.comm.target if plot.comm else uuid.uuid4().hex self.plot = plot - dims, keys = drop_streams(plot.streams, plot.keys, plot.dimensions) - self.dimensions, self.keys = dims, keys self.json_data = {} if self.p...
codereview_python_data_1381
Parameters ---------- nbunch : single node, container, or all nodes (default= all nodes) - The view will only report edges from these nodes (outgoing if directed). data : string or bool, optional (default=False) The edge attribute returned in 3-tuple (u, v, dd...
codereview_python_data_1382
"""Initialize sids and other state variables. :Arguments: - granularity : str (daily, hourly or minutely) The duration of the bars. annualizer : int <optional> Which constant to use for annualizing risk metrics. - If not provided, w...