id stringlengths 30 32 | content stringlengths 139 2.8k |
|---|---|
codereview_new_python_data_4399 |
-#!/usr/bin/env python3
-# -*- coding: utf-8 -*-
-"""
-
-This tests reading a LAMMPS data file with a
-"PairIJ Coeffs" section, issue #3336.
-
-"""
-
-import MDAnalysis as mda
-
-
-PAIRIJ_COEFFS_DATA = "PR3959_test.data"
-
-u = mda.Universe(PAIRIJ_COEFFS_DATA)
-
-print(str(u))
This can become part of the other LAMMP... |
codereview_new_python_data_4400 |
-#!/usr/bin/env python3
-# -*- coding: utf-8 -*-
-"""
-
-This tests reading a LAMMPS data file with a
-"PairIJ Coeffs" section, issue #3336.
-
-"""
-
-import MDAnalysis as mda
-
-
-PAIRIJ_COEFFS_DATA = "PR3959_test.data"
-
-u = mda.Universe(PAIRIJ_COEFFS_DATA)
-
-print(str(u))
This needs to be added as a `datafile` ... |
codereview_new_python_data_4401 | def test_wc_dist(u):
wmsg = ("Accessing results via selection indices is "
"deprecated and will be removed in MDAnalysis 2.5.0")
- with pytest.warns(match=wmsg):
for i in range(len(strand1)):
assert_allclose(WC.results.pair_distances[:, i], WC.results[i][0])
MAybe use http... |
codereview_new_python_data_4402 | def _single_frame(self) -> None:
self._res_array[self._frame_index, :] = dist
def _conclude(self) -> None:
self.results['times'] = np.array(self.times)
self.results['pair_distances'] = self._res_array
To be removed in 2.5.0
def _single_frame(self) -> None:
self._res_arra... |
codereview_new_python_data_4403 | def calc_dihedrals(coords1: Union[np.ndarray, 'AtomGroup'],
Array containing the dihedral angles formed by each quadruplet of
coordinates. Values are returned in radians (rad). If four single
coordinates were supplied, the dihedral angle is returned as a single
- number instead of an ... |
codereview_new_python_data_4404 | def test_sanitize_fail_warning(self):
with warnings.catch_warnings():
warnings.simplefilter("error")
u.atoms.convert_to.rdkit()
- if record:
- assert all("Could not sanitize molecule" not in str(w.message)
- for w in record.list)
@requires... |
codereview_new_python_data_4405 | def test_sanitize_fail_warning(self):
with warnings.catch_warnings():
warnings.simplefilter("error")
u.atoms.convert_to.rdkit()
- if record:
- assert all("Could not sanitize molecule" not in str(w.message)
- for w in record.list)
@requires... |
codereview_new_python_data_4406 |
If `distopia`_ is installed, the functions in this table will accept the key
'distopia' for the `backend` keyword argument. If the distopia backend is
selected the `distopia` library will be used to calculate the distances. Note
-that for functions listed in this table **distopia is the default backend if it
-is av... |
codereview_new_python_data_4407 | def timeseries(self, asel=None, start=0, stop=-1, step=1, order='afc'):
data is returned whenever `asel` is different from ``None``.
start : int (optional)
stop : int (optional)
- .. deprecated:: 3.0
Note that `stop` is currently *inclusive* but will be
- ... |
codereview_new_python_data_4408 | def timeseries(self, asel=None, start=0, stop=-1, step=1, order='afc'):
data is returned whenever `asel` is different from ``None``.
start : int (optional)
stop : int (optional)
- .. deprecated:: 3.0
Note that `stop` is currently *inclusive* but will be
- ... |
codereview_new_python_data_4409 | def _read_frame(self, i):
timestep = self._read_next_timestep()
return timestep
- def _read_next_timestep(self, ts=None):
- # NOTE: TRR implements its own version
- """copy next frame into timestep"""
- if self._frame == self.n_frames - 1:
- raise IOError(errn... |
codereview_new_python_data_4410 | def test_raises_StopIteration(self, reader):
with pytest.raises(StopIteration):
next(reader)
- @pytest.mark.parametrize('order', ['turnip', 'abc', ''])
- def test_timeseries_raises_incorrect_order(self, reader, order):
- with pytest.raises(ValueError, match="must be a permutation o... |
codereview_new_python_data_4411 | def _read_next_timestep(self, ts=None):
if ts is None:
# use a copy to avoid that ts always points to the same reference
# removing this breaks lammps reader
- ts = self.ts.copy() # why is this copy required ??
frame = self._file.read()
self._frame += 1
-... |
codereview_new_python_data_4412 | def _read_next_timestep(self, ts=None):
if self._frame == self.n_frames - 1:
raise IOError('trying to go over trajectory limit')
if ts is None:
- # use a copy to avoid that ts always points to the same reference
- # removing this breaks lammps reader
- ts... |
codereview_new_python_data_4413 | def test_pickle_reader(self, reader):
"Timestep is changed after pickling")
def test_frame_collect_all_same(self, reader):
- # check that the timestep resets so that the base pointer is the same
- # for all timesteps in a collection witht eh exception of memoryreader
... |
codereview_new_python_data_4414 | def __init__(self, filename, convert_units=True, dt=None, **kwargs):
.. versionchanged:: 0.17.0
Changed to use libdcd.pyx library and removed the correl function
- .. versionchanged:: 2.4.0
- Added deprecation warning for timestep copying
"""
super(DCDReader, s... |
codereview_new_python_data_4415 | def test_isolayer(self, u, periodic):
ref_outer = set(np.where((d1 < rmax) | (d2 < rmax))[0])
ref_outer -= ref_inner
- assert ref_outer == set(result.indices)
@pytest.mark.parametrize('periodic', (True, False))
def test_spherical_zone(self, u, periodic):
just to check, this sel... |
codereview_new_python_data_4416 | class DumpReader(base.ReaderBase):
to represent the unit cell. Lengths *A*, *B*, *C* are in the MDAnalysis
length unit (Å), and angles are in degrees.
- .. versionchanges:: 2.4.0
Now imports velocities and forces, translates the box to the origin,
and optionally unwraps trajectories with... |
codereview_new_python_data_4417 | def u(self):
0.019,
0.019,
0.019,
- 0.019, # methane [:5]
-0.003,
0.001,
0.001,
```suggestion
0.019, # methane [:5]
```
One thing picked up by flake8
def u(self):
... |
codereview_new_python_data_4418 | def test_group_return_unsorted_sorted_unique(self, ugroup):
assert unsorted_unique is sorted_unique
assert unique._cache['unsorted_unique'] is sorted_unique
class TestEmptyAtomGroup(object):
""" Test empty atom groups
"""
```suggestion
class TestEmptyAtomGroup(object):
```
As above... |
codereview_new_python_data_4419 | def wrapper(*args, **kwargs):
def check_atomgroup_not_empty(groupmethod):
"""Decorator triggering a ``ValueError`` if the underlying group is empty.
- Avoids obscure computational errors on group methods.
Raises
------
This is a bit vague
```suggestion
Avoids downstream errors in compu... |
codereview_new_python_data_4420 | def _load_offsets(self):
"{self.filename}. Using slow offset calculation.")
self._read_offsets(store=True)
return
- raise e
with fasteners.InterProcessLock(lock_name) as filelock:
if not isfile(fname):
```suggestion
... |
codereview_new_python_data_4421 | class TXYZParser(TopologyReaderBase):
- Elements
.. versionadded:: 0.17.0
- .. versionchanged:: 2.4
- Adding Element attribute if all names is a valid element symbol
"""
format = ['TXYZ', 'ARC']
```suggestion
Adding the `Element` attribute if all names are valid element symbol... |
codereview_new_python_data_4422 | class TXYZParser(TopologyReaderBase):
- Elements
.. versionadded:: 0.17.0
- .. versionchanged:: 2.4
- Adding Element attribute if all names is a valid element symbol
"""
format = ['TXYZ', 'ARC']
```suggestion
.. versionchanged:: 2.4.0
```
class TXYZParser(TopologyReaderBase):
... |
codereview_new_python_data_4423 | def test_TXYZ_elements():
element_list = np.array(['C', 'H', 'H', 'O', 'H', 'C', 'H', 'H', 'H'], dtype=object)
assert_equal(u.atoms.elements, element_list)
def test_missing_elements_noattribute():
"""Check that:
```suggestion
```
def test_TXYZ_elements():
element_list = np.... |
codereview_new_python_data_4424 | class TXYZParser(TopologyReaderBase):
- Atomnames
- Atomtypes
- - Elements
.. versionadded:: 0.17.0
.. versionchanged:: 2.4.0
```suggestion
- Elements (if all atom names are element symbols)
```
Otherwise users will be surprised when they do not have an `elements` attribute.
clas... |
codereview_new_python_data_4425 | def test_between_simple_case_indices_only(self, group, ag, ag2, expected):
).indices
assert_equal(actual, expected)
- distance = 5.9
-
- def test_between_return_type_not_empty(self, group, ag, ag2):
'''Test MDAnalysis.analysis.distances.between() for
returned type when retur... |
codereview_new_python_data_4426 | def test_between_simple_case_indices_only(self, group, ag, ag2, expected):
).indices
assert_equal(actual, expected)
- distance = 5.9
-
- def test_between_return_type_not_empty(self, group, ag, ag2):
'''Test MDAnalysis.analysis.distances.between() for
returned type when retur... |
codereview_new_python_data_4427 | def test_between_return_type(self, dists, group, ag, ag2):
ag2,
dists
)
- assert(isinstance(actual, MDAnalysis.core.groups.AtomGroup))
`assert` is a statement, not a function
```suggestion
assert isinstance(actual, MDAnalysis.core.groups.AtomGroup)
```
def test_b... |
codereview_new_python_data_4428 | def test_between_simple_case_indices_only(self, group, ag, ag2, expected):
@pytest.mark.parametrize('dists', [5.9, 0.0])
def test_between_return_type(self, dists, group, ag, ag2):
- '''Test MDAnalysis.analysis.distances.between() for
- returned type when returned group is not empty.'''
... |
codereview_new_python_data_4429 |
import pytng
from MDAnalysisTests.datafiles import (TNG_traj, TNG_traj_gro)
-
@pytest.mark.skipif(not HAS_PYTNG, reason="pytng not installed")
-class TestTNGTraj(object):
_n_atoms = 1000
_n_frames = 101
Why are we not using it multiframereader base test class in the tests here? Given we have th... |
codereview_new_python_data_4430 | def test_pytng_not_present_raises():
with pytest.raises(ImportError, match="please install pytng"):
u = mda.Universe(TNG_traj_gro, TNG_traj)
@pytest.mark.skipif(not HAS_PYTNG, reason="pytng not installed")
class TNGReference(BaseReference):
also test the static method (for getting number of atoms)... |
codereview_new_python_data_4431 | def test_equivalent_atoms(self, ref, output):
for attr in self.almost_equal_atom_attrs:
ra = getattr(r, attr)
oa = getattr(o, attr)
- assert_allclose(
- ra,
- oa,
- rtol=0,
- atol=1... |
codereview_new_python_data_4432 | def _format_PDB_charges(charges: np.ndarray) -> np.ndarray:
NumPy array of dtype object with strings representing the
formal charges of the atoms being written.
"""
- if charges.dtype != int:
raise ValueError("formal charges array should be of `int` type")
... |
codereview_new_python_data_4433 | def attach_auxiliary(self,
for reader in coord_parent._auxs.values():
aux_memory_usage += reader._memory_usage()
if aux_memory_usage > memory_limit:
- warnings.warn("AuxReader: memory usage warning!")
def _memory_usage(self):
raise NotImplementedError("BUG: Ove... |
codereview_new_python_data_4434 | def attach_auxiliary(self,
for reader in coord_parent._auxs.values():
aux_memory_usage += reader._memory_usage()
if aux_memory_usage > memory_limit:
- warnings.warn("AuxReader: memory usage warning!")
def _memory_usage(self):
raise NotImplementedError("BUG: Ove... |
codereview_new_python_data_4435 | def long_description(readme):
'packaging',
'fasteners',
'gsd>=1.9.3',
- 'pyedr'
]
setup(name='MDAnalysis',
add a comma to reduce diff noise when we add the next
def long_description(readme):
'packaging',
'fasteners',
'gsd>=1.9.3'... |
codereview_new_python_data_4436 |
from typing import Union, Optional, Callable
from typing import TYPE_CHECKING
-if TYPE_CHECKING:
from ..core.groups import AtomGroup
from .util import check_coords, check_box
from .mdamath import triclinic_vectors
Add a `#pragma: no coverage` (or whatever excludes it from coverage) as this looks as some co... |
codereview_new_python_data_4437 | def check_coords(*coord_names, **options):
array([1., 1., 1.], dtype=float32)
>>>
>>> # automatic handling of AtomGroups
- >>> u = mda.Universe(PSF,DCD)
>>> coordsum(u.atoms, u.select_atoms("index 1 to 10"))
...
>>>
add space after comma
def check_coords(*coord_names, **options):
... |
codereview_new_python_data_4438 |
# MDAnalysis: A Toolkit for the Analysis of Molecular Dynamics Simulations.
# J. Comput. Chem. 32 (2011), 2319--2327, doi:10.1002/jcc.21787
#
-from turtle import position
import pytest
import numpy as np
from numpy.testing import assert_equal, assert_almost_equal, assert_allclose
Really, we're using `turtle` so... |
codereview_new_python_data_4439 | def test_PBC_mixed_combinations(self, backend, ref_system, pos0, pos1,
d = distances.distance_array(ref_val, points_val,
box=box,
backend=backend)
- assert_almost_equal(d, np.array([[0., 0., 0., self._dist(points[3],
- ... |
codereview_new_python_data_4440 | def test_input_unchanged_apply_PBC_atomgroup(self, coords_atomgroups, box,
ref = crd.positions.copy()
res = distances.apply_PBC(crd, box, backend=backend)
assert_equal(crd.positions, ref)
-
class TestEmptyInputCoordinates(object):
"""Tests ensuring that the following function... |
codereview_new_python_data_4441 | def search(self, atoms: AtomGroup,
unique_idx = unique_int_1d(np.asarray(pairs[:, 1], dtype=np.intp))
return self._index2level(unique_idx, level)
- def _index2level(self, indices: List[int], level: str) -> None:
"""Convert list of atom_indices in a AtomGroup to either the
A... |
codereview_new_python_data_4442 | def test_plot_mean_profile(self, hole, frames, profiles):
stds = np.array(list(map(np.std, binned)))
midpoints = 0.5 * bins[1:] + 0.5 * bins[:-1]
# assume a bin of length 1.5
- assert_allclose(midpoints, bins[1:], atol=0.75)
ylow = list(mean-(2*stds))
yhigh = list(... |
codereview_new_python_data_4588 | def main():
{}
</ul>
</description>
- </release>\n'''[1:]
tmp = ''
regex = r"version ([\d.]+) \(([\w ]+)\)\n(.*?)[\n]{2}"
Here we take all symbols except the first one. Should it be better to just remove **<** from the beginning of the line instead of making a copy of the string?
... |
codereview_new_python_data_4655 | def prepare(self):
# xyz if STABLE|LATEST
# STABLE otherwise
config_version = self.settings.get("version", JMeter.VERSION, force_set=True)
- if config_version == "auto":
- self.settings["version"] = JMeter.VERSION
- elif config_version == JMet... |
codereview_new_python_data_5038 | def test_mask_parse(self):
[4.1, 2.2, 0.6, 5.5, 0.6],
[2.7, 2.5, 0.4, 5.7, 0.2],
],
- numpy.float64,
)
try:
treecluster(data, mask1)
As `numpy.float` was a synonym for `float`, I would prefer to replace it with just `float` here.... |
codereview_new_python_data_5039 |
Examples
--------
-This example downloads the Cellosaurus database and parses it:
>>> from urllib.request import urlopen
>>> from io import TextIOWrapper
>>> from Bio.ExPASy import cellosaurus
>>> url = "ftp://ftp.expasy.org/databases/cellosaurus/cellosaurus.txt"
>>> bytestream = urlopen... |
codereview_new_python_data_5040 | def __init__(self, probe_radius=1.40, n_points=100, radii_dict=None):
f"Probe radius must be a positive number: {probe_radius} <= 0"
)
- self.probe_radius = probe_radius
if n_points < 1:
raise ValueError(
Would it matter if the user passed an integer or s... |
codereview_new_python_data_5041 | def run_psea(fname, verbose=False):
if not p.stderr.strip() and os.path.exists(base + ".sea"):
return base + ".sea"
else:
- raise RuntimeError("stderr not empty")
def psea(pname):
Sorry, I missed this. We should return the message here e.g. `raise RuntimeError(f"Error running p-sea: {p.... |
codereview_new_python_data_5042 | def _count_codons(self, fasta_file):
# iterate over sequence and count all the codons in the FastaFile.
for record in SeqIO.parse(handle, "fasta"):
- sequence = record.seq
for i in range(0, len(sequence), 3):
codon = sequence[i : i + 3]
... |
codereview_new_python_data_5043 |
-# Copyright 2000, 2004 by Brad Chapman.
-# Revisions copyright 2010-2013, 2015-2018 by Peter Cock.
# All rights reserved.
#
# This file is part of the Biopython distribution and governed by your
Although the classes here were in ``Bio/Align/__init__.py`` I don't think that copyright block applies.
Rather it lo... |
codereview_new_python_data_5044 |
from Bio import MissingExternalDependencyError
import os
if "command not found" or "'psea' is not recognized" in getoutput("psea -h"):
raise MissingExternalDependencyError(
"Download and install psea from ftp://ftp.lmcp.jussieu.fr/pub/sincris/software/protein/p-sea/. Make sure that psea is on path"
... |
codereview_new_python_data_5045 | class State(enum.Enum):
class AlignmentIterator(interfaces.AlignmentIterator):
- """FASTA output alignment iterator.
- For reading the (pairwise) alignments from the FASTA alignment programs
- using the '-m 8CB' or '-m 8CC' output formats.
"""
def __init__(self, source):
Mention BLAST outp... |
codereview_new_python_data_5046 | def __init__(self, database_manager: DatabaseManager,
self.get_revocation_strategy = get_revocation_strategy
self.write_req_validator = write_req_validator
self.legacy_sort_config = getConfig().REV_STRATEGY_USE_COMPAT_ORDERING or False
- self.config_state = self.database_manager.get_d... |
codereview_new_python_data_5047 | def hard_reset():
execute_command(soft_reset_cmd, timeout=RECOVERY_CMD_TIMEOUT)
if environment.is_android_emulator():
- #For recovery state
logs.log('Platform ANDROID_EMULATOR detected.')
restart_adb()
state = get_device_state()
Can you please format this comment a bit better by adding a spa... |
codereview_new_python_data_5048 | def do_GET(self): # pylint: disable=invalid-name
def run_server():
"""Start a HTTP server to respond to the health checker."""
- if utils.is_oss_fuzz() or environment.is_android():
- # OSS-Fuzz and Android multiple instances per host model aren't supported
# yet.
return
This may be a little too... |
codereview_new_python_data_5049 | def is_android_kernel(plt=None):
def is_android_real_device():
"""Return True if we are on a real android device."""
- return platorm() == 'ANDROID'
def is_lib():
Please fix the typo/tests, thanks!
def is_android_kernel(plt=None):
def is_android_real_device():
"""Return True if we are on a real a... |
codereview_new_python_data_5050 | def split_stacktrace(stacktrace: str):
"""Split stacktrace by line, and handle special cases with regex."""
stacktrace = re.sub(CONCATENATED_SAN_DEADLYSIGNAL_REGEX,
SPLIT_CONCATENATED_SAN_DEADLYSIGNAL_REGEX, stacktrace)
- print(stacktrace)
return stacktrace.splitlines()
... |
codereview_new_python_data_5051 | def split_stacktrace(stacktrace: str):
"""Split stacktrace by line, and handle special cases with regex."""
stacktrace = re.sub(CONCATENATED_SAN_DEADLYSIGNAL_REGEX,
SPLIT_CONCATENATED_SAN_DEADLYSIGNAL_REGEX, stacktrace)
- print(stacktrace)
return stacktrace.splitlines()
... |
codereview_new_python_data_5052 |
SAN_DEADLYSIGNAL_REGEX = re.compile(
r'(Address|Leak|Memory|UndefinedBehavior|Thread)Sanitizer:DEADLYSIGNAL')
CONCATENATED_SAN_DEADLYSIGNAL_REGEX = re.compile(
- r'\n(.+)(' + SAN_DEADLYSIGNAL_REGEX.pattern + r')\n')
SPLIT_CONCATENATED_SAN_DEADLYSIGNAL_REGEX = r'\n\1\n\2\n'
SAN_FPE_REGEX = re.compile(r'.*[a... |
codereview_new_python_data_5053 | def prepare(self, corpus_dir, target_path, build_dir):
arguments.extend(strategy_info.arguments)
# Update strategy info with environment variables from fuzzer's options.
- for env_var_name, value in extra_env:
- if env_var_name not in strategy_info.extra_env:
- strategy_info.extra_env[env_va... |
codereview_new_python_data_5054 | def matches_top_crash(testcase, top_crashes_by_project_and_platform):
def _group_testcases_based_on_variants(testcase_map):
"""Group testcases that are associated based on variant analysis."""
# Skip this if the project is configured so (like Google3).
- config_decision = local_config.ProjectConfig().get('vari... |
codereview_new_python_data_5055 |
OPTIONS_FILE_EXTENSION = '.options'
# Whitelist for env variables .options files can set.
-ENV_VAR_WHITELIST = set([afl_constants.DONT_DEFER_ENV_VAR, "GODEBUG"])
class FuzzerOptionsException(Exception):
Please use single quotes.
OPTIONS_FILE_EXTENSION = '.options'
# Whitelist for env variables .option... |
codereview_new_python_data_5056 | def check_miracleptr_status(testcase):
try:
return MIRACLEPTR_STATUS[status]
except:
- logs.log(f'Unknown MiraclePtr status: {line}')
break
return None
nit: log_error here.
def check_miracleptr_status(testcase):
try:
return MIRACLEPTR_STATUS[status]
... |
codereview_new_python_data_5057 |
GROUP_MAX_TESTCASE_LIMIT = 25
VARIANT_CRASHES_IGNORE = re.compile(
- r'^Out-of-memory|^Timeout|^Missing-library|^Data race')
VARIANT_THRESHOLD_PERCENTAGE = 0.2
VARIANT_MIN_THRESHOLD = 5
nit: do
```
r'^(Out-of-memory|...|...)'
```
to avoid many repetitions of `^`.
GROUP_MAX_TESTCASE_LIMIT = 25
... |
codereview_new_python_data_5058 |
r'^std::sys_common::backtrace',
r'^__rust_start_panic',
r'^__scrt_common_main_seh',
- r'^libgcc_s.so.1',
# Functions names (contains).
r'.*ASAN_OnSIGSEGV',
Can you add a test? see https://github.com/google/clusterfuzz/commit/c8ddbe20fc4706cdfc8f46b79076fd7ad6b1cd9c for an example.
... |
codereview_new_python_data_5059 | def _get_runner():
def _get_reproducer_path(log, reproducers_dir):
"""Gets the reproducer path, if any."""
crash_match = _CRASH_REGEX.search(log)
- if not crash_match or not crash_match.group(1):
return None
tmp_crash_path = Path(crash_match.group(1))
prm_crash_path = Path(reproducers_dir) / tmp_cra... |
codereview_new_python_data_5060 |
r'libFuzzer: out-of-memory \(',
r'rss limit exhausted',
r'in rust_oom',
- r'Failure description: out-of-memory', # Centipede
]))
RUNTIME_ERROR_REGEX = re.compile(r'#\s*Runtime error in (.*)')
RUNTIME_ERROR_LINE_REGEX = re.compile(r'#\s*Runtime error in (.*), line [0-9]+')
nit: end with period.
... |
codereview_new_python_data_5061 | def save(self, issue):
def create(self):
"""Create an issue object locally."""
- raw_fields = {"id": "-1", "fields": {"components": [], "labels": []}}
# Create jira issue object
jira_issue = jira.resources.Issue({},
jira.resilientsession.ResilientSession(),... |
codereview_new_python_data_5062 | def get_testcase_variant(testcase_id, job_type):
def get_all_testcase_variants(testcase_id):
"""Get all testcase variant entities based on testcase id."""
- variants = data_types.TestcaseVariant.query(
- data_types.TestcaseVariant.testcase_id == testcase_id).get()
- if not variants:
return []
- retu... |
codereview_new_python_data_5063 | def get_all_testcase_variants(testcase_id):
data_types.TestcaseVariant.testcase_id == testcase_id)
if not variants_query:
return []
- return list(variants_query.iter())
# ------------------------------------------------------------------------------
I think this will never be the case. can omit.... |
codereview_new_python_data_5064 | def get_all_testcase_variants(testcase_id):
data_types.TestcaseVariant.testcase_id == testcase_id)
if not variants_query:
return []
- return list(variants_query.iter())
# ------------------------------------------------------------------------------
No need to turn this into an eager list. We ca... |
codereview_new_python_data_5065 | def test_reproduce(self):
"""Tests reproducing a crash."""
testcase_path, _ = setup_testcase_and_corpus('crash', 'empty_corpus')
engine_impl = engine.Engine()
- sanitized_target_path = f'{DATA_DIR}/__centipede_address/test_fuzzer'
result = engine_impl.reproduce(sanitized_target_path, testcase_pa... |
codereview_new_python_data_5066 | def reset_current_memory_tool_options(redzone_size=0,
set_value('MEMORY_TOOL', tool_name)
bot_platform = platform()
# Default options for memory debuggin tool used.
- if tool_name in ['ASAN', 'HWASAN', 'NOSANITIZER']:
tool_options = get_asan_options(redzone_size, malloc_context_size,
... |
codereview_new_python_data_5067 | def job_name(self, project_name, config_suffix):
GFT_UBSAN_JOB = JobInfo('googlefuzztest_ubsan_', 'googlefuzztest', 'undefined',
['googlefuzztest', 'engine_ubsan'])
-LIBFUZZER_NONE_JOB = JobInfo("libfuzzer_none_", "libfuzzer", "none", [])
LIBFUZZER_NONE_I386_JOB = JobInfo(
- "libfuzzer_... |
codereview_new_python_data_5068 | def test_unrecovered_exception(self):
testcase.get_metadata(triage.TRIAGE_MESSAGE_KEY))
def test_no_experimental_bugs(self):
- """Test no exception."""
self.mock.file_issue.return_value = 'ID', None
self.testcase.crash_type = 'Command injection'
self.assertFalse(triage._fil... |
codereview_new_python_data_5069 | def prepare_runner(fuzzer_path,
engine_common.recreate_directory(fuzzer_utils.get_temp_dir())
if environment.get_value('USE_UNSHARE'):
runner_class = UnshareAflRunner
- elif not environment.is_android():
- runner_class = AflRunner
- else:
runner_class = AflAndroidRunner
runner = runner_class(... |
codereview_new_python_data_5070 | def get_command(self, additional_args=None):
if additional_args:
command.extend(additional_args)
- return self.tool_prefix('unshare') + self.tool_prefix('inj') + command
class ModifierProcessRunner(ModifierProcessRunnerMixin, ProcessRunner):
nit: rename inj to extra_sanitizers
def get_command(... |
codereview_new_python_data_5071 | def parse(self, stacktrace: str) -> CrashInfo:
# Shell bugs detected by extra sanitizers.
self.update_state_on_match(
- EXTRA_SANITIZERS_SHELL_BUG_REGEX, line, state, new_type='Shell bug')
# For KASan crashes, additional information about a bad access may come
# from a later li... |
codereview_new_python_data_5072 | def create_grid(self):
self.method_label = QLabel(_('Method') + ':')
self.method_combo = QComboBox()
self.method_combo.addItems([_('Preserve payment'), _('Decrease payment')])
- self.method_combo.currentIndexChanged.connect(self.update)
old_size_label = TxSizeLabel()
... |
codereview_new_python_data_5073 | def start(self, initial_data = {}):
return self._current
def last_if_single_password(self, view, wizard_data):
- return False # TODO: self._daemon.config.get('single_password')
def last_if_single_password_and_not_bip39(self, view, wizard_data):
return self.last_if_single_password... |
codereview_new_python_data_5074 | def export_request(self, x: Invoice) -> Dict[str, Any]:
# if request was paid onchain, add relevant fields
# note: addr is reused when getting paid on LN! so we check for that.
is_paid, conf, tx_hashes = self._is_onchain_invoice_paid(x)
- if is_paid and self.lnworker.g... |
codereview_new_python_data_5075 | def merge_in(self, tree, scope, stage, merge_scope=False):
# CodeGenerator, and tell that CodeGenerator to generate code
# from multiple sources.
assert isinstance(self.body, Nodes.StatListNode)
if self.pxd_stats is None:
self.pxd_stats = Nodes.StatListNode(self.body.... |
codereview_new_python_data_5076 | def __init__(self, cname, components):
self._convert_to_py_code = None
self._convert_from_py_code = None
# equivalent_type must be set now because it isn't available at import time
- from . import Builtin
- self.equivalent_type = Builtin.tuple_type
def __str__(self):
... |
codereview_new_python_data_5077 | def test_use_typing_attributes_as_non_annotations():
def test_optional_ctuple(x: typing.Optional[tuple[float]]):
"""
- Should not be a C-tuple (because these can't be optional
>>> test_optional_ctuple((1.0,))
tuple object
"""
```suggestion
Should not be a C-tuple (because these can't be... |
codereview_new_python_data_5082 |
# distutils: language = c++
-# Note that the pure and classic syntax examples are not quite identical
-# since pure Python syntax does not support C++ "new", so we allocate the
-# scratch space slightly differently
from cython.parallel import parallel, prange
from cython.cimports.libc.stdlib import malloc, free
... |
codereview_new_python_data_5083 | def is_reverse_number_slot(name):
unaryfunc = Signature("T", "O") # typedef PyObject * (*unaryfunc)(PyObject *);
binaryfunc = Signature("OO", "O") # typedef PyObject * (*binaryfunc)(PyObject *, PyObject *);
ibinaryfunc = Signature("TO", "O") # typedef PyObject * (*binaryfunc)(PyObject *,... |
codereview_new_python_data_5084 | def runtests(options, cmd_args, coverage=None):
('limited_api_bugs.txt', options.limited_api),
('windows_bugs.txt', sys.platform == 'win32'),
('cygwin_bugs.txt', sys.platform == 'cygwin'),
- ('windows_bugs_39.txt', sys.platform == 'win32' and sys.version_info[:2] == (3... |
codereview_new_python_data_5085 | def find_referenced_modules(self, env, module_list, modules_seen):
module_list.append(env)
def sort_types_by_inheritance(self, type_dict, type_order, getkey):
- subclasses = {} # maps type key to list of subclass keys
for key in type_order:
new_entry = type_dict[key]
... |
codereview_new_python_data_5086 | def func(a: fused_type1, b: fused_type2):
# called from Cython space
cfunc[cython.double](5.0, 1.0)
cpfunc[cython.float, cython.double](1.0, 2.0)
-# Indexing def function in Cython code requires string names
func["float", "double"](1.0, 2.0)
```suggestion
# Indexing def functions in Cython code requires string n... |
codereview_new_python_data_5087 | class Context(object):
# include_directories [string]
# future_directives [object]
# language_level int currently 2 or 3 for Python 2/3
- # legacy_implicit_noexcept [bool]
cython_scope = None
language_level = None # warn when not set but default to Py2
I th... |
codereview_new_python_data_5088 | def __init__(self, include_directories, compiler_directives, cpp=False,
if language_level is not None:
self.set_language_level(language_level)
- self.legacy_implicit_noexcept = getattr(options, 'legacy_implicit_noexcept', False)
self.gdb_debug_outputwriter = None
Is the `ge... |
codereview_new_python_data_5089 | def annotated_function(a: cython.int, b: cython.int):
with cython.annotation_typing(False):
# Cython is ignoring annotations within this code block
c: list = []
- c.append(a)
- c.append(b)
- c.append(s)
return c
If I were writing this I'd only put the `c: list` in the ... |
codereview_new_python_data_5090 | def main():
foo4: cython.int = 1
foo5: stdint.bar = 5 # warning
foo6: object = 1
_WARNINGS = """
Here, I wanted also to test the following case:
```python
foo7: cython.bar = 1
```
But it yields following warnings:
```
14:16: Unknown type declaration 'cython.bar' in annotation, ignoring
25:... |
codereview_new_python_data_5091 | def analyse_as_type(self, env):
# Try to give a helpful warning when users write plain C type names.
if not env.in_c_type_context and PyrexTypes.parse_basic_type(self.name):
- warning(self.pos, "Found C type '%s' in a Python annotation. Did you mean to use a 'cython.%s'?" % (self.name, s... |
codereview_new_python_data_5092 | def analyse_as_type(self, env):
return self.analyse_type_annotation(env)[1]
def _warn_on_unknown_annotation(self, env, annotation):
- """Method checks for cases when user should be warned that annotation contains unkonwn types."""
if annotation.is_name:
# Validate annotatio... |
codereview_new_python_data_5094 | def run_build():
"Topic :: Software Development :: Libraries :: Python Modules"
],
project_urls={
- 'Documentation': 'https://cython.readthedocs.io/',
- 'Funding': 'https://cython.readthedocs.io/en/latest/src/donating.html',
- 'Source': 'https://github.co... |
codereview_new_python_data_5095 | def run_build():
project_urls={
"Documentation": "https://cython.readthedocs.io/",
"Donate": "https://cython.readthedocs.io/en/latest/src/donating.html",
- "Source code": "https://github.com/cython/cython",
- "Bug tracker": "https://github.com/cython/cython/issu... |
codereview_new_python_data_5096 | def run_build():
project_urls={
"Documentation": "https://cython.readthedocs.io/",
"Donate": "https://cython.readthedocs.io/en/latest/src/donating.html",
- "Source code": "https://github.com/cython/cython",
- "Bug tracker": "https://github.com/cython/cython/issu... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.