id
stringlengths
24
28
content
stringlengths
121
2.08k
codereview_python_data_5583
state.last_saveload = path path = os.path.expanduser(path) try: - f = file(path, "wb") - f.write(str(content)) - f.close() except IOError, v: master.statusbar.message(v.strerror) This must not be the case. We want to get to a point where we have error-only flows as wel...
codereview_python_data_5588
""" self.ag.center_of_mass(pbc=True) - def time_center_of_mass_unwrap(self, num_atoms): - """Benchmark center_of_mass calculation with - unwrap active. - """ - self.ag_unwrap.center_of_mass(unwrap=True, compound='residues') - def time_center_of_geometry_default(self...
codereview_python_data_5592
if len(G) == 0: return {}, {} - M = nx.to_scipy_sparse_matrix(G, nodelist=list(G)) - (n, m) = M.shape # should be square - A = M.T @ M # authority matrix x = np.ones((n, 1)) / n # initial guess # choose fixed starting vector if not given if nstart is not None: I like that you a...
codereview_python_data_5593
import json import tqdm import pickle -import gdown from gluoncv.utils import download, makedirs _TARGET_DIR = os.path.expanduser('~/.mxnet/datasets/visualgenome') Put it in another place so mainland china users could have access? import json import tqdm import pickle from gluoncv.utils import download, make...
codereview_python_data_5594
@property def hadoop_user_name(self): - return os.getlogin() @property def spark_version(self): It is a bit dangerous, in some environments HADOOP_USER_NAME may be already set and this will override it, right? Probably it would be safer to return None @property def hadoop_user_nam...
codereview_python_data_5595
def get_final_epoch(config): cfg = mmcv.Config.fromfile('./configs/' + config) epoch = cfg.runner.max_epochs if cfg.data.train.type == 'RepeatDataset': This code cannot be modified because `epoch_{}.pth` will make an error. def get_final_epoch(config): + cfg = mmcv.Config.fromfile('./configs/' + c...
codereview_python_data_5599
self.nodeMsgRouter.routes[Request] = self.processNodeRequest self.nodeAuthNr = self.defaultNodeAuthNr() - self.nodeMsgRouter.routes[PrePrepare] = self.extraPrePrepareProcesing - - - def extraPrePrepareProcesing(self, msg, frm): - ledgerid = getattr(msg, f.LEDGER_ID.nm, -1) - if...
codereview_python_data_5600
archive = FileArchive(export_name=export_name, pack=False) archive.add(self.image1) archive.add(self.image2) - self.assertEqual(None, FileArchive.clear(archive)) Not sure what this is testing, shouldn't this be something like: ```suggestion archive.clear() self.assertEqual(archive._fi...
codereview_python_data_5601
raise errors.SchemaError(f'unsupported collection type {t!r}') elif isinstance(t, s_objtypes.ObjectType): - if t not in view_shapes: - # If we have an object type that isn't attached to a view, - # it must be the case that it doesn't actually appear in - ...
codereview_python_data_5608
Number of wells 96 If the handle contains no records, or more than one record, - an exception is raised. For example: from Bio import phenotype record = phenotype.read("plates.csv", "pm-csv") You need a double colon on the preceding paragraph to make this an RST literal block. Num...
codereview_python_data_5610
runner.register_training_hooks(cfg.lr_config, optimizer_config, cfg.checkpoint_config, cfg.log_config, cfg.get('momentum_config', None)) - runner.register_hook(CompatibleCheckHook()) if distributed: runner.register_hook(DistSa...
codereview_python_data_5614
ndarray = () -def check_sample(values, require_1d_array=True, require_sequence=True): if isinstance(values, ndarray): - if require_1d_array and values.ndim != 1: note_deprecation(( 'Only one-dimensional arrays are supported for sampling, ' 'and the given v...
codereview_python_data_5615
'want to sample slices. Sampling a multi-dimensional ' 'array will be an error in a future version of Hypothesis.' ).format(ndim=values.ndim, shape=values.shape)) - elif not isinstance(values, _SEQUENCE_TYPES): note_deprecation( 'Cannot sample fro...
codereview_python_data_5621
if skiprows is not None and not isinstance(skiprows, int): return False - # can't pickle dialect object to the worker process - if read_csv_kwargs.get("dialect", None) is not None: - return False - return True @classmethod are you sure this is relevant to th...
codereview_python_data_5622
], ), ) - for i in range(1, len(cumulative)) ] return ( dict(partition_ids_with_indices) Can we remove the `cumsum()` here and use `indices[count_for_each_partition[i]` below instead of what we have...
codereview_python_data_5627
def __init__(self, data, models, **kwargs): super().__init__(data, models, **kwargs) - def _determine_loss_func(self, data): - return F.cross_entropy def save_encoder(self, name): save_model(self.model[0], self.get_model_path(name)) def load_encoder(self, name): load_model(self.model[0...
codereview_python_data_5632
return greytrack_bgs, greytrack_labels def canvas_angle(self, base): - """Given base-pair position, return (angle, cosine, sin)(PRIVATE).""" angle = self.sweep * 2 * pi * (base - self.start) / self.length return (angle, cos(angle), sin(angle)) Put a space between the closing and ...
codereview_python_data_5638
scheme = 'http' host = 'localhost' port = 9200 - es_retry_on_timeout=False - es_timeout=10 es_max_retries = 3 def __init__(self, url=None, *args, **kwargs): For uniformity and readability I think it is preferrable to surround `=` with spaces: ``` es_retry_on_timeout = False ``` sch...
codereview_python_data_5641
-# Copyright 2018 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. nit: Should we make it 2019 as well? +# Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not ...
codereview_python_data_5643
from .test_mixins import RPNTestMixin from .. import builder from ..registry import DETECTORS -from mmdet.core import (bbox2roi, bbox2result, merge_aug_masks) -from mmdet.core import build_assigner, build_sampler @DETECTORS.register_module Since all methods are imported from the same modul...
codereview_python_data_5644
d[k] = _get_cls(v) -_load_dict(icmp6rplcodes) _load_dict(icmp6ndoptscls) _load_dict(icmp6typescls) _load_dict(ipv6nhcls) This will never be called: the contrib module will always be called after `inet6`, meaning this will always be empty. d[k] = _get_cls(v) _load_dict(icmp6ndoptscls) _load_dict...
codereview_python_data_5647
return self.op() def test_wrong_pipeline(): pipe = WrongPipeline(BATCH_SIZE, NUM_WORKERS, DEVICE_ID, SEED) - try: - pipe.build() - except Exception as e: - print(e) - return - raise Exception('Should not pass') This looks weird - there's nothing "wrong" with this pipeline. ...
codereview_python_data_5650
help='Deletes an entire model') delete_model_parser.add_argument( 'model', - help='Model to delete, either hash or name') create_model_parser = action_subparser.add_parser( 'create', Instead of `hash`, use `handle`, as it is more consistent with usage everywhere else. ...
codereview_python_data_5654
return data1.get(attr, default) == data2.get(attr, default) else: attrs = list(zip(attr, default)) # Python 3 def match(data1, data2): - values1 = [data1.get(attr, d) for attr, d in attrs] - values2 = [data2.get(attr, d) for attr, d in attrs] - return...
codereview_python_data_5656
# homepage : http://jaceksmietanski.net # email : jacek.smietanski@ii.uj.edu.pl # -# This file is part of the Biopython distribution and governed by your -# choice of the "Biopython License Agreement" or the "BSD 3-Clause License". # Please see the LICENSE file that should have been included as part of this ...
codereview_python_data_5660
warning(pos, "'%s' is a reserved name in C." % cname, -1) entries = self.entries - entry = None - cpp_already_overridden = False if name and name in entries and not shadow: old_entry = entries[name] This makes an assumption about the order returned by `.all_alt...
codereview_python_data_5666
self.matcher = self.pat.match if match else self.pat.search def __call__(self, o): - posix_o = Path(o).as_posix() - res = self.matcher(str(posix_o)) - assert res,f'Failed to find "{self.pat}" in "{posix_o}"' return res.group(1) # Cell `Path` is really slow, and this functio...
codereview_python_data_5668
In order to query this endpoint, send a GET request. A JSON response will be returned, with one of three codes. - :statuscode 200: The user token is valid. :statuscode 400: No token was sent to the endpoint. - :statuscode 401: The user token is invalid (does not exist). """ auth_token = r...
codereview_python_data_5669
raise CorpusPruningException('Failed to sync corpus to disk.') if not self.quarantine_corpus.rsync_to_disk(self.quarantine_corpus_path): - logs.log_error('Failed to sync quarantine corpus to disk.') if not self.shared_corpus.rsync_to_disk(self.shared_corpus_path): - logs.log_error('Failed to ...
codereview_python_data_5671
data = json.loads(fileutil.read_file(config_file)) except (IOError, OSError) as e: self.logger.warn('Failed to load resource manifest file ({0}): {1}'.format(config_file, e.strerror)) - except ValueError: - self.logger.warn('Malformed resource manifest file ({0}).'.f...
codereview_python_data_5672
self.overall_progress_tqdm = None self.epoch_progress_tqdm = None self.is_training = False - self.test_last_update_time = time.time() - self.test_epoch_progress_tqdm = None - self.test_num_epochs = None - self.test_logs = None self.num_epochs = None ...
codereview_python_data_5677
from sovrin_client.test.helper import getClientAddedWithRole -from sovrin_client.test.helper import checkRejects from stp_core.loop.eventually import eventually from sovrin_node.test.pool_config.helper import ensurePoolConfigSent, checkPoolConfigWritableSet, sendPoolConfig from plenum.common.constants import STEWAR...
codereview_python_data_5680
item_count = item_dict.get('count') item_id = item_dict.get('item_id') - if not item_count and not item_id: if item_id in items_stock: items_stock[item_id] = item_count return items_stock I misunderstood the if condition. Previous one ...
codereview_python_data_5688
import tempfile import sqlite3 import os This creates a file on the file system and returns you an opened file. It's probably not what we want when we're creating a database _de nuovo_. I suggest that you create a temporary directory instead, and then join the tmpdir path with some filename to get the database file...
codereview_python_data_5690
async def _init_graphql_schema(conn, cluster, loop): logger.info('Bootstrapping graphql module...') - from edgedb.lang import schema as edgedb_schema - from edgedb.server import protocol as edgedb_protocol - protocol = edgedb_protocol.Protocol(cluster, loop=loop) protocol.backend = await backend.o...
codereview_python_data_5691
from app.api.rest_api import RestApi from app.service.app_svc import AppService from app.service.auth_svc import AuthService from app.service.data_svc import DataService from app.service.learning_svc import LearningService from app.service.planning_svc import PlanningService from app.service.rest_svc import Rest...
codereview_python_data_5694
if web: install_webapp() -def update_examples(): - ''' - This is only used during development to update the examples. - ''' - # doesn't hurt to run init/update in case the repo doesn't exist yet. - # if there are still files in it from before switching to submodules, they need to be deleted...
codereview_python_data_5700
assert_equal(len(u.atoms), 3341, "Loading universe failed somehow") assert_equal(u.trajectory.n_frames, 2 * ref.trajectory.n_frames) def test_pickle(self): u = mda.Universe(PSF, DCD) - s = cPickle.dumps(u, protocol = cPickle.HIGHEST_PROTOCOL) - new_u = cPickle.loads(s) ...
codereview_python_data_5712
if os.path.exists('/var/log/forseti.log'): # ubuntu on GCE default_log_handler = logging.FileHandler('/var/log/forseti.log') else: default_log_handler = logging.handlers.SysLogHandler() - - default_log_handler.setFormatter(logging.Formatter(SYSLOG_LOG_FMT)) logger_instance = logging...
codereview_python_data_5719
def test_can_send_bytes_bytearray_objects_with_files(self): # Test bytes: - data = {'a': 0.0} files = {'b': b'foo'} r = requests.Request('POST', httpbin('post'), data=data, files=files) p = r.prepare() @Lukasa I thought we expected all data to be bytes/string and were ge...
codereview_python_data_5721
This module contains the functionality that is used when benchmarking modin commits. In the case of using utilities from the main modin code, there is a chance that when benchmarking old commits, the utilities changed, which in turn can unexpectedly affect -the performance results. """ import os ```suggestion the...
codereview_python_data_5732
Store the partition information """ # Get shared data from server side request = GetSharedDataRequest(GET_SHARED_MSG) rpc.send_request(self._main_server_id, request) response = rpc.recv_response() revert the change here. Store the partition inform...
codereview_python_data_5733
:param obj: :rtype: bool """ - dumpable_types = (cls.TYPES, JSONDumpable) return isinstance(obj, dumpable_types) @staticmethod This changes the result completely. Is this intentional change? Also weird that no unit test has detected this problem :param obj: ...
codereview_python_data_5734
class AlignmentHasDifferentLengthsError(Exception): - """Manage exceptions for Alignments with different length.""" pass Why "Manage"? Also having looked at the context it is raised, it would be more accurate to say something like "Exception where sequences in alignment have different lengths". Looking at thi...
codereview_python_data_5738
def compare_arguments(self, target_path, arguments, corpora_or_testcase, actual): """Compare expected arguments.""" - self.assertListEqual( - actual, - ['/usr/bin/unshare', '-U', '--map-root-user', '-n', target_path - ] + arguments + corpora_or_testcase) @test_u...
codereview_python_data_5748
self.data_instance_type = iris.cube.Cube self.init_data() def test_dataset_add_dimensions_values_hm(self): pass I assume you are doing this to disable some of the inherited tests. A docstring explaining why these tests are not enable would be good... self.data_instance_type = ...
codereview_python_data_5750
""" bs = len(img_metas) input_img_h, input_img_w = img_metas[0]['batch_input_shape'] - padding_mask = feats[-1].new_zeros((bs, input_img_h, input_img_w), - dtype=torch.float32) for i in range(bs): img_h, img_w, _ = img_met...
codereview_python_data_5760
return ret def from_networkx(self, nx_graph): - # FIXME: the doc says that the argument should be nx.DiGraph but in - # fact it can take in any data convertible to nx.DiGraph. Is this - # intended? """Convert from networkx graph. If 'id' edge attribute exists, the e...
codereview_python_data_5766
"""Upload inventory summary to GCS.""" -from google.cloud.forseti.common.gcp_api import storage from google.cloud.forseti.common.util import date_time from google.cloud.forseti.common.util import logger from google.cloud.forseti.common.util import string_formats Please do not use abbreviation in class name `GcsInv...
codereview_python_data_5767
suggestions[entry['target']].update(entry) suggestions[entry['target']]['count'] += 1 except DataError as e: - # Catches 'argument exceeds the maximum length of 255 bytes' Error - return HttpResponse(status=501, reason='Not Implemented: {error}'.format(error=e)) ret...
codereview_python_data_5768
_plot_methods = dict(single='bezier') def get_data(self, element, ranges=None, empty=False): - data_attrs = ['x0', 'y0', 'x1', 'y1', - 'cx0', 'cy0', 'cx1', 'cy1'] verts = np.array(element.data[0]) inds = np.where(np.array(element.data[1])==1)[0] data = {d...
codereview_python_data_5772
if self.is_parallel and not self.is_nested_prange: code.putln("/* Clean up any temporaries */") for temp, type in sorted(self.temps): - code.put_xdecref_clear(temp, type, do_for_memoryviewslice=True, have_gil=False) def setup_parallel_control_flow_block(self, code)...
codereview_python_data_5773
"""Configure self._clear_timer according to the config.""" interval = config.get('ui', 'message-timeout') if interval != 0: - multimpy_by = len(self._messages) + 1 - if multimpy_by > 5: - multimpy_by = 5 - interval *= multimpy_by se...
codereview_python_data_5776
from panopticapi.evaluation import OFFSET, VOID, PQStat from panopticapi.utils import IdGenerator, rgb2id -from .api_wrappers import COCO as _COCO from .builder import DATASETS from .coco import CocoDataset We can directly use COCOPanoptic from panopticapi.evaluation import OFFSET, VOID, PQStat from panopticapi...
codereview_python_data_5781
G2 = nx.barbell_graph(3, 0) # There is only one cut edge, and each set has volume seven. S2 = {0, 1, 2} - conductance_no_T = nx.conductance(G2, S2) - expected2 = 1 / 7 - assert expected2 == conductance_no_T class TestEdgeExpansion: ```suggestion assert nx.conductance(G2...
codereview_python_data_5784
assert_equal(sorted(G.neighbors('C')),['D']) assert_equal(sorted(G['C']),['D']) assert_equal(sorted(G.neighbors('A')),['B', 'C']) - assert_equal(sorted(G.neighbors('A')),['B', 'C']) - assert_equal(sorted(G.neighbors('C')),['D']) - assert_equal(sorted(G.neighbors('A')),['B...
codereview_python_data_5787
search command. """ - aliases = ('search', 's') summary = _('search package details for the given string') @staticmethod Zypper calls this `se`, and I think that makes more sense than `s`. search command. """ + aliases = ('search', 'se') summary = _('search package details for...
codereview_python_data_5788
class TestFont: - """Test Font.""" - TESTS = { # (style, weight, pointsize, pixelsize, family '"Foobar Neue"': Feel free to just remove the docstring completely class TestFont: TESTS = { # (style, weight, pointsize, pixelsize, family '"Foobar Neue"':
codereview_python_data_5791
a = a1 + a2 # shape (B, deg, 1) e = F.softmax(F.leaky_relu(a), dim=1) if self.attn_drop != 0.0: - e = F.dropout(e, self.attn_drop, training=self.training) return {'accum': torch.sum(e * ft, dim=1)} # shape (B, D) Instead of using nn.functional.dropout, let's change to a...
codereview_python_data_5797
'memory://thisshouldntbethebroker') assert self.app.conf.broker_url == prepatch_broker_url def test_table(self): assert self.app.conf.table(with_defaults=True) assert self.app.conf.table(with_defaults=False) The application configuration has already been reso...
codereview_python_data_5800
from google.cloud.forseti.common.util import logger from google.cloud.forseti.common.util import string_formats from google.cloud.forseti.notifier.notifiers import findings -from google.cloud.forseti.notifier.notifiers.gcs_inv_summary import ( - GcsInvSummary) from google.cloud.forseti.notifier.notifiers.base_no...
codereview_python_data_5801
dist.broadcast(module.running_var, 0) dist.broadcast(module.running_mean, 0) if not self.by_epoch or not self.evaluation_flag(runner): return Seems this code snippet is used several times, how about turning it into a method? dist.bro...
codereview_python_data_5805
def get_commited_votes(self, bigchain, election_pk=None): if election_pk is None: election_pk = self.to_public_key(self.id) - txns = list(backend.query.get_received_votes_for_election(bigchain.connection, self.id, election_pk)) return self.count_votes(election_pk, txns) @...
codereview_python_data_5808
queue_url = self._queue_url(path, req_data, headers) self._set_queue_attributes(queue_url, req_data) elif action == 'DeleteQueue': - del QUEUE_ATTRIBUTES[self._queue_url(path, req_data, headers)] if 'QueueName' in req_data: enco...
codereview_python_data_5816
"Bio.KEGG.Compound", "Bio.KEGG.Enzyme", "Bio.NMR.xpktools", - "Bio.MaxEntropy" "Bio.motifs", "Bio.motifs.applications._xxmotif", "Bio.pairwise2", Missing trailing comma - would instead get concatenated with the next line I think. "Bio.KEGG.Compound", "Bio.KEGG.Enzyme", ...
codereview_python_data_5818
label = 'order' name = 'oscar.apps.order' verbose_name = _('Order') - - def ready(self): - from . import receivers # noqa - super(OrderConfig, self).ready() I don't think we need a `super()` call here - the parent method is a noop. label = 'order' name = 'oscar.apps.order' ...
codereview_python_data_5826
test_tool.ParseOptions(options) test_tool.ProcessStorage() - with open(temp_file_name, 'r') as file_object: for line in file_object.readlines(): lines.append(line.strip()) `open(temp_file_name, 'r')` => `io.open(temp_file_name, 'rb', encoding='utf-8')` ? test_tool.ParseOp...
codereview_python_data_5845
image=tf.convert_to_tensor(rand_image), flow=tf.convert_to_tensor(rand_flows), ) - np.testing.assert_allclose(rand_image, interp, rtol=1e-3) def test_zero_flows(): ```suggestion np.testing.assert_allclose(rand_image, interp, rtol=1e-6, atol=1e-6) ``` For info, the signature of assertAllClose is `def ...
codereview_python_data_5862
"""Set up.""" fake_global_configs = { 'securitycenter': {'max_calls': 1, 'period': 1.1}} - cls.securitycenter_api_client = securitycenter.SecurityCenterClient(version='v1') cls.project_id = 111111 cls.source_id = 'organizations/111/sources/222' ditto, we don't ne...
codereview_python_data_5870
# Link property reference; the source is the # link immediately preceding this step in the path. if path_tip.rptr is None: - source = get_set_type(path_tip, ctx=ctx) - s_dn = source.get_displayname(ctx.env.schema) - ...
codereview_python_data_5875
def test_alignto_sort(self, universe): mobile = universe.atoms[:4] ref = universe.atoms[[3, 2, 1, 0]] - assert align.alignto(mobile, ref, select='bynum 1-4') == (0.0, 0.0) def _get_aligned_average_positions(ref_files, ref, select="all", **kwargs): I sometimes get a bit nervous on exact e...
codereview_python_data_5878
def remove_blank_target(self): """Remove target from link.""" elem = self._elem - for i in range(5): if elem is None: break tag = elem.tagName().lower() Since you don't need `i` here, can you name it `_` instead? def remove_blank_target(sel...
codereview_python_data_5879
self.shmem_buffer_holder.append( self._shared_cache[emb_name][grad_shmem_name]) - # The minimun buffer size is 32. # We extend the buffer by idx_i.shape[0] * 2 to avoid ...
codereview_python_data_5893
upsample_ratio=2, num_classes=81, class_agnostic=False, - carafe_cfg=None, conv_cfg=None, norm_cfg=None, loss_mask=dict( Maybe renamed to `upsample_cfg` for future usage. upsam...
codereview_python_data_5908
def to_array(dali_out): if isinstance(dali_out, TensorListGPU): - dali_out = dali_out.asCPU() return np.squeeze(dali_out.as_array()) I believe `as_cpu() ` is the proper syntax now. `asCPU` is deprecated def to_array(dali_out): if isinstance(dali_out, TensorListGPU): + dali_out = dali_ou...
codereview_python_data_5916
'similarity.similar_users', params=params)) -@cli.command(name='request_similar_users') @click.pass_context def request_all_stats(ctx): ctx.invoke(request_user_stats, type_="entity", range_="week", entity="artists") should be request_all_stats 'similarity.similar_users', params=params)) +@cli...
codereview_python_data_5919
# END String map partitions operations - def repeat(self, repeats): - new_modin_frame = self._modin_frame._apply_full_axis( - 0, lambda df: df.squeeze().repeat(repeats, axis=None) - ) - return self.__constructor__(new_modin_frame) - def unique(self): """Return uniqu...
codereview_python_data_5921
path : file or string File, directory, or filename to read. - simplify: Simplify line geometries to start and end coordinates - If False, and line feature geometry has multiple segments, the - attributes for that feature will be repeated for each edge comprising - that feature ...
codereview_python_data_5924
order_args[asset] = (asset, amount, style) order_ids = self.blotter.batch_order(viewvalues(order_args)) - order_ids = pd.Series(data=order_ids, index=order_args) - return order_ids[~order_ids.isnull()] @error_keywords(sid='Keyword argument `sid` is no longer supported for ' ...
codereview_python_data_5931
df.index = [(i - length / 2) % length for i in range(length)] # Add NaNs to sorted index - meta = {0: "index", 1: "columns"} for df in [modin_df, pandas_df]: - sort_index = getattr(df, meta[axis]) - setattr( - df, - meta[axis], [np.nan if i % 2 ...
codereview_python_data_5942
from google.cloud.security.inventory.pipelines import load_group_members_pipeline from google.cloud.security.inventory.pipelines import load_org_iam_policies_pipeline from google.cloud.security.inventory.pipelines import load_orgs_pipeline from google.cloud.security.inventory.pipelines import load_projects_iam_poli...
codereview_python_data_5943
err_msg = "Frechet distances did not increase after path reversal" assert_(self.frech_matrix[1,2] >= self.frech_matrix[0,1], err_msg) - def check_dendrogram_produced(self): err_msg = "Dendrogram dictionary object was not produced" assert_(type(self.plot_data[1]) is dict, err_msg) ...
codereview_python_data_5948
self._out_feats = out_feats self._k = k with self.name_scope(): - # NOTE(zihao): MXNet do not support ModuleList, use Sequential as workaround. self.fc = nn.Sequential() for _ in range(k): self.fc.add( I think Sequential is the right way....
codereview_python_data_5950
from azurelinuxagent.common.future import ustr import azurelinuxagent.common.logger as logger from azurelinuxagent.common.protocol.restapi import DataContract, set_properties from azurelinuxagent.common.utils.flexible_version import FlexibleVersion IMDS_ENDPOINT = '169.254.169.254' -IMDS_ENDPOINT_BACKUP = '168.63....
codereview_python_data_5956
self.entry.create_wrapper = True else: if self.overridable: - error(self.pos, "Variables can not be cpdef") if self.directive_locals: error(self.pos, "Decorators can only be followed by functions") ...
codereview_python_data_5962
device, flatten=False): """Almost the same as the implementation in fcos, we remove half stride - offset to align with the original implementation.""" warnings.warn( '`_get_points_single` in `AutoAssignHead` will be ' ...
codereview_python_data_5963
def out_degrees(self, u=ALL): """Return the out-degree(s) of the given nodes. - It computes the out-degree(s) w.r.t. to the edges of the given edge type. It does not support heterogeneous graphs yet. Parameters So where is the edge type? def out_degrees(self, u=ALL): ...
codereview_python_data_5965
import argparse -import math import os import time -import dgl -import dgl.function as fn import numpy as np -import scipy.sparse as sp import sklearn.preprocessing import torch import torch.nn as nn Seems I'am always getting "Iteration 0/MAX", which is a bit confusing. Maybe you can just remove it if this does...
codereview_python_data_5967
aligner.score("AAA", "AA&") def test_aligner_array_errors(self): - import array aligner = Align.PairwiseAligner() self.assertEqual(aligner.alphabet, "ABCDEFGHIJKLMNOPQRSTUVWXYZ") s1 = "GGG" Move the import to the top of the file? aligner.score("AAA", "A...
codereview_python_data_5969
tasks = [TaskRole('test', 'cd scikit-learn/benchmarks && python bench_mnist.py', memoryMB=4096)] -class FailJob(PaiTask): - image = "openpai/pai.example.sklearn" - name = "test_job_fail_{0}".format(time.time()) - command = 'cd scikit-learn/benchmarks && python bench_mnist.py' - virtual_cluster = 'spark...
codereview_python_data_5970
basestring = str # Python 3 class NotConstant(object): - def __deepcopy__(self, memo): - return self def __repr__(self): return "<NOT CONSTANT>" Wouldn't using **new** be more robust for making sure this is a singleton class? basestring = str # Python 3 class NotConstant(object): +...
codereview_python_data_5976
from django.conf import settings customDir = join(dirname(__file__), 'custom') customModPrefix = 'graphite.functions.custom.' maybe add some function validations here ? (types are known, etc..) from django.conf import settings +from graphite.functions.params import Param, ParamTypes # noqa +from graphite.logger ...
codereview_python_data_5980
prev_block_id = g.id for block in range(4): transactions = [ - Transaction.create( - [b.me], [user_vk], metadata={'i': i}).sign([b.me_private]) for i in range(10) ] block = b.create_block(transactions) Since `Transaction.asset` can never be `N...
codereview_python_data_5986
key: mark identifier; capital indicates a global mark """ self._tabbed_browser.jump_mark(key) - - @cmdutils.register(instance='command-dispatcher', scope='window') - @cmdutils.argument('count', count=True) - def repeat_command(self, count=None): - """Repeat the last execut...
codereview_python_data_5988
"timeout tuple, or a single float to set " "both timeouts to the same value".format(timeout)) raise ValueError(err) elif timeout is not None: timeout = TimeoutSauce(connect=timeout, read=timeout) Unfortunately, this change is breaki...
codereview_python_data_5997
return ret return lhex(x) - -class ThreeBytesEnumField(EnumField, ThreeBytesField): - - def __init__(self, name, default, enum): - EnumField.__init__(self, name, default, enum, "!I") - - class _MultiEnumField(_EnumField): def __init__(self, name, default, enum, depends_on, ...
codereview_python_data_6003
@cmdutils.register() @cmdutils.argument('tab', value=cmdutils.Value.cur_tab) def reverse_selection(tab: apitypes.Tab) -> None: - """Toggle caret selection mode.""" tab.caret.reverse_selection() That seems wrong. @cmdutils.register() @cmdutils.argument('tab', value=cmdutils.Value.cur_tab) def reverse_sel...
codereview_python_data_6004
locale=locale, entity=t.entity, translation=t, - project=t.entity.resource.project, ) for t in Translation.objects.filter(pk__in=changed_translation_pks).prefetch_related('entity__resource')] TranslationMemoryEntry.objects.bulk_create(memory_entries) There's already `project...
codereview_python_data_6009
corpus_backup_dir = ('gs://{bucket}/corpus/libfuzzer/test2_fuzzer/') gsutil.GSUtilRunner().run_gsutil([ 'cp', (corpus_backup_dir + - 'backup.zip').format(bucket=TEST_BUCKET_TEST2_BACKUP), (corpus_backup_dir + '%s.zip' % corpus_backup_date).format(bucket=self.backup_bu...
codereview_python_data_6012
]) == 0 -def on_master(): - return hash_for_name('HEAD') == merge_base('HEAD', 'origin/master') - - def changelog(): with open(os.path.join(ROOT, 'docs', 'changes.rst')) as i: return i.read() > This updates the master check to use "git merge-base --is-ancestor" ]) == 0 def changelog(): ...