id
stringlengths
24
28
content
stringlengths
121
2.08k
codereview_python_data_4160
Group.url: '[src], [href]', Group.prevnext: 'a, area, button, link, [role=button]', Group.focus: '*:focus', - Group.inputs: 'input[type=text], input[type=password], textarea', } Why only `text` and `password` as types, instead of `input:not([type=hidden])` like above in `Group.all`? Group.url:...
codereview_python_data_4165
os.symlink(os.path.join(os.pardir, os.pardir, os.pardir, 'Contents', 'MacOS', lib), os.path.join(dest, lib)) - # Patch Info.plist to declare URLs support plist_path = os.path.join(app_path, 'Contents', 'Info.plist') with open(plist_path, "rb") a...
codereview_python_data_4168
LOGGER = logger.get_logger(__name__) -CAI_RESOURCE_TYPE_MAPPING = { - 'lien': 'cloudresourcemanager.googleapis.com/Lien', - 'sink': 'logging.googleapis.com/LogSink' -} - class CaiDataModel(base_data_model.BaseDataModel): """Cloud Asset Inventory (CAI) Data Model.""" Is this repeated from above, from `conf...
codereview_python_data_4170
def test_paddle_prepare_first_batch(): from nvidia.dali.plugin.paddle import DALIGenericIterator as PaddleIterator check_prepare_first_batch(PaddleIterator, output_map=["data"], - to_np=lambda x: np.array(x["data"])) \ No newline at end of file add line break at the end def te...
codereview_python_data_4172
views.ajax_permissions, name='pontoon.teams.ajax.permissions'), url(r'^(?P<locale>[A-Za-z0-9\-\@\.]+)/request/$', views.request_item, name='pontoon.teams.request.projects'), - - # AJAX: Request team to be added to Pontoon - url(r'^request/team/$', - views.request_it...
codereview_python_data_4173
logits_in_channel = ( self.conv_out_channels if self.upsample_method == 'deconv' else upsample_in_channels) - if self.predictor_cfg: - self.conv_logits = build_conv_layer(self.predictor_cfg, - logits_in_channel, - ...
codereview_python_data_4174
for k in range(K)] B = [experiment('xentropy', label_type='binary', data=DATA)['time'] for k in range(K)] -print(f"Best `binary` time: {str(min(A))}") -print(f"Best `xentropy` time: {str(min(B))}") ```suggestion print(f"Best `binary` time: {min(A)}") print(f"Best `xentropy` time: {min(B)}") ``` `str()` is...
codereview_python_data_4177
'Source type\t: {0:s}\n'.format(self._source_type)) if self._artifact_filters: self._output_writer.Write('Artifact filters\t: {0!s}\n'.format( - self._artifact_filters)) if self._filter_file: self._output_writer.Write('Filter file\t: {0:s}\n'.format( self._filter_fil...
codereview_python_data_4178
data['score'] = float(bboxes[i][4]) data['category_id'] = 1 json_results.append(data) - return dict(proposal=json_results) def det2json(dataset, results): The return types of `xxx2json` should remain the same. data['score'] = float(bboxes[i][4]) dat...
codereview_python_data_4185
return element @staticmethod - def _get_csv_config_random(path, delimiter, loop, variable_names, random_order, encoding, same_list): """ :type path: str is it possible to write in single line? return element @staticmethod + def _get_csv_config_random(path, delimiter...
codereview_python_data_4194
:param ramp_up: int ramp_up period :return: """ - rampup_sel = ".//stringProp[@name='ThreadGroup.ramp_time']" for group in jmx.enabled_thread_groups(): prop = group.find(rampup_sel) Let's not rely on "stringProp". Let's rely on any node with such name. ...
codereview_python_data_4198
from copy import deepcopy from hashlib import sha256 from plenum.common.types import OPERATION from plenum.common.constants import TXN_TYPE, RAW, ENC, HASH from plenum.server.client_authn import NaclAuthNr, CoreAuthNr, CoreAuthMixin -from indy_common.constants import ATTRIB, POOL_UPGRADE, SCHEMA, CLAIM_DEF, \ - ...
codereview_python_data_4200
class Handler(base_handler.Handler): - """Handler that gets the crash stats when user first lands on the page.""" @handler.post(handler.JSON, handler.JSON) @handler.oauth Does handler.oauth decorator not check this ? class Handler(base_handler.Handler): + """Handler for crash querying.""" @handler.post(h...
codereview_python_data_4203
def test_preflow_push_makes_enough_space(): #From ticket #1542 G = nx.DiGraph() - G.add_path([0,1,3],capacity=1) - G.add_path([1,2,3],capacity=1) - R = preflow_push(G,0,3,value_only=False) assert_equal(R.graph['flow_value'], 1) def test_shortest_augmenting_path_two_phase(): Please ensure that...
codereview_python_data_4204
im_ids_16) def _test_tf_dataset(device): skip_for_incompatible_tf() Why we need run `sess` twice? im_ids_16) +def _dataset_options(): + options = tf.data.Options() + try: + options.experimental_optimization.apply_default_optimizations = False + options.experimental_...
codereview_python_data_4206
# -*- coding: utf-8 -*- import time -<<<<<<< HEAD import json import random -======= -import random ->>>>>>> refs/remotes/origin/patch-2 from pgoapi.utilities import f2i from pokemongo_bot import logger Merge conflict was committed here ^ # -*- coding: utf-8 -*- import time import json import random from p...
codereview_python_data_4215
def test_example(self): p = PDBParser(PERMISSIVE=True) - s = p.get_structure("test", sys.argv[1]) - io = PDBIO() - io.set_structure(s) filenumber, filename = tempfile.mkstemp() os.close(filenumber) with open("out2.pdb", "w") as fp: s1 = p.get_st...
codereview_python_data_4216
except Exception as e: print(e) -#snippet-end:[iam.python.create_role.complete] #snippet-comment:[These are tags for the AWS doc team's sample catalog. Do not remove.] #snippet-sourcedescription:[create_role.py demonstrates how to create an IAM Role.] #snippet-keyword:[Python] This should say `#snippet-start:...
codereview_python_data_4217
import os import os.path -from molecule import utilities import anyconfig DEFAULT_CONFIG = os.path.join(os.path.dirname(__file__), 'conf/defaults.yml') PROJECT_CONFIG = 'molecule.yml' LOCAL_CONFIG = '~/.config/molecule/config.yml' Not sure why this moved? I think our standard order is: 1. Core modules 2. 3rd par...
codereview_python_data_4220
mem_limit = max(DEFAULT_MEM_LIMIT_MIN_MB, round(os_util.get_total_mem() * DEFAULT_MEM_LIMIT_PCT / 100, 0)) # agent values - if AGENT_NAME.lower() in cgroup_name.lower(): mem_limit = min(DEFAULT_MEM_LIMIT_MAX_MB, mem_limit) return mem_limit - - -class CGroupsUtils(object): ...
codereview_python_data_4223
return not rev if x is None else rev def sort_func(src, rev, na_pos): - res = sorted(src, key=lambda x: (key_func(x, rev, na_pos), x), reverse=rev) return res If you handle `na_pos="remove"` here, then the tests can be simplified (making them parametrized on the `na_position` argument): ``` if na_pos...
codereview_python_data_4225
# where 0 represents unlimited. # We need to check that we aren't asking for a bigger queue than the - # platform supports, which requires access to this internal value. # pylint: disable=no-member,protected-access queue_max_length = _multiprocessing.SemLock.SEM_VALUE_MAX # pylint: enable=no...
codereview_python_data_4234
from .sklearn import LGBMModel -def _check_not_tuple_of_2_elements(obj: Any, obj_name: str = 'obj') -> Optional[str]: """Check object is not tuple or does not have 2 elements.""" if not isinstance(obj, tuple) or len(obj) != 2: raise TypeError(f"{obj_name} must be a tuple of 2 elements.") ```suggest...
codereview_python_data_4235
# e.g. with lib.log #: Release of MDAnalysis as a string, using `semantic versioning`_. -__version__ = "1.0.0-dev0" # NOTE: keep in sync with RELEASE in setup.py Tests are failing because this tag is different from the one in `MDAnalysisTests/__init__.py`. ``` E AssertionError: MDAnalysis release 1.0.1-dev0 must be...
codereview_python_data_4243
def __repr__(self) -> str: return ( f'<pg.{self.__class__.__name__} ' - f'name={self.relation.name!r} at 0x{id(self):x}>' ) ```suggestion f'name={self.relation.name!r} at {id(self):#x}>' ``` :) def __repr__(self) -> str: return ( f'<pg.{self.__...
codereview_python_data_4245
from __future__ import print_function import tensorflow as tf -from tensorflow_addons.utils import keras_utils -@keras_utils.register_keras_custom_object class SWA(tf.keras.optimizers.Optimizer): """This class extends optimizers with Stochastic Weight Averaging (SWA). Replace with `@tf.keras.utils.register_ker...
codereview_python_data_4248
Returns ------- - dict - With ``str`` keys and ``tensor`` values. """ return self._src_data This line is usually used to explain what is the meaning of the returned value. Returns ------- + dict with ``str`` keys and ``tensor`` values + ...
codereview_python_data_4266
""" data = self._data if not isinstance(data, (bytes, bytearray)): - data = bytes(data) return data.decode("ASCII") def __hash__(self): What else could it be? """ data = self._data if not isinstance(data, (bytes, bytearray)): + ...
codereview_python_data_4271
reproduction_help_url = ndb.StringProperty(default='') # Documentation url. - documentation_url = ndb.StringProperty( - default='https://google.github.io/clusterfuzz/') # Bug report url. - bug_report_url = ndb.StringProperty( - default='https://github.com/google/clusterfuzz/issues') # Platforms ...
codereview_python_data_4273
def _get_streams(self): is_live = False - video_id = self._find_video_id(self.url) - self.video_id = video_id - log.debug("Using video ID: {0}", video_id) - info = self._get_stream_info(video_id) if info and info.get("status") == "fail": log.error("Could n...
codereview_python_data_4276
-from calendar import monthrange -from datetime import datetime -from dateutil.relativedelta import relativedelta - -import listenbrainz_spark -from listenbrainz_spark.exceptions import SQLException - -from pyspark.sql.utils import * -from listenbrainz_spark.stats import utils \ No newline at end of file This isn't id...
codereview_python_data_4280
""" request: HTTPRequest response: Optional[HTTPResponse] = None - trailers: http.Headers error: Optional[flow.Error] = None """ Note that it's possible for a Flow to have both a response and an error I suppose trailers are optional as well? """ request: HTTPRequest res...
codereview_python_data_4282
lines = [] output = output_writer.ReadOutput() output = codecs.decode(output, 'utf-8') for line in output.split('\n'): lines.append(line) why not encode the `expected_line` instead of decoding all the output? lines = [] output = output_writer.ReadOutput() + # TODO: add test out...
codereview_python_data_4285
TX_IN_BACKLOG = 'backlog' """return if transaction is in backlog""" - def __init__(self, tendermint_host=None, tendermint_port=None, connection=None): """Initialize the Bigchain instance A Bigchain instance has several configuration parameters (e.g. host). I don't think we need this, the...
codereview_python_data_4286
runner.register_hook(eval_hook(val_dataloader, **eval_cfg)) # user-defined hooks - if cfg.get('hooks', None): for hook_cfg in cfg.hooks: hook_cfg = hook_cfg.copy() priority = hook_cfg.pop('priority', 'NORMAL') Rename the field `hooks` to `additional_hooks` or `custom...
codereview_python_data_4287
url = flow.request.pretty_url else: url = flow.request.url - terminalWidthLimit = shutil.get_terminal_size()[0] - 25 if self.flow_detail < 1 and len(url) > terminalWidthLimit: url = url[:terminalWidthLimit] + "…" url = click.style(strutils.escape_...
codereview_python_data_4292
.. versionchanged:: 0.11.0 Frames now 0-based instead of 1-based .. versionchanged:: 2.0.0 - Reader now raises error if unitcell has neither 3 or 9 entries. Reader now reads a 3 entry zero unit cell (i.e. ``[0, 0, 0]``) as a being without dimension information (i.e. will the time...
codereview_python_data_4298
@staticmethod def _print_default_format_warning(file_format): - """Print a warning to stdout. Temporary warning (similar to a deprecation warning) that files are being downloaded in mmCIF. Should this end with '(PRIVATE)' like in `Bio/Nexus/Nexus.py` so as to keep this consistent? ...
codereview_python_data_4302
echo = self.stub.Ping(notifier_pb2.PingRequest(data=data)).data return echo == data - def run(self, config_file, inventory_index_id): """Runs the notifier. Args: - config_file (str): Path the to the forseti config file. inventory_index_id (int): Inventory I...
codereview_python_data_4315
mode = self.rule['mode'] has_violation = False - crypto_key = self.rule['key'] - for key_data in crypto_key: rule_algorithms = key_data.get('algorithms') rule_protection_level = key_data.get('protection_level') rule_purpose = key_data.get('purpose')...
codereview_python_data_4318
spotipy_call = getattr(spotipy_client, endpoint) recently_played = spotipy_call(**kwargs) break except SpotifyException as e: retries -= 1 if e.http_status == 429: these could fail if the endpoint doesn't exist on the client, or if the kwargs ar...
codereview_python_data_4323
def gen_base_anchors(self): w = self.base_size h = self.base_size - if self.ctr is None: - x_ctr = self.ctr_offset * (w - 1) - y_ctr = self.ctr_offset * (h - 1) else: - x_ctr, y_ctr = self.ctr h_ratios = torch.sqrt(self.ratios) w_...
codereview_python_data_4325
self.ready_event = threading.Event() self.stop_event = threading.Event() - self.server_sock = self._create_socket_and_bind() - # in case self.port = 0 - self.port = self.server_sock.getsockname()[1] - @classmethod def text_response_server(cls, text, request_timeout=0.5, ...
codereview_python_data_4326
The time difference between frames (ps). If :attr:`time` is set, then `dt` will be ignored. filename: string, optional - The name of the file from which this instance is created """ super(MemoryReader, self).__init__() Maybe state it will otherwise be No...
codereview_python_data_4330
Parameters ---------- row_labels : list-like, slice or label - The indices for the rows to extract. col_labels : list-like, slice or label - The indices for the columns to extract. Returns ------- docstring is now wrong Parameters ...
codereview_python_data_4334
parent (Resource): The parent Resource. lifecycle_state (LifecycleState): The lifecycle state of the bucket. - lifecycle (list): A list of dicts that contains actions - ("delete") and conditions ("age") """ super(Bucket, self).__init...
codereview_python_data_4335
def _ref(var): - release = tf.__version__[:5] - if release < "2.0.0": - return var - else: - return var.ref() if hasattr(var, "ref") else var.experimental_ref() class DecoupledWeightDecayExtension: tf.addons supports TF2 only anyway, maybe we can remove this string comparison and just return v...
codereview_python_data_4338
class argmap: - """A decorating class which calls specified transformations on a function's - arguments before calling it. Arguments can be specified either as strings, numerical indices, or (in the next example) tuples thereof @argmap(sum, 'x', 2) ```suggestion """Decorate a function by applying...
codereview_python_data_4340
# optimizer model = dict( pretrained='open-mmlab://resnext101_64x4d', - backbone=dict( - type='ResNeXt', - depth=101, - groups=64, - base_width=4, - num_stages=4, - out_indices=(0, 1, 2, 3), - frozen_stages=1, - norm_cfg=dict(type='BN', requires_grad=Tru...
codereview_python_data_4342
def __init__(self, streaming_jar, modules=None, streaming_args=None, libjars=None, libjars_in_hdfs=None, jobconfs=None, - archives=None, input_format=None, output_format=None, - end_job_with_atomic_move_dir=True): def get(x, default): return x...
codereview_python_data_4343
# Arguments that are just blank spaces aren't really arguments # We need to get rid of those. If the user intended to pass a sequence # of spaces, it would come between quotes - clean_args = [] - for a in args: - if isinstance(a, str): - if a.strip() !=...
codereview_python_data_4344
def read_numpy_offsets(filename): - """read offsets into dictionary. This assume offsets have been saved using - numpy Parameters ---------- Keep a single line as a summary, add everything after a blank, like ```reST read offsets in `filename` into dictionary This assumes offsets have been saved using...
codereview_python_data_4351
@property def is_unique(self): return self.nunique(dropna=False) == len(self) @property @amyskov plz add docstring compatible with numpydoc standard (#1411) @property def is_unique(self): + """Check if Series has no duplicate values. + + Returns + ------- + ...
codereview_python_data_4358
DEFAULT_LOG_FMT = ('%(asctime)s %(levelname)s ' '%(name)s(%(funcName)s): %(message).1024s') -SYSLOG_LOG_FMT = ('%(levelname)s [forseti-security] %(__version__)s ' '%(name)s(%(funcName)s): %(message).1024s') # %(asctime)s is used as the marker by multiline parser to determine We...
codereview_python_data_4360
''' - This solution implements a breadth-start_bucket search of the graph of possible valid states for the two buckets until it reaches a state in which one of the two buckets contains the goal amount ''' This appears to be an unintentional change from a Replace-All; please revert it. ''' + This so...
codereview_python_data_4364
'Rule %s already defined in rules: %s' % ( rule['name'], ', '.join(sorted(self.rules.keys())))) - if self._add_rule_callback: - if self._add_rule_callback(new_rule): - self.rules[new_rule['name']] = new_rule - else: self.rules[ne...
codereview_python_data_4365
def list_exfilled_files(self, startdir=None): if not startdir: startdir = self.get_config('exfil_dir') exfil_files = dict() exfil_folders = [f.path for f in os.scandir(startdir) if f.is_dir()] I went to the Exfills UI before running any operations, selected "all" and got an...
codereview_python_data_4370
http_message = message if ctype := message.headers.get("content-type"): if ct := http.parse_content_type(ctype): - content_type = http.assemble_content_type(ct[0], ct[1], ct[2]) description, lines, error = get_content_view( viewmode, content, I believe we nev...
codereview_python_data_4374
obj_type = TRACER_TO_REAL_TYPE_MAP[type(obj)] real_type = TRACER_TO_REAL_TYPE_MAP[tracer_type] raise errors.InvalidReferenceError( - f'{str(refname)!r} exists, but is a ' - f'{obj_type.get_schema_class_displayname()!r}, ' - f'not a {real_type.get_schema_class_...
codereview_python_data_4384
if SHOULD_INVENTORY_GROUPS: GROUPS_DOMAIN_SUPER_ADMIN_EMAIL = context.properties[ 'groups-domain-super-admin-email'] - GSUITE_SERVICE_ACCOUNT_KEY_FILE = context.properties[ 'groups-service-account-key-file'] # TODO: remove this in a future version This will requi...
codereview_python_data_4387
self.max_pokemon_storage = inventory.get_pokemon_inventory_size() self.last_pokemon_count = 0 - self.config_transfer = self.config.get("transfer", True) - self.config_evolve = self.config.get("evolve", True) self.config_evolve_time = self.config.get("evolve_time", 20) s...
codereview_python_data_4388
_row_partition_class = PandasOnDaskFrameRowPartition @classmethod - def get_indices(cls, axis, partitions, index_func=None): """This gets the internal indices stored in the partitions. Note: These are the global indices of the object. This is mostly useful Since `index_func` has to be a ...
codereview_python_data_4394
self.state = state self.retval = retval - @staticmethod - def get_name(task, req): - return req.shadow if hasattr(req, 'shadow') else task.name - def handle_error_state(self, task, req, eager=False, call_errbacks=True): store_errors = not eager I...
codereview_python_data_4399
self.vip_dictionary[Pokemons.id_for(key)] = 0 def is_snipeable(self, pokemon): - pokeballs_count = self.inventory.get(Item.ITEM_POKE_BALL.value).count - greatballs_count = self.inventory.get(Item.ITEM_GREAT_BALL.value).count - ultraballs_count = self.inventory.get(Item.ITEM_UL...
codereview_python_data_4404
self.tmaster.reset(addons) self.tmaster.addons.trigger("tick") class ProxyTestBase: # Test Configuration I think we have a `human_address` function for this somewhere...? self.tmaster.reset(addons) self.tmaster.addons.trigger("tick") + def start(self): + super().sta...
codereview_python_data_4407
refpos = positions.mean(axis=0) refpos = refpos.astype(np.float32, copy=False) - if target_position is None: - target = distances.apply_PBC(refpos, self.dimensions) - else: - target = distances.minimize_periodic_vector(reference_point=target_position, center_pos...
codereview_python_data_4408
print('Start training...') # train -gbm = lgb.LGBMRegressor(boosting_type='rgf', - objective='regression', num_leaves=31, learning_rate=0.05, n_estimators=20) I think it's better to create a new example print('Start t...
codereview_python_data_4412
or "REPORT" in raw_message # necessary until tail is updated in docker images. See this PR: # http://git.savannah.gnu.org/gitweb/?p=coreutils.git;a=commitdiff;h=v8.24-111-g1118f32 - or "tail: unrecognized file system type 0x794c7630" in raw_message or regex...
codereview_python_data_4421
dest="url_param", metavar="URL", help=""" - Alternative parameter to specify a URL to attempt to - extract streams from. """ ) stream.add_argument( Is there a way we could make this more user friendly in terms of explanation? I feel like it is a bit confusing, not sure if there is a better ...
codereview_python_data_4422
<h1>Error 503 Backend is unhealthy</h1> <p>Backend is unhealthy</p> <h3>Guru Mediation:</h3> - <p>Details: cache-sea4438-SEA 1645521621 3021675987</p> <hr> <p>Varnish cache server</p> </body> Can we please change this to: ``` test_role_arn = 'arn:aws:sts::000000000000:role/rd_role' ``` F...
codereview_python_data_4434
AbstractCommandline.__init__(self, cmd, **kwargs) def _validate_incompatibilities(self, incompatibles): - """Use _validate method by the BLAST+ (PRIVATE).""" for a in incompatibles: if self._get_parameter(a): for b in incompatibles[a]: The meaning has changed...
codereview_python_data_4437
self.base._module_persistor.set_data(self.repo_module, stream=self.stream, version=version, profiles=sorted(set(profiles))) - def nevra(self): - return self.artifacts() - def artifacts(self): return self.module_metadata.get_rpm_artifacts().g...
codereview_python_data_4442
:param proxies: A dictionary of schemes or schemes and hosts to proxy URLs. """ proxy = select_proxy(request.url, proxies) - if proxy and not request.url.lower().startswith('https'): url = urldefragauth(request.url) else: url = request.path_url This ...
codereview_python_data_4449
:return: """ if self.client.token: - worker_index = os.environ.get('TAURUS_INDEX_ALL', 'no_index') - artifacts_zip = "artifacts.%s.zip" % worker_index mfile = self.__get_jtls_and_more() self.log.info("Uploading all artifacts as %s ...", artifact...
codereview_python_data_4453
fetched_recs = self.idx._get_record(99228) - self.compare_record(recs[0], fetched_recs[0]) - self.compare_record(recs[1], fetched_recs[1]) - self.compare_record(recs[2], fetched_recs[2]) - self.compare_record(recs[3], fetched_recs[3]) - self.compare_re...
codereview_python_data_4454
async def _create_relationships(self, relationships, operation): for relationship in relationships: await self._save_fact(operation, relationship.source) - if all(relationship.target): - await self._save_fact(operation, relationship.target) self.relation...
codereview_python_data_4465
assert edge_dir == 'in' req_list = [] partition_book = dist_graph.get_partition_book() - np_nodes = np.array(nodes) partition_id = F.asnumpy( partition_book.nid2partid(F.tensor(np_nodes))) for pid in range(partition_book.num_partitions()): what happens if `nodes` is a DL tensor? ...
codereview_python_data_4467
return 'ANDROID' in (plt or platform()) -def is_android_gce(plt=None): """Return true if we are on android gce platform.""" return 'ANDROID_X86' in (plt or platform()) nit: rename to is_android_cuttlefish to be clearer. return 'ANDROID' in (plt or platform()) +def is_android_cuttlefish(plt=None): """Re...
codereview_python_data_4474
# if it is a new pokemon to our dex, simulate app animation delay if exp_gain >= 500: - sleep (randrange(newtodex_wait_min, newtodex_wait_max)) except IOError as e: self.logger.info('[x] Error while opening location f...
codereview_python_data_4479
Returns: str: A string representation of FirewallAction. """ - return "FirewallAction(action=%s, rules=%s)" % (self.action, self.rules) def json_dict(self): """Gets the JSON key and values for the firewall action. nit: could you use single quotes instead of double? (ju...
codereview_python_data_4490
"""Add another sequence or string to this sequence. The sequence is first converted to a Bio.Seq object before the addition. """ # Let the Seq object deal with the alphabet issues etc return self.toseq() + other I think it is unclear from text which object gets turned into ...
codereview_python_data_4496
point["lat"] = float(point_tuple[0]) point["lng"] = float(point_tuple[1]) point["alt"] = float(point_tuple[2]) - if "mode" not in point: - point["mode"] = "walking" return points def load_gpx(self): Replace this if block for `point["mode"] ...
codereview_python_data_4505
BigqueryAccessControlsData = collections.namedtuple( 'BigqueryAccessControlsData', - ['resource', 'bigquery_acl']) class BigqueryScanner(base_scanner.BaseScanner): """Scanner for BigQuery acls.""" (here and in function parameters of find_policy_violations). To avoid ambiguity, I think we should either r...
codereview_python_data_4510
user_id, limit=min(_parse_int_arg("count", DEFAULT_ITEMS_PER_GET), MAX_ITEMS_PER_GET), from_id=min_ts, - to_id=max_ts, - order=request.args.get("order", "desc"), ) listen_data = [] for listen in listens: does listenstore accept None as an argument? what's it's be...
codereview_python_data_4511
# custom wrappers around ops from nvidia.dali import backend as _b -from nvidia.dali._multiproc.messages import TaskArgs import nvidia.dali.types from nvidia.dali._utils.external_source_impl import \ get_callback_from_source as _get_callback_from_source, \ This is bad - you're exposing stuff from a privat...
codereview_python_data_4522
labelleft=False, ) - ax.margins(margins[0], margins[1]) node_collection.set_zorder(2) return node_collection ```suggestion if margins is not None: ax.margins(margins[0], margins[1]) ``` I think this is the cause of (at least) most errors. We have to treat the default case explicitly. ...
codereview_python_data_4525
return Result.ok(data=data) -def cast_validator(v): pub_key = v['pub_key']['data'] - # NOTE: tendermint expects public to be ecoded in go-wire format # so `01` has to be appended pubKey = bytes.fromhex('01{}'.format(pub_key)) return Validator(pubKey=pubKey, Why does nothing have to be a...
codereview_python_data_4543
`num_outputs` : int, optional If specified, denotes the number of TensorLists that are produced by the source function. - If set the returned output would be a list. Keyword Args ------------ ```suggestion If set, the operator returns a list of ``DataNode`` objects, otherwise a single ``DataNode`` object is...
codereview_python_data_4545
def __init__(self): super(ApiritifNoseExecutor, self).__init__() self._tailer = FileReader(file_opener=lambda _: None, parent_logger=self.log) - self._iteration_number = None - self._iteration_start = None def reporting_setup(self, prefix=None, suffix=None): if not sel...
codereview_python_data_4550
""" username = user['musicbrainz_id'] # insert payload looks for 'id' key whereas the user dict here has it in 'user_id' key - user['id'] = user['user_id'] retries = 10 while retries >= 0: try: current_app.logger.debug('Submitting %d listens for user %s', len(listens), ...
codereview_python_data_4551
raw_data = to_str(base64.b64decode(self.querystring.get('RawMessage.Data')[0])) - LOGGER.error('Raw email:\n%s' % raw_data) source = get_source_from_raw(raw_data) if not source: Error log level seem a bit too verbose here - can we use `LOGGER.info` (or `debug`) instead? raw_...
codereview_python_data_4552
try: body_seek(body_pos) except (IOError, OSError): - raise UnrewindableBodyError("An error occurred when rewinding request " "body for redirect/retry.") elif body_pos is _FAILEDTELL: raise UnrewindableBodyError("Unable to ...
codereview_python_data_4554
-# This file add snack case alias for coco api from pycocotools.coco import COCO as _COCO from pycocotools.cocoeval import COCOeval as _COCOeval class COCO(_COCO): def __init__(self, annotation_file=None): super().__init__(annotation_file=annotation_file) May add a docstring to indicate the difference...
codereview_python_data_4556
) async def test_edgeql_select_subshape_filter_01(self): async with self.assertRaisesRegexTx( edgedb.QueryError, "possibly an empty set returned", Ideally we should produce a good hint on what to do to fix the error with the use of `assert_exists`. ) asyn...
codereview_python_data_4559
import torch.nn as nn import torch.nn.functional as F from mmcv.cnn import (Conv2d, build_activation_layer, build_norm_layer, - constant_init, normal_init, trunc_normal_, - trunc_normal_init) from mmcv.cnn.bricks.drop import build_dropout from mmcv.cnn.bricks.transformer i...
codereview_python_data_4561
except KeyboardInterrupt: return except BaseException: - logger.exception("Error in event callback (%s) for %r", callback, event) @property def task_module(self): Always put changes like this in separate PRs please ex...
codereview_python_data_4562
max_crm_calls = configs.get('max_crm_api_calls_per_100_seconds', 400) crm_rate_limiter = RateLimiter(max_crm_calls, 100) pipelines = [ - LoadOrgIamPoliciesPipeline( - cycle_timestamp, configs, crm_rate_limiter, dao), # TODO: add load projects pipeline # TODO: add load ...
codereview_python_data_4564
self.write(data) -class RootPathHandler(tornado.web.RequestHandler): def get(self): - visualization_graph = configuration.get_config().get('core', 'visualization_graph', '') if visualization_graph == "d3": self.redirect("/static/visualiser/index.d3.html") else: ...
codereview_python_data_4575
new_instance = copy.deepcopy(self) for k, v in new_instance.items(): if isinstance(v, torch.Tensor): - v.to(*args, **kwargs) return new_instance # Tensor-like methods Does it support the slicing operator? new_instance = copy.deepcopy(self) ...
codereview_python_data_4582
-def treeFromTraversals(preorder, inorder): if len(preorder) != len(inorder): raise ValueError("traversals must have the same length") if set(preorder) != set(inorder): Forgive me; I've been bouncing between too many different languages lately. My previous suggestion was incorrect, this should be `s...