id
stringlengths
24
28
content
stringlengths
121
2.08k
codereview_python_data_1870
sections = (max_end - max_start) / 3 idx = max_start + int(sections) + int(sections/2) - return lrs[idx].item(), (lrs[idx].item(), losses[idx]) # Cell def slide(lrs:list, losses:list, num_it:int, lr_diff:int=15, thresh:float=.005, adjust_value:float=1.): I think this will fail if the suggestion isn't a ...
codereview_python_data_1873
template = config.val.url.searchengines[engine] url = qurl_from_user_input(template.format(urllib.parse.quote(term))) - if config.val.url.open_base_url and \ - term in config.val.url.searchengines.keys(): url = qurl_from_user_input(config.val.url.searchengines[term]) url.setPat...
codereview_python_data_1878
module=module, ) - objtype: Optional[so.Object] = schema.get_by_id(type_id, None) created = objtype is None if objtype is None: components = list(components) `get_by_id` also supports the `type` argument, please use that. module=module, ) + objtype = schema.get_by_...
codereview_python_data_1894
'name': int(), 'hostname': int(), 'image': int(), - 'pull': str(), 'registry': { 'url': int(), 'credentials': { Can you change this to `'pull': init()`, this will force the validation to error, which down below the assert will n...
codereview_python_data_1898
from google.cloud.security.common.data_access import firewall_rule_dao from google.cloud.security.common.data_access import folder_dao from google.cloud.security.common.data_access import forwarding_rules_dao -from google.cloud.security.common.data_access import ke_dao from google.cloud.security.common.data_access ...
codereview_python_data_1901
wrap_func = _wrap_op_fn(op_class, wrapper_name) setattr(module, wrapper_name, wrap_func) if submodule: - setattr(fn_module, '.'.join(submodule + [wrapper_name]), wrap_func) from nvidia.dali.external_source import external_source I don't think this is necessary - but this is: ```s...
codereview_python_data_1905
except shellutil.CommandError as cmd_err: if chk_err: - msg = """Failed to eject dvd: ret={0} - [stdout] - {1} - - [stderr] - {2} - """.format(cmd_err.returncode, cmd_err.stdout, cmd_err.stderr) ...
codereview_python_data_1910
for model in model_infos: pwc_model_info = OrderedDict() pwc_model_info['Name'] = osp.split(model['config'])[-1].split('.')[0] # get metadata memory = round(model['results']['memory'] / 1024, 1) - epochs = model['epochs'] meta_data = OrderedDict() meta_d...
codereview_python_data_1913
# TODO: remove inplace=False if isinstance(instance, (Seq, MutableSeq)): instance = instance.reverse_complement(inplace=False) - if isinstance(instance, (str, SeqRecord)): instance = instance.reverse_complement() instances.append(instan...
codereview_python_data_1914
end=kwargs.pop('end', None), trading_calendar=self.trading_calendar, ) - self.capital_base = self.sim_params.capital_base self.perf_tracker = None # Pull in the environment's new AssetFinder for quick reference Looks like this is only used for the...
codereview_python_data_1915
self._push(CalciteSortNode(collations)) def _process_filter(self, op): - self._maybe_add_projection(op) - condition = self._translate(op.condition) self._push(CalciteFilterNode(condition)) With this projection, we cannot use filters by `rowid` which may be required since it can b...
codereview_python_data_1919
name='pontoon.contributors.save_custom_homepage'), # AJAX: Save preferred source locale - url(r'^save-custom-preferred-source-locale/$', views.save_custom_preferred_source_locale, - name='pontoon.contributors.save_custom_preferred_source_locale'), - - url(r'^user-preferred-source-locale/$', v...
codereview_python_data_1924
def update_kinesis(method, path, data, headers, response=None, return_forward_info=False): if return_forward_info: - if os.environ['KINESIS_RETURN_ERRORS'] == 'True': return 500 else: return True Instead of querying os.environ directly, could we have a config variable (i...
codereview_python_data_1926
rdprop = rdprops["_MDAnalysis_%s" % prop] mdaprop = getattr(mol2.atoms[idx], prop) assert rdprop == mdaprop - - -@pytest.mark.skipif(rdkit_installed == True, reason="test minimal dependency") -class TestRequiresRDKit(object): - def test_converter_requires_rdkit(self): - ...
codereview_python_data_1929
fmt = config.get('completion', 'timestamp-format') if fmt is None: - def fmt_atime(atime): return '' else: def fmt_atime(atime): Why define two functions at all, instead of just having one function and doing the `if fmt is None:` check in there? fmt = config.get('compl...
codereview_python_data_1936
import gettext -from PyQt5.QtCore import QLocale - LOCALE_DIR = os.path.join(os.path.dirname(__file__), 'locale') language = gettext.translation('electrum', LOCALE_DIR, fallback=True) you must not assume that qt is available, in the core lib. import gettext LOCALE_DIR = os.path.join(os.path.dirname(__file__), 'l...
codereview_python_data_1939
"engine": engine, "squeeze": squeeze, "skipfooter": skipfooter, - "kwds": kwds, } return cls.from_pandas(pandas.read_excel(**kwargs)) @classmethod I think we need to do an `update` instead of setting `kwds=kwds` here. It will treat `kwds` as a ke...
codereview_python_data_1940
torch.cuda.synchronize() time_backward += timer.since_last_check() bar.update() -print(f'\nCARAFE time forward: {(time_forward + 1e-3) * 1e3 / loop_num} ' - f'ms/iter | time backward: {(time_backward + 1e-3) * 1e3 / loop_num}' - ' ms/iter') time_naive_forward = 0 time_naive_backward = 0 Comp...
codereview_python_data_1943
locale = request.GET["locale"] page_results_limit = int(request.GET.get("limit", 100)) page = int(request.GET.get("page", 1)) - except MultiValueDictKeyError as e: return JsonResponse( {"status": False, "message": "Bad Request: {error}".format(error=e)}, ...
codereview_python_data_1944
if index is None: self.tab_next() return - if index == 0: index = self._count() - if index < 0: index = self._count() + index + 1 if 1 <= index <= self._count(): Not something directly related to your change, but I think it'd be cleane...
codereview_python_data_1948
if not target_path: raise TargetNotFoundError('Failed to find target ' + target_name) - return engine_impl.reproduce(target_path, testcase_path, arguments, timeout) class TestcaseRunner(object): Why not leave this logic in the constructor? Isn't it better to fail earlier? if not target_path: raise T...
codereview_python_data_1959
ct.punct(">")) def __getstate__(self): - # type: () -> Dict[str, Any] """ Creates a basic representation of the instance, used in conjunction with __setstate__() e.g. by pickle You might use a stricter type for `__getstate__ `and `__setstate__` as ...
codereview_python_data_1960
if __name__ == '__main__': - tf.enable_v2_behavior() tf.test.main() Shouldn't be required as we only test with TF2. if __name__ == '__main__': tf.test.main()
codereview_python_data_1964
for row in data: curr_strategy = data_types.FuzzStrategyProbability() curr_strategy.strategy_name = str(row['strategy']) - curr_strategy.strategy_probability = float(row['bandit_weight']) strategy_data.append(curr_strategy) - ndb.delete_multi( - data_types.FuzzStrategyProbability.query().fetc...
codereview_python_data_1965
) -> tf.Tensor: """Computes the (weighted) mean of elements across dimensions of a tensor. """ - return tf.divide( - tf.reduce_sum(tf.multiply(weights, input_tensor), axis=axis, keepdims=keepdims), - tf.reduce_sum(weights, axis=axis, keepdims=keepdims), - ) @tf.keras.utils.register_keras_s...
codereview_python_data_1969
elif tag == "//": if len(record.sequence) != scount: raise ValueError( - "The number of sequences specified in the record" - " (%d) does not agree with the number of sequences found (%d)" % (scount, len(record.sequence)) ...
codereview_python_data_1970
self.request_log = [] self.keep_alive = True self.session = None def tearDown(self): pass In case of API testing there is whole bunch of "success" codes of 2xx. Maybe cover them all with assert2xx instead of just 200? Those who want specific code would go with assertStatusCode ...
codereview_python_data_1972
from django.db.models.functions import Concat from django.conf import settings -from pontoon.base.models import Entity, TranslatedResource, Translation from pontoon.pretranslation.pretranslate import ( get_translations, update_changed_instances, I haven't tested this yet, but I wonder if this works as exp...
codereview_python_data_1982
import lightgbm as lgb import numpy as np -import pandas as pd import pytest from scipy import sparse @jmoralez Please make `pandas` optional for basic tests like you did in sklearn tests: ``` pd = pytest.importorskip("pandas") ``` import lightgbm as lgb import numpy as np import pytest from scipy import spar...
codereview_python_data_1983
class TxnAuthorAgreementHandlerV1(TxnAuthorAgreementHandler): - def _update_txn_author_agreement(self, text, version, seq_no, txn_time, retired=False): digest = StaticTAAHelper.taa_digest(text, version) data = encode_state_value({ TXN_AUTHOR_AGREEMENT_TEXT: text, Why is it implemente...
codereview_python_data_1985
reduction='mean', avg_factor=None, class_weight=None, - ignore_index=255): """Calculate the binary CrossEntropy loss. Args: 255 is so confusing reduction='mean', ...
codereview_python_data_1986
cls: Type[NameT], name: Union[SchemaName, str], module: Optional[str] = None, - ) -> Any: if not name: raise NameError('name must not be empty') This change doesn't seem to be correct. cls: Type[NameT], name: Union[SchemaName, str], module...
codereview_python_data_1991
from graphite.node import LeafNode, BranchNode from graphite.render.hashing import compactHash from graphite.util import unpickle, logtime, is_local_interface from graphite.finders.utils import BaseFinder from graphite.readers.remote import RemoteReader Shouldn't this be inside the loop? from graphite.node impo...
codereview_python_data_1992
self._proc.error.connect(self.on_proc_error) editor = config.get('general', 'editor') executable = editor[0] - args = [arg.replace('{}', self._filename) if '{}' in arg else arg for arg in editor[1:]] log.procs.debug("Calling \"{}\" with args {}".format(executable, args)) ...
codereview_python_data_2007
low_quality_rate=stats["low_quality"] - stats["last_low_quality"], no_match_rate=stats["no_match"] - stats["last_no_match"], listens_per_sec=listens_per_sec, - listens_matched_p=stats["listens_matched"] / stats["listen_cou...
codereview_python_data_2008
self.get_url(method) def get_url(self,method): - self.master.prompt("Url:", "http://www.example.com/", self.new_request, method) def new_request(self, url, method): try: Url -> URL (as in the flow editor) self.get_url(method) def get_url(self,method): + ...
codereview_python_data_2017
text="URL: <b>{}</b>".format( html.escape(url.toDisplayString())), yes_action=functools.partial(QDesktopServices.openUrl, url), - url=urlstr) return True elif (info.domain, info.error) in ignored_errors: log.webview...
codereview_python_data_2021
bbox_head=None, mask_roi_extractor=None, mask_head=None, - mask_iou_head=None, train_cfg=None, test_cfg=None, pretrained=None): Move this argument to `MaskScoringRCNN`. bbox_he...
codereview_python_data_2029
entry.qualified_name = self.builtin_scope().qualify_name(name) return entry - def _is_package_scope_or_module(self): - # Returns True for all ModuleScopes representing package or scopes representing - # modules. Otherwise returns False. - # Note: For package pkg_a Cython create...
codereview_python_data_2040
with ctx.new() as orderctx: orderctx.expr_exposed = False - # In OPDER BY we compile ir.Set as a subquery: # SELECT SetRel.value FROM SetRel) subq = relgen.set_as_subquery( expr.expr, as_value=True, ctx=orderctx) Typo fix opportunity: ```su...
codereview_python_data_2041
urlstr = info.url.toDisplayString() order = config.get('network', 'scheme-order') - if info.url.scheme() in order and order[-1:][0] != info.url.scheme(): next_scheme = order[order.index(info.url.scheme()) + 1] log.webview.info('Trying next scheme: {}'.format(next_schem...
codereview_python_data_2046
__tablename__ = violations_tablename id = Column(Integer, primary_key=True) - inventory_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 =...
codereview_python_data_2057
attr_dict.update(ndict) else: attr_dict = attr - self.add_node(n, **attr_dict) def remove_node(self, n): """Remove node n. You are only testing for whether the node is hashable, but this code is supposed to check if the node is already in the DiGr...
codereview_python_data_2060
request.setAttribute(QNetworkRequest.CacheLoadControlAttribute, QNetworkRequest.AlwaysNetwork) - if request.url().scheme().lower() != 'data': - suggested_fn = (utils.sanitize_filename(title) + ".html" if title - else urlutils.filename_f...
codereview_python_data_2063
for pipeline in pipelines: pipeline.run() - if notifier_configs.get('violation').get('cscc').get('enabled'): - CsccPipeline().run( - violations_as_dict, - notifier_configs.get('violation').get('cscc').get('gcs_path')) if __name__ == '__main__': Do you think it's possible ...
codereview_python_data_2069
<h1>Error 503 Backend is unhealthy</h1> <p>Backend is unhealthy</p> <h3>Guru Mediation:</h3> - <p>Details: cache-sea4460-SEA 1645545924 2021587045</p> <hr> <p>Varnish cache server</p> </body> One issue with this design is if I come up with a custom sampler (e.g., TimeSensitiveEdgeDataLoa...
codereview_python_data_2074
import sys -if sys.version_info[0] == 3 and sys.version_info[1] <= 5: sys.exit('Please use python version 3.6 or higher') # get the version If `sys.version_info[0]` is `2`, then it won't generate the error. You can also use this simple construct: `sys.version_info < (3, 6)`. Other nice examples: ``` ~ -> python...
codereview_python_data_2084
self._save_goal_state() self._update_host_plugin(new_goal_state.container_id, new_goal_state.role_config_name) - except Exception as e: # pylint: disable=C0103 - raise ProtocolError("Error processing goal state: {0}".format(ustr(e))) def try_update_goal_state(sel...
codereview_python_data_2088
label : [None | string] Label for legend - margins : Sequence of 2 numbers or None (default=None) - The sequence contains horizontal and vertical axis margins. Adjust to avoid image being clipped. Returns ------- The description here should be modified to reflect the changes below, ma...
codereview_python_data_2089
else: """change non-float data to float data, need to copy""" data = np.array(mat.reshape(mat.size), dtype=np.float32) - ptr_data, type_ptr_data, new_data = c_float_array(data) n_preds = self.__get_num_preds(num_iteration, mat.shape[0], ...
codereview_python_data_2097
parsed = urlparse(url) try: - return (unquote(parsed.username), unquote(parsed.password)) except (AttributeError, TypeError): - pass - return ('', '') def to_native_string(string, encoding='ascii'): I know I'm guilty of them, but I'm not the biggest fan of `except: ...
codereview_python_data_2100
mean = self.sum / self.count total = self.squared_sum - self.sum * mean raw_scores = 1 - (self.res / total) - n = tf.cast(self.num_examples, dtype=tf.float32) - - num = tf.multiply(tf.subtract(1.0, raw_scores), tf.subtract(n, 1.0)) - den = tf.subtract(tf.subtract(n, self....
codereview_python_data_2102
elif name == 'motd': emitter = dnf.automatic.emitter.MotdEmitter(system_name) emitters.append(emitter) - else: - if name != 'None': - assert False return emitters In think we should make confreader to convert None to real None elif name...
codereview_python_data_2104
@typechecked def __init__(self, units: int, - projection: Union[int, str] = None, use_bias: bool = False, kernel_initializer: types.Initializer = "glorot_uniform", recurrent_initializer: types.Initializer = "glorot_uniform...
codereview_python_data_2118
verify=True, cert=None, proxies=None, **adapter_kwargs): """Receives a Response. Returns a generator of Responses.""" - hist = [resp, ] # keep track of history; seed it with the original response url = self.get_redirect_target(resp) while url: No need for th...
codereview_python_data_2129
**Default Window Length:** 1 """ window_length = 1 - missing_value = nan def _validate(self): super(PeerCount, self)._validate() missing value of nan is the default for factors with dtype float64 (which is the default dtype for factors), so we shouldn't need this. **Default Window...
codereview_python_data_2137
@mock.patch('pymongo.MongoClient.__init__') @mock.patch('time.sleep') def test_connection_error(mock_sleep, mock_client): - from pymongo.errors import ConnectionFailure from bigchaindb.backend import connect # force the driver to trow ConnectionFailure for code other than bigchaindb we can import at th...
codereview_python_data_2139
def test_server_finishes_on_error(self): """the server thread exits even if an exception exits the context manager""" server = Server.basic_response_server() - try: with server: raise Exception() - except Exception: - pass assert len...
codereview_python_data_2140
task_configuration_error('{}.{}'.format(outer, inner)) return None - if config.evolve_captured: - parser.error('"evolve_captured" has been removed in favor of the EvolveTask') - return None if not (config.location or config.location_cache): parser.error("Needs ei...
codereview_python_data_2143
assert_almost_equal(Q.mean(), 0.0, decimal=1) - def test_villin_folded(self): # one folded, one unfolded f = MDAnalysis.Universe(contacts_villin_folded) You don't use the self argument. So please remove it and add the `staticmethod` decorator. assert_almost_equal(Q.mean(), 0.0...
codereview_python_data_2144
category_torch_type[category] = to_torch_type[np.dtype(category_tensors[category].dtype())] if type(category_tensors[category]) is TensorGPU: if not torch_gpu_device: - torch.device('cuda', dev_id) cat...
codereview_python_data_2151
from .dist_tensor import DistTensor from .partition import partition_graph, load_partition, load_partition_book from .graph_partition_book import GraphPartitionBook, PartitionPolicy -from .graph_partition_book import NodePartitionPolicy, EdgePartitionPolicy from .sparse_emb import SparseAdagrad, DistEmbedding from...
codereview_python_data_2152
(initial_finished, initial_inputs) = sampler.initialize(input_tensors) cell_input = initial_inputs cell_state = cell.get_initial_state(...) - for time_step in range(max_output_length): cell_output, cell_state = cell(cell_input, cell_state) sample_ids = sampler.sample(time_step, cell_outp...
codereview_python_data_2153
def _when(self, entry, next_time_to_run, mktime=time.mktime): adjust = self.adjust - return (mktime(entry._default_now().timetuple()) + (adjust(next_time_to_run) or 0)) def populate_heap(self, event_t=event_t, heapify=heapq.heapify): This is a protected method. You should pro...
codereview_python_data_2155
that accepts exactly one argument (:meth:`~nvidia.dali.types.SampleInfo` objects that represent the index of the requested sample). If batch is set to True, the ``source`` can be either a callable, an iterable or a generator function. - Callable in batch mode must accept exactly one argument - an inte...
codereview_python_data_2158
self.service_account_key_file = kwargs.get('service_account_key_file') self.vpc_host_project_id = kwargs.get('vpc_host_project_id') self.vpc_host_network = kwargs.get('vpc_host_network') or 'default' - self.vpc_host_subnetwork = kwargs.get('vpc_host_subnetwork') \ - or 'defa...
codereview_python_data_2164
q.title = "Save file to:" q.text = "Please enter a location for <b>{}</b>".format( html.escape(url.toDisplayString())) - q.url = url.toString(QUrl.RemoveUserInfo) q.mode = usertypes.PromptMode.download q.completed.connect(q.deleteLater) q.default = _path_suggestion(suggested_filenam...
codereview_python_data_2165
# sub-hook. return hooks[0] else: - return super(DelegatingHooks, cls).__new__(cls, hooks) - - def __init__(self, hooks): - self._hooks = hooks # Implement all interface methods by delegating to corresponding methods on # input hooks. we don't want to f...
codereview_python_data_2171
class TestTransTable(object): - Ridx = np.array([0, 0, 2, 2, 1, 1, 3, 3, 1, 2]) - Sidx = np.array([0, 1, 1, 0]) - @pytest.fixture() def tt(self): - return TransTable(10, 4, 2, self.Ridx, self.Sidx) def test_a2r(self, tt): for aix, rix in zip( these aren't used anywhere but the fix...
codereview_python_data_2172
return dh @classmethod - def from_store(cls, path, basename, key_size, passphrase: str = None): ca_path = os.path.join(path, basename + "-ca.pem") if not os.path.exists(ca_path): key, ca = cls.create_store(path, basename, key_size) Let's make this argument bytes righ...
codereview_python_data_2173
<h1>Error 503 Backend is unhealthy</h1> <p>Backend is unhealthy</p> <h3>Guru Mediation:</h3> - <p>Details: cache-sea4421-SEA 1645545908 1547545002</p> <hr> <p>Varnish cache server</p> </body> This is a little bit strange. Shouldn't it transform a tensor to a graph? <h1>Error 503 Ba...
codereview_python_data_2174
import cheese def report_cheese(name): - print("Found cheese: " + name.decode('utf-8')) cheese.find(report_cheese) It feels like the caller should do the decoding here. import cheese def report_cheese(name): + print("Found cheese: " + name) cheese.find(report_cheese) +
codereview_python_data_2175
# ANY KIND, either express or implied. See the License for the specific language # governing permissions and limitations under the License. -"""Base IO classes optimized for pandas on Ray execution.""" from .io import ( ExperimentalPandasOnRayIO, there's nothing about "experimental" in here # ANY KIND, eithe...
codereview_python_data_2177
# Cell add_docs(TfmdLists, setup="Transform setup with self", - decode="From `Pipeline", - show="From `Pipeline", overlapping_splits="All splits that are in more than one split", subset="New `TfmdLists` with same tfms that only includes items in `i`th split", in...
codereview_python_data_2178
} if fulfillment.type_name == 'threshold-sha-256': - subfulfillments = [ _fulfillment_to_details(cond['body']) for cond in fulfillment.subconditions ] return { 'type': 'threshold-sha-256', 'threshold': fulfillment.threshold, - ...
codereview_python_data_2183
schema, new_scalar, catenate=False) if needs_recreate: - cond = dbops.EnumExists(type_name) self.pgops.add( - dbops.DropEnum(name=type_name, conditions=[cond])) self.pgops.add(dbops.CreateEnum( dbops.E...
codereview_python_data_2186
return src_type.is_float and src_type.rank <= dst_type.rank return False -def best_match(arg_types, functions, pos=None, env=None, args=None, - validate_types_fully=False): """ Given a list args of arguments and a list of functions, choose one to call which seems to be the...
codereview_python_data_2187
KeyError: 'foo' """ - def __init__(self, cache=None): if cache is not None: self._cache = cache else: self._cache = {} - def get(self, key, dt, cleanup=basic_cleanup): """Get the value of a cached object. Parameters I would probably make thi...
codereview_python_data_2189
assert self._host is None return - if not utils.raises(ValueError, ipaddress.IPv6Address, parsed.netloc[1:-1]): # Using QUrl parsing to minimize ipv6 addresses url = QUrl() - url.setHost(parsed.hostname) self._host = url.host() ...
codereview_python_data_2210
""" -from __future__ import print_function - -from Bio._py3k import _as_string - class SwissProtParserError(ValueError): """An error occurred while parsing a SwissProt file.""" This won't work yet: ``` ====================================================================== ERROR: test_AlignIO -------------------...
codereview_python_data_2211
class CorpusTag(Model): """Corpus Tags for use in cross-pollination.""" tag = StringProperty() - fuzz_target = StringProperty() def coverage_information_date_to_string(date): Nit: fuzz_target_name for consistency with other data types (like FuzzTargetJob). class CorpusTag(Model): """Corpus Tags for use i...
codereview_python_data_2217
device = d.split(':')[1] break break - except OSError: - pass return device def set_hostname_record(self, hostname): Any value in logging? It isn't clear to me what would h...
codereview_python_data_2218
@staticmethod def apply_stealth(executor, code): - if executor not in ['shellcode_amd64', 'shellcode_386']: - options = dict(windows=lambda c: obfuscate_ps1(c), - darwin=lambda c: obfuscate_bash(c), - linux=lambda c: obfuscate_bash(c)) - ...
codereview_python_data_2219
# Wait a maximum of MIN_SECONDS_ALLOWED_FOR_CELL_CHECK seconds before requesting nearby cells if (seconds_since_last_check < self.MIN_SECONDS_ALLOWED_FOR_CELL_CHECK): # Sleep a bit longer for the Pokemon to appear self._log('Waiting for the Pokemon to ...
codereview_python_data_2223
if context.client_context: headers["X-Amz-Client-Context"] = context.client_context - def event_serializer(o): - if isinstance(o, datetime): - return o.isoformat() - - data = json.dumps(event, default=event_serializer) if isinstance(event, dict) else str(event) LOG.debug("Forw...
codereview_python_data_2224
Args: index: The index of the tab to get a size hint for. ellipsis: Whether to use ellipsis to calculate width - instead of the tab's text. - Forced to false for pinned tabs. Return: A QSize of the smallest tab size we can ...
codereview_python_data_2228
window = self._tabbed_browser.window() if window.isFullScreen(): - window.setWindowState(window._state_before_fullscreen & ~Qt.WindowFullScreen) else: - window._state_before_fullscreen = window.windowState() window.showFullScreen() Make this a public attrib...
codereview_python_data_2239
elif len(transform_or_transforms.get_shape()) == 2: transforms = transform_or_transforms else: raise ValueError( "Transforms should have rank 1 or 2, but got rank %d" - % len(transform_or_transforms.get_shape())) # Invert transformations transforms = flat_t...
codereview_python_data_2245
return url def check_forms_can_be_destroyed(self, tab): # Check for user modified fields in a single tab confirm_quit = config.get('ui', 'confirm-quit') if tab.isModified() and 'forms' in confirm_quit: You should add a docstring explaining what this does and what the tab argume...
codereview_python_data_2248
shutil.copy(whl, docker_build_dir / whl.name) subprocess.check_call([ "docker", - "buildx" "build", "--platform linux/amd64,linux/arm64,darwin/amd64,darwin/arm64", "--tag", be.docker_tag, You've missed the comma separator here. Subprocess gladly issues the command w...
codereview_python_data_2252
if k is None: nodes = G else: - nodes = seed.sample(sorted(G.nodes()), k) for s in nodes: # single source shortest paths if weight is None: # use BFS Unfortunately, nodes are not sortable in general.Using `sorted` should be fine in tests where we know what the nodes ar...
codereview_python_data_2253
fnames = test_utils.filter_files(data_dir, data_extension) nfiles = len(fnames) - for i in range(len(fnames), 10): # At leat 10 elements fnames.append(fnames[-1]) nfiles = len(fnames) _input_epoch = [ Could you add `TODO: remove` here? I'll remove these 3 lines with my `more_audio_data`...
codereview_python_data_2260
def test_restarter_can_initialize_after_pool_restart(txnPoolNodeSet): ''' - 1. Schedule restart after restart_timeout seconds - 2. Add restart schedule message to ActionLog - 3. Add start restart message to ActionLog - 4. Check that Restarter can be create (emulate case after node restart). ''' ...
codereview_python_data_2266
c = unique_atoms[mask] positions[mask] = mdamath.make_whole(c, inplace=False) # Apply reference shift if required: if ref == 'com': masses = c.masses total_mass = masses.sum() Could you check the i...
codereview_python_data_2271
self.assertAlmostEqual(evals_result['valid_0']['binary_logloss'][-1], ret, places=5) params['feature_fraction'] = 0.5 gbm2 = lgb.train(params, lgb_train, - num_boost_round=25, - valid_sets=lgb_eval, - verbose_eval=False, ...
codereview_python_data_2275
# if det_bboxes is rescaled to the original image size, we need to # rescale it back to the testing scale to obtain RoIs. - if rescale and not isinstance(scale_factors[0], float): - scale_factors = det_bboxes.new_tensor(scale_factors) - det_bboxes = det_bboxes[..., :4] ...
codereview_python_data_2281
elif archive_type in (ArchiveType.TAR, ArchiveType.TAR_LZMA): if archive_type == ArchiveType.TAR_LZMA: - # Import lzma here so that if lzma installation fails (as it may on - # Windows), other archives can still be opened. - # TODO(metzman): Determine if this actually fails on Windows and move th...
codereview_python_data_2289
# Hidrophobicity -# 1 Kyte & Doolittle index of hydrophobicity # J. Mol. Biol. 157:105-132(1982). # "KyteDoolittle" kd = {"A": 1.8, "R": -4.5, "N": -3.5, "D": -3.5, "C": 2.5, Are the numbers (1 to 27) meaningful? If you can avoid this is will make any future additions easier. Also perhaps do these in key order? ...
codereview_python_data_2294
# model settings model = dict( - type='MaskRCNN', pretrained='open-mmlab://resnet101_caffe', backbone=dict( type='ResNet', Add a new detector `MaskScoringRCNN`. # model settings model = dict( + type='MaskScoringRCNN', pretrained='open-mmlab://resnet101_caffe', backbone=dict( ...
codereview_python_data_2307
quit_texts.append("{} {} open.".format( tab_count, "tab is" if tab_count == 1 else "tabs are")) # Ask if pinned-tabs are open - if 'pinned-tabs' in config.val.confirm_quit and has_pinned: quit_texts.append("{} {} pinned.".format( - tab_count, "ta...