id
stringlengths
24
28
content
stringlengths
121
2.08k
codereview_python_data_6013
if status is 1: self.api.get_inventory() response_dict = self.api.call() - if self.config.smart_catch: id_cp_tuples = self.get_id_cp_tupl...
codereview_python_data_6017
""" minimum_size = self.minimumTabSizeHint(index) height = config.get('tabs', 'tabbar-size') if self.vertical: confwidth = str(config.get('tabs', 'width')) if confwidth.endswith('%'): I think the setting should still have a value like `auto` by default, whi...
codereview_python_data_6024
# Except we do want to notify on a multipart upload completion, which does use a query. elif method == 'POST' and query.startswith('uploadId'): return True - else: - return False # instantiate listener nitpick: `else` technically not needed # Except we do wan...
codereview_python_data_6027
config = copy.deepcopy(self.engine.config) - for key in ("cli", "cli-aliases"): - if key in config: - del config[key] - provisioning = config.get(Provisioning.PROV) self._filter_unused_modules(config, provisioning) why not use existing blacklist config? ...
codereview_python_data_6028
ann_id = self.coco.get_ann_ids(img_ids=[i]) ann_ids.extend(ann_id) assert len(set(ann_ids)) == len( - ann_ids), "Annotation ids in '{}' are not unique!".format(ann_file) return data_infos def get_ann_info(self, idx): use f string instead ann_id ...
codereview_python_data_6029
self.assertTrue(os.path.exists(path)) JMeterExecutor.JMETER_DOWNLOAD_LINK = jmeter_link JMeterExecutor.PLUGINS_DOWNLOAD_TPL = plugins_link JMeterExecutor.JMETER_VER = jmeter_ver This was intentional, to check that it does not install it again. And to cover other branches of the code...
codereview_python_data_6031
num_valid_anchors = anchors.shape[0] bbox_targets = torch.zeros_like(anchors) bbox_weights = torch.zeros_like(anchors) - labels = anchors.new_zeros( - num_valid_anchors, dtype=torch.long) + background_label label_weights = anchors.new_zeros(num_valid_anchors, dtype=...
codereview_python_data_6032
BACKBONES = Registry('backbone') NECKS = Registry('neck') -UPPER_NECKS = Registry('upper_neck') ROI_EXTRACTORS = Registry('roi_extractor') HEADS = Registry('head') DETECTORS = Registry('detector') All `upper_neck` can be renamed to `shared_head`, which may be more clear. BACKBONES = Registry('backbone') NECKS ...
codereview_python_data_6034
schema_seq = int(tar.extractfile(member).read().strip()) if schema_seq != LISTENS_DUMP_SCHEMA_VERSION: raise SchemaMismatchException('Incorrect schema version! Expected: %d, got: %d.' - 'Please, get the latest vers...
codereview_python_data_6040
except StopIteration: raise ValueError("Problem in misc lines before sequence") - -if __name__ == "__main__": - from Bio._utils import run_doctest - run_doctest(verbose=0) Are there any doctests in this file? If not, there is no reason to having these three lines of code. except S...
codereview_python_data_6042
def search(text, output_format="tab", sort="score", oragnism="", columns=(), isoform=False, compress=False, offset=0, limit=0): """Perform a query over the UniProt API. - More at: https://www.uniprot.org/help/api_queries """ cgi = "https://www.uniprot.org/uniprot/?" We should probably ...
codereview_python_data_6045
build_revision = fuzzer_utils.get_build_revision() job = environment.get_value('JOB_NAME') # fuzzer name is filled by fuzz_task. - testcase_run = fuzzer_stats.TestcaseRun('', job, build_revision, current_timestamp()) testcase_run['command'] = fuzzer_command Can w...
codereview_python_data_6047
async def upload(self, request): try: reader = await request.multipart() - exfil_dir = await self.create_unique_exfil_sub_directory() while True: field = await reader.next() if not field: good idea. changes: - make this a private func...
codereview_python_data_6050
Returns: dict[str, Tensor]: A dictionary of loss components. """ - # NOTE the batched image size information may be useful, e.g. - # in DETR, this is needed for the construction of masks, which is - # then used for the transformer_head. - input_img_shape = tupl...
codereview_python_data_6052
self._lines = None def get_stock_info(self, product, options): - "Hook for implementing strategies that depend on product options" return self.strategy.fetch_for_product(product) def add_product(self, product, quantity=1, options=None): Let's properly decorate docstring with three do...
codereview_python_data_6057
super().__init__(database_manager) self.write_req_validator = write_req_validator - def additional_dynamic_validation(self, request: Request, req_pp_time: Optional[int]): - pass - def authorize(self, request): self.write_req_validator.validate(request, ...
codereview_python_data_6058
bool: Whether this action is a subset of the other action. """ return (self.action == other.action and - (other.applies_to_all or - self.any_value or - other.any_value or not other.expanded_rules or all([ ...
codereview_python_data_6059
else: self[self.SUCCESSES] += 1 - self[self.RESP_TIMES][r_time] += 1 - self[self.RESP_TIMES_HDR].record_value(int(round(r_time, 3) * 1000)) if byte_count is not None: self[self.BYTE_COUNT] += byte_count multiply before rounding? else: sel...
codereview_python_data_6061
): try: val = configuration.find(attrname) - vals = [mapper(el) for el in val.text.strip().split('\n')] except: pass else: Wow that fixed it? What was wrong with splitting on any white space? I thought the problem was not ...
codereview_python_data_6062
# Internal Cell @Normalize def setups(self, to:Tabular): - store_attr(means=dict(getattr(to, 'train', to).conts.mean()), - stds=dict(getattr(to, 'train', to).conts.std(ddof=0)+1e-7), - but='to') return self(to) @Normalize Move the `but=`s to the first line of the function - no n...
codereview_python_data_6071
recipient, recipient=recipient, verb="", description=description ) - self.stdout.write( - "Suggestion notifications sent to {count} users.".format(count=len(data)) - ) Nitpick/question: what do you think about using f-strings? recipient, recipien...
codereview_python_data_6072
''' src_data, tgt_data = self.src[mode], self.tgt[mode] n = len(src_data) - # make sure all devices have the same number of batches n = n // ndev * ndev # XXX: is partition then shuffle equivalent to shuffle then partition? I don't think so, but in order to make sure...
codereview_python_data_6077
return comment + GENERIC_INCORRECT_COMMENT.format(label=wrong_label) + suffix -def _label_display_name(issue): - """Return label display for a issue (based on its issue tracker type).""" - issue_tracker_name = issue.issue_tracker.name - if issue_tracker_name == 'monorail': - return 'label' - elif issue_tracke...
codereview_python_data_6078
eval_hook(val_dataloader, **eval_cfg), priority='LOW') resume_from = None - if cfg.resume_from is None and cfg.auto_resume: resume_from = find_latest_checkpoint(cfg.work_dir) if resume_from is not None: cfg.resume_from = resume_from ```python resume_from=None if cfg.resume_f...
codereview_python_data_6084
self.universes = [self.universe1, self.universe2, self.universe_rev] self.psa = MDAnalysis.analysis.psa.PSAnalysis(self.universes, \ path_select='name CA', \ - targetdir=tempdir.TempDir())...
codereview_python_data_6088
_define_word.return_value, ] assert _define_words_in_sentence(fakes.course1, "{foo bar} {baz quux}", True) == [ _define_word.return_value, _define_word.return_value, please introduce a new test case for this one _define_word.return_value, ...
codereview_python_data_6092
"""Handler that schedules ML train jobs.""" from base import tasks -from base import utils from datastore import data_types from datastore import fuzz_target_utils from handlers import base_handler Should we rename gradientfuzz to something like gradient_generator or something similar to rnn_generator ? Same for ...
codereview_python_data_6114
self.client.timeout = dehumanize_time(self.settings.get("timeout", self.client.timeout)) self.send_interval = dehumanize_time(self.settings.get("send-interval", self.send_interval)) self.send_monitoring = self.settings.get("send-monitoring", self.send_monitoring) - self.monitoring_buff...
codereview_python_data_6120
-h, --help Show this message and exit. Commands: - codemod `hypothesis codemod` refactors deprecated or inefficent code. fuzz [hypofuzz] runs tests with an adaptive coverage-guided fuzzer. write `hypothesis write` writes property-based tests for you! ```suggestion codemod `hypot...
codereview_python_data_6126
:returns tuple (number_of_files_copied, total_size_copied_in_bytes) """ - (dst_bucket, dst_key) = self._path_to_bucket_and_key(destination_path) - # don't allow threads to be less than 3 threads = 3 if threads < 3 else threads from boto3.s3.transfer import TransferCon...
codereview_python_data_6135
.. deprecated:: 1.0.0 - :func: `notwithin_coordinates_factory` is no longer supported and will be removed in 2.0.0. as part - of the removal of the :func:`density_from_PDB` function. """ # Benchmark of FABP system (solvent 3400 OH2, protein 2100 atoms) on G4 powerbook, 500 frames # ...
codereview_python_data_6145
B : Numpy matrix The modularity matrix of G. - Notes - ----- - For MultiGraph/MultiDiGraph, the edges weights are summed. - See Also -------- to_numpy_matrix Given the `@not_implemented_for` decorators, what does this note mean. Similarly with `modularity_spectrum`? B : Numpy ...
codereview_python_data_6147
# to the lock file and fail because the file is already locked by the previous process. # The -n flag in flock will fail the process right away when the process is not able to acquire the lock so we won't # queue up the jobs. -(echo "{run_frequency} /usr/bin/flock -n /tmp/forseti_cron_runner.lock $FORSETI_HOME/setup...
codereview_python_data_6150
display_name = self._GetRowValue(query_hash, row, 'given_displayname') fullname = self._GetRowValue(query_hash, row, 'fullname') username = '{0!s} <{1!s}>'.format(fullname, display_name) event_data = SkypeAccountEventData() why the change, what other type can fullname, display_name be? displa...
codereview_python_data_6155
@pytest.mark.parametrize('smi,chirality', [ - ('C[C@@H](C(=O)O)N', 'R'), - ('C[C@H](C(=O)O)N', 'S'), ]) def test_chirality(smi, chirality): Chem = pytest.importorskip('rdkit.Chem', reason='requires rdkit') Isn't this a bit redundant? Or you want a specific test for the dtype? @pytest.mark.parametrize('...
codereview_python_data_6157
self.shared_roi_extractor = False else: self.shared_roi_extractor = True self.mask_head = builder.build_head(mask_head) self.train_cfg = train_cfg `self.mask_roi_extractor = self.bbox_roi_extractor` can be added here, which will make the inference mo...
codereview_python_data_6158
Args: message (str): error message """ - LOGGER.error(message) super(Error, self).__init__(message) It would be better for the raiser or the catcher to log the error, rather than log it here where you can't tell where the exception is coming from. Args: ...
codereview_python_data_6161
""" itemcount = 1 for item in self._data: - itemcount += self.count_for(item) return itemcount def get_space_left(self): if `self._data[item_id].get('count', False)` fails and return `False`, then this line raises an error. It should only add if `self.count_for(i...
codereview_python_data_6167
) def _write_flows(self, path, flows): - f = open(path, "wb") - fw = io.FlowWriter(f) - for i in flows: - fw.add(i) - f.close() def save_one_flow(self, path, flow): return self._write_flows(path, [flow]) We should use `with open(...) as f:` more. ...
codereview_python_data_6174
if residual: if indim != hiddendim: self.residual_fc = nn.Linear(indim, hiddendim, bias=False) - nn.init.xavier_normal_(self.residual_fc.weight.data, gain=1.414) def forward(self, nodes): ret = nodes.data['accum'] Would it better to change to `gain=nn...
codereview_python_data_6177
flipped[..., 1::4] = h - bboxes[..., 3::4] flipped[..., 3::4] = h - bboxes[..., 1::4] else: - raise ValueError(f'Invalid flipping direction "{direction}"') return flipped def __call__(self, results): Use single quote to wrap the str. flipped[......
codereview_python_data_6187
selection = trans_u.residues[0].atoms center_pos = selection.center_of_mass() matrix = rotation_matrix(np.deg2rad(angle), vector, center_pos) - rotation = matrix[:3, :3] - translation = matrix[:3, 3] - ref.positions = np.dot(ref.positions, rotation) + translation - transformed = rotateby(angl...
codereview_python_data_6189
yield "this is a generator" # pragma: no cover def send_response(self, response): - if response.content == None: - raise HttpException("Cannot assemble flow with None content") self.send_response_headers(response) self.send_response_body(response, [response.content]) ...
codereview_python_data_6194
def check_import(self, lib_path): import tensorflow as tf - import nvidia.dali as dali # DALI symbols need to be loaded print("Importing the TF library to check for errors") try: tf.load_op_library(lib_path) So we cannot install DALI and plugin in one go as DALI nee...
codereview_python_data_6197
keep_partitioning=True, lengths=None, enumerate_partitions=True, - max_retries=0, ) # pending completion This is a separate change. Please limit this PR to only adding _ability_ to pass extra keywords, and use them separately (you could use that in th...
codereview_python_data_6209
return x * out -class DYReLU(BaseModule): - """Dynamic ReLU (DY-ReLU) module. See `Dynamic ReLU <https://arxiv.org/abs/2003.10027>`_ for details. Current implementation is specialized for task-aware attention in DyHead. Shall we keep using DyReLU? It is consistent with DyHead and DyDCNv2 ...
codereview_python_data_6210
"""Schedule computing new batch from source callback by the parallel pool.""" dst_chunk_i = (self.flat_iter_idx + lead) % pool.contexts[context_i].queue_depth if self.batch: - pool.schedule_batch(context_i, dst_chunk_i, TaskArgs.make_batch( self.callback_args(None,...
codereview_python_data_6213
_bboxes = bbox_mapping(det_bboxes[:, :4], img_shape, scale_factor, flip) mask_rois = bbox2roi([_bboxes]) - mask_roi_extractor = self.mask_roi_extractor[-1] - mask_feats = mask_roi_extractor( ...
codereview_python_data_6220
mode=self.upsample_method, align_corners=align_corners) upsampler_cfg_['type'] = self.upsample_method - _, self.upsample = build_upsampler_layer(upsampler_cfg_) out_channels = 1 if self.class_agnostic else self.num_classes logits_in_channel = ( Also a...
codereview_python_data_6228
'FUCHSIA_DIR', os.path.join(self.build_dir, self.FUCHSIA_DIR_REL_PATH)) environment.set_value('FUCHSIA_RESOURCES_DIR', self.build_dir) - # Does not support partial unpack. - assert environment.get_value('UNPACK_ALL_FUZZ_TARGETS_AND_FILES') result = super(FuchsiaBuild, self).setup() if not ...
codereview_python_data_6241
np.testing.assert_allclose(output, expected_output) def test_all_ones(): image = tf.ones([10, 10, 1], tf.uint8) output = dist_ops.euclidean_dist_transform(image) Do you think that we could test the new algo against `scipy.ndimage.distance_transform_edt`? np.testing.assert_allclose(output,...
codereview_python_data_6244
def _count_diff_NG86(codon1, codon2, codon_table=default_codon_table): - """Count differences between two codons, three-letter string; (PRIVATE). The function will take multiple pathways from codon1 to codon2 into account. The original was fine as it was. If you want to end with ``(PRIVATE)`` I would rem...
codereview_python_data_6246
from . import backend from .set_default_backend import set_default_backend -from .pytorch.sparse import gspmm_hetero -from .pytorch.sparse import gsddmm_hetero _enabled_apis = set() we should import any function in pytorch backend here. from . import backend from .set_default_backend import set_default_backend ...
codereview_python_data_6247
return [self.app, pickle_loc] + self.app_options() def run(self): - name = re.sub(r'[^\w]', '_', self.name) - self.run_path = tempfile.mkdtemp(prefix=name) - self.run_pickle = os.path.join(self.run_path, '.'.join([name, 'pickle'])) with open(self.run_pickle, 'wb') as fd: ...
codereview_python_data_6248
self._init_key_label() def _check_save_support(self, save): - if self.question.option is None: raise Error("No setting available to save the answer for this " "question.") Should this be `if save and self.question.option is None:`? self._init_key_lab...
codereview_python_data_6249
(test_Y == argmax_Y.float()).sum().item() / len(test_Y) * 100)) ############################################################################### -# The figure here is an animation where you plot graphs with the probability that a trained model # assigns its Amazon SageMaker ground truth label to it. # # .. imag...
codereview_python_data_6252
DBA = dual_barabasi_albert_graph(100, m1, m2, p, seed, initial=initial) BA1 = barabasi_albert_graph(100, m1, seed, initial=initial) - BA2 = barabasi_albert_graph(100, m1, seed, initial=initial) assert ( min(BA1.size(), BA2.size()) <= DBA.size() <= max(B...
codereview_python_data_6254
@register_query(LocalMongoDBConnection) -def put_pre_commit_state(conn, state): commit_id = state['commit_id'] return conn.run( conn.collection('pre_commit') All functions to save data have "store" as prefix, would it make sense to use it here as well so we are consistent? @register_query(LocalMo...
codereview_python_data_6260
else: candidates.append((func, func_type)) - # Optimize the most common case of no overloading... - if len(candidates) == 1 and not validate_types_fully: - return candidates[0][0] - elif len(candidates) == 0: if pos is not None: func, errmsg = errors[0] ...
codereview_python_data_6263
if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argument( - "--export_path", dest="export_path", type=str, required=False, ```suggestion "--export-path", ``` plus note that you should change the calling line in `conf.py` now, otherwise the variables...
codereview_python_data_6265
from urwid import BaseScreen from bzt import TaurusInternalException, TaurusNetworkError, ToolError -from bzt.six import string_types, iteritems, binary_type, text_type, b, integer_types, request, file_type, etree, parse -def get_output(args, env=None): - return subprocess.check_output(args, env=env, stderr=subpro...
codereview_python_data_6270
def _list_from_csv(csv_string, caster=None): - """Transform the given comma-separated string into a list. :param csv_string: comma-separated input string :type csv_string: string Can you make this end ``... into a list (PRIVATE).`` too please. def _list_from_csv(csv_string, caster=None): + """Transf...
codereview_python_data_6276
CHANGED_OPTIONS = { ('content', 'cookies-accept'): _get_value_transformer('default', 'no-3rdparty'), - ('storage', 'download-directory'): - _get_value_transformer('', '%'), } changed = pyqtSignal(str, str) I think this will change `''` to `'%'` unconditionally, i....
codereview_python_data_6277
import numpy as np from Bio.KDTree import _CKDTree -# Bio 1.71 API different from previous :( -from distutils import version -import Bio -_NEW_BIO_KDTREE = version.LooseVersion(Bio.__version__) >= version.LooseVersion('1.7.1') -del Bio -del version - - from MDAnalysis.lib.distances import _box_check, _check_array, a...
codereview_python_data_6283
# Requires Python 2.4+ and Openssl 1.0+ # -import azurelinuxagent.utils.shellutil as shellutil -from azurelinuxagent.distro.default.osutil import DefaultOSUtil class AlpineOSUtil(DefaultOSUtil): def __init__(self): looks like you just need to update imports to `azurelinuxagent.common.utils.shellutil` and `azur...
codereview_python_data_6288
def get_config(self): config = { "margin": self.margin, } base_config = super().get_config() return {**base_config, **config} Should we also serialize `self.soft` here? def get_config(self): config = { "margin": self.margin, + ...
codereview_python_data_6293
Parameters ---------- - diha : list of 4 np.int64 element tuples - The dihedrals not involving hydrogens - dihh : list of 4 np.int64 element tuples - The dihedrals involving hydrogens Returns ------- nitpicky, but here you could just have `if not ...
codereview_python_data_6300
usecols=usecols, **kwargs ) - pandas_df = parser.read().dropna(how="all") # Since we know the number of rows that occur before this partition, we can # correctly assign the index in cases of RangeIndex. If it is not a RangeIndex, What is this change for? ...
codereview_python_data_6301
Callable, Mapping, cookielib, urlunparse, urlsplit, urlencode, str, bytes, is_py2, chardet, builtin_str, basestring) -from .compat import json from .status_codes import codes #: The set of HTTP status codes that indicate an automatically Why did you change this? Callable, Mapping, cookielib...
codereview_python_data_6305
} -# @test_utils.run_all_in_graph_and_eager_modes -# class TranslateOpTest(tf.test.TestCase): - - @pytest.mark.usefixtures("maybe_run_functions_eagerly") @pytest.mark.parametrize("dtype", _DTYPES) def test_translate(dtype): I think you can remove this. } @pytest.mark.usefixtures("maybe_run_functions_eagerly") ...
codereview_python_data_6311
Notes ----- Graphs may have node labels, node attributes, edge labels, and edge attributes, - varing from different dataset. """ _url = r"https://www.chrsmrrs.com/graphkerneldatasets/{}.zip" I suggest we clearly describe the changes here, so that people will know instantly by reading the d...
codereview_python_data_6316
Enum for defining the Feature Names for all internal and CRP features """ MultiConfig = "MultipleExtensionsPerHandler" - ExtensionTelemetryPipeline = "ExtensionTelemetryPipeline" class AgentFeature(object): we should move this class to its own file we also need to clarify its intent (and maybe renam...
codereview_python_data_6317
calculated_md5 = dirhash.dirhash(path, 'md5', ignore=ignore, match=included_extensions) if md5 == calculated_md5: return version - return 'unknown' class Access(Enum): APP = 0 I feel like this should return a tuple-- the version (number), and the hash, se...
codereview_python_data_6323
class StringSelection(Selection): """Selections based on text attributes - .. versionchanged:: 0.21 - Supports multiple wildcards, based on fnmatch """ def __init__(self, parser, tokens): vals = grab_not_keywords(tokens) @Iv-Hristov the text entry in a `versionchanged` needs to be indent...
codereview_python_data_6327
class ContentDecodingError(RequestException, BaseHTTPError): """Failed to decode response content""" -class StreamConsumedError(RequestException): """The content for this response was already consumed""" This needs to doubly inherit, like so: ``` python class StreamConsumedError(RequestException, TypeError)...
codereview_python_data_6331
import collections import os - -import shade -import paramiko import time import tempfile from molecule import util from molecule.driver import basedriver Since `time` and `tempfile` are part of the standard library, they should be imorted with `os` (above), in alphabetical order. `Paramiko` should stay with `sh...
codereview_python_data_6335
Tries harder: if the thing to inspect is a class but typing.get_type_hints raises an error or returns no hints, then this function will try calling it - on the __init__ method. This second step often helps with user-defined - classes on older versions of Python. Never errors: i...
codereview_python_data_6336
async def load_ability_file(self, filename, access): for entries in self.strip_yml(filename): for ab in entries: - ability_id = ab.pop('id') if 'id' in ab else ab.pop('ability_id', None) name = ab.pop('name', '') description = ab.pop('descripti...
codereview_python_data_6346
please use format(motif, format_spec). """ warnings.warn( - """\ -Motif.format has been deprecated, and we intend to remove it in a future -release of Biopython. Instead of motif.format(format_spec), please use -format(motif, format_spec). -""", BiopythonDeprecationWar...
codereview_python_data_6348
) -> None: lines = text.splitlines() for action, full_insert in zip(*[iter(lines)] * 2): - # if '0x71F85B2E46976bD21302B64329868fd15eb0D127' in action: - # __import__("pdb").set_trace() - # a = 1 - if full_insert == '*': full_...
codereview_python_data_6352
Slice object to check. sequence_len : int, optional Length of the sequence to index with the passed `slc`. - If not specified the function won't consider `slc` to - be a full-grab if its ``.stop`` attribute is equal or - greater than the sequence length. Returns ---...
codereview_python_data_6360
""" def _get_new_resampler(key): - return Resampler(self._dataframe[key], **self.resample_args) from .series import Series I think @YarShev was against my simplification - this indeed makes it harder to make a subclass if we create `Resampler` explicitly """ def...
codereview_python_data_6371
for i in range(0, 20): al = [Atom() for j in range(100)] ns = NeighborSearch(al) - for i in [0, 1, 2, 3, 4, 5, 6]: self.assertEqual(i, len(ns.search_all(5.0))) Why not use ``range(7)`` which gives 0, 1, 2, 3, 4, 5 ,6? for i in range(0, 20): ...
codereview_python_data_6375
RUBYGEMS_API_KEY = os.path.join(SECRETS, 'api_key.yaml') def decrypt_secrets(): subprocess.check_call([ 'openssl', 'aes-256-cbc', minor: why is this defined in the top-level tooling file, if it's a Ruby-specific constant? RUBYGEMS_API_KEY = os.path.join(SECRETS, 'api_key.yaml') +SECRET_FILES = [ + ...
codereview_python_data_6380
def __init__(self, learn:Learner, n_step:int = 1, drop_last:bool = False): super().__init__(learn) - self.n_step = n_step - self.drop_last = drop_last def on_train_begin(self, **kwargs): "check if loss is reduction" Both on one line (fastai style guide) def __init__(self...
codereview_python_data_6383
""" index = count if count is not None else index - if index in ('last', self._current_index() + 1): self._tab_focus_last() return - - if index is None: self.tab_next() return As for not raising the error in the `self._current_index() ...
codereview_python_data_6385
<h1>Error 503 Backend is unhealthy</h1> <p>Backend is unhealthy</p> <h3>Guru Mediation:</h3> - <p>Details: cache-sea4478-SEA 1645521665 3876263177</p> <hr> <p>Varnish cache server</p> </body> nit: We could use `select_attributes(..)` from `utils/common.py` here, to make this a bit shorte...
codereview_python_data_6390
Multiplier. Default: 2 avg_deg : int, optional Average degree. Default: 3 - pq : list of pair of nonnegative float or str, optional - Random densities. Default: Appendix_C rng : numpy.random.RandomState, optional Random number generator. Default: None - Raises - ----...
codereview_python_data_6392
sig.freeze(self.request.id) if self.request.is_eager: - return sig.apply().get() - # task_result = sig.apply() - # with allow_join_result(): - # return task_result.get() else: sig.delay() raise Ignore('Replaced by new t...
codereview_python_data_6393
if project_name == TFA_RELEASE: # TODO: remove if-else condition when tf supports package consolidation. if platform.system() == 'Linux': - REQUIRED_PACKAGES.append('tensorflow-gpu >= 2.0.0-rc0') else: - REQUIRED_PACKAGES.append('tensorflow >= 2.0.0-rc0') elif project_name == TFA_NIGHTLY:...
codereview_python_data_6395
if isinstance(struct, Task): return struct.output() elif isinstance(struct, dict): - r = struct.__class__() - for k, v in six.iteritems(struct): - r[k] = getpaths(v) - return r elif isinstance(struct, (list, tuple)): return struct.__class__(getpaths(r) fo...
codereview_python_data_6398
images, bb, labels = self.input(name="Reader") return self.base_define_graph(images, labels, bb) -test_data = {\ COCOReaderPipeline: [["/data/coco/coco-2017/coco2017/train2017", "/data/coco/coco-2017/coco2017/annotations/instances_train2017.json"], ["/data/coco/coco-2017/coc...
codereview_python_data_6401
dim_names = [d.name for d in dimensions] if dynamic: - group_dims = [d.name for d in self.kdims if d not in dimensions] - kdims = [self.get_dimension(d) for d in group_dims] group_kwargs = dict(util.get_param_values(self), kdims=kdims) group_kwargs.updat...
codereview_python_data_6408
if not pass_through: broadcast_finished = tf.broadcast_to( tf.expand_dims(finished, axis=-1), new.shape) - return new if pass_through else tf.where( - broadcast_finished, cur, new) if impute_finished: ...
codereview_python_data_6416
naive_dice=False, loss_weight=1.0, eps=1e-3): - """`Dice Loss, there are two forms of dice loss is supported: - the one proposed in `V-Net: Fully Convolutional Neural Networks for Volumetric Medical Image Segmentation '`' is unn...
codereview_python_data_6417
def get(self, k, d=None): """Return the value in the dictionary. - - If key not found the second - attribute is returned. By default it is None. """ try: return self.__getitem__(k) That's odd line breaking. We could explain the short hand k=key and d=d...
codereview_python_data_6419
# this is important for some web applications that store authentication-related info in cookies (it took a long time to figure out) if response2.headers.get('set-cookie'): - headers['Cookie'] = response2.headers.get('set-cookie') # get the challenge auth_header_val...
codereview_python_data_6427
if self.master.options.mode != "regular": r.append("[%s]" % self.master.options.mode) if self.master.options.scripts: - scripts = list(chain.from_iterable([glob(re) for re in self.master.options.scripts])) r.append("[scripts:%s]" % len(scripts)) if self.ma...
codereview_python_data_6431
---------- graph : DGLGraph The graph. - feat : mxnet.NDArray If a mxnet.NDArray is given, the input feature of shape :math:`(N, D_{in})` where :math:`D_{in}` is size of input feature, :math:`N` is the number of nodes. mxnet.NDArray or pair o...
codereview_python_data_6432
"Bio.Align.Applications", "Bio.Align.substitution_matrices", "Bio.AlignIO", "Bio.Application", "Bio.Blast", "Bio.CAPS", If you want to keep a ``Bio.Alphabet`` stub, we need to keep it on the list of installed packages. "Bio.Align.Applications", "Bio.Align.substitution_matrices"...