id stringlengths 24 28 | content stringlengths 121 2.08k |
|---|---|
codereview_python_data_8289 | build_directory=build_directory))
-def _update_environment_for_testcase(testcase, build_directory, application):
"""Update environment variables that depend on the test case."""
commands.update_environment_for_job(testcase.job_definition)
environment.set_value('JOB_NAME', testcase.job_type)
# O... |
codereview_python_data_8299 | 'Graph has more than one node type; please specify a dict for src_nodes.')
src_nodes = {g.ntypes[0]: src_nodes}
src_node_ids = [
- utils.toindex(src_nodes.get(ntype, []), g._idtype_str).tousertensor(
- ctx=F.to_backend_ctx(g._graph.ctx))
for ntyp... |
codereview_python_data_8308 | # out/<build_dir>/ at time of build generation (chromium only).
path = utils.remove_prefix(path, '../../')
- # Remove /proc/self/cwd prefix if exists.
path = utils.remove_prefix(path, '/proc/self/cwd/')
# Cross-platform way to determine path absoluteness.
Can you mention that this is something bazel can a... |
codereview_python_data_8316 | open_target = target_arg
else:
open_target = config.get('general', 'new-instance-open-target')
- win_id = mainwindow.get_window(via_ipc, open_target=open_target)
tabbed_browser = objreg.get('tabbed-browser', scope='window',
... |
codereview_python_data_8320 | res_handler = result_handler_plist_to_file.PlistToFile(
buildaction,
report_output,
- lock,
export_plist_path)
res_handler.print_steps = args.print_steps
Note to a future refactoring: it might scale better to have a seperate po... |
codereview_python_data_8328 | super(OrderedDefaultDict, self).__init__(*args, **kwargs)
self.default_factory = default_factory
- def __getitem__(self, key):
- try:
- return super(OrderedDefaultDict, self).__getitem__(self, key)
- except KeyError:
- return self.__missing__(key)
-
def __mi... |
codereview_python_data_8332 | async def _add_fact_relationships(self, criteria=None):
relationships = await self.dao.get('core_relationships', criteria)
- for r in relationships:
- r.pop('source')
- r.pop('link_id')
- if r.get('target'):
- r['target'] = (await self.dao.get('core_f... |
codereview_python_data_8340 | with self.assertRaisesMessage(CommandError, 'Course "645343" does not exist'):
management.call_command('exportcourse', 645343, stdout=StringIO(), verbosity=3)
- def test_argument_type(self):
- with self.assertRaisesMessage(CommandError, "Error: argument course_id: invalid int value: 'dgd... |
codereview_python_data_8345 | self.g = g
def forward(self, score):
- """Forward function."""
g = self.g.local_var()
g.edata['s'] = score
g.update_all(fn.copy_e('s', 'm'), fn.max('m', 'smax'))
I suggest preserving the pseudo code so that users could understand the process.
self.g = g
de... |
codereview_python_data_8346 | -from datetime import datetime
import logging
-
-from xml.sax.saxutils import (
- escape as xml_escape,
- quoteattr,
-)
-
import os
from bulk_update.helper import bulk_update
from django.conf import settings
from django.contrib import messages
from django.contrib.auth.decorators import login_required
Nit: ... |
codereview_python_data_8356 | """
if type(G) == nx.Graph:
- return nx.number_of_nodes(G) == 0 or (nx.is_connected(G) and ( nx.number_of_edges(G) == nx.number_of_nodes(G)-1 ) and G.number_of_selfloops()==0)
else:
return False
The last check, `G.number_of_selfloops()==0`, is useless: a connected graph with self-loo... |
codereview_python_data_8358 | <h1>Error 503 Backend is unhealthy</h1>
<p>Backend is unhealthy</p>
<h3>Guru Mediation:</h3>
- <p>Details: cache-sea4441-SEA 1645544077 1005086470</p>
<hr>
<p>Varnish cache server</p>
</body>
it seems you need to keep both history node embeddings for each layer as well as aggregated hist... |
codereview_python_data_8361 | }
}).to_dict()
- # Precompue pair so lat/lon, easting/northing, mapbox coord values
self.lon_range1, self.lat_range1 = (10, 30), (20, 40)
self.easting_range1, self.northing_range1 = Tiles.lon_lat_to_easting_northing(
self.lon_range1, self.lat_range1
```sugges... |
codereview_python_data_8364 | "creationTimestamp": "2017-09-25T12:33:24.312-07:00",
"name": "default1",
"description": "Default network for the project",
- "selfLink": "https://www.googleapis.com/compute/v1/projects/project1/global/networks/default",
"autoCreateSubnetworks": true,
"subnetworks": [
"https://www.googleapis.... |
codereview_python_data_8368 | import os
from tensorflow.python.framework import test_util
-from tensorflow_addons.custom_ops.text.python import skip_gram_ops
from tensorflow_addons.custom_ops import text
from tensorflow.python.framework import constant_op
from tensorflow.python.framework import dtypes
swap those two lines?
import os
from t... |
codereview_python_data_8371 | class _KerasModel(model_lib.Model):
"""Internal wrapper class for tf.keras.Model objects."""
- def __init__(self, inner_model, dummy_batch, loss_fns, loss_weights, metrics):
# NOTE: sub-classed `tf.keras.Model`s do not have fully initialized
# variables until they are called on input. We forced that here... |
codereview_python_data_8373 | Examples
--------
>>> G = nx.path_graph(3)
>>> is_threshold_graph(G)
True
``` >>> from networkx.algorithms.threshold import is_threshold_graph ```
Examples
--------
+ >>> from networkx.algorithms.threshold import is_threshold_graph
>>> G = nx.path_graph(3)
>>> is_thresh... |
codereview_python_data_8374 | 'violation_data': violation.get('violation_data')
},
'source_id': 'FORSETI',
- 'category': violation.get('rule_name'),
- 'url': 'table:{}/id:{}'.format(
- VIOLATIONS_TABLE, violation.get('id'))
}
... |
codereview_python_data_8375 | init_func=init_zero_func)
kvclient.register_push_handler('data_3', add_push)
kvclient.map_shared_data(partition_book=gpb)
- id_tensor = id_tensor = F.tensor([0,2,4], F.int64)
data_tensor = F.tensor([[6.,6.],[6.,6.],[6.,6.]], F.float32)
time.sleep(kvclient.client_id + 1)
... |
codereview_python_data_8379 | # build a where clause to match all of the words in any order
# given the search term "a b", the WHERE clause would be:
- # ((url || title) LIKE '%a%') AND ((url || title) LIKE '%b%')
where_clause = ' AND '.join(
"(url || ' ' || title) LIKE :{} escape '\\'".format(i)
... |
codereview_python_data_8389 | self._assert_handler_status(protocol.report_vm_status, "Ready", 1, "1.0.0")
self._assert_ext_status(protocol.report_ext_status, "success", 1)
- #Test new version available without GUID change
test_data.goal_state = test_data.goal_state.replace("<Incarnation>3<",
... |
codereview_python_data_8391 | from plenum.server.request_handlers.handler_interfaces.read_request_handler import ReadRequestHandler
-from indy_common.authorize.auth_constraints import ConstraintCreator
-from indy_node.server.pool_config import PoolConfig
-
from indy_common.authorize.auth_actions import AuthActionEdit, EDIT_PREFIX, AuthActionAdd
-... |
codereview_python_data_8397 | wmsg = "The `timeseries` attribute was deprecated in MDAnalysis 2.0.0"
with pytest.warns(DeprecationWarning, match=wmsg):
assert_equal(wb.timeseries, wb.results.timeseries)
-
-def test_import_warning():
- wmsg = 'This module has been moved to'
- with pytest.warns(DeprecationWarning,... |
codereview_python_data_8400 | self.__dict__.update(d)
# TODO: super's setstate not called?
if "param" not in self.__dict__:
- self.param = type(self.param)(self.__class__, self=self)
class Dimensioned(LabelledData):
Seems like an oversight but I don't think the super would do anything else in this case unless... |
codereview_python_data_8406 | """Tests for Email Factory"""
-from google.cloud.forseti.common.util.email import email_factory, mailjet_connector
from google.cloud.forseti.common.util.email import sendgrid_connector
from google.cloud.forseti.common.util.errors import InvalidInputError
from tests.unittest_utils import ForsetiTestCase
Each import... |
codereview_python_data_8412 | """
return self._screen
- @expect_types(term=ComputableTerm, name=str)
def add(self, term, name, overwrite=False):
"""
Add a column.
I would try to re-use the error message above rather than using `expect_types` here. This will spit out a message telling the user that we exp... |
codereview_python_data_8415 | """Extract RoI features from a single level feature map.
If there are multiple input feature levels, each RoI is mapped to a level
- according to its scale.
Args:
roi_layer (dict): Specify RoI layer type and arguments.
Also add the paper title and link.
"""Extract RoI features from a s... |
codereview_python_data_8417 | 'projects': create_tables.CREATE_PROJECT_TABLE,
'project_iam_policies': create_tables.CREATE_PROJECT_IAM_POLICIES_TABLE,
# pylint: disable=line-too-long
'raw_project_iam_policies': create_tables.CREATE_RAW_PROJECT_IAM_POLICIES_TABLE,
'raw_org_iam_policies': create_tables.CREATE_RAW_ORG_IAM_POLI... |
codereview_python_data_8435 | # Slot descriptor for the table of attribute get & set methods.
def slot_code(self, scope):
- if scope.property_entries or scope.lookup_here("__dict__"):
return scope.getset_table_cname
else:
return "0"
This repetitive special casing actually suggests that the featu... |
codereview_python_data_8439 | flags.mark_flag_as_required('organization_id')
-def main(unused_argv=None):
"""Run the scanner."""
logger = LogUtil.setup_logging(__name__)
nit: This method is getting long in the tooth, I'd suggest (at some later point) splitting this up into other functions, e.g. violation checking, generating emails, etc... |
codereview_python_data_8441 | self._create_or_update_from_compiler(
self._query_compiler.concat(1, value._query_compiler), inplace=True
)
self.columns = self.columns[:-1].append(pandas.Index([key]))
else:
self.insert(loc=len(self.columns), column=k... |
codereview_python_data_8442 | try:
connection = socket.socket(self.address.family, socket.SOCK_STREAM)
if self.spoof_source_address:
- if os.geteuid() != 0:
- raise RuntimeError("Insufficient privileges to set socket option")
- else:
connection.... |
codereview_python_data_8448 | def __init__(self, atomgroup, reference=None, select='all',
- groupselections=None, weights=None, tol_mass=0.1,
- ref_frame=0, **kwargs):
r"""Parameters
----------
atomgroup : AtomGroup or Universe
So having now looked at `get_weights`, it looks like that... |
codereview_python_data_8449 | if has_body:
properties = {}
- for stat in getattr(self.body, 'stats', []):
if isinstance(stat, FuncDefNode):
stat._properties = properties # deliberately shared between them
self.body.analyse_declarations(scope)
Calling `getattr()` a... |
codereview_python_data_8451 | self.norm_cfg = norm_cfg
self.loss_point = build_loss(loss_point)
- fc_channels_in = in_channels + num_classes
self.fcs = nn.ModuleList()
for k in range(num_fcs):
fc = ConvModule(
- fc_channels_in,
fc_channels,
kern... |
codereview_python_data_8455 | return
if conf.get_enable_overprovisioning():
- if not self.protocol.supports_overprovisioning():
- logger.verbose("Overprovisioning is enabled but protocol does not support it.")
- else:
- artifacts_profile = self.protocol.get_artifacts_profile(... |
codereview_python_data_8458 | Call Sphinx command with hard-coded "html" target
"""
# Copy docs files from Open3D-ML repo
- OPEN3D_ML_ROOT = os.environ.get("OPEN3D_ML_ROOT", "../../Open3D-ML")
if os.path.isdir(OPEN3D_ML_ROOT):
shutil.copy(os.path.join(OPEN3D_ML_ROOT, "docs", "tensorboard.md"),... |
codereview_python_data_8464 | -from pontoon.checks import DB_EXCLUDE_LIBRARIES
from pontoon.checks.models import Warning, Error
-def get_failed_checks_db_objects(translation, failed_checks, excluded=None):
"""
Return model instances of Warnings and Errors
:arg Translation translation: instance of translation
:arg dict failed_ch... |
codereview_python_data_8466 | val=pgast.NullConstant())
assert query.larg and query.rarg
query.rarg.target_list.append(restarget)
nullref = pgast.ColumnRef(name=[alias], nullable=True)
Is this for the `emptyrel` side of `optional_wrapping`, if so, it probably makes sense to to check for a `NullRelation` expl... |
codereview_python_data_8471 | def __call__(self):
return [
- np.array([-1, -2, -3, -4], dtype = self._data_type),
- np.array([99, 2, -10, 10], dtype = self._data_type)]
def valid_axes(self):
return [None, 0]
```suggestion input, keep_dims = keep_dims, axes = axes) ``` Just a note, you don't have ... |
codereview_python_data_8472 | from data import *
def parse_args():
- parser = argparse.ArgumentParser(description='Train Faster-RCNN networks e2e.')
parser.add_argument('--image', type=str, default='',
help="The image for scene graph extraction.")
parser.add_argument('--gpu', type=str, default='',
Is this a ... |
codereview_python_data_8478 | elif self._config.batch_mode == 'family':
return family
elif self._config.batch_mode == 'unbatched_params':
- param_str = ', '.join(f'{k}={v}' for k, v in six.iteritems(unbatched_args))
- return f'{family}({param_str})'
else:
raise ValueError('U... |
codereview_python_data_8488 | guiclass="ArgumentsPanel", testclass="Arguments")
@staticmethod
- def _get_http_request(url, label, method, timeout, body, keepalive, files=(), encoding=None,
- redirect_follow=True, redirect_auto=False):
"""
Generates HTTP request
... |
codereview_python_data_8496 | def get_main_container_name():
- cmd = "docker inspect -f '{{ .Name }}' %s | cut -c 2-" % config.HOSTNAME
- return run(cmd).strip()
def setup_logging():
Instead of piping to `cut` here, can we do the string manipulation directly in Python - something like: ``` cmd = "docker inspect -f '{{ .Name }}' %s" % confi... |
codereview_python_data_8500 | new_directives_out.update(new_directives)
return new_directives_out
-def get_conversion_utility_code_directives(directives):
- directives_out = dict(_directive_defaults)
- allowed_directives = (
- 'binding', 'always_allow_keywords', 'allow_none_for_extension_args',
- 'auto_pickle', 'ccompl... |
codereview_python_data_8502 | score_factors (Tensor): The factors multiplied to scores before
applying NMS.
return_inds (bool): Whether return the indices of kept bboxes.
Returns:
tuple: (bboxes, labels, indices (optional)), tensors of shape (k, 5), \
(bool, optional): xxx, Defaults to False.
... |
codereview_python_data_8503 | func_details.envvars["AWS_LAMBDA_FUNCTION_HANDLER"] = main_file
func_details.envvars["AWS_LAMBDA_EVENT_BODY"] = json.dumps(json_safe(event))
else:
- func_details = {}
- func_details.envvars = {
- "AWS_LAMBDA_FUNCTION_HANDLER": main_file,
- ... |
codereview_python_data_8506 | return getattr(self, self.norm_name)
def init_weights(self):
- nonlinearity = self.act_cfg['type'] if self.with_activation else 'relu'
kaiming_init(self.conv, nonlinearity=nonlinearity)
if self.with_norm:
constant_init(self.norm, 1, bias=0)
nonlinearity can only be `... |
codereview_python_data_8515 | self.fail('KeyError should be caught')
def test_get_coord_axes_bad_dims(self):
- '''Test that ValueError is raised when
numpy array with incorrect dimensions
- is fed to get_coord_axes().'''
with self.assertRaises(ValueError):
PSA.get_coord_axes(np.zeros((5... |
codereview_python_data_8521 | self.disconnect()
"""
- def __init__(self, server_address=None, source_address=None):
super(ServerConnectionMixin, self).__init__()
- self.server_conn = ServerConnection(server_address, source_address)
self.__check_self_connect()
def __check_self_connect(se... |
codereview_python_data_8524 | # handle empty file gracefully
return
if marker != b"ABIF":
- raise IOError('File should start with ABIF, not %r' % marker)
# dirty hack for handling time information
times = {'RUND1': '', 'RUND2': '', 'RUNT1': '', 'RUNT2': '', }
I think the original is OK here, and the improved... |
codereview_python_data_8526 | test_helpers.patch(self, ['metrics.logs.log_warn'])
# Pass-through logs just so we can see what's going on (but moving from
# log_warn to plain log to avoid creating a loop)
- self.mock.log_warn.side_effect = metrics.logs.log
environment.set_value('FUZZ_TARGET', 'example_fuzzers/overflow_fuzzer')... |
codereview_python_data_8527 | import os.path as osp
-import random
import mmcv
import numpy as np
from torch.utils.data import Dataset
from mmdet.core import eval_map, eval_recalls
It's better to change `random` to `np.random` since the latter one is the conventional one used in mmdet and it's more compatible with numpy arrays.
import os.pa... |
codereview_python_data_8529 | -import asyncio
from argparse import ArgumentParser
import numpy as np
import requests
-from mmdet.apis import (async_inference_detector, inference_detector,
- init_detector, show_result_pyplot)
def parse_args():
Address and port of the inference server.
from argparse import ArgumentParser... |
codereview_python_data_8530 | from .layers import *
from .metrics import *
from .losses import *
import time
Instead of an extra param, could you just allow tmp_name to be (optionally) an absolute path?
from .layers import *
from .metrics import *
from .losses import *
+from .fp16 import *
import time |
codereview_python_data_8534 | if path is infer:
path = os.getenv('HYPOTHESIS_DATABASE_FILE')
if path is not None: # pragma: no cover
- # Note: for Hypothesis 4, there should still be a deprecation
- # warning (noting that the var is ignored) to ease debugging for
- # anyone using it and migra... |
codereview_python_data_8540 | if not self.config.hatch_eggs:
return
- self.api.get_inventory()
- response_dict = self.api.call()
inv = {}
incubators = []
eggs = []
Please, use self.bot.get_inventory() - it is cached version of it.
if not self.config.hatch_eggs:
r... |
codereview_python_data_8547 | path = utils.expand_windows_drive(path)
# Drive dependent working directories are not supported, e.g.
# E:filename is invalid
- if re.fullmatch(r'[A-Z]:[^\\]', path, re.IGNORECASE):
return None
# Paths like COM1, ...
# See https://github.com/qutebrowser/qutebrowser/issues/82
This s... |
codereview_python_data_8548 | result = response['result']
if mode == self.mode_commit:
check_tx_code = result.get('check_tx', {}).get('code', 0)
- deliver_tx_code = result['deliver_tx'].get('code', 0)
error_code = check_tx_code or deliver_tx_code
else:
error_code = result.... |
codereview_python_data_8549 | default=[100, 300, 1000],
help='proposal numbers, only used for recall evaluation')
parser.add_argument(
- '--class_wise', action='store_true', help='whether eval class wise ap')
args = parser.parse_args()
- coco_eval(args.result, args.types, args.ann, args.max_dets,
- ... |
codereview_python_data_8559 | self.assertEqual(string_table, expected_string_table)
- def testStringParsing(self):
- """Test parsing an ASCII string."""
self.assertEqual(binary.ReadUTF16(self._ascii_string_1), 'Whatis')
self.assertEqual(binary.ReadUTF16(self._ascii_string_2), 'What is this?')
name of function and docstring don... |
codereview_python_data_8569 | messages = self.consumer.get_messages(count=CASSANDRA_BATCH_SIZE, block=True, timeout=KAFKA_READ_TIMEOUT)
for message in messages:
- print(message.message.value)
try:
data = ujson.loads(message.message.value)
listens.app... |
codereview_python_data_8572 | """Scanner for the GroupsSettings rules engine."""
from google.cloud.forseti.common.gcp_type import groups_settings
from google.cloud.forseti.common.util import logger
from google.cloud.forseti.scanner.audit import groups_settings_rules_engine
I recommend json.dumps with sort_keys=True instead of str() because tha... |
codereview_python_data_8575 | PUBSUB_PLATFORMS = ['linux']
-MEMORY_SAFE_LANGUAGES = ['go', 'java', 'python', 'rust']
OSS_FUZZ_DEFAULT_PROJECT_CPU_WEIGHT = 1.0
OSS_FUZZ_MEMORY_SAFE_LANGUAGE_PROJECT_WEIGHT = 0.2
Since there are fewer memory unsafe languages than memory safe ones, why don't we just use that instead?
PUBSUB_PLATFORMS = ['linux']
... |
codereview_python_data_8576 | return Rank(self, method=method, ascending=ascending, mask=mask)
@expect_types(
- target=ComputableTerm,
correlation_length=int,
mask=(Filter, NotSpecifiedType),
)
I would probably put `(Factor, Slice)` here rather than `ComputableTerm`. We shouldn't accept a Filter or a Cla... |
codereview_python_data_8581 | # Each fetch will take place in its own thread, since it's naturally
# parallel work.
- nodes = []
patterns = []
for v in nodes_or_patterns:
if isinstance(v, basestring):
patterns.append(v)
else:
- nodes.append(v)
... |
codereview_python_data_8584 | if make_url(self.get_connection_string()).drivername == \
'sqlite+pysqlite':
# FIXME: workaround for locking errors
- # FIXME: why is the connection used by multiple threads
- # is that a problem ??? do we need some extra locking???
engine = sqla... |
codereview_python_data_8587 | def test_characters_of_specific_groups():
st = characters(whitelist_categories=('Lu', 'Nd'))
- minimal(st, lambda c: unicodedata.category(c) == 'Lu')
- minimal(st, lambda c: unicodedata.category(c) == 'Nd')
assert_no_examples(
st, lambda c: unicodedata.category(c) not in ('Lu', 'Nd'))
This is... |
codereview_python_data_8591 | # Copyright (C) 2016 Arthur Gervais, Ken LE PRADO, Sébastien Mainand
-from scapy.all import *
# TODO: implement serial specific function codes
Is that really useful ? Wouldn't it be better to only import what you need ?
# Copyright (C) 2016 Arthur Gervais, Ken LE PRADO, Sébastien Mainand
+from scapy.packet import ... |
codereview_python_data_8601 | def test_build_network_url(self):
"""Verify that we can get a url from project and network name."""
- self.assertEqual(
- fe.build_network_url(
- 'example.com:testing', 'mytestnet'),
- 'https://www.googleapis.com/compute/{}/projects/'
- 'example.com:t... |
codereview_python_data_8605 | implicit_limit: int = 0
inline_typeids: bool = False
inline_typenames: bool = False
- inline_shapeids: bool = True
schema_object_ids: Optional[Mapping[s_name.Name, uuid.UUID]] = None
source: Optional[edgeql.Source] = None
backend_runtime_params: Any = (
```suggestion inline_objectids: ... |
codereview_python_data_8607 | text.replace("\n", " ")))
def _write_multi_line(self, tag, text):
- """Write multiple lines in each GenBank record (PRIVATE)."""
# TODO - Do the line spliting while preserving white space?
max_len = self.MAX_WIDTH - self.HEADER_WIDTH
lines = ... |
codereview_python_data_8611 | script_content = fds.read()
if "con:soapui-project" in script_content:
self.log.info("SoapUI project detected")
- # TODO: don't fail if there's one test case inside the SoapUI project
- test_case = scenario_obj.get("test-case",
- ... |
codereview_python_data_8620 | folds=None, nfold=5, stratified=True, shuffle=True,
metrics=None, fobj=None, feval=None, init_model=None,
feature_name='auto', categorical_feature='auto',
- early_stopping_rounds=None, early_stopping_threshold=0.0,
- fpreproc=None, verbose_eval=None, show_stdv=True, seed=0,
c... |
codereview_python_data_8621 | p = remainder
continue
if i <= 1:
- # We special case so that zero is always false and 1 is
# always true which makes shrinking easier because we can
# always replace a truthy block with 1. This has t... |
codereview_python_data_8622 | def check_root():
"""Ask for confirmation if running as root when unnecessary."""
- if sys.platform == "linux":
if spell.can_use_data_path() and os.geteuid() == 0:
print("You're running Qt >= 5.10 which means qutebrowser will "
"load dictionaries from a path in your hom... |
codereview_python_data_8624 | find(
st.binary(min_size=100),
lambda x: assume(not finicky) and has_a_non_zero_byte(x),
- settings=settings(
- database=database,
- max_shrinks=10,
- ),
database_key=key
)
... |
codereview_python_data_8625 | config_path=dict(section='core', name='worker-ping-interval'))
keep_alive = BoolParameter(default=False,
config_path=dict(section='core', name='worker-keep-alive'))
- keep_alive_ttl = TimeDeltaParameter(default=datetime.timedelta(0),
- ... |
codereview_python_data_8628 | super().__init__()
self.id = id
self.start, self.finish = None, None
- self.timeout = 180
self.name = name
self.group = group
self.agents = agents
I think this should be a dynamic configuration option within the operations pane or global application configur... |
codereview_python_data_8629 | # Issue #1511
# analysis_class should not raise
# a DeprecationWarning
- with no_deprecated_call():
- u = mda.Universe(PSF, DCD)
- def distance(a, b):
- return np.linalg.norm((a.centroid() - b.centroid()))
- Distances = base.analysis_class(distance)
d = Distanc... |
codereview_python_data_8630 | kwargs = {
'dn': args.dataset, 'g': g, 'train_nid': train_nid, 'num_workers_sampler': args.num_workers_sampler,
- 'train': False, 'num_subg_norm': args.num_subg_norm, 'batch_size_norm': args.batch_size_norm,
'online': args.online, 'num_subg': args.num_subg
}
I wonder if we need this ... |
codereview_python_data_8641 | self._widget.page().findText(text, flags, wrapped_callback)
def _on_find_finished(self, find_text_result):
- """Unwrap the QWebEngineFindTextResult and pass it along."""
- self.search_match_changed.emit(find_text_result.activeMatch(),
- find_text_result.... |
codereview_python_data_8644 | repos = list(self.base.repos._iter_disabled_with_enabled_metadata())
for repo in repos:
repo.enable()
- self.base._add_repo_to_sack(repos)
self.base._set... |
codereview_python_data_8648 | @property
def xlim(self):
dim1_keys, _ = self.dense_keys()
return min(dim1_keys), max(dim1_keys)
@property
def ylim(self):
_, dim2_keys = self.dense_keys()
return min(dim2_keys), max(dim2_keys)
I think we should rename this to `ViewMap` as it will become the main... |
codereview_python_data_8650 | edge only if the triple (source node, destination node and relation)
matches one of the edges in the graph.
- This sampler samples edges without replacement by default, which means it
- returns a fixed number of batches (i.e., num_edges/batch_size). However
- it accepts a replacement argument, whic... |
codereview_python_data_8651 | f'shapes cannot be applied to '
f'{expr_stype.get_verbosename(ctx.env.schema)}'
)
- try:
- view_type = viewgen.process_view(
- stype=expr_stype, path_id=expr.path_id,
- elements=shape.elements, ctx=ctx)
- except irast.InvalidScopeConfiguration as e:
... |
codereview_python_data_8655 | # ensure that when we do the math for the blocks, the partition column
# will be read in along with a non partition column.
if columns and directory and any(col in partitioned_columns for col in columns):
- partitioned_columns = [col for col in columns if col in partitioned_columns... |
codereview_python_data_8664 | self.use_deform = use_deform
self.switch = nn.Conv2d(
self.in_channels, 1, kernel_size=1, stride=stride, bias=True)
- self.switch.weight.data.fill_(0)
- self.switch.bias.data.fill_(1)
self.weight_diff = nn.Parameter(torch.Tensor(self.weight.size()))
self.we... |
codereview_python_data_8674 | inventory_index_id = Column(String(256))
resource_id = Column(String(256), nullable=False)
resource_type = Column(String(256), nullable=False)
rule_name = Column(String(256))
rule_index = Column(Integer, default=0)
violation_data = Column(Text)
Do you think that we... |
codereview_python_data_8676 | @attr.s()
-class MultipleResults(Generic[Ex_Inv], Iterable):
values = attr.ib()
def __iter__(self):
return iter(self.values)
def multiple(*args: Ex_Inv) -> MultipleResults[Ex_Inv]:
"""This function can be used to pass multiple results to the target(s) of
a rule. Just use ``return multiple... |
codereview_python_data_8680 | return {'last_metrics': last_metrics + mets}
def try_save(state:Dict, path:Path=None, file:PathLikeOrBinaryStream=None):
- target = open(path / file, 'wb') if is_pathlike(file) else file
try: torch.save(state, target)
except OSError as e:
- raise Exception(f"{e}\n Can't write {path / file}. Pa... |
codereview_python_data_8682 | pos : dict or None optional (default=None)
Initial positions for nodes as a dictionary with node as keys
and values as a coordinate list or tuple. If None, then use
- circular_layout() for dim > 2 and a linear layout for dim == 1.
weight : string or None optional (default='weight'... |
codereview_python_data_8686 | train=dict(classes=classes),
val=dict(classes=classes),
test=dict(classes=classes))
load_from = 'https://s3.ap-northeast-2.amazonaws.com/open-mmlab/mmdetection/models/faster_rcnn_r50_fpn_1x_20181010-3d1b3351.pth' # noqa
This URL is outdated, add a `TODO` to fix it.
train=dict(classes=classes),
... |
codereview_python_data_8688 | new_parameters[key] = new_param
if new_parameters:
env.model.reset_parameter(new_parameters)
callback.before_iteration = True
callback.order = 10
return callback
I think you should update env.params after reset_parameters.
new_parameters[key] = ne... |
codereview_python_data_8689 | # frame seek within range is tested
new_frame = 91
self.dcdfile.seek(new_frame)
- assert_equal(self.dcdfile.current_frame, new_frame)
def test_seek_negative(self):
# frame seek with negative number
The `dcd_frame` is a namedtuple. You can access the coordinates also with... |
codereview_python_data_8690 | tensor([0, 1, 0, 1, 2, 2, 3, 5, 4, 6, 3, 5, 4, 6]))
"""
if algorithm == 'bruteforce-blas':
- return _segmented_knn_graph_blas(x, k, segs)
else:
- out = knn(x, segs, x, segs, k, algorithm=algorithm)
row, col = out[1], out[0]
return convert.graph((row, col))
-def _segm... |
codereview_python_data_8696 | def set_one_var_from_string(
- name: Optional[str],
- param_type: Optional[str],
- checks: List
-) -> Optional[str]:
"""Construct code for auto config file for one param value.
Parameters
```suggestion name: str, param_type: str, checks: List[str] ) -> str: ```
def set_one_var_from_string(
+ n... |
codereview_python_data_8697 | """
Purpose
-Shows how to use AWS SDK for Python (Boto3) with the Amazon Elastic Compute Cloud
(Amazon EC2) API to terminate an instance and clean up additional resources.
"""
...**the** AWS SDK...
"""
Purpose
+Shows how to use the AWS SDK for Python (Boto3) with the Amazon Elastic Compute Cloud
(Amazon EC2) A... |
codereview_python_data_8699 | # https://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectGET.html
if method == 'GET':
query_map = urlparse.parse_qs(parsed.query, keep_blank_values=True)
- allowed_overrides = {
- 'response-content-type': 'Content-Type',
- ... |
codereview_python_data_8711 | Returns:
iter: An iterator of assets that match the text search.
"""
- if table is None:
- table = 'assets'
-
objects = backend.query.text_search(self.connection, search, limit=limit,
table=table)
Unnecessary if we m... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.