id stringlengths 24 28 | content stringlengths 121 2.08k |
|---|---|
codereview_python_data_1385 | data, csvfile = get_airdrop_data(protocol_name, data_dir)
for row in data:
if len(row) < 2:
- raise InvalidData(f'Airdrop for {protocol_name} contains an invalid row {row}')
addr, amount, *_ = row
# not doing to_checksum_address() here since the fi... |
codereview_python_data_1387 | dtypes: A `List` of `tf.DType` with the expected output types
devices: A `List` with the indexes of the devices to use
prefetch_queue_depth: `int` with the amount of prefetched batches
- num_threads: `int` with the number of reader threads in the pipeline
"""
super... |
codereview_python_data_1392 | Mainly used to ensure consistent and helpful error messages
"""
- err_msg = "Cannot set {attr} from {cls}. "
-
if isinstance(group, (Atom, AtomGroup)):
group_level = 1
elif isinstance(group, (Residue, ResidueGroup)):
I think I would prefer this message template to be down in the functio... |
codereview_python_data_1395 | coordinates ``reference[pairs[k, 0]]`` and
``configuration[pairs[k, 1]]``.
"""
pairs = np.empty((0, 2), dtype=np.int64)
distances = np.empty((0,), dtype=np.float64)
probably makes more sense to put this in an `else:` branch below the size checks, else it's not clear why we're defining ... |
codereview_python_data_1408 | backend=default_backend())
return Fernet(base64.urlsafe_b64encode(generated_key.derive(bytes(self.get_config('encryption_key'), 'utf-8'))))
- @staticmethod
- def _load_packers(path):
- packers = dict()
- for module in glob.iglob('%s/**.py' % path):
- ... |
codereview_python_data_1409 | try:
if request.headers.get('API_KEY') == self.get_config('api_key'):
return True
- elif 'localhost:' in request.host:
return True
await check_permission(request, group)
except (HTTPUnauthorized, HTTPForbidden):
can you make this ... |
codereview_python_data_1415 | pass
def _matrix(self, options):
- """Creates a matrix for NEXUS object."""
if not self.ntax or not self.nchar:
raise NexusError('Dimensions must be specified before matrix!')
self.matrix = {}
This is a private method (starts with an underscore, not one of the unders... |
codereview_python_data_1419 | def test_cylayer(self, universe, selstr):
sel = universe.select_atoms(selstr)
assert_equal(len(sel), 88)
empty = universe.select_atoms('cylayer 4.0 6.0 10 -10 name NOT_A_NAME')
assert_equal(len(empty), 0)
Thanks, these are thorough tests -- could you make each of these separate... |
codereview_python_data_1422 | url="https://github.com/modin-project/modin",
long_description=long_description,
long_description_content_type="text/markdown",
- install_requires=["pandas==0.23.4", "ray==0.6.2", "numpy<=1.15.0", "sqlalchemy>=1.2.17"],
extras_require={
# can be installed by pip install modin[dask]
... |
codereview_python_data_1431 | )
@click.option(
'--blotter',
- type=str,
default='default',
help="The blotter to use.",
show_default=True,
does this do anything?
)
@click.option(
'--blotter',
default='default',
help="The blotter to use.",
show_default=True, |
codereview_python_data_1457 | self._assert_ext_pkg_file_status(expected_to_be_present=False,
extension_version=extension_version)
- def test_ext_zip_file_packages_removed_in_updates_and_uninstall_case(self, *args):
test_data = WireProtocolData(DATA_FILE)
exthandlers_handler, pr... |
codereview_python_data_1461 | # Cell
class AzureMLCallback(Callback):
"Log losses, metrics, model architecture summary to AzureML"
def before_fit(self):
self.run = Run.get_context()
Add this line here to fix your smooth loss problem: ```python order = Recorder.order+1 ```
# Cell
class AzureMLCallback(Callback):
"Log lo... |
codereview_python_data_1467 | return f"{stack_name_part}-{resource_id_part}-{random_id_part}"
-def pre_create_default_name(key: str):
- def _pre_create_default_name(resource_id, resources, resource_type, func, stack_name):
resource = resources[resource_id]
props = resource["Properties"]
if not props.get(key):
nit... |
codereview_python_data_1468 | "Please Report this as a bug, and send in data file."
def _translate(self, options):
- """Translates a Nexus file (PRIVATE).""""
self.translate = {}
opts = CharBuffer(options)
while True:
There are four double-quotes at the end of that line, which is where this flake... |
codereview_python_data_1476 | <h1>Error 503 Backend is unhealthy</h1>
<p>Backend is unhealthy</p>
<h3>Guru Mediation:</h3>
- <p>Details: cache-sea4451-SEA 1645523409 3341744762</p>
<hr>
<p>Varnish cache server</p>
</body>
What is the abbreviation `sc`? Can we be a bit more verbose here so that it's more easy to read?... |
codereview_python_data_1483 | if double_stranded:
if seq_type == "protein":
- raise ValueError("double-stranded proteins await their discovery")
elif seq_type == "DNA":
seq = complement(seq, inplace=False) # TODO: remove inplace=False
elif seq_type == "RNA":
Funny, but perhaps a clearer erro... |
codereview_python_data_1490 | bboxes = squares[:, :4]
- if (self.ignore_iof_thr > 0) and (gt_bboxes_ignore is not None) and (
- gt_bboxes_ignore.numel() > 0 and bboxes.numel() > 0):
if self.ignore_wrt_candidates:
ignore_overlaps = bbox_overlaps(
bboxes, gt_bboxes_igno... |
codereview_python_data_1492 | id=record_id,
description=record_id,
annotations={
- "molecule_type": "protein",
"model": model.id,
"chain": chain.id,
"start": int(rnumbers[0]),
Same here. How do you know it's protein?
id=record_id,... |
codereview_python_data_1494 | if len(self.nlabel_dict) > 1:
self.nlabels_flag = True
- assert len(g) == n_nodes
# update statistics of graphs
self.n += n_nodes
It is better to use g.number_of_nodes() len(g) will be deprecated soon.
if len(self.... |
codereview_python_data_1500 | action="store_true",
help=_("enables dnf's obsoletes processing logic "
"for upgrade or display capabilities that "
- "the package obsoletes for repoquery, and info"))
... |
codereview_python_data_1508 | task, self._id, self._task_result_queue, reporter,
use_multiprocessing=bool(self.worker_processes > 1),
worker_timeout=self._config.timeout,
- check_unfulfilled_deps=self._config.check_unfulfilled_deps
)
def _purge_children(self):
Can you add a trailing c... |
codereview_python_data_1512 | setdiff,
shift,
sort,
- split_into_nhot_depr as split_into_nhot,
symdiff,
Type,
union,
@st-pasha After your changes, `split_into_nhot_depr` should be changed to `split_into_nhot_deprecated` here.
setdiff,
shift,
sort,
+ split_into_nhot_deprecated as split_into_nhot,
... |
codereview_python_data_1520 | builder.add('connect-src', 'self', quote=True)
builder.add('script-src', 'self', quote=True)
builder.add('script-src', 'scripts.test.tld')
- builder.add_sourceless('block-all-mixed-content')
self.assertEqual(
- str(builder), "block-all-mixed-content; connect-src 'self'; "
- "default... |
codereview_python_data_1521 | from Bio.Align import MultipleSeqAlignment
from Bio.SeqRecord import SeqRecord
-from Bio.codonalign.codonalphabet import default_codon_table, default_codon_alphabet, \
- compare_codon_alphabet
from Bio.codonalign.codonseq import _get_codon_list, CodonSeq, cal_dn_ds
from Bi... |
codereview_python_data_1524 | return 1
try:
- shellutil.run_command(['chcon', con, path])
except shellutil.CommandError as cmd_err:
return cmd_err.returncode
return 0
shellutil logs errors by default... we would need to log here to match the original code
... |
codereview_python_data_1531 | name='clusterfuzz',
version='0.0.1',
author='ClusterFuzz authors',
- author_email='clusterfuzz-announce@googlegroups.com',
description='ClusterFuzz',
long_description=long_description,
long_description_content_type='text/markdown',
should this be clusterfuzz-dev@ ?
name='clusterf... |
codereview_python_data_1534 | else:
ky = target_data.pop(key, None)
graph.add_edge(source, target, key=ky)
- graph[source][target][ky].update(target_data)
return graph
This `target_data` should be `tdata` I believe. Also, in this function, we copy the `tdata` dict just to `pop(id_)... |
codereview_python_data_1542 | from Bio import Alphabet
from Bio.Seq import Seq
-from Bio.SeqRecord import SeqRecord
from Bio.SeqIO.Interfaces import SequenceWriter
import struct
import sys
import re
If you are sorting alphabetically, it should be one line higher. See also #2715 when I removed the ``import sys`` and put the standard library i... |
codereview_python_data_1543 | continue
elif coding in [")", "}"]:
raise NexusError(
- 'Improper character "'
- + coding
- + '" at position '
- + pos
- + " of a coding sequence.... |
codereview_python_data_1549 | return cfg.total_epochs
-def get_final_results(log_json_path, epoch, RESULTS_LUT):
result_dict = dict()
with open(log_json_path, 'r') as f:
for line in f.readlines():
Should use lower case here for RESULTS_LUT.
return cfg.total_epochs
+def get_final_results(log_json_path, epoch, results_l... |
codereview_python_data_1554 | import threading
import os
from select import select, error as select_error
import subprocess
import time
import types
-import socket
from scapy.consts import DARWIN, FREEBSD, OPENBSD, WINDOWS
from scapy.compat import plain_str
from scapy.data import ETH_P_ALL, MTU
Also please move it to its right alphabetica... |
codereview_python_data_1557 | # Value should be of WellRecord type
if not isinstance(obj, WellRecord):
raise ValueError(
- "A WellRecord type object is needed as value" + " (got %s)" % type(obj)
)
def __getitem__(self, index):
We can remove the plus and combine these strings. (The ori... |
codereview_python_data_1559 | _url_re = re.compile(r'''https?://(?:www\.)?teamliquid\.net/video/streams/''')
-_afreecaRe = re.compile('View on Afreeca')
-_twitchRe = re.compile('View on Twitch.tv')
class Teamliquid(Plugin):
Rather than searching for the specific strings `View on Afreeca` or `View on Twitch.tv` you might be better searching for a... |
codereview_python_data_1569 | -from ..geometry import bbox_overlaps
from .registry import IOU_CALCULATOR
There is only one method in `geometry.py`. We may consider moving it to this file.
+import torch
+
from .registry import IOU_CALCULATOR |
codereview_python_data_1575 | stds = deltas.new_tensor(stds).unsqueeze(0)
deltas = deltas.sub_(means).div_(stds)
- return deltas.cuda()
def delta2bbox(rois,
Is this still necessary?
stds = deltas.new_tensor(stds).unsqueeze(0)
deltas = deltas.sub_(means).div_(stds)
+ return deltas
def delta2bbox(rois, |
codereview_python_data_1580 | cmdline.annot = self.annotation_outfile
self.assertEqual(
str(cmdline),
- probcons_exe + " -c 4 -ir 222 -pre 1 -annot Fasta/probcons_annot.out"
- " -a Fasta/fa01",
)
stdout, stderr = cmdline()
self.assertTrue(stderr.startswith("\nPROBCONS")... |
codereview_python_data_1581 | def train(self, mode=True):
super(ResNet, self).train(mode)
if mode and self.norm_eval:
- for mod in self.modules():
# trick: eval have effect on BatchNorm only
- if isinstance(self, nn.BatchNorm2d):
- mod.eval()
If we set eval mode i... |
codereview_python_data_1584 | import hive_metastore.ttypes
partition_str = self.partition_spec(partition)
thrift_table = client.get_partition_by_name(database, table, partition_str)
- except hive_metastore.ttypes.NoSuchObjectException as e:
return ''
... |
codereview_python_data_1585 | from Queue import Queue
-from anytree import Node
from anytree import RenderTree
from anytree import AsciiStyle
from anytree import node
nit: ``` import anytree as at ``` and use at.Node, at.RenderTree, etc.
from Queue import Queue
from anytree import RenderTree
from anytree import AsciiStyle
from anytree imp... |
codereview_python_data_1586 | @classmethod
def materialize(cls, future):
"""
- Materialize data matching ``future`` object.
Parameters
----------
```suggestion Materialize data matching `future` object. ``` numpydoc says reference parameters with single backicks
@classmethod
def materialize(cl... |
codereview_python_data_1601 | return ParseResult(cmd=None, args=None, cmdline=cmdline)
args = self._split_args(cmd, argstr, keep)
- args = [x.strip().lstrip(':').strip() if x is not ':' and x is not ' '
else x for x in args]
if keep and args:
cmdline = [cmdstr, sep + args[0]] + arg... |
codereview_python_data_1602 | # Issue warning if pdb_file is given
if pdb_file is not None:
warnings.warn(
- "ResidueDepth no longer requires a pdb file. "
- "This argument will be removed in a future release "
- "of Biopython.",
BiopythonDeprecationWarning... |
codereview_python_data_1605 | Number of days of daily returns to use for the regression.
allowed_missing_percentage : float, optional
Percentage of returns observations that are allowed to be missing when
- calculating betas. Default is 25%.
"""
window_safe = True
dtype = float64_dtype
I couldn't find a... |
codereview_python_data_1606 | raise cmdexc.CommandError("Quickmark '{}' not found!".format(name))
@cmdutils.register(instance='command-dispatcher', scope='window')
- @cmdutils.argument('toggle', flag='t')
def bookmark_add(self, url=None, title=None, toggle=False):
"""Save the current page as a bookmark, or a speci... |
codereview_python_data_1609 | Return
------
modin.DataFrame or pandas.DataFrame [and list of groupby columns names if
- columns for groupby were be generated]
"""
assert not (
(groupby_ncols is None) ^ (count_groups is None)
```suggestion modin.DataFrame or pandas.DataFrame [and list of groupby columns name... |
codereview_python_data_1610 | def test_delete_non_existent_policy_returns_no_such_entity(self):
non_existent_policy_arn = "arn:aws:iam::000000000000:policy/non-existent-policy"
- try:
- self.iam_client.delete_policy(PolicyArn=non_existent_policy_arn)
- except ClientError as e:
- self.assertEqual("No... |
codereview_python_data_1611 | if weight is not None:
if weight.shape != loss.shape:
if weight.size(0) == loss.size(0):
- # weight does not have num_class dim
weight = weight.view(-1, 1)
else:
- # weight is flattened while loss is not
assert weigh... |
codereview_python_data_1614 | title_obj = None
title = self._format_title(key)
if self.show_title and len(self.coords) > 1 and title:
- title_obj = self.handles['fig'].suptitle(title, **self._fontsize('title'),
- y=self.suptitle_y)
self.handles['t... |
codereview_python_data_1617 | from bigchaindb.models import Transaction
# create blocks with transactions for `USER` to spend
print('Fuck you')
- for height in range(1,4):
transactions = [
Transaction.create(
[alice_pubkey(alice)],
I think we should remove this.
from bigchaindb.models ... |
codereview_python_data_1621 | ]
else:
alternate_services_violations = []
- print 'XXX: Has violation? %r / %r / %r' % (iap_resource.iap_enabled,
- self.allowed_direct_access_sources,
- iap_resource.direct_a... |
codereview_python_data_1625 | return result
-def exit_if_exception(result):
"""
If "result" is an exception then raise the "result".
Unless "result" is an exception then return the "result".
It will be better just to re-raise the exception 'result' rather than to abort with `exit` call. Correspondingly, the function `exit_if_ex... |
codereview_python_data_1626 | atoms (altloc) as a tie-breaker.
"""
- self.child_list.sort
def flag_disordered(self):
"""Set the disordered flag."""
Should that not be ``self.child_list.sort()`` for an in-place sorting of the list?
atoms (altloc) as a tie-breaker.
"""
+ self.child_lis... |
codereview_python_data_1627 | restutil.http_get("http://foo.bar", retry_delay=retry_delay_in_sec, max_retry=max_retry)
duration = datetime.utcnow() - start_time
- self.assertEqual(max_retry, mock_resp.call_count, "Did not Retry the required amount of time")
upper_bound = timedelta(second... |
codereview_python_data_1628 | assert not message_mock.messages
assert qutescheme.spawn_output == expected
assert proc.exit_status() == QProcess.NormalExit
- assert proc.final_stdout().strip() == "test", proc.final_stdout()
- assert proc.final_stderr().strip() == "", proc.final_stderr()
def test_start_verbose(proc, qtbot, messa... |
codereview_python_data_1632 | def get_result(self):
"""Get the result of minimization."""
# Done with minimization, output log one more time
- self._report_progress(True)
if not self.minimizer.tokenize:
return self.get_required_tokens()
return str(self)
Nit: explicit parameter_name=True here.
def get_result(sel... |
codereview_python_data_1638 | SUBSCRIBER_NAME = "bq"
KEYSPACE_NAME_INCOMING = "ilisten"
KEYSPACE_NAME_UNIQUE = "ulisten"
-APP_CREDENTIALS_FILE = os.environ['GOOGLE_APPLICATION_CREDENTIALS']
# TODO:
# Big query hardcoded data set ids
will this fail if the env variable doesn't exist? Is this the preferred behaviour?
SUBSCRIBER_NAME = "bq"
... |
codereview_python_data_1652 | -# This code is part of the Biopython distribution and governed by its
-# license. Please see the LICENSE file that should have been included
-# as part of this package.
"""Tests for online functionality of EBI Search module."""
Missing copyright statement with author names.
+# Copyright 2017 by Berenice Batut (ber... |
codereview_python_data_1663 | def __getitem__(self, n):
if isinstance(n, slice):
raise nx.NetworkXError(
- f"{type(self).__name__} does not support slicing, try list(G.nodes)[{n}]"
)
return self._nodes[n]
I went with `{n.start}:{n.stop}` as IMO the target users for this error may not ... |
codereview_python_data_1664 | stockrecord. The price_incl_tax is quantized to two decimal places.
Rounding behaviour is Decimal's default
"""
- rate = D('0.20')
exponent = D('0.01') # Default to two decimal places
def pricing_policy(self, product, stockrecord):
Rate is country specific and should be moved inside UK st... |
codereview_python_data_1666 | #@subsitute: tempita
[requires tempita substitution
- - context can't be specified here though
- only necessary when @required from non-tempita code]
for prototypes and implementation respectively. For non-python or
Then, where does it get the substitution context/variables fr... |
codereview_python_data_1682 | self.buffer = self.buffer[1:]
def next_until(self, target):
- """Keep iterating the NEXUS file until it reaches a target character.
-
- Returns the word found in the NEXUS file.
- """
for t in target:
try:
pos = self.buffer.index(t)
This wor... |
codereview_python_data_1683 | service_name = "{0}.service".format(name).lower()
if CGroups.enabled() and not CGroupsTelemetry.is_tracked(service_name):
cgroup = CGroups.for_systemd_service(service_name)
tracker = CGroupsTelemetry(service_name, cgroup=cgroup)
CGroupsTelemetry._tracked[service_... |
codereview_python_data_1688 | def init_stylesheet(self, css_file="green.css"):
"""Initialize the stylesheet with a provided css file."""
- css_path = str(pathlib.Path(__file__).parent / css_file)
- self.config_stub.val.content.user_stylesheets = css_path
def set_css(self, css):
"""Set document style to `css... |
codereview_python_data_1694 | cb = functools.partial(
get_path_output_or_null,
env=env,
- no_find_output=True,
path_id=path_id,
aspect=aspect)
Let's name this `disable_output_fusion` or something like that.
cb = functools.partial(
get_path_output_or_null... |
codereview_python_data_1696 | if not self.serialized_fuzz_target:
return None
- fuzz_target = data_types.FuzzTarget()
- fuzz_target.engine = self.serialized_fuzz_target['engine']
- fuzz_target.project = self.serialized_fuzz_target['project']
- fuzz_target.binary = self.serialized_fuzz_target['binary']
return fuzz_target... |
codereview_python_data_1698 | cmake_cmd.append("-DOpenCL_LIBRARY={0}".format(opencl_library))
elif use_cuda:
cmake_cmd.append("-DUSE_CUDA=ON")
- if openmp_include_dir:
- cmake_cmd.append("-DOpenMP_INCLUDE_DIR={0}".format(openmp_include_dir))
- if openmp_library:
- cmake_cmd.append("-DOp... |
codereview_python_data_1709 | package, alt_package = package
try:
locals()[package] = __import__(alt_package)
- except (ImportError, SyntaxError):
locals()[package] = __import__(package)
else:
locals()[package] = __import__(package)
we need to be *extremely* careful about touching th... |
codereview_python_data_1710 | def __truediv__(self, other):
pass
- def abs(self):
pass
def conjugate(self):
This can also be overloaded as `__abs__`.
def __truediv__(self, other):
pass
+ def __abs__(self):
pass
def conjugate(self): |
codereview_python_data_1721 | return ContainerInfo(container_name, entry_point)
- def get_host_path_for_path_in_docker(self, path):
- return re.sub(r'^%s/(.*)$' % config.TMP_FOLDER,
- r'%s/\1' % config.HOST_TMP_FOLDER, path)
-
def destroy_docker_container(self, func_arn):
"""
Stops ... |
codereview_python_data_1728 | SettingValue(typ.Bool(), 'false'),
"Hide the tabbar if only one tab is open."),
- ('perm-hide',
SettingValue(typ.Bool(), 'false'),
- "Hide permanently."),
('wrap',
SettingValue(typ.Bool(), 'true'),
I think `perm-` is a bit confusing. I'd prefer `always-hi... |
codereview_python_data_1739 | def send_notifications(method, bucket_name, object_path, version_id):
- bucket_name = normalize_bucket_name(bucket_name)
for bucket, notifs in S3_NOTIFICATIONS.items():
- if bucket.lower() == bucket_name.lower():
action = {'PUT': 'ObjectCreated', 'POST': 'ObjectCreated', 'DELETE': 'ObjectRe... |
codereview_python_data_1741 | loss_cls = build_loss(loss_cls_cfg)
assert torch.allclose(loss_cls(fake_pred, fake_label), torch.tensor(200.))
- # test bce_loss
- cls_score = torch.Tensor([[-200, 100], [500, -1000], [300, -300]])
- label = torch.Tensor([0, 1, 0]).long()
- weight = torch.Tensor([0.6, 0.4, 0.5])
- class_weight ... |
codereview_python_data_1748 | ),
'output_filename': 'js/machinery.min.js',
},
- 'in_context': {
- 'source_filenames': (
- 'js/jquery-1.11.1.min.js',
- 'js/bootstrap.min.js',
- 'js/cbpAnimatedHeader.min.js',
- 'js/agency.js',
- ),
- 'output_filename': 'js/in_c... |
codereview_python_data_1749 | nonliteral_other.append(arg)
else:
arg.default = DefaultLiteralArgNode(arg.pos, arg.default)
- if arg.type.is_pyobject or arg.type.is_numeric:
if arg.kw_only:
default_kwargs.append(arg... |
codereview_python_data_1750 | def _read_pfm_four_columns(handle):
- """Read motifs in Cluster Buster position frequency matrix format from a file handle.
- #cisbp
Pos A C G T
1 0.00961538461538462 0.00961538461538462 0.00961538461538462 0.971153846153846
2 0.00961538461538462 0.00961538461538462 0.00961538461538462 0... |
codereview_python_data_1756 | evts = self.phyloxml.phylogenies[4].clade.events
# Container behavior: __len__, __contains__
self.assertEqual(len(evts), 1)
- self.assertTrue("speciations" in evts)
- self.assertFalse("duplications" in evts)
# Attribute access: __get/set/delitem__
self.assertEq... |
codereview_python_data_1763 | )
return usd_price
except (RemoteError, DeserializationError) as e:
- msg = f'Could not find price for {asset}. {str(e)}'
if instance._ethereum is not None:
instance._ethereum.msg_aggregator.add_warning(msg)
- ... |
codereview_python_data_1777 | class ZigbeeClusterLibrary(Packet):
name = "Zigbee Cluster Library (ZCL) Frame"
fields_desc = [
# Frame control (8 bits)
BitField("reserved", 0, 3),
Could you add a ```python deprecated_fields = { "direction": ("command_direction", "2.5.0"), } ``` before the `fields_desc` to account for de... |
codereview_python_data_1781 | sym_g.ndata[key] = g.ndata[key]
g = sym_g
- profiler = Profiler()
- profiler.start()
dgl.distributed.partition_graph(g, args.dataset, args.num_parts, 'data',
part_method=args.part_method,
balance_ntypes=balance_nt... |
codereview_python_data_1782 | # Adjust data
adj_cols = ['open', 'high', 'low', 'close']
for ticker in panel.items:
- ratio = (panel[ticker]['price'] / panel[ticker]['close']).values
for col in adj_cols:
- panel[ticker][col] *= ratio
return panel
Could a stock on the way to delisting have a close price... |
codereview_python_data_1785 | @utils.benchmark('time', timeout=1200)
@utils.parametrize_cpu('graph_name', ['cora', 'livejournal', 'friendster'])
@utils.parametrize_gpu('graph_name', ['cora', 'livejournal'])
-@utils.parametrize('format', ['csr']) # csr/csc is not supported
@utils.parametrize('fraction', [0.01, 0.1])
@utils.parametrize('return_... |
codereview_python_data_1787 | def _apply():
if "apply_state" in self._optimizer._sparse_apply_args:
train_op = self._optimizer._resource_apply_sparse(
- accum_gradient.read_value(),
var,
indices,
apply_state=apply_state,
... |
codereview_python_data_1789 | pipeline = Pipeline.current()
if pipeline.exec_async or pipeline.exec_pipelined:
raise RuntimeError("PythonFunction can be used only in pipelines with `exec_async` and "
- "`exec_pipelined` specified to False.")
if (len(inputs) > self._schema.MaxNumI... |
codereview_python_data_1791 | message_func='default',
reduce_func='default',
apply_node_func='default'):
- """Functional method for ``dgl.DGLGraph.prop_nodes``.
Parameters
----------
Same as above for default arguments or docstrings
message_func='default',
... |
codereview_python_data_1794 | def __init__(self, tab, qtbot, config_stub):
self.tab = tab
self.qtbot = qtbot
- loader = jinja2.FileSystemLoader(pathlib.Path(__file__).parent)
self._jinja_env = jinja2.Environment(loader=loader, autoescape=True)
# Make sure error logging via JS fails tests
conf... |
codereview_python_data_1796 | @property
def current_key(self):
"""Returns the current key value."""
- return getattr(self, '_current_key', None)
def _stream_parameters(self):
return util.stream_parameters(
I think I would prefer you declare `self._current_key=None` in the constructor and just return `self._c... |
codereview_python_data_1800 | if not environment.is_engine_fuzzer_job():
return None
if not fuzz_targets:
logs.log_error('No fuzz targets found. Unable to pick random one.')
return None
- fuzz_targets = list(fuzz_targets)
environment.set_value('FUZZ_TARGET_COUNT', len(fuzz_targets))
fuzz_target = fuzzer_selection.select_... |
codereview_python_data_1803 | ProjectFiles(locale_code, [self.parsed_configuration]),
)
- def l10n_path(self, locale, absolute_resource_path):
"""
Return l10n path for the given locale and reference path.
"""
project_files = self.get_or_set_project_files(locale.code)
- reference_pa... |
codereview_python_data_1804 | def test_fuchsia_asan(self):
"""Test for Fuchsia ASan crashes."""
data = self._read_test_data('fuchsia_asan.txt')
expected_type = 'Heap-buffer-overflow\nWRITE 1'
expected_state = 'foo_function\nfoo_function\nbar_function\n'
as discussed, we need to fix this duplicated frame appearing in the stac... |
codereview_python_data_1813 | def _init_write_request_validator(self):
constraint_serializer = ConstraintsSerializer(domain_state_serializer)
config_state = self.states[CONFIG_LEDGER_ID]
- self.add_auth_rules_to_config_state(state=config_state,
- auth_map=auth_map,
- ... |
codereview_python_data_1815 | return self.retrieve(ram['planners'], self.unique)
else:
existing.update('stopping_conditions', self.stopping_conditions)
- existing.update('module', self.module)
- existing.update('description', self.description)
existing.update('params', self.param... |
codereview_python_data_1837 | from plenum.common.util import get_utc_epoch
from plenum.test.helper import sdk_send_and_check, sdk_sign_request_from_dict
from indy_common.constants import REVOC_REG_DEF_ID, VALUE, FROM, TO, ISSUED, \
- REVOKED, PREV_ACCUM, ACCUM, STATE_PROOF_FROM
from plenum.common.constants import TXN_TIME, DATA
from plenum.... |
codereview_python_data_1841 | results['scale'],
interpolation='nearest',
backend=self.backend)
- results['gt_semantic_seg'] = gt_seg
results[key] = gt_seg
def __call__(self, results):
should we rm line 269?
results['scale'],
... |
codereview_python_data_1843 | consumer_to_locate = find_consumer(consumer_arn, consumer_name, stream_arn)
if(not consumer_to_locate):
- error_msg = 'Consumer %s not found.' % consumer_arn or consumer_name
return simple_error_response(error_msg, 400, 'ResourceNotFoundException')
nit: I guess... |
codereview_python_data_1846 | runnable_scanners = scanner_builder.ScannerBuilder(
global_configs, scanner_configs, service_config, model_name,
- model_name).build()
# pylint: disable=bare-except
for scanner in runnable_scanners:
This model_name should not be repeated.
runnable_scanners = scanner_builder.Scanner... |
codereview_python_data_1847 | def order_processes(delays, args_for_script):
- processed_delays = []
processes_dictionary = {}
- for delay in delays:
- if delay in processed_delays:
- continue
- else:
- processed_delays.append(delay)
delays_indices = [i for i, e in enumerate(delays) if e == de... |
codereview_python_data_1849 | "Fill a remotely allocated dict with values from the Cython C stack"
cython_func = self.get_cython_function()
- if sys.version_info[0] == 2:
- iterator = cython_func.locals.iteritems()
- else:
- iterator = cython_func.locals.items()
- for name, cyvar in itera... |
codereview_python_data_1861 | import azurelinuxagent.common.logger as logger
"""
-Data contract between guest and host
"""
"Base class for data contracts between guest and host and utilities to manipulate the properties in those contracts"
import azurelinuxagent.common.logger as logger
"""
+Base class for data contracts between guest and hos... |
codereview_python_data_1866 | class GNNBenchmarkDataset(DGLBuiltinDataset):
- r"""Base Class for GNN Benchmark dataset from https://github.com/shchur/gnn-benchmark#datasets"""
- _url = None
def __init__(self, name, force_reload=False):
_url = _get_dgl_url('dataset/' + name + '.zip')
super(GNNBenchmarkDataset, self).__i... |
codereview_python_data_1869 | match = re.search(pattern, new_line.decode('utf-8'))
if match:
self.set_tracking_url(
- self.logs_output_pattern_to_url(match.group(1))
)
else:
sleep(time_to_sleep... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.