id stringlengths 24 28 | content stringlengths 121 2.08k |
|---|---|
codereview_python_data_7387 | from plaso.lib import errors
# pylint: disable=missing-type-doc,missing-return-type-doc,missing-return-doc
class Token(object):
Please make these local overrides instead of overrides for the whole module (repeat every else)
from plaso.lib import errors
# pylint: disable=missing-type-doc,missing-return-type-doc,m... |
codereview_python_data_7392 | def convert_pos_from_native(self, x, inplace=True):
"""Conversion of coordinate array x from native units to base units.
- Keywords
- --------
- inplace : bool
Whether to modify the array inplace, overwriting previous data
Note
This is also not the correct numpy-s... |
codereview_python_data_7394 | <h1>Error 503 Backend is unhealthy</h1>
<p>Backend is unhealthy</p>
<h3>Guru Mediation:</h3>
- <p>Details: cache-sea4450-SEA 1645543193 1543471933</p>
<hr>
<p>Varnish cache server</p>
</body>
I think the module name "mapping" is confusing, given the number of mappings we have now.
... |
codereview_python_data_7406 | # See the License for the specific language governing permissions and
# limitations under the License.
-"""Forseti installer CLI config object"""
from config import Config
from ..util.constants import TEMPLATE_TYPE_CLIENT
class ClientConfig(Config):
- """Forseti installer CLI config object"""
def __init__(... |
codereview_python_data_7407 | def follow_vk_redirect(cls, url):
# If this is a 'videos' catalog URL with an video ID in the GET request, get that instead
parsed_url = urlparse(url)
- if parsed_url.path.startswith('/video'):
query = {v[0]: v[1] for v in [q.split('=') for q in parsed_url.query.split('&')] if... |
codereview_python_data_7409 | cmd.cli.demands = copy.deepcopy(self.cli.demands)
cmd.configure()
cmd.run()
- except Exception as e:
logger.error(_("Error:") + " " + e.value)
except:
return
no need for another exce... |
codereview_python_data_7415 | out_shape,
inds,
device='cpu',
- interpolation='bilinear', rounded=True):
"""See :func:`BaseInstanceMasks.crop_and_resize`."""
if len(self.masks) == 0:
empty_masks = np.empty((0, *out_shape),... |
codereview_python_data_7420 | for atom in atom_list:
x, y, z = atom.coord
radius = _get_atom_radius(atom, rtype="united")
- print(
- "{:6.3f}\t{:6.3f}\t{:6.3f}\t{:1.2f}".format(x, y, z, radius),
- file=pdb_to_xyzr,
)
# make surface
I'd be tempted to switc... |
codereview_python_data_7423 | assert(pipe.epoch_size("caffe_reader") != 0)
assert(pipe.epoch_size("caffe2_reader") != 0)
assert(pipe.epoch_size("file_reader") != 0)
- assert(len(pipe.epoch_size()) == 4)
\ No newline at end of file
missing empty line
assert(pipe.epoch_size("caffe_reader") != 0)
assert(pipe.epoch_size("c... |
codereview_python_data_7427 | # -*- coding: utf-8 -*-
-"""Parser for bash history files."""
import io
import re
```suggestion """Parser for fish history files.""" ```
# -*- coding: utf-8 -*-
+"""Parser for fish history files."""
import io
import re |
codereview_python_data_7432 | Args:
s: The string to evaluate.
- file: Interpret s as a path to file also implies --quiete.
quiet: Don't show the output in a new tab.
"""
if file:
Please add a comma before "also", and quiete -> quiet.
Args:
s: The string to evaluate.
+ file: Interpret s... |
codereview_python_data_7438 | def get_s3(region=None):
- """Get a Boto 3 S3 resource with a specific Region or with your default Region."""
return boto3.resource('s3', region_name=region) if region else boto3.resource('s3')
**Amazon** S3 resource...**AWS** Region...
def get_s3(region=None):
+ """
+ Get a Boto 3 Amazon S3 resource... |
codereview_python_data_7444 | if not conv:
raise configexc.ValidationError(
value,
- '{} not in {}'.format(kind, list(converters.keys())))
if len(kind) != len(vals):
raise configexc.ValidationError(
dict keys are unordered in Python 3.5, so the erro... |
codereview_python_data_7450 | """
def wrapped_cmd(*args, **kwargs):
- filename = "/".join([filedir, "status", "{0}.status".format(wrapped_cmd.inc)])
fileutil.write_file(filename, msg)
# Every time enable is called, the agent looks for the next status file
os.path.join with os.path.sep instead ... |
codereview_python_data_7451 | summary='Create a new objective',
description='Create a new objective using the format provided in the `ObjectiveSchema`.')
@aiohttp_apispec.request_schema(ObjectiveSchema)
- @aiohttp_apispec.response_schema(ObjectiveSchema)
async def create_objective(s... |
codereview_python_data_7455 | return MissingProductImage()
def get_all_images(self):
- if self.is_child and not self.images.exists() and self.parent is not None:
return self.parent.images.all()
return self.images.all()
`and not self.parent_id` avoids another query.
return MissingProductImage()
... |
codereview_python_data_7462 | code.putln("#endif")
code.putln("")
- code.putln("#if CYTHON_COMPILING_IN_LIMITED_API")
- code.putln("static void %s_free(void *m) {" % Naming.module_cname)
- code.putln(" %s_clear(m);" % Naming.module_cname)
- code.putln("}")
- code.putln("#endif")
code.pu... |
codereview_python_data_7464 | AgentTestCase.tearDown(self)
def _create_dummy_archive(self, size=1024):
- with open(self.archive_path, "wb") as f:
f.truncate(size)
def test_it_should_invoke_all_periodic_operations(self):
I'm worried about the scope of this mock; if any other code branches happen to call `os.pa... |
codereview_python_data_7469 | def worker(start_method, sock, task_queue, res_queue, worker_cb, worker_params):
if start_method == "spawn":
- init_queue(sock, task_queue)
- init_queue(sock, res_queue)
sock.close()
while True:
if worker_cb(task_queue, res_queue, **worker_params) is None:
I tried to follow w... |
codereview_python_data_7475 | result = self.test(*args, **kwargs)
finish = benchmark_time()
internal_draw_time = sum(data.draw_times[initial_draws:])
- runtime = datetime.timedelta(microseconds=((finish - start - internal_draw_time) * 1000000))
self.__test_runtime = ... |
codereview_python_data_7477 | ``cumulated_variance``. The value at the ith index of `cumulated_variance`
is the sum of the variances from 0 to i.
- >>> n_pcs = np.where(PSF_pca.cumulated_varance > 0.95)[0][0]
>>> atomgroup = u.select_atoms('backbone')
>>> pca_space = PSF_pca.transform(atomgroup, n_components=n_pcs)
Is it really "var... |
codereview_python_data_7480 | applies_to = {}
for applies_dict in rule_def.get('applies_to'):
resource_type = applies_dict['type']
if resource_type not in SUPPORTED_LOCATION_RESOURCE_TYPES:
Can we make this backward compatible? e.g. if 'resource_ids' is not defined then we can use '*' as the default valu... |
codereview_python_data_7481 | Processes a list of streams promoting Parameterized objects and
methods to Param based streams.
"""
- parameterizeds = defaultdict(list)
valid, invalid = [], []
for s in streams:
if isinstance(s, Stream):
What would be the effect of simply ignoring the e... |
codereview_python_data_7491 | return
self.temp_code = code.funcstate.allocate_temp(
type, manage_ref=self.use_managed_ref)
-
- if self.type.is_cpp_class:
- code.globalstate.use_utility_code(
- UtilityCode.load_cached("MoveIfSupported", "CppSupport.cpp"))
... |
codereview_python_data_7493 | + _base_doc[_base_doc.find('verbose :'):])
# DaskLGBMClassifier support for callbacks and init_model is not tested
- fit.__doc__ = (
- f"{_base_doc[:_base_doc.find('callbacks :')]} **kwargs\n {' ' * 12} 'Other parameters passed through to ``LGBMClassifier.fit()``.\n'"
- )
def pr... |
codereview_python_data_7498 | and ref.nullable
and typemod == ql_ft.TypeModifier.SingletonType
):
- raise RuntimeError(
'operations on potentially empty arguments not supported in '
'simple expressions')
return args
Is this a temporary assertion? If not, then this... |
codereview_python_data_7527 | if not resource['should_notify']:
LOGGER.debug('Not notifying for: %s', resource['resource'])
continue
- if notifier_configs.get('email_connector_config'):
notifiers.append(email_violations.EmailViolations(
... |
codereview_python_data_7536 | results = []
# Find all dashboard names that contain each of our query terms as a substring
- for dashboard in Dashboard.objects.values('name').order_by('name'):
- name = dashboard['name'].lower()
if name.startswith('temporary-'):
continue
You could even do ```python for name in Dashboard.objects... |
codereview_python_data_7540 | """Return a list of all the edges with this label."""
if label not in self._label_map:
raise ValueError("Unknown label: " + str(label))
- return list(self._label_map[label])
def labels(self):
"""Return a list of all the edge labels in this graph."""
Are you sure abou... |
codereview_python_data_7542 | assert_equal_branchings(x, x_)
-def test_edge_attribute_preservation():
# Test that edge attributes are preserved when finding an optimum graph
- # using the Edmonds class. Check this for both normal and multigraphs
G = nx.Graph()
edgelist = [(0, 1, [('weight', 5), ('otherattr', 1), ('otherattr2'... |
codereview_python_data_7543 | def cond_check(pkg):
if not pkg.requires:
return True
- return self.sack.query().installed().filter(name=pkg.requires) or \
pkg.requires in (pkg.name for pkg in self._goal._installs) or \
pkg.requires in [pkg.name for pkg in trans.insta... |
codereview_python_data_7551 | if returntype == "numpy":
adj = np.full((len(coord), len(coord)), False, dtype=bool)
pairs = capped_distance(coord, coord, max_cutoff=cutoff, box=box, return_distances=False)
-
- for x, y in pairs:
- adj[x][y]=True
return adj
elif returntype == "sparse":
#... |
codereview_python_data_7553 | tparams = Params(alpha = 1, beta = 2, lambda1 = 3, lambda2 = 4, d = 5,
n_epochs = 6, inter = True)
-tmodel = dt.Frame([[random.random()] * tparams.d,
- [random.random()] * tparams.d],
names=['z', 'n'])
default_params = Params(alpha = 0.005, beta = 1, lambda1... |
codereview_python_data_7560 | Return:
True if there was a change, False otherwise.
"""
- if policy is usertypes.UNSET:
return False
old_value = self._settings.unknownUrlSchemePolicy()
policy = self._UNKNOWN_URL_SCHEME_POLICY[policy]
I'm pretty sure this handling is incorrect - wh... |
codereview_python_data_7563 | val_idx = train_idx
# calculate norm for each edge type and store in edge
- for canonical_etypes in hg.canonical_etypes:
- u, v, eid = hg.all_edges(form='all', etype=canonical_etypes)
_, inverse_index, count = torch.unique(v, return_inverse=True, return_counts=True)
degrees = c... |
codereview_python_data_7566 | nx.write_gexf(G,fh)
fh.seek(0)
H=nx.read_gexf(fh,node_type=int)
- assert_true(H.node[1]['testattr'], True)
Should be only one argument to assert_true()...
nx.write_gexf(G,fh)
fh.seek(0)
H=nx.read_gexf(fh,node_type=int)
+ assert_equal(H.node[1]['testa... |
codereview_python_data_7567 | event_data.http_response_bytes = self._GetValueFromStructure(
structure, 'response_bytes')
- if key in ['combined_log_format', 'vhost_combined_log_format']:
event_data.http_request_referer = self._GetValueFromStructure(
structure, 'referer')
event_data.http_request_user_agent =... |
codereview_python_data_7579 | name = "SCI"
fields_desc = [
- MACField("system_identifier", "00:00:00:00:00:00"),
ShortField("port_identifier", 0)
]
Maybe you could use `SourceMACField("system_identifier")` to get a "default value that works"?
name = "SCI"
fields_desc = [
+ SourceMACField("system_ide... |
codereview_python_data_7583 | from io import StringIO
from collections import defaultdict
-from importlib import reload
from numpy.testing import (
assert_equal, assert_array_equal,)
Why do we need `reload`? This is very unusual and I'd not rather have it unless absolutely necessary. It is not explicitly used so should be removed.
from i... |
codereview_python_data_7585 | ConditionalField(IP6Field("ipv6_address", '::1'),
lambda pkt: pkt.length == 16)]
class IE_MSInternationalNumber(IE_Base):
name = "MS International Number"
Do you think it's cleaner to have the IPv4 and IPv6 fields named separately, or both under `address` ... |
codereview_python_data_7586 | the ``img_scale``.
Returns:
- tuple[int]: Image scale sampled
- None: Placeholder, to be consistent with :func:`random_select`.
"""
assert isinstance(img_scale, tuple) and len(img_scale) == 2
```python Returns: (tuple[int], None): xxx ```
... |
codereview_python_data_7591 | weights_groupselections : False or list of {"mass", ``None`` or array_like} (optional)
1. ``False`` will apply imposed weights to `groupselections` from
- ``weights`` option if `weights` is not iterable. Otherwise will assume
- a list of length equal to length of `groupsel... |
codereview_python_data_7601 | import torch.nn.functional as F
import argparse
from sklearn.metrics import f1_score
-from train import GAT
from dgl.data.ppi import PPIDataset
from torch.utils.data import DataLoader
Put `GAT` in `gat.py`. Let `train.py` and `train_ppi.py` import from it.
import torch.nn.functional as F
import argparse
from ... |
codereview_python_data_7604 | class Node(object):
- """A node in the Scop hierarchy
sunid -- SCOP unique identifiers. e.g. '14986'
Since you'll have to edit this file again anyway, you might as well add the trailing full stop here too.
class Node(object):
+ """A node in the Scop hierarchy.
sunid -- SCOP unique identifiers. e.g... |
codereview_python_data_7611 | :return: True if the recycling process should be run; otherwise, False.
:rtype: bool
"""
- if inventory.items().get_space_left() < (DEFAULT_MIN_EMPTY_SPACE if self.min_empty_space is None else self.min_empty_space):
return True
return False
Good job on reverting ... |
codereview_python_data_7613 | for (root, dir_names, files) in os.walk(path):
if dir_names:
partitioned_columns.add(dir_names[0].split("=")[0])
partitioned_columns = list(partitioned_columns)
else:
directory = False
We shouldn't have to continue searching for part... |
codereview_python_data_7614 | def with_mask(self):
return hasattr(self, 'mask_head') and self.mask_head is not None
- @property
- def with_mask_iou(self):
- return hasattr(self,
- 'mask_iou_head') and self.mask_iou_head is not None
-
@abstractmethod
def extract_feat(self, imgs):
pa... |
codereview_python_data_7615 | def test_run_missing_binding(self):
q = sql.Query('SELECT :answer')
- with pytest.raises(sql.SqlError, match='Missing bound values!'):
q.run()
def test_run_batch(self):
I don't feel like this test properly tests whether the method under test works properly. Like it needs a test c... |
codereview_python_data_7621 | title = 'requests'
version = '2.14.2'
build = 0x021402
It looks like the file may need `# -*- coding: utf-8 -*-` at the top for Python 2 because of this line.
+# -*- coding: utf-8 -*-
title = 'requests'
version = '2.14.2'
build = 0x021402 |
codereview_python_data_7626 | def analyse(self, env, nonempty=0, is_self_arg=False):
- self.base_type.is_self_arg = self.is_self_arg = is_self_arg
if self.type is not None:
return self.name_declarator, self.type
Can we keep the `if` test? Given the default class attributes, it doesn't seem necessary to always set ... |
codereview_python_data_7636 | expand = param.Boolean(default=True, doc="""
Whether the x_range and y_range should be allowed to expand
- beyond the extent of the data.""")
height = param.Integer(default=400, doc="""
The height of the aggregated image in pixels.""")
Maybe this docstring could be, ahem, expanded, with... |
codereview_python_data_7643 | # map up to original set of anchors
if unmap_outputs:
num_total_anchors = flat_anchors.size(0)
- labels = unmap(labels, num_total_anchors, inside_flags,
- self.num_classes) # fill bg label
label_weights = unmap(label_weights, num_total_an... |
codereview_python_data_7644 | return redirect('pontoon.teams.team', locale=user.profile.custom_homepage)
# Guess user's team page or redirect to /teams
- locale = get_project_locale_from_request(request, Locale.objects.available())
if locale not in ('en-US', 'en', None):
start_url = reverse('pontoon.teams.team', k... |
codereview_python_data_7654 | parent: QWidget = None) -> None:
super().__init__(parent)
self.pattern = None # type: typing.Optional[str]
- self._model_pattern = None # type: typing.Optional[str]
self._win_id = win_id
self._cmd = cmd
self._active = False
Like you say, I think i... |
codereview_python_data_7661 | from __future__ import division
from __future__ import print_function
-from tensorflow_addons.losses.python.triplet import triplet_semihard_loss
from tensorflow_addons.losses.python.lifted import lifted_struct_loss
swap those two imports?
from __future__ import division
from __future__ import print_function
fro... |
codereview_python_data_7663 | @memoize.wrap(memoize.FifoOnDisk(DISK_CACHE_SIZE))
@memoize.wrap(memoize.Memcache(60 * 60 * 24 * 30)) # 30 day TTL
-def revision_to_branched_from(uri, rev):
"""Interrogates git code review server to find the branch-from
revision of a component."""
- full_uri = "%s/+/%s?format=JSON" % (uri, rev)
url_content... |
codereview_python_data_7666 | def test_valid_callback_false(self):
"""Verify valid rules returns True."""
self.firewall_rules._add_rule_callback = lambda _: False
- self.assertFalse(self.firewall_rules._check_rule_before_adding(self.test_rule))
def test_unknown_key(self):
"""A rule with an unknown key rai... |
codereview_python_data_7669 | self.loss_cls = build_loss(loss_cls)
self.loss_bbox = build_loss(loss_bbox)
- self.fp16_enabled = True
self._init_layers()
Why is the default value True?
self.loss_cls = build_loss(loss_cls)
self.loss_bbox = build_loss(loss_bbox)
+ self.fp16_enabled = False
... |
codereview_python_data_7672 | if isinstance(edges, dict):
# TODO(zhengda) we need to directly generate subgraph of all relations with
# one invocation.
- subg = {etype: self.find_edges(edges[etype], etype) for etype in edges}
num_nodes = {ntype: self.number_of_nodes(ntype) for ntype in self... |
codereview_python_data_7676 | import nvidia.dali.ops as ops
import nvidia.dali.types as types
from nvidia.dali.pipeline import Pipeline
-from PIL import Image as Image
video_directory = '/tmp/labelled_videos/'
Maybe you can use ElementExtract to extract all frames from a sequence as a separate batches and call resize on it instead of going thr... |
codereview_python_data_7677 | input, _ = fn.file_reader(file_root=img_dir)
decoded = fn.image_decoder(input, device='cpu', output_type=types.RGB)
decoded = decoded.gpu() if device == 'gpu' else decoded
- tile = fn.cast(fn.uniform(range=(50, 200), shape=[1]), dtype=types.INT32)
- ratio = fn.uniform(range=(0.3, 0.7), shape=[1])
-... |
codereview_python_data_7680 | req["url"] = None
try:
requests.append(self.__parse_request(req))
- except:
raise TaurusConfigError("Wrong request:\n %s" % req)
return requests
It would be nice to have exception dumped somewhere (debug logs, info logs).
... |
codereview_python_data_7682 | """Check if a `txid` was already used as an input.
A transaction can be used as an input for another transaction. Bigchain
- needs to make sure that a given `txid` is only used once.
- This method will check if the `txid` and `output` has already been
spent in a transaction that... |
codereview_python_data_7687 | @send_with_retry
def __send_monitoring(self):
- src_name = platform.node()
data = self.monitoring_buffer.get_monitoring_json(self._session)
- self._session.send_monitoring_data(id(self.engine), data)
@send_with_retry
def __send_custom_metrics(self):
The engine id is the same ... |
codereview_python_data_7697 | abbreviate('Something - I made up from thin air'), 'SIMUFTA')
def test_apostrophes(self):
- self.assertEqual(abbreviate('Halley\'s Comet'), 'HC')
if __name__ == '__main__':
For readability, can you please use double quotes around the input string to negate the need for escaping the apostrophe... |
codereview_python_data_7698 | @deprecated_posargs
def complex_numbers(
*,
- min_magnitude: Optional[Real] = 0,
max_magnitude: Real = None,
allow_infinity: bool = None,
allow_nan: bool = None
```suggestion min_magnitude: Real = 0, ``` There's no real reason to accept `min_magnitude=None`, as there's a clear lower-bound on p... |
codereview_python_data_7699 | schema: s_schema.Schema,
astnode: qlast.DDLOperation,
context: sd.CommandContext,
- ) -> Union[CreateScalarType, sd.CommandGroup]:
cmd = super()._cmd_tree_from_ast(schema, astnode, context)
if isinstance(cmd, sd.CommandGroup):
for subcmd in cmd.get_subcommand... |
codereview_python_data_7706 | return RTMPStream(self.session, params=params)
def _get_vod_stream(self, page):
- m = self._vod_re.search(page.text)
- if m:
- return HLSStream.parse_variant_playlist(self.session, m.group(1).replace('\\/', '/'))
def _get_streams(self):
url_channel_name = self._url_r... |
codereview_python_data_7712 | The output feature of shape :math:`(N, D_{out})` where :math:`D_{out}`
is size of output feature.
"""
if isinstance(feat, tuple):
feat_src = self.feat_drop(feat[0])
feat_dst = self.feat_drop(feat[1])
Would you mind adding a check in the sparse `SAGE... |
codereview_python_data_7714 | # shape of position array set here, use span in last dimension
# from this point on
self._position_array[self._frame_index] = (
- self._atoms.positions[:, self._dim])
def _conclude(self):
if self.fft:
This is a place where I disagree with pep8bot and think the below ... |
codereview_python_data_7715 | ctypes.c_int(end_iteration)))
return self
- def loads_params(self):
"""Loads model parameters by calling LGBM_BoosterGetConfig."""
buffer_len = 2 << 20
tmp_out_len = ctypes.c_int64(0)
```suggestion def _load_params(self): ``` Can you please prefix this with a `_`, to... |
codereview_python_data_7721 | if isinstance(offline, Packet):
tempfile_written, offline = _write_to_pcap([offline])
- elif (isinstance(offline, list) or
- isinstance(offline, PacketList)) and \
all(isinstance(elt, Packet) for elt in offline):
... |
codereview_python_data_7722 | # is 'No' then we need to prepare suitable subgraph view.
partition_nodes = set().union(*partition)
if len(partition_nodes) != len(G):
- if create_using is None:
- # This hack is necessary because we will
- # be passing subgraph instance.
- create_using = G
... |
codereview_python_data_7738 | self.exRadius = float(tokens.popleft())
self.sel = parser.parse_expression(self.precedence)
@return_empty_on_empty_selection
def apply(self, group):
indices = []
Rather than replacing `return_empty_on_apply`, you can usually stack decorators like ``` @return_empty_on_apply @return_... |
codereview_python_data_7739 | return self
def infer_type(self, env):
- # AttributeNode (and possibly others) have ErrorType by default, so make sure to infer
- # if the result is an error, rather than just accepting it
- if self.type is not None and not self.type.is_error:
return self.type
if... |
codereview_python_data_7745 | if not path:
return path
- return os.path.join(self.chroot.directory, path[1:])
def _get_chroot_corpus_paths(self, corpus_directories):
"""Return chroot relative paths for the given corpus directories.
instead of path[1:], can we explicitly do lstrip(os.sep), seems more clear ?
if not path... |
codereview_python_data_7746 | .. Note:: This ``close()`` method is non-standard. ``del NamedStream``
always closes the underlying stream.
-
- .. versionchanged:: 2.1.0
- Calls to ``close()`` will no longer attempt to close or flush the
- stream if :attr:`closed` is `True`.
-
"""
... |
codereview_python_data_7747 | Returns
-------
- iterable
- An iterable of node names in topological sorted order.
- iterable[tuples[node, int]]
- If with_generation=True, returns an iterable of tuples where the first
element is the node and the second element is the generation. In
topologically sorted... |
codereview_python_data_7749 | for m in self.modules():
# DeformConv2dPack, ModulatedDeformConv2dPack
if hasattr(m, 'conv_offset'):
- m.conv_offset.weight.data.zero_()
- m.conv_offset.bias.data.zero_()
@abstractmethod
def loss(self, **kwargs):
DCN should not be able to use `... |
codereview_python_data_7760 | scope_tree=ctx.path_scope,
ctx=inf_ctx,
)
- cardinality = inference.infer_cardinality(
- ir,
- scope_tree=ctx.path_scope,
- ctx=inf_ctx,
- )
# Fix up weak namespaces
_rewrite_weak_namespaces(ir, ctx)
Hm. Why a second call to `infer_cardinality`?
sco... |
codereview_python_data_7767 | if os.path.isfile(self._filename):
# The file already exists, so ask the user if it should be
# overwritten.
- self._ask_overwrite_question()
- # FIFO, device node, etc. Don't even try.
elif (os.path.exists(self._filename) and not
os.path.is... |
codereview_python_data_7768 | c = CacheClass()
self.assertEqual(2, c.foo(1))
self.assertEqual(2, c.foo(1))
self.assertListEqual([
(1,),
(1,),
], c.called)
def test_name_clash(self):
do we want to self.assertEqual(3, c.foo(2)) with different arg as well
c = CacheClass()
self.assertEqual(2, c.... |
codereview_python_data_7773 | def check_elasticsearch(expect_shutdown=False, print_error=True):
# Check internal endpoint for health
- endpoint = '%s://%s:%s' % (get_service_protocol(), 'localhost', config.PORT_ELASTICSEARCH)
try:
req = requests.get(endpoint + '/_cluster/health')
es_status = json.loads(req.text)
nit... |
codereview_python_data_7774 | """
newList = []
- seenNames = {}
for seriesList in seriesLists:
for series in seriesList:
if series.name not in seenNames:
- seenNames[series.name] = True
newList.append(series)
return newList
Can be a set (`seenNames = set()`) and then `seenNames.add(series.name)` :) EDIT: I'... |
codereview_python_data_7775 | tvonline\.ewe|nettv\.netcologne|tvplus\.m-net
)\.de
)|(?:(?:
- player\.waly|www\.netplus|www\.1und1
)\.tv)
|www\.bbv-tv\.net
|www\.meinewelt\.cc
reuse www ```regex player\.waly|www\.(?:1und1|netplus) ```
... |
codereview_python_data_7793 | # To avoid interfering with the remaining pairwise2 tests,
# restore the original functions
pairwise2._make_score_matrix_fast = orig_make_score_matrix_fast
- pairwise2.rint = orig_python_rint
Did this have any functional usage? i.e. Might anyone be assuming these exist?
# To... |
codereview_python_data_7799 | raise errors.UnableToParseFile('Not a valid Firefox cache2 record.')
if file_metadata_header.format_version >= 2:
- flags = file_object.read(4) # pylint: disable=unused-variable
url = file_object.read(file_metadata_header.key_size)
header_data = file_object.read()
Remove the pylint override... |
codereview_python_data_7809 | #
import pytest
import numpy as np
-from numpy.testing import assert_equal, assert_almost_equal
import itertools
from itertools import combinations_with_replacement as comb
use the specific import `from itertools import product`
#
import pytest
import numpy as np
+from numpy.testing import assert_equal, asser... |
codereview_python_data_7811 | runner.register_training_hooks(cfg.lr_config, optimizer_config,
cfg.checkpoint_config, cfg.log_config,
cfg.get('momentum_config', None))
- runner.register_hook_from_cfg(cfg.check_isfinite)
if distributed:
if isinstance(runner,... |
codereview_python_data_7812 | def get_spike_length(values):
first_spike_start = values[0][3]
- for i in range(1, len(values)):
if values[i][3] == first_spike_start:
return i
- i += 1
return len(values)
why do you need inc index var?
def get_spike_length(values):
first_spike_start = values[0][3]
+ ... |
codereview_python_data_7827 | logger.info("Deploy ssh key pairs.")
self.osutil.deploy_ssh_keypair(ovfenv.username, keypair)
- def report_event(self, message, is_success=False, duration=0):
add_event(name=AGENT_NAME,
message=message,
duration=duration,
... |
codereview_python_data_7832 | from pytest import raises
-pytestmark = pytest.mark.tendermint
-
-
class TestBlockModel(object):
def test_block_initialization(self, monkeypatch):
from bigchaindb.models import Block
I don't think we need to fix these tests for `Block` class as it's going to be removed soon.
from pytest import raises... |
codereview_python_data_7838 | while i < len(self.shrink_target.blocks):
j = min(i + 4, len(self.shrink_target.blocks) - 2)
while j >= i:
- u, v = self.shrink_target.blocks[i]
- r, s = self.shrink_target.blocks[j]
if self.incorporate_new_buffer(
- se... |
codereview_python_data_7840 | try:
is_gcs_summary_enabled = (
inventory_notifier_config.get('gcs_summary').get('enabled'))
- if self.notifier_config.get('email_connector'):
- is_email_summary_enabled = True
if inventory_notifier_config.get('email_summary'):
... |
codereview_python_data_7849 | email = models.EmailField(_("Email"), db_index=True, blank=True)
# This key are used to confirm and cancel alerts for anon users
- key = models.CharField(_("Key"), max_length=128, blank=True, unique=True, db_index=True)
# An alert can have two different statuses for authenticated
# users ``ACTIVE... |
codereview_python_data_7857 | -def transform(old):
pass
`legacy_data` will look better. What do you think?
+def transform(legacy_data):
pass |
codereview_python_data_7861 | stride=1,
bias=True)
self.init_cfg = dict(
- override=dict(type='Constant', val=0, name='rfp_conv'))
def rfp_forward(self, x, rfp_feat):
"""The forward function that also takes the RFP features as input."""
in __init__ self.init_cfg = dict(typ... |
codereview_python_data_7866 | return res
# Cell
-def _dcm2dict(fn,window,**kwargs): return fn.dcmread().as_dict(window=window, **kwargs)
# Cell
@delegates(parallel)
should `window` have a default argument?
return res
# Cell
+def _dcm2dict(fn, window=dicom_windows.brain, **kwargs): return fn.dcmread().as_dict(window=window, **kwargs)... |
codereview_python_data_7871 | :param destination_s3_path: URL for target S3 location
:param kwargs: Keyword arguments are passed to the boto function `put_object`
"""
- self._check_deprecated_argument(kwargs)
# put the file
self.put_multipart(local_path, destination_s3_path, **kwargs)
it should a... |
codereview_python_data_7872 | in_channels=[128, 256, 512, 1024],
out_channels=256,
num_outs=5))
-
-find_unused_parameters = True
This should be unnecessary as only the backbone and neck are changed. Otherwise, we should clean the code of implementation.
in_channels=[128, 256, 512, 1024],
out_channels=2... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.