id
stringlengths
24
28
content
stringlengths
121
2.08k
codereview_python_data_6877
tx = b.create_transaction(b.me, user_vk, None, 'CREATE', payload=payload) payload_uuid = tx['transaction']['data']['uuid'] matches = b.get_tx_by_payload_uuid(payload_uuid) assert len(matches) == 1 assert matches[0]['id'] == tx['id'] This method will check the `bigchain` tab...
codereview_python_data_6878
test_with_categorical_variable ) for test_with_interaction_constraints in [True, False]: for monotone_constraints_method in ["basic", "intermediate", "advanced"]: params = { "min_data": 20, I'm ok with this change, but could you update the assert on line 1334 w...
codereview_python_data_6879
violations (dict): Violations to be uploaded as findings. organization_id (str): The id prefixed with 'organizations/'. """ - findings = self._transform_for_cscc_api(violations) client = securitycenter.SecurityCenterClient() Can we put a log message here? ...
codereview_python_data_6889
format = 'TNG' units = {'time': 'ps', 'length': 'nm', 'velocity': 'nm/ps', 'force': 'kJ/(mol*nm)'} - _writer = TRRWriter - _file = TRRFile def __init__(self, filename, convert_units=True, **kwargs): """ Why do we need '_frame'? We can just use ts.frame format = 'TNG' ...
codereview_python_data_6890
@staticmethod def _convert_fs_path(fs_path): - # Only Python 2 'unioode' needs to be converted to str/bytes try: if isinstance(fs_path, unicode): fs_path = fs_path.encode(sys.getfilesystemencoding()) ```suggestion # Only Python 2 'unicode' needs to be converted t...
codereview_python_data_6902
if isinstance(rampup, numeric_types) and isinstance(hold, numeric_types): duration = hold + rampup else: - duration = 0 trg = etree.Element("ThreadGroup", guiclass="ThreadGroupGui", testclass="ThreadGroup", testname=testname) what if one o...
codereview_python_data_6906
async def task_agent_with_ability(self, paw=None, ability_id=None): abilities = await self.get_service('data_svc').locate('abilities', match=dict(ability_id=ability_id)) - agent = await self.get_service('data_svc').locate('agents', match=dict(paw=paw)) - if abilities and agent: ...
codereview_python_data_6917
if isinstance(arrowsize, list): if len(arrowsize) != len(edge_pos): - raise ValueError("arrowsize should have the same length as G.edges") else: mutation_scale = arrowsize # scale factor of arrow head This error message will be incorrect in the case where a u...
codereview_python_data_6919
if src[self.RESP_TIMES]: self[self.RESP_TIMES].add(src[self.RESP_TIMES]) - - if not self[self.PERCENTILES]: # using existing percentiles # FIXME: it's not valid to overwrite, better take average self[self.PERCENTILES] = copy.deepcopy(src[self.PERCENTIL...
codereview_python_data_6921
Column A new column """ - if isinstance(self.storage, distributed.dist_tensor.DistTensor): # copy actual tensor from DistTensor, if self.storage is a DistTensor self._copy_dist_tensor() col = self.clone() Is this needed? `Column.data` will call `...
codereview_python_data_6927
<h1>Error 503 Backend is unhealthy</h1> <p>Backend is unhealthy</p> <h3>Guru Mediation:</h3> - <p>Details: cache-sea4463-SEA 1645521622 3631596217</p> <hr> <p>Varnish cache server</p> </body> I think we're missing `MessageConversion._fix_error_codes(method, data, response)` here. <...
codereview_python_data_6933
pass def _matrix(self, options): - """Creates a matrix for NEXUS object (PRIVATE)""" if not self.ntax or not self.nchar: raise NexusError('Dimensions must be specified before matrix!') self.matrix = {} And the trailing full stop too please. pass def _m...
codereview_python_data_6936
""" COVERAGE_UNCHANGED_SPECIFICATION = QuerySpecification( - adjusted_weight=0.65, threshold=1.0, query_format=COVERAGE_UNCHANGED_FORMAT, formatter=_coverage_formatter, Can you explain this more. """ COVERAGE_UNCHANGED_SPECIFICATION = QuerySpecification( + adjusted_weight=0.70, threshold...
codereview_python_data_6937
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) label_weights = anchors.new_zeros(num_valid_anchors, dtype=torch.float) pos_inds = sampling_result.pos_inds...
codereview_python_data_6940
) unrejected_date = models.DateTimeField(null=True, blank=True) - class Source(models.TextChoices): TRANSLATION_MEMORY = "translation-memory", "Translation Memory" GOOGLE_TRANSLATE = "google-translate", "Google Translate" MICROSOFT_TRANSLATOR = "microsoft-translator", "Microsoft ...
codereview_python_data_6945
self.cumulative_stats = CumulativeStats() stats_pane = Pile([(WEIGHT, 0.50, self.latest_stats), - (1, Filler(Divider())), (WEIGHT, 0.50, self.cumulative_stats), ]) self.graphs = ThreeGraphs() We don't need this divider self.cumu...
codereview_python_data_6947
} } } - - -TINY_CONTEXT = { - "@context": { - "ExhibitionEvent": {"@id": "schema:ExhibitionEvent"}, - "Eye": {"@id": "schema:Eye"} - } -} Do we have integration tests trying to write these Context examples? } } }
codereview_python_data_6949
""" Test if tax values are known for this basket """ - for line in self.all_lines(): - if not line.is_tax_known: - return False - return True @property def total_excl_tax(self): Nitpicking... Can be replaced by ``` return all([line.is_tax_kno...
codereview_python_data_6953
request = Request(data=encoded_data, headers=headers, method=method) return request elif req_data.get('Action', [None])[0] == 'SendMessage': - queue_url = req_data.get('QueueUrl', path)[0] queue_name = queue_url[queue_url.rindex('/') + 1:] ...
codereview_python_data_6956
def get_expr_referrers(schema: s_schema.Schema, - obj: so.Object) -> Dict[Any, Any]: """Return schema referrers with refs in expressions.""" refs = schema.get_referrers_ex(obj) The correct annotation for the return type is `Dict[so.Object, str]` def get_expr_referrers(schema: s_sche...
codereview_python_data_6960
label = param.Boolean(default=True, doc=""" Whether to use the parameter documentation as the dimension label""") def __call__(self, parameterized, **kwargs): types = {param.String:str, param.Integer:int} Can the precedence threshold be a parameter (defaulting to 0)? label = param.Boo...
codereview_python_data_6964
stride=1, padding=0, dilation=1, - deformable_groups=1): super(DeformConv, self).__init__() self.in_channels = in_channels self.out_channels = out_channels The default value should be kept consistent. st...
codereview_python_data_6970
class _NoLLSLenField(LenField): def i2m(self, pkt, x): if x is None: x = self.adjust(len(pkt.payload)) Please add a doctring. Also, why did use use an underscore to name this object? class _NoLLSLenField(LenField): + """ + LenField that will ignore the size of OSPF_LLS_Hdr if it exi...
codereview_python_data_6991
self.next_update = datetime.now() + timedelta(seconds=self.min_interval) - def _process_config(self): - """ - Fetches the configuration for this worker and stores the values internally. - :return: Nothing. - :rtype: None - """ - self.min_interval = int(self.config.g...
codereview_python_data_6993
return get_archive_type(filename) != ArchiveType.UNKNOWN -def _normalize_filename(filename): - """Normalize file name from archive for directory traversal detection.""" - if filename.startswith('./'): - filename = filename[2:] - if os.path.altsep: - filename = filename.replace(os.path.altsep, os.path.sep) -...
codereview_python_data_6994
elif isinstance(result_files, dict): result_file = result_files[res_type] else: - assert NotImplementedError assert result_file.endswith('.json') coco_dets = coco.loadRes(result_file) May raise a TypeError here. elif isinstance(result_files, dict): ...
codereview_python_data_6995
""" Utility to remove a temporary directory during program exit. """ try: shutil.rmtree(dirname) - print(("Removed temporary directory: %s" % dirname)) except OSError: # if the temp dir was removed already by other means pass What is the second set of brackets for? ...
codereview_python_data_6997
from mitmproxy import options from .. import tservers import pytest -from unittest import mock - - -class UrlError(Exception): - pass - - -def mock_log(message): - if "Invalid URL" in message: - raise UrlError(message) class TestFlowlist(tservers.MasterTest): It is probably easier if you directly chec...
codereview_python_data_7000
def _use_berry(self, berry_id, berry_count, encounter_id, catch_rate_by_ball, current_ball): # Delay to simulate selecting berry - action_delay(self.config.action_wait_min, self.config.action_wait_max) new_catch_rate_by_ball = [] self.emit_event( 'pokemon_catch_rate',...
codereview_python_data_7003
.distinct() try: - similar_artist_df.take(1)[0] except IndexError: current_app.logger.error('Similar artists not generated.', exc_info=True) raise would prefer to do this in a seperate function ...
codereview_python_data_7006
description='Port for webhdfs') user = luigi.Parameter(default='', description='Defaults to $USER envvar', config_path=dict(section='hdfs', name='user')) - client_type = luigi.Parameter(default='insecure', - description=...
codereview_python_data_7014
import numpy as np import pytest import torch -import torch.nn as nn from mmdet import digit_version from mmdet.models.dense_heads import RetinaHead, YOLOV3Head -from .utils import convert_result_list, verify_model - -onnx_io = 'tmp.onnx' data_path = osp.join(osp.dirname(__file__), 'data') Could we move this cla...
codereview_python_data_7017
continue if self.breakable_incubator: - if incubator.get('uses_remaining') is not None: if egg["km"] not in self.breakable_incubator: continue if self.infinite_incubator: - ...
codereview_python_data_7018
def __init__(self, in_vm_artifacts_profile_json): if in_vm_artifacts_profile_json and not in_vm_artifacts_profile_json.isspace(): - self.__parse(in_vm_artifacts_profile_json) - - def __parse(self, json_str): - # trim null and whitespaces - trimmed = json_str.rstrip(' \t\r\n\0')...
codereview_python_data_7021
def remote_shutdown(self): udp_sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) - udp_sock.sendto(b"Shutdown", ("localhost", self.management_port)) self.log.debug("Shutdown command sent") time.sleep(10) - udp_sock.sendto(b"StopTestNow", ("localhost", self.management_...
codereview_python_data_7026
else: gt_bboxes_ignore = np.zeros((0, 4), dtype=np.float32) - seg_map = img_info['filename'].split(".")[0] + ".png" ann = dict( bboxes=gt_bboxes, Thank you for your feedback, you may also need to consider the scenario of `a.b.c.jpg`. else: gt_bb...
codereview_python_data_7033
self.assertEqual(item['attr2'], 'value2') attributes = [{'AttributeName': 'id', 'AttributeType': STRING}] - userIdIdx = [ {'Create': { 'IndexName': 'id-index', 'KeySchema': [{ nitpick: could be changed from `camelCase` to `snake_case` (`user_id_id...
codereview_python_data_7034
<h1>Error 503 Backend is unhealthy</h1> <p>Backend is unhealthy</p> <h3>Guru Mediation:</h3> - <p>Details: cache-sea4431-SEA 1645521628 3669625611</p> <hr> <p>Varnish cache server</p> </body> nit: We could remove lines 54-55 and change line 53 to: ``` event_bus = self._get_param('EventBu...
codereview_python_data_7037
row = result.fetchone() if row: users = {} - for user in row[1]: - users[user] = row[1][user][0] - return SimilarUsers(user_id=row[0], similar_users=users) return None not directly related to this change, but can we use dict access here to ma...
codereview_python_data_7039
"one hundred and twenty-three")) def test_number_too_large(self): - with self.assertRaisesWithMessage(ValueError) as error: say(1e12) - self.assertTrue(len(str(error.exception)) > 0) def test_number_negative(self): - with self.assertRaises...
codereview_python_data_7041
_entry_db_names = _get_entry_dbs() if db not in _entry_db_names: raise ValueError( - "TogoWS entry fetch does not officially support " "database '%s'." % db ) if field: try: You can merge those two strings into one now. _entry_db_names = _get_entry_dbs...
codereview_python_data_7048
self.was_ended = arborted try: self.trigger.release() - except (THREAD_EXCEPTION, AttributeError) as e: pass class SelectableSelector(object): Please remove ` as e` as you don't need it. self.was_ended = arborted try: self.trigger.rele...
codereview_python_data_7052
else: raise - def _foreach_controller(self, operation, message): """ Executes the given operation on all controllers that need to be tracked; outputs 'message' if the controller is not mounted. """ This method can be static. else: ...
codereview_python_data_7055
@cli.command() @click.option('--location', '-l', default=os.path.join(os.getcwd(), 'listenbrainz-export')) def import_dump(location): db.init_db_connection(config.SQLALCHEMY_DATABASE_URI) db_dump.import_postgres_dump(location) We need more error catching here -- there are a lot of things that could go wro...
codereview_python_data_7058
except KeyError: continue stream = HLSStream.parse_variant_playlist(self.session, url) - self.session.new_http_session() streams.update(stream) return streams why not just `self.session.http.close()` or `http.close()` --- do you have an exampl...
codereview_python_data_7064
if self.wrap: for i in range(0, len(data), self.wrap): - self.handle.write(data[i: i + self.wrap] + "\n") else: self.handle.write(data + "\n") I think that change (and the one below) would be counter to black coding style (which TravisCI is probably about to c...
codereview_python_data_7070
} ) _rtmp_quality_lookup = { - "オリジナル画質": "original", - "original spec": "original", "低画質": "low", "low spec": "low" } # changes here must also be updated in test_plugin_showroom _quality_weights = { - "original": 720, "other": 360, "low": 160 } This is the only thing I can see ...
codereview_python_data_7077
style_opts = line_properties + ['level'] - apply_ranges = False - _plot_methods = dict(single='Span') def get_data(self, element, ranges, style): I think this should probably be a boolean parameter. style_opts = line_properties + ['level'] + apply_ranges = param.Boolean(default=False, do...
codereview_python_data_7081
A list of transactions containing related to the asset. If no transaction exists for that asset it returns an empty list `[]` """ - cursor = self.connection.run( - r.table('bigchain', read_mode=self.read_mode) - .get_all(asset_id, index='asset_id') - ...
codereview_python_data_7082
self.active_flows.add(flow) def response(self, flow: http.HTTPFlow): if self.stream and flow.websocket is None: self.stream.add(flow) self.active_flows.discard(flow) Does this mean the HTTP 101 flow is not saved and lost? But it contains interesting data such as aut...
codereview_python_data_7095
template = config.val.url.searchengines[engine] url = qurl_from_user_input(template.format(urllib.parse.quote(term))) - if config.val.url.open_base_url: - try: - search_url = urllib.parse.urlparse(config.val.url.searchengines[term]) - url = QUrl('{}://{}'.format(search_url.sche...
codereview_python_data_7097
"""Decorator to perform check that the model handle exists in the service. Args: - f(func): The model handle should exists when executing function f Returns: wrapper: Function wrapper to perform model handle existence check. To be consistent with the rest of our codebase, please add a sp...
codereview_python_data_7102
``id`` property. metadata (dict): Metadata to be stored along with the Transaction. - version (int): Defines the version number of a Transaction. """ CREATE = 'CREATE' TRANSFER = 'TRANSFER' Why do we need to change this. Wouldn't be enough to upd...
codereview_python_data_7106
class IntervalDomain(dbops.Domain): def __init__(self) -> None: super().__init__( - name=('edgedb', 'interval_t'), base='interval', constraints=( dbops.DomainCheckConstraint( - domain_name=('edgedb', 'interval_t'), ...
codereview_python_data_7109
module = self.eth_modules.get('uniswap', None) if not module: return None - - if module == 'loading': - with gevent.Timeout(10): - while True: - module = self.eth_modules.get('uniswap', None) - if module == 'loading': ...
codereview_python_data_7117
# try to revoke token with Google Auth API otherwise Google will consider the account # be still connected and will not send a refresh_token next time the user tries to # connect again. if it doesn't succeed proceed normally and just delete from our database - self._revoke_token(user["...
codereview_python_data_7120
trajectory is changed. See section on **Dynamic selections** below. [``True``] rdkit_kwargs : dict (optional) - Arguments passed to the RDKitConverter when using selection based on - SMARTS queries **selgroups : keyword arguments of str: AtomGroup (optional) ...
codereview_python_data_7126
label : string, optional If not None, the parsed nodes will be renamed according to node - attributes indicated by `label`. Default value: `'label'`. destringizer : callable, optional A destringizer that recovers values stored as strings in GML. If it The double backticks around the ...
codereview_python_data_7130
edge_shuffled = edge_mapping.shape != (0,) use_bcast = op not in ['copy_lhs', 'copy_rhs'] and u_shp[1:] != e_shp[1:] # pass edge_mapping to tvm only when array packing will be used - use_idx = edge_shuffled and num_feat_partitions > 1 and not use_bcast and use_e f_input = [indptr, indices] k...
codereview_python_data_7133
Attaches plot refresh to all streams on the object. """ def append_refresh(dmap): - for stream in get_streams(dmap): stream._hidden_subscribers.append(plot.refresh) return obj.traverse(append_refresh, [DynamicMap]) Can't this be simplified to: ``` python if isinstance(obj, Dynam...
codereview_python_data_7135
def now(self): """Return the current time and date as a datetime.""" - from celery.utils.time import to_utc - from datetime import datetime - now_in_utc = to_utc(datetime.utcnow()) return now_in_utc.astimezone(self.timezone) why are we importing stuff here? def now(s...
codereview_python_data_7142
MIN_SECONDS_ALLOWED_FOR_CELL_CHECK = 10 MIN_SECONDS_ALLOWED_FOR_REQUESTING_DATA = 5 MIN_BALLS_FOR_CATCHING = 10 - MAX_CACHE_LIST_SIZE = 500 def __init__(self, bot, config): super(Sniper, self).__init__(bot, config) You do realize people bot on raspberry devices, right? Increasing this t...
codereview_python_data_7143
sort = False join = kwargs.get("join", "outer") ignore_index = kwargs.get("ignore_index", False) - other_data = [o._data_obj for o in other] - new_data = self._data_obj._concat(axis, other_data, join, sort) if ignore_index: - new_data.index = pandas.Range...
codereview_python_data_7159
as the ``descriptor`` argument. """ def __init__(self, oauth_credentials=None, descriptor='', http_=None, - chunksize=10 * 1024 * 1024): self.chunksize = chunksize http_ = http_ or httplib2.Http() you should default this to CHUNKSIZE and set CHUNKSIZE to 10x1024x1024 ...
codereview_python_data_7166
class DelayTest(unittest_utils.ForsetiTestCase): """ Tests for the Delay Utility.""" - def mytest_delay(self): """test to verify that a delay is used""" delay_by = 9 param = 1 test functions have to start with test_ to get run. Please rename to test_delay. class DelayTest(unittest...
codereview_python_data_7179
self.stage_type = stage_type self.scales = scales self.width = width - # delattr(self, 'conv2') delattr(self, self.norm2_name) def forward(self, x): May I ask why change this? self.stage_type = stage_type self.scales = scales self.width = widt...
codereview_python_data_7181
feature.type = element.attrib.get("type", "") if "id" in element.attrib: feature.id = element.attrib["id"] - if "description" in element.attrib: - feature.qualifiers["description"] = element.attrib["description"] - if "evidence" in element....
codereview_python_data_7182
raise Exception("Couldn't find location for table: {0}".format(str(self))) return location - def open(self, mode): - return NotImplementedError("open() is not supported for {}".format(self.__class__.__name__)) - class HiveTableTarget(HivePartitionTarget): """ - exists returns tr...
codereview_python_data_7187
demands.root_user = True def run_on_module(self): - module_specs = self.base.repo_module_dict.install(self.opts.module_nsvp) if module_specs: raise NoModuleException(", ".join(module_specs)) Are Lock and Unlock sub-commands in scope? demands....
codereview_python_data_7189
# limitations under the License. # import os from .cfg_parser import LuigiConfigParser from .toml_parser import LuigiTomlParser Am i correct that if you want to use a config parser other than `cfg`, you have to define the `LUIGI_CONFIG_PARSER` environmental variable? # limitations under the License. # import ...
codereview_python_data_7193
class ConflictingHeaderError(RequestException): """Mutually exclusive request headers set""" -class UnreachableCodeError(RequestException, RuntimeError): - """Unreachable code block reached""" # Warnings Heh, while I like this name I don't think it's a good one. It's too general. =) Let's instead define a ne...
codereview_python_data_7200
from plenum.common.constants import STEWARD_STRING from plenum.common.exceptions import RequestNackedException from plenum.common.util import randomString -from plenum.test.helper import sdk_multi_sign_request_objects, sdk_json_to_request_object, sdk_send_signed_requests, \ - sdk_get_and_check_replies from plenu...
codereview_python_data_7204
Notes ----- - The implementation is adapted from the algorithm by Sporns et al. [1]_ - which is inspired from the original work from Maslov and Sneppen(2002) [2]_ References ---------- These sentences have lost their periods. Notes ----- + The implementation is adapted from the ...
codereview_python_data_7206
'Paths', ] for name, path in _path_info().items(): - lines += [ '{}: {}'.format(name, path) ] return '\n'.join(lines) nitpick: No spaces inside `[]` here 'Paths', ] for name, path in _path_info().items(): + lines += ['{}: {}'.format(name, path)] return '\n...
codereview_python_data_7207
raise configexc.ValidationError(value, str(e)) return except UnicodeEncodeError as e: - raise configexc.ValidationError(value, e) class AutoSearch(BaseType): Keeping this here is actually good - I just didn't think about this in the example I d...
codereview_python_data_7216
if rank == 0: torch.cuda.synchronize() elapsed = time.perf_counter() - start_time - batch_size = data['img'][0].size(0) prog_bar.update( completed=batch_size * world_size, elapsed_time=elapsed) We need to keep using to obtain the `batch_size` ...
codereview_python_data_7218
'type': self.cname, }) # Override directives that should not be inherited from user code. - from . import Options - directives = Options.get_conversion_utility_code_directives(env.directives) from .UtilityCode import CythonUtilityCode ...
codereview_python_data_7220
def ping(self, **kwargs): worker_id = kwargs['worker'] worker = self._update_worker(worker_id) - return {"messages": worker.fetch_messages()} def _upstream_status(self, task_id, upstream_status_table): if task_id in upstream_status_table: I just thought about it now (not rel...
codereview_python_data_7222
oss_fuzz_project.ccs = ccs oss_fuzz_project.put() else: - cpu_weight = ( - OSS_FUZZ_MEMORY_SAFE_LANGUAGE_PROJECT_WEIGHT - if language in MEMORY_SAFE_LANGUAGES else - OSS_FUZZ_DEFAULT_PROJECT_CPU_WEIGHT) data_types.OssFuzzProject( id=project, I would convert this t...
codereview_python_data_7228
from hypothesis.internal.floats import int_to_float LABEL_MASK = 2 ** 64 - 1 -_SEQUENCE_TYPES = (OrderedDict, Sequence, enum.EnumMeta) def calc_label_from_name(name): I'd delete this and just use it inline. from hypothesis.internal.floats import int_to_float LABEL_MASK = 2 ** 64 - 1 def calc_label_from_name(nam...
codereview_python_data_7229
def get_issue_url(testcase): - """Return issue url for a testcase.""" issue_tracker = get_issue_tracker_for_testcase(testcase) if not issue_tracker: return None Maybe expand on description here that this is for display and account for group bug. def get_issue_url(testcase): + """Return issue url for a ...
codereview_python_data_7230
return imports @abstractmethod - def build_source_code(self, execution=None): pass @staticmethod Why this is changed? return imports @abstractmethod + def build_source_code(self): pass @staticmethod
codereview_python_data_7241
"strings." ) raise InvalidArgument(f"thing={thing!r} must be a type") # pragma: no cover - if types.is_forbidden_to_dispatch(thing): # pragma: no cover # Code like `st.from_type(TypeAlias)` does not make sense. raise InvalidArgument(f"thing={thing!r} does no...
codereview_python_data_7246
'runnning locally.') flags.DEFINE_integer('max_admin_api_calls_per_day', 150000, 'Admin SDK queries per day.') -flags.DEFINE_integer('max_results_admin_api', 500, -+ 'maxResult param for the Admin SDK list() method') class AdminDirectoryClient(_base_clien...
codereview_python_data_7251
Parameters ---------- - applier : Function object to register `funcs` - *funcs : list of functions to register in `applier` Returns ------- ```suggestion applier: Callable Function object to register `funcs` *funcs: list List of functions to register in `applier` ``` Parameters ---...
codereview_python_data_7254
from __future__ import print_function import glob import os import sys Please revert changes to this file from __future__ import print_function import glob +import locale import os import sys
codereview_python_data_7255
if not flow: raise exceptions.CommandError("No flow selected.") if part in ("response-headers", "response-body", "set-cookies"): - flow.response = http.HTTPResponse.make() if part == "cookies": self.master.switch_view("edit_focus_cookies") elif pa...
codereview_python_data_7256
def parse(file, format, **kwargs): - """Parse a file and return each of the trees it contains. If a file only contains one tree, this still returns an iterable object that contains one element. It would be good to have something in the one line indicating this is an iterator, maybe "Parse a file iterativ...
codereview_python_data_7272
alt = uniform(self.bot.config.alt_min, self.bot.config.alt_max) if self.bot.config.walk_max > 0: - mode = "walking" - if "mode" in point: - mode = point["mode"] step_walker = walker_factory(self.walker, self.bot, l...
codereview_python_data_7274
Installed = "Installed" Enabled = "Enabled" FailedUpgrade = "FailedUpgrade" - DidNotRun = "DidNotRun" class GoalStateStatus(object): I do not like the idea of creating a new state for this case. It seems like an overkill for what we're trying to achieve since creating and maintaining a new state req...
codereview_python_data_7285
self.nodes.add(key) self.nodes_len = len(self.nodes) for i in range(self.replica_count): - replica_key = "%s:%d" % (key, i) if self.hash_type == 'fnv1a_ch': replica_key = "%d-%s" % (i, key[1]) position = self.compute_ring_position(replica_key) entry = (position, key) ...
codereview_python_data_7293
from platforms.fuchsia.util.device import Device from platforms.fuchsia.util.fuzzer import Fuzzer from platforms.fuchsia.util.host import Host from system import environment from system import minijail from system import new_process from system import shell -from zipfile import ZipFile # Maximum length of a ran...
codereview_python_data_7303
return self.__it.__length_hint__() def __repr__(self): if self.__done: return repr(self.__consumed) else: - return '[{}]'.format(', '.join( [repr(x) for x in self.__consumed] + ['...'])) def __iter__(self): Please use `{0}` here, as position...
codereview_python_data_7306
<h1>Error 503 Backend is unhealthy</h1> <p>Backend is unhealthy</p> <h3>Guru Mediation:</h3> - <p>Details: cache-sea4427-SEA 1645523378 794088412</p> <hr> <p>Varnish cache server</p> </body> Instead of `Config`, use `Service` <h1>Error 503 Backend is unhealthy</h1> <p>Backend ...
codereview_python_data_7312
int The number of nodes """ - assert self._handle is not None return _CAPI_DGLGraphNumVertices(self._handle) def number_of_edges(self): The assertion is not needed. Or you could think that all APIs require such assertion which means we should assume the _handle is ne...
codereview_python_data_7333
raise errors.InvalidConstraintDefinitionError( f'Constraint {constraint.get_displayname(schema)} on ' f'{subject.get_displayname(schema)} is not supported ' - f'because it would depend on multiple tables', context=source_context, ...
codereview_python_data_7360
return data @ma.post_load - def build_planner(self, data, **kwargs): return None if kwargs.get('partial') is True else Operation(**data) do we want None or just an empty list? return data @ma.post_load + def build_operation(self, data, **kwargs): return None if kwar...
codereview_python_data_7363
results['pad_shape'] = img.shape results['flip'] = False results['scale_factor'] = 1.0 - cnum = 1 if len(img.shape) < 3 else img.shape[2] - results['img_norm_cfg'] = [[0.0] * cnum, [1.0] * cnum, False] return results def __repr__(self): Use a more specific variabl...
codereview_python_data_7374
sudo('dpkg --configure -a') sudo('apt-get -y -f install') sudo('apt-get -y install build-essential wget bzip2 ca-certificates \ - libglib2.0-0 libxext6 libsm6 libxrender1 libssl-dev \ - git gcc g++ python3-dev libboost-python-dev libffi-dev \ ...
codereview_python_data_7383
def assertAlmostEqualList(self, list1, list2, **kwargs): self.assertEqual(len(list1), len(list2)) - for i in range(len(list1)): - self.assertAlmostEqual(list1[i], list2[i], **kwargs) def test_nucleotides(self): filename = "GFF/multi.fna" I would use zip(list1, list2) here....