id stringlengths 24 28 | content stringlengths 121 2.08k |
|---|---|
codereview_python_data_12232 | 'charset', 'charpartition', 'taxpartition', 'matrix',
'tree', 'utree', 'translate', 'codonposset', 'title']
KNOWN_NEXUS_BLOCKS = ['trees', 'data', 'characters', 'taxa', 'sets', 'codons']
-PUNCTUATION = r'()[]{}\,;:=*\'"`+-<>'
MRBAYESSAFE = 'abcdefghijklmnopqrstuvwxyzABCDEFGHI... |
codereview_python_data_12235 | hour,min = 16,0
ref = ref[7:]
- refDate = datetime.utcnow().replace(hour=hour,minute=min,second=0,tzinfo=pytz.utc)
#Day reference
if ref in ('yesterday','today','tomorrow'): #yesterday, today, tomorrow
Same, with `django.utils.timezone` you can do `timezone.now().replace(hour=hour,minute=min,second=0)... |
codereview_python_data_12252 | @pyqtSlot(str)
def _on_config_changed(self, option: str) -> None:
if option.startswith('fonts.tabs.'):
- self.update()
self.ensurePolished()
self._set_icon_size()
elif option == 'tabs.favicons.scale':
Why are those two needed?
@pyqtSlot(str)
d... |
codereview_python_data_12254 | A new dataframe with the updated labels.
"""
- def new_labels_mapper(x):
- return str(prefix) + str(x)
if axis == 0:
return self.rename(new_row_labels=new_labels_mapper)
```suggestion def new_labels_mapper(x, prefix=str(prefix)): return prefix + str(x) ``` ... |
codereview_python_data_12255 | def generate_scoped_enum_definition(self, entry, code):
code.mark_pos(entry.pos)
type = entry.type
- name = entry.cname or entry.name or ""
- header, footer = self.sue_header_footer(type, "enum class", name)
- code.putln(header)
enum_values = entry.enum_values
... |
codereview_python_data_12267 | try:
return safe_run(cmd)
except subprocess.CalledProcessError as e:
- if not safe:
return ""
if "No such container" in e.stdout.decode(config.DEFAULT_ENCODING):
raise NoSuchContainer(container_name_or_id, stdout=e.stdout, stderr=e... |
codereview_python_data_12271 | r = s.get(url, stream=True, verify=verify_ssl)
# check status code before attempting to read body
if r.status_code != 200:
- raise 'Failed to download %s, response code %s' % (url, r.status_code)
total = 0
try:
The raised object should be an instance of `Exception` (otherwise we get a `... |
codereview_python_data_12287 | tag_string = container['image_tag'].format(container['image'],
container['image_version'])
- if 'disable_cache' in container and container['disable_cache'] is True:
- nocache = True
- else:
- nocache = False
errors... |
codereview_python_data_12295 | # Note: MrBayes may choke on large alignments if not interleaved
if interleave is None:
- interleave = False if columns <= 1000 else True
n.write_nexus_data(self.handle, interleave=interleave)
def _classify_alphabet_for_nexus(self, alphabet):
How about simplifying that to jus... |
codereview_python_data_12296 | @pytest.fixture()
def normalized_timeseries(self, h):
- return self._normalize_timeseries(h)
# keys are the names in the h.table
reference = {
Should just put this method into the fixture rather than refer to it
@pytest.fixture()
def normalized_timeseries(self, h):
+ # time... |
codereview_python_data_12304 | return ret
finally:
pcap_freealldevs(devs)
- if(conf.use_winpcapy):
get_if_list = winpcapy_get_if_list
def in6_getifaddr():
err = create_string_buffer(PCAP_ERRBUF_SIZE)
Can you rewrite without parenthesis? `if conf.use_winpcapy:`
return ret
finally:
pcap_freeallde... |
codereview_python_data_12305 | import warnings
-from Bio import Alphabet, BiopythonDeprecationWarning
from Bio.Align import _aligners
from Bio.Seq import Seq
from Bio.SeqRecord import SeqRecord, _RestrictedDict
Personally I would keep this as two lines, but like with the resorting of the imports.
import warnings
+from Bio import Alphabet
+fro... |
codereview_python_data_12308 | cmdline.type = "protein"
self.assertEqual(
str(cmdline),
- t_coffee_exe + " -output clustalw_aln "
- "-infile Fasta/fa01 -outfile Fasta/tc_out.aln "
"-type protein -outorder input -gapopen -2 -gapext -5",
)
stdout, stderr = cmdline()
C... |
codereview_python_data_12317 | Encoding for text data.
prettyprint : bool (optional, default: True)
If True use line breaks and indenting in output XML.
- version: string (optional default: '1.2draft')
- The version of GEXF to be used for nodes attrbutes checking
Examples
--------
```suggestion version: strin... |
codereview_python_data_12319 | else:
raise DGLError('Unsupported graph data type:', type(data))
-def hetero_from_relations(rel_graphs, num_nodes_per_type=None, index_dtype='int64'):
"""Create a heterograph from graphs representing connections of each relation.
The input is a list of heterographs where the ``i``th graph contai... |
codereview_python_data_12322 | install_requires = [
'tornado>=4.0,<5',
'python-daemon<3.0',
- 'toml',
]
if os.environ.get('READTHEDOCS', None) == 'True':
No version specification?
install_requires = [
'tornado>=4.0,<5',
'python-daemon<3.0',
]
if os.environ.get('READTHEDOCS', None) == 'True': |
codereview_python_data_12323 | 'vase', 'scissors', 'teddy bear', 'hair drier', 'toothbrush')
def load_annotations(self, ann_file):
- """Load annotation from COCO style annotation file
Args:
ann_file (str): Path of annotation file.
Missing the last `.`
'vase', 'scissors', 'teddy bear... |
codereview_python_data_12324 | def test_word_with_duplicated_character_in_mixed_case(self):
self.assertIs(is_isogram("Alphabet"), False)
- def test_word_with_duplicated_character_in_mixed_case_lowercase_first(self):
self.assertIs(is_isogram("alphAbet"), False)
def test_hypothetical_isogrammic_word_with_hyphen(self):
T... |
codereview_python_data_12329 | def max_id(self):
return int(self.MAX_FUTURE_SECONDS + calendar.timegm(time.gmtime()))
- def fetch_listens_from_storage(*args):
""" Override this method in PostgresListenStore class """
raise NotImplementedError()
Can you explain this?
def max_id(self):
return int(self... |
codereview_python_data_12331 | for code, titles in _codes.items():
for title in titles:
setattr(codes, title, code)
- if not title.startswith('\\') and not title.strartswith('/'):
setattr(codes, title.upper(), code)
I don't think `strartswith` is the name of this method.
for code, titles in _codes.items():
... |
codereview_python_data_12340 | ntypes = list(sorted(ntype_set))
else:
ntypes = list(sorted(num_nodes_per_type.keys()))
- num_nodes_per_type = utils.toindex([num_nodes_per_type[ntype] for ntype in ntypes])
ntype_dict = {ntype: i for i, ntype in enumerate(ntypes)}
for rgrh in rel_graphs:
if rgrh._graph.... |
codereview_python_data_12345 | img_show = mmcv.imresize(img_show, (ori_w, ori_h))
if out_dir:
- out_file = osp.join(out_dir,
- osp.basename(img_meta['filename']))
else:
out_file = None
For different datasets, we may want... |
codereview_python_data_12347 | GTTGCTTCTGGCGTGGGTGGGGGGG
<BLANKLINE>
- Note some formats require a binary handle (bytes) rather than a text mode
- handle (strings), and may require you to specify the molecule type when it
- cannot be determined by the parser:
>>> from Bio import SeqIO
>>> from io import BytesIO
This sou... |
codereview_python_data_12350 | algo.register_trading_control(AssetDateBounds(on_error='fail'))
def handle_data(algo, data):
- # This should work because sid 3's is valid during the algo
- # lifetime.
algo.order(algo.sid(3), 1)
# Sid already expired.
typo `3's is` --> `3 is`
... |
codereview_python_data_12352 | return len(self.masks)
def rescale(self, scale, interpolation='nearest'):
- """See `BaseInstanceMasks.rescale()`."""
if len(self.masks) == 0:
new_w, new_h = mmcv.rescale_size((self.width, self.height), scale)
rescaled_masks = np.empty((0, new_h, new_w), dtype=np.u... |
codereview_python_data_12357 | with self.assertRaisesRegex(ValueError, err):
FeatureLocation(42, 23, 1)
with self.assertRaisesRegex(ValueError, err):
FeatureLocation(BeforePosition(42), AfterPosition(23), -1)
- # Features with UnknownPositions should pass test
FeatureLocation(42, UnknownPos... |
codereview_python_data_12369 | Returns:
str|PathFilterScanTreeNode: a scan object, which is either
- a scan tree sub node, a path of the default value.
"""
return self._path_segments.get(path_segment, self.default_value)
I don't really undersand. "a path to the default value" maybe?
Returns:
str|PathFilte... |
codereview_python_data_12373 | )
# multiple column selection by label
- assert frame[:, f['value', 'id']].to_list()[0] == frame[:, ['value', 'id']].to_list()[0]
# multiple column selection by position
- assert frame[:, f[-1, 0]].to_list()[0] == frame[:, ['value', 'id']].to_list()[0]
#------------------------------------------------... |
codereview_python_data_12378 | class NAMDBINReader(base.SingleFrameReaderBase):
"""Reader for NAMD binary files.
- .. versionchanged:: 1.0.0
"""
Should be `.. versionadded:: 1.0.0.`
class NAMDBINReader(base.SingleFrameReaderBase):
"""Reader for NAMD binary files.
+ .. versionchanged:: 1.0.0.
""" |
codereview_python_data_12382 | plugin.UpdateChainAndProcess(parser_mediator, registry_key)
except (IOError, dfwinreg_errors.WinRegistryValueError) as exception:
parser_mediator.ProduceExtractionError(
- 'in key: {0:s} {1!s}'.format(registry_key.path, exception))
def _NormalizeKeyPath(self, key_path):
"""Normalizes... |
codereview_python_data_12383 | In case of excessive usage of the E-utilities, NCBI will attempt to contact
a user at the email address provided before blocking access to the
E-utilities.""", UserWarning)
- # Tell Entrez if we want to set a custom cache location.
- if "cache" not in params:
- params["cache"] = cache
return params... |
codereview_python_data_12385 | txn_type,
field=None,
value=None,
- is_owner: bool = True,
- non_ledger_did: bool = False):
self.txn_type = txn_type
self.field = str(field) if field is not None else ''
self.value = str(value) if value is n... |
codereview_python_data_12396 | @pytest.mark.parametrize(
- "fn", ["max", "min", "median", "skew", "kurt", "sem", "std", "var"]
)
@pytest.mark.parametrize(
"numeric_only", bool_arg_values, ids=arg_keys("numeric_only", bool_arg_keys)
This list is not the same as the list of affected operations.
@pytest.mark.parametrize(
+ "fn", ["max"... |
codereview_python_data_12401 | try:
proc = next(w for w in self._pool if w.pid == pid)
except StopIteration:
- logger.critical("process with pid=%s already exited :( this will be handled elsewhere.", pid)
return
assert proc.inqW_fd not in self._fileno_to_inq
assert proc.inqW_f... |
codereview_python_data_12407 | (overwrite) to write to the file!
"""
- def __init__(self, win_id, parent=None):
- super().__init__(win_id, parent)
-
def _cleanup(self):
"""Clean up temporary files after the userscript finished."""
if self._cleaned_up:
You can remove the overridden `__init__`now.
(ove... |
codereview_python_data_12409 | shellutil.run_command(["eject", dvd])
except shellutil.CommandError as cmd_err:
if chk_err:
- raise OSUtilError("Failed to eject dvd: ret={0}".format(cmd_err.returncode))
def try_load_atapiix_mod(self):
try:
we should probably add the stdout/stderr of the... |
codereview_python_data_12413 | except (errors.HttpError, HttpLib2Error) as e:
raise api_errors.ApiExecutionError(project_id, e)
- @tracing.traced()
def get_tables(self, project_id, dataset_id):
"""Return BigQuery tables stored in the requested project_id.
This decorator is used for classes, use the `@tracing.t... |
codereview_python_data_12415 | wikimedia tile source without warning.
This config parameter was introduced as wikimedia tile sources
- can no longer be used outside the wikimedia domain.""")
def __call__(self, **params):
self.param.set_param(**params)
```suggestion can no longer be used outside the wikimedia doma... |
codereview_python_data_12419 | request = self.client.objects().get_media(bucket=bucket, object=obj)
downloader = http.MediaIoBaseDownload(fp, request, chunksize=chunksize)
-
- try:
- _, done = downloader.next_chunk()
- except errors.HttpError as err:
- if err.resp.status <... |
codereview_python_data_12420 | # divide in degrees for mean reducer.
if reduce_op == 'mean':
- if g._graph.number_of_etypes() > 1:
- raise NotImplementedError("Reduce op 'mean' is not supported in "
- "the new heterograph API. Use multi_update_all().")
ret_shape = F.shape(ret)... |
codereview_python_data_12426 | return gsddmm_internal(
g._graph, op, lhs_data, rhs_data, lhs_target, rhs_target)
else:
- # TODO (Israt): Call reshape func
lhs_and_rhs_tuple = tuple(list(lhs_data) + list(rhs_data))
return gsddmm_internal_hetero(g, op, len(lhs_data), lhs_target,
... |
codereview_python_data_12427 | else:
get_weight = lambda u, v, data: data.get(weight, 1)
- length = dict(_dijkstra(G, source, get_weight, target=target))
try:
return length[target]
It seems we don't need this dict either. We just want the one length. So we can iterate through the values from `_dijkstra` and look for ... |
codereview_python_data_12430 | """Add a strategy into our existing strategy pool."""
self.strategy_names.add(strategy_tuple.name)
- def remove_strategy(self, strategy_tuple):
- """Remove a strategy from our existing strategy pool."""
- if strategy_tuple.name in self.strategy_names:
- self.strategy_names.remove(strategy_tuple.na... |
codereview_python_data_12431 | self._built = True
def feed_input(self, data_node, data, layout="", cuda_stream = None):
- """Bind a NumPy array (or a list thereof) to an output of ExternalSource.
- In the case of the GPU input, it is the user responsibility to modify the
- provided GPU memory content only using pro... |
codereview_python_data_12438 | node_subgraph
"""
if len(deprecated_kwargs) != 0:
- raise DGLError("Key word argument preserve_nodes is deprecated. "
- "Use relabel_nodes instead.")
if graph.is_block and relabel_nodes:
raise DGLError('Extracting subgraph from a block graph is not allowed.')
... |
codereview_python_data_12441 | <h1>Error 503 Backend is unhealthy</h1>
<p>Backend is unhealthy</p>
<h3>Guru Mediation:</h3>
- <p>Details: cache-sea4424-SEA 1645542746 1393056521</p>
<hr>
<p>Varnish cache server</p>
</body>
this isn't needed either
<h1>Error 503 Backend is unhealthy</h1>
<p>Backend is unheal... |
codereview_python_data_12442 | >>> G = nx.Graph() # or DiGraph, MultiGraph, MultiDiGraph, etc
>>> G.add_weighted_edges_from([(0,1,3.0),(1,2,7.5)])
"""
- # TODO For some reason this fails when `ebunch` is an iterator.
- ebunch = list(ebunch)
self.add_edges_from(((u, v, {weight: d}) for u, v, d in eb... |
codereview_python_data_12447 | return selection
# Second Legendre polynomial
- lg2 = lambda self,x : (3*x*x - 1)/2
def run(self, **kwargs):
"""
Do not use `sys.stdout.write`: if you want to show progress, use our own `lib.log.ProgressMeter` class.
return selection
# Second Legendre polynomial
+ lg2 =... |
codereview_python_data_12449 | else:
segm_results = self.simple_test_mask(
x, img_metas, det_bboxes, det_labels, rescale=rescale)
- return [
- (bbox_result, segm_result)
- for bbox_result, segm_result in zip(bbox_results, segm_results)
- ]
def aug_test(se... |
codereview_python_data_12454 | self.assertEqual(basename(test_data[trace]["path"][-1]).replace('.ab1', ''), record.name)
self.assertEqual(test_data[trace]['seq'], str(record.seq))
self.assertEqual(test_data[trace]['qual'], record.letter_annotations['phred_quality'])
- print(record)
... |
codereview_python_data_12455 | else:
self.sources = source
if not self.sim_params:
self.sim_params = create_simulation_parameters(
start=start,
We may want to take a step back and consider whether or not `run` should still supporting having the `start` and `end` paramaters. One thing to n... |
codereview_python_data_12460 | )
include_ancestors = (
expr_type is s_types.ExprType.Insert
- or include_descendants
)
return irtyputils.type_to_typeref(
schema,
It's probably cleaner to restate DML types here in case `include_descendants` deviates from the current set of conditions.
)
include... |
codereview_python_data_12466 | def join(self, other):
"""Return a merge of the sequences in other, spaced by the sequence from self.
- Accepts Seq/UnknownSeq objects and Strings as objects to be concatinated with
the spacer
>>> spacer = UnknownSeq(5)
- >>> seqlist = list([Seq("AAA"),Seq("TTT"),Seq("PPP")... |
codereview_python_data_12471 | binding.role: bigquery_acl.role,
}
- # only compare fields that were set
- rule_regex_to_val.pop(None, None)
-
return regular_exp.all_match(rule_regex_to_val)
Remove the 'pop' here? A rule will always have a dataset and role
binding.role: bigquery_acl.role,
... |
codereview_python_data_12472 | self._read_next_timestep()
- try:
- self._get_dt()
- except OSError:
- raise ValueError("Supplied n_atoms {} is incompatible "
- "with provided trajectory file. "
- "Maybe `topology` is wrong?".format(self.n_atoms))
-
-... |
codereview_python_data_12482 | >>> G = nx.DiGraph(nx.path_graph(4))
>>> sr = nx.simrank_matrix(G)
>>> sr
- [[ 1. 0. 0.8181254 0. ]
- [ 0. 1. 0. 0.8181254]
- [ 0.8181254 0. 1. 0. ]
- [ 0. 0.8181254 0. 1. ]]
Notes
-----
from travis tests, the re... |
codereview_python_data_12487 | np_t[0:2, 1:3, 0:4][0:1, 0:2, 2:3])
# Slice a zero-dim tensor
- with pytest.raises(Exception):
o3c.Tensor.ones((), device=device)[:]
- with pytest.raises(Exception):
o3c.Tensor.ones((), device=device)[0:1]
`with pytest.raises(RuntimeError, match="Cannot slice a... |
codereview_python_data_12498 | [1, 0, 0, 1, 1],
[1, 1, 0, 0, 1],
[1, 1, 1, 0, 0]], dtype=bool)
- # There's are also two nans in the independent data.
independent_nan_grid = np.array([[0],
... |
codereview_python_data_12504 | """
with debug.log_time(log.completion, 'Setting filter pattern'):
self.pattern = val
- val = val.casefold()
val = re.escape(val)
val = val.replace(r'\ ', r'.*')
- self.patternre = re.compile(val)
self.invalidateFilter()
... |
codereview_python_data_12511 | self.handle_private_mode = False
self._tmphist = None
- self.history = []
- if history:
self.history = history
def __getitem__(self, idx):
What's the reason for this change? The idiom ``` python def foo(self, bar=None): if bar is None: self.bar = [] else: self.bar = ba... |
codereview_python_data_12512 | logger.info("Starting to compile the library.")
cmake_cmd = ["cmake", "../compile/"]
- if opencl_python_package:
use_gpu = False
- use_mpi = False
- nomp = False
- use_hdfs = False
- cmake_cmd.append("-D__OPENCL_PYTHON_PACKAGE=ON")
if use_gpu:
cmake_cmd.ap... |
codereview_python_data_12513 | violation_map[resource['resource']],
global_configs,
notifier_configs, None))
if notifier['name'] != 'email_violations':
chosen_pipeline = find_notifiers(notifier[... |
codereview_python_data_12514 | assert type(disp_uv) is float
def test_impossible_things(self):
- G=nx.davis_southern_women_graph()
disp = nx.dispersion(G)
- for d in disp:
- for dd in d:
- assert dd >= 0
Failed on python 3, and a good thing. This isn't checking what you think. ``` pytho... |
codereview_python_data_12516 | from multiprocessing import Process, Queue
from typing import Dict, Tuple, Union
-import localstack.utils.docker
from localstack import config
from localstack.constants import (
THUNDRA_APIKEY,
nitpick: So far, we've usually used relative (not absolute) import names. We could continue using this pattern, e.g.... |
codereview_python_data_12525 | -def detect_anagrams(string, candidates):
pass
Your suggestion looks solid, but could you also change `string` to something more meaningful like `word`?
+def detect_anagrams(word, candidates):
pass |
codereview_python_data_12527 | 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
Exceptions can (and should) be r... |
codereview_python_data_12531 | ]
}
"""
task_def_arn = luigi.Parameter(default=None)
Could you update the above docstring to include this parameter and a description? (I don't use ECS, so perhaps this is obvious and unnecessary)
]
}
+ :param cluster: str defining the ECS clust... |
codereview_python_data_12534 | self[key] = value
def get_default_endpoint(self):
- """Get server address from the forseti_client_conf.yaml file
Returns:
str: Forseti server endpoint
To be accurate, this description should be shorter ```Get server address``` as it could either be the conf file OR th... |
codereview_python_data_12547 | connection (:class:`~bigchaindb.backend.connection.Connection`):
A connection to the database.
"""
- config_utils.autoconfigure()
-
- self.tendermint_host = tendermint_host or bigchaindb.config['tendermint']['host']
- self.tendermint_port = tendermint_port or ... |
codereview_python_data_12555 | If None, all edge weights are considered equal.
Otherwise holds the name of the edge attribute used as weight.
In this measure the weight is interpreted as the connection strength.
Returns
-------
nodes : dictionary
```suggestion In this measure the weight is interpreted as the conn... |
codereview_python_data_12559 | # http://msdn.microsoft.com/en-us/library/cc227282%28PROT.10%29.aspx
# http://msdn.microsoft.com/en-us/library/cc227259%28PROT.13%29.aspx
-import sys
import os
import stat
from azurelinuxagent.common.utils import shellutil
from azurelinuxagent.daemon.resourcedisk import get_resourcedisk_handler
from tests.tools ... |
codereview_python_data_12560 | 'sendgrid==5.6.0',
'simple-crypt==4.1.7',
'unicodecsv==0.14.1',
- 'xxhash==1.4.1',
# Setup related.
'grpcio==1.18.0',
'grpcio-tools==1.18.0',
Have you looked into the hash functions in hashlib for python? They hash to the same value by default. Installing a new library just for hashing... |
codereview_python_data_12565 | strethaddress_to_identifier('0xfAE4Ee59CDd86e3Be9e8b90b53AA866327D7c090'): 'CPC',
'ONE-2': 'ONE',
strethaddress_to_identifier('0xf4CD3d3Fda8d7Fd6C5a500203e38640A70Bf9577'): 'YFDAI',
- 'BTMX': 'ASD',
strethaddress_to_identifier('0xEA1ea0972fa092dd463f2968F9bB51Cc4c981D71'): 'MODEFI',
strethad... |
codereview_python_data_12568 | cycle_timestamp, configs, admin_api_client, dao)
])
else:
- raise inventory_errors.LoadDataPipelineError(
'Unable to inventory groups with specified arguments:\n%s',
- self.configs)
def _run_pipelines(pipelines):
"""Run the pipe... |
codereview_python_data_12569 | self.segm_head = build_head(segm_head)
self.mask_head = build_head(mask_head)
- def forward_dummy(self, img):
"""Used for computing network flops.
See `mmdetection/tools/analysis_tools/get_flops.py`
It might not be a good idea to hardcode the shape of images in this place. Can we... |
codereview_python_data_12571 | if params["local_listen_port"] == 12400:
# If local_listen_port is set to LightGBM's default value
# then we find a random open port for each worker
- worker_address_to_port = client.run(_find_random_open_port)
else:
# If another port was specified then we search for an open ... |
codereview_python_data_12572 | return PolygonMasks(resized_masks, *out_shape)
def shear(self,
- shear_matrix,
out_shape,
- fill_val=0,
- flags=cv2.INTER_NEAREST,
- borderMode=cv2.BORDER_CONSTANT):
raise NotImplementedError
def to_bitmap(self):
We also nee... |
codereview_python_data_12573 | ('graph vc', 'brown', 'brown'),
('graph rps', 'dark green', 'dark green'),
('graph fail', 'dark red', 'dark red'),
- ('graph r_time', 'dark blue', 'dark blue'),
('graph lt', 'dark cyan', 'dark cyan'),
('graph cn', 'dark magenta', 'dark magenta'),
('stat-hdr',... |
codereview_python_data_12574 | 'SELECT location FROM user_credentials UNION '
'SELECT location FROM amm_swaps',
)
- locations_raw = cursor.fetchall()
- locations = {Location.deserialize_from_db(loc[0]) for loc in locations_raw}
cursor.execute('SELECT DISTINCT type FROM amm_events')
- f... |
codereview_python_data_12575 | :param ppTime: the time at which PRE-PREPARE was sent
:param req: the client REQUEST
"""
- return self.default_executor(DOMAIN_LEDGER_ID, ppTime, reqs,
stateRoot, txnRoot)
def update_txn_with_extra_data(self, txn):
This is an API method defin... |
codereview_python_data_12577 | else:
line_width = width
- if isinstance(style, str):
linestyle = style
elif np.iterable(style):
if len(style) == len(edge_pos):
I think this logic can be simplified a bit: ```suggestion if np.iterable(style) and not isinstance(sty... |
codereview_python_data_12579 | """Return the name of this builtin function."""
raise NotImplementedError
-class BundledFunction(BuiltinFunction):
- """A builtin function that bundles multiple functions.
Parameters
----------
Why subclass `BuiltinFunction`? `BundledFunction` could be comprised of both UDF and builtin, ... |
codereview_python_data_12581 | dest_lng
)
- if self.bot.config.walk == 0:
- self.speed = self.bot.config.walk_min - random() * (self.bot.config.walk_max - self.bot.config.walk_min)
- else:
- self.speed = self.bot.config.walk
self.destLat = dest_lat
self.destLng = dest_lng
I... |
codereview_python_data_12585 | console.logger.info("streamlink is running as root! Be careful!")
-def check_current_versions():
"""Show current installed versions"""
if args.loglevel == "debug":
# MAC OS X
maybe this method should have a different name, like log current versions? might be confusing otherwise...
... |
codereview_python_data_12586 | try:
validate_listen(listen, listen_type)
listens.append(listen)
- except APIBadRequest as e:
- current_app.logger.info(str(e))
return listens
this still logs the error and the raise is discarded. Should it be the other way round?
try:
va... |
codereview_python_data_12590 | def test_changed(self):
config = [
- ([1,2,3,4,4,5,5,5,6,7], [0,0,0,0,1,0,1,1,0,0]),
- ([None,None,None,None,0,0,0,None,None,1], [0,1,1,1,0,1,1,0,1,0])
]
for i, c in enumerate(config):
name = "collectd.test-db{0}.load.value".format(i + 1)
For why the t... |
codereview_python_data_12596 | # TODO: deprecate `extra_convs_on_inputs`
warnings.simplefilter('once')
warnings.warn(
- '"extra_convs_on_inputs" will be deprecated in the future,'
'Please use "add_extra_convs"', DeprecationWarning)
self.add_ex... |
codereview_python_data_12607 | min_count = kwargs.pop("min_count")
if min_count != 0:
raise NotImplementedError(
- f"OmniSci' sum does not support such set of parameters: min_count={min_count}"
)
return self._agg("sum", **kwargs)
```suggestion f"OmniSci's sum does not support such ... |
codereview_python_data_12610 | """
if len(args) <= 0: # pylint: disable=len-as-condition
args = sys.argv[1:]
- command, force, verbose, debug, conf_file_path, log_collector_mode = parse_args(args)
if command == "version":
version()
elif command == "help":
This seems like we're returning a lot of arguments, a... |
codereview_python_data_12614 | """
Return Series as ndarray or ndarray-like depending on the dtype.
"""
-
- def values(df):
- return df.values
-
- return self._default_to_pandas(values)
def add(self, other, level=None, fill_value=None, axis=0): # noqa: PR01, RT01, D200
"""
```sugges... |
codereview_python_data_12615 | What type of feature importance should be dumped.
If "split", result contains numbers of times the feature is used in a model.
If "gain", result contains total gains of splits which use the feature.
- object_hook: function given to `json.loads`
Returns
---... |
codereview_python_data_12617 | import collections
import random
from tests import assert_equals
#-------------------------------------------------------------------------------
# Define namedtuple of test parameters
```python from tests import noop ... def test_ftrl_construct_wrong_inter(): with pytest.raises(TypeError) as e: noop(core.Ftrl(in... |
codereview_python_data_12624 | def test_wrong_source():
common_msg = "External Source in parallel mode (when `parallel=True`) accepts as `source` only *. Got {} instead"
- expected_error_msgs = (
common_msg.format("a callable that does not accept arguments"),
"External source callback must be a callable with 0 or 1 argumen... |
codereview_python_data_12629 | entries, where key is padded to a uniform width.
"""
- return format_pair(list(d.items()))
def format_text(text: TTextType) -> typing.Iterator[TViewLine]:
There's no need to wrap `d.items()` in `list()`.
entries, where key is padded to a uniform width.
"""
+ return format_pairs(d.items())
... |
codereview_python_data_12636 | init_dist(args.launcher, **cfg.dist_params)
# build the dataloader
- # TODO: support multiple images per gpu (only minor changes are needed)
samples_per_gpu = 1
if 'samples_per_gpu' in cfg.data.test:
samples_per_gpu = cfg.data.test.pop('samples_per_gpu')
Please merge with master so ... |
codereview_python_data_12641 | """
if not self.bundles:
@self.register('bundle',
- calendar_name=('NYSE'),
start_session=pd.Timestamp('2014', tz='UTC'),
end_session=pd.Timestamp('2014', tz='UTC'))
def _(environ,
we can drop ... |
codereview_python_data_12647 | def get_dependencies(self, cuda_version=None, idx=None):
- """Obtains dependant packages list if exists. Otherwise return None
Parameters
----------
This doc made me check, what happens if you pass `None` to `join`. Unsurprisingly, it fails :)
def get_dependencies(self, cuda... |
codereview_python_data_12649 | modin_df1.combine_first(modin_df2), pandas_df1.combine_first(pandas_df2)
)
- def test_corr(self):
- data = test_data_values[0]
modin_result = pd.DataFrame(data).corr()
pandas_result = pandas.DataFrame(data).corr()
df_equals(modin_result, pandas_result)
We can ... |
codereview_python_data_12651 | FuncThread(do_start).start()
LOG.info('Elasticsearch is starting for the first time, please wait..')
data['Created'] = True
- pass
result = get_domain_status(domain_name)
# record event
nit: `pass` not required here
FuncThread(do_start).start()
LOG.info('E... |
codereview_python_data_12667 | def test_check_not_empty_string_throws_on_empty_string():
with pytest.raises(errors.DataValidationError):
- validation.check_not_empty_string("")
def test_check_not_empty_string_passes_on_non_empty_string():
thrown = None
try:
- validation.check_not_empty_string("foobar")
except Exce... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.