Unnamed: 0
int64 0
2.44k
| repo
stringlengths 32
81
| hash
stringlengths 40
40
| diff
stringlengths 113
1.17k
| old_path
stringlengths 5
84
| rewrite
stringlengths 34
79
| initial_state
stringlengths 75
980
| final_state
stringlengths 76
980
|
---|---|---|---|---|---|---|---|
600 |
https://:@github.com/jakobrunge/tigramite.git
|
ebf5ae6ad58a416f2097bc7453df96b6ff584b17
|
@@ -2577,7 +2577,7 @@ class CMIsymb(CondIndTest):
dim, T = symb_array.shape
# Needed because np.bincount cannot process longs
- if isinstance(self.n_symbs ** dim, int):
+ if not isinstance(self.n_symbs ** dim, int):
raise ValueError("Too many n_symbs and/or dimensions, "
"numpy.bincount cannot process longs")
if self.n_symbs ** dim * 16. / 8. / 1024. ** 3 > 3.:
|
tigramite/independence_tests.py
|
ReplaceText(target='not ' @(2580,11)->(2580,11))
|
class CMIsymb(CondIndTest):
dim, T = symb_array.shape
# Needed because np.bincount cannot process longs
if isinstance(self.n_symbs ** dim, int):
raise ValueError("Too many n_symbs and/or dimensions, "
"numpy.bincount cannot process longs")
if self.n_symbs ** dim * 16. / 8. / 1024. ** 3 > 3.:
|
class CMIsymb(CondIndTest):
dim, T = symb_array.shape
# Needed because np.bincount cannot process longs
if not isinstance(self.n_symbs ** dim, int):
raise ValueError("Too many n_symbs and/or dimensions, "
"numpy.bincount cannot process longs")
if self.n_symbs ** dim * 16. / 8. / 1024. ** 3 > 3.:
|
601 |
https://:@github.com/ontio/neo-boa.git
|
07ac051d44eb38ac612effd14b57af0a5b65c90e
|
@@ -8,7 +8,7 @@ class SCTest(FunctionCode):
@staticmethod
def Main(a, b):
- if a > b:
+ if a == b:
return True
|
tests/src/CompareTest2.py
|
ReplaceText(target='==' @(11,13)->(11,14))
|
class SCTest(FunctionCode):
@staticmethod
def Main(a, b):
if a > b:
return True
|
class SCTest(FunctionCode):
@staticmethod
def Main(a, b):
if a == b:
return True
|
602 |
https://:@github.com/ggventurini/python-deltasigma.git
|
3dd6127dc022234c4433d4e4a018942927fa417f
|
@@ -59,7 +59,7 @@ def cancelPZ(arg1, tol=1e-6):
z = copy.copy(arg1.zeros)
p = copy.copy(arg1.poles)
k = arg1.gain
- for i in range(max(z.shape) - 1, 0, -1):
+ for i in range(max(z.shape) - 1, -1, -1):
d = z[i] - p
cancel = np.nonzero(np.abs(d) < tol)[0]
if cancel.size:
|
deltasigma/_cancelPZ.py
|
ReplaceText(target='-1' @(62,37)->(62,38))
|
def cancelPZ(arg1, tol=1e-6):
z = copy.copy(arg1.zeros)
p = copy.copy(arg1.poles)
k = arg1.gain
for i in range(max(z.shape) - 1, 0, -1):
d = z[i] - p
cancel = np.nonzero(np.abs(d) < tol)[0]
if cancel.size:
|
def cancelPZ(arg1, tol=1e-6):
z = copy.copy(arg1.zeros)
p = copy.copy(arg1.poles)
k = arg1.gain
for i in range(max(z.shape) - 1, -1, -1):
d = z[i] - p
cancel = np.nonzero(np.abs(d) < tol)[0]
if cancel.size:
|
603 |
https://:@github.com/jordens/rayopt.git
|
3bc56650b966e2c34d25d47af76d3b7f63110c4f
|
@@ -199,7 +199,7 @@ class Analysis(object):
axp, axm, axsm, axss, axo = axi
axp.add_patch(mpl.patches.Circle((0, 0), r, edgecolor="black",
facecolor="none"))
- axp.text(-.1, .5, "OY=%s" % hi, rotation="vertical",
+ axo.text(-.1, .5, "OY=%s" % hi, rotation="vertical",
transform=axp.transAxes,
verticalalignment="center")
for i, (wi, ci) in enumerate(zip(wavelengths, colors)):
|
rayopt/analysis.py
|
ReplaceText(target='axo' @(202,12)->(202,15))
|
class Analysis(object):
axp, axm, axsm, axss, axo = axi
axp.add_patch(mpl.patches.Circle((0, 0), r, edgecolor="black",
facecolor="none"))
axp.text(-.1, .5, "OY=%s" % hi, rotation="vertical",
transform=axp.transAxes,
verticalalignment="center")
for i, (wi, ci) in enumerate(zip(wavelengths, colors)):
|
class Analysis(object):
axp, axm, axsm, axss, axo = axi
axp.add_patch(mpl.patches.Circle((0, 0), r, edgecolor="black",
facecolor="none"))
axo.text(-.1, .5, "OY=%s" % hi, rotation="vertical",
transform=axp.transAxes,
verticalalignment="center")
for i, (wi, ci) in enumerate(zip(wavelengths, colors)):
|
604 |
https://:@github.com/jordens/rayopt.git
|
0d5689d0c36fa3aec836c7869e169f4bc4b1a72f
|
@@ -333,7 +333,7 @@ class System(list):
c = getattr(el, "curvature", 0)
if pending is not None:
r = max(el.radius, pending.radius)
- if c < 0:
+ if c <= 0:
el.radius = r
if c0 > 0:
pending.radius = r
|
rayopt/system.py
|
ReplaceText(target='<=' @(336,21)->(336,22))
|
class System(list):
c = getattr(el, "curvature", 0)
if pending is not None:
r = max(el.radius, pending.radius)
if c < 0:
el.radius = r
if c0 > 0:
pending.radius = r
|
class System(list):
c = getattr(el, "curvature", 0)
if pending is not None:
r = max(el.radius, pending.radius)
if c <= 0:
el.radius = r
if c0 > 0:
pending.radius = r
|
605 |
https://:@github.com/pantherlab/v2d-cli.git
|
fe2f6fe46f14778cfcb74852d817d1876d171352
|
@@ -92,7 +92,7 @@ def main():
print('Similar domains to {}'.format(dom))
domains.difference_update(set(dom))
for d in domains:
- print_diff(d, args.domain)
+ print_diff(args.domain, d)
if write:
f.write(d + "\n")
if (args.check):
|
v2d/main.py
|
ArgSwap(idxs=0<->1 @(95,16)->(95,26))
|
def main():
print('Similar domains to {}'.format(dom))
domains.difference_update(set(dom))
for d in domains:
print_diff(d, args.domain)
if write:
f.write(d + "\n")
if (args.check):
|
def main():
print('Similar domains to {}'.format(dom))
domains.difference_update(set(dom))
for d in domains:
print_diff(args.domain, d)
if write:
f.write(d + "\n")
if (args.check):
|
606 |
https://:@github.com/xtimon/inipgdump.git
|
47c9bf35a256ee9c6caa0aeb6913a5e80cc15d23
|
@@ -92,7 +92,7 @@ def main():
if not os.path.isdir(dump_dir):
print('Folder \'%s\' not found' % dump_dir)
sys.exit(1)
- if keep_count <= 0:
+ if keep_count < 0:
print('keep_count must be greater than 0')
sys.exit(1)
make_dump(conf_file, dump_dir, keep_count)
|
inipgdump/core.py
|
ReplaceText(target='<' @(95,18)->(95,20))
|
def main():
if not os.path.isdir(dump_dir):
print('Folder \'%s\' not found' % dump_dir)
sys.exit(1)
if keep_count <= 0:
print('keep_count must be greater than 0')
sys.exit(1)
make_dump(conf_file, dump_dir, keep_count)
|
def main():
if not os.path.isdir(dump_dir):
print('Folder \'%s\' not found' % dump_dir)
sys.exit(1)
if keep_count < 0:
print('keep_count must be greater than 0')
sys.exit(1)
make_dump(conf_file, dump_dir, keep_count)
|
607 |
https://:@github.com/dogebuild/dogebuild.git
|
5fbc92cbf6aceb4a99374e5e19208b3889c36628
|
@@ -14,7 +14,7 @@ class Doge:
plugin_full_name = self.contrib_name + '-' + plugin_name
plugin_package = self.contrib_name + '_' + plugin_name
- if not self.check_plugin_installed(plugin_full_name):
+ if not self.check_plugin_installed(plugin_package):
self.pip.install(plugin_full_name) # ???
file, path, desc = self.find_dotted_module(plugin_package + '.loader')
|
dogebuild/Doge.py
|
ReplaceText(target='plugin_package' @(17,43)->(17,59))
|
class Doge:
plugin_full_name = self.contrib_name + '-' + plugin_name
plugin_package = self.contrib_name + '_' + plugin_name
if not self.check_plugin_installed(plugin_full_name):
self.pip.install(plugin_full_name) # ???
file, path, desc = self.find_dotted_module(plugin_package + '.loader')
|
class Doge:
plugin_full_name = self.contrib_name + '-' + plugin_name
plugin_package = self.contrib_name + '_' + plugin_name
if not self.check_plugin_installed(plugin_package):
self.pip.install(plugin_full_name) # ???
file, path, desc = self.find_dotted_module(plugin_package + '.loader')
|
608 |
https://:@github.com/jiosue/qubovert.git
|
11782cc691038742a250ee53b863c413f28b6455
|
@@ -329,7 +329,7 @@ class DictArithmetic(dict):
for k, v in other.items():
self[k] -= v
else:
- self[()] -= v
+ self[()] -= other
return self
def __mul__(self, other):
|
qubovert/utils/_dict_arithmetic.py
|
ReplaceText(target='other' @(332,24)->(332,25))
|
class DictArithmetic(dict):
for k, v in other.items():
self[k] -= v
else:
self[()] -= v
return self
def __mul__(self, other):
|
class DictArithmetic(dict):
for k, v in other.items():
self[k] -= v
else:
self[()] -= other
return self
def __mul__(self, other):
|
609 |
https://:@github.com/jiosue/qubovert.git
|
ad39ad11cea1cd2ca8f82a23b21990cd0e758915
|
@@ -323,7 +323,7 @@ class SpinSimulation:
# the change in energy from flipping variable i is equal to
# -2 * (the energy of the subgraph depending on i)
dE = -2 * puso_value(self._state, self._subgraphs[i])
- if dE < 0 or (T and random.random() < exp(-dE / T)):
+ if dE <= 0 or (T and random.random() < exp(-dE / T)):
self._flip_bit(i)
|
qubovert/sim/_simulations.py
|
ReplaceText(target='<=' @(326,22)->(326,23))
|
class SpinSimulation:
# the change in energy from flipping variable i is equal to
# -2 * (the energy of the subgraph depending on i)
dE = -2 * puso_value(self._state, self._subgraphs[i])
if dE < 0 or (T and random.random() < exp(-dE / T)):
self._flip_bit(i)
|
class SpinSimulation:
# the change in energy from flipping variable i is equal to
# -2 * (the energy of the subgraph depending on i)
dE = -2 * puso_value(self._state, self._subgraphs[i])
if dE <= 0 or (T and random.random() < exp(-dE / T)):
self._flip_bit(i)
|
610 |
https://:@github.com/gjo/colander_jsonschema.git
|
14d7446b85b8faf56705047146a62f10981c0bf7
|
@@ -124,7 +124,7 @@ class ValidatorConversionDispatcher(object):
if isinstance(validator, colander.All):
converted = {}
for v in validator.validators:
- ret = self(schema_node, validator)
+ ret = self(schema_node, v)
converted.update(ret)
return converted
|
colander_jsonschema/__init__.py
|
ReplaceText(target='v' @(127,40)->(127,49))
|
class ValidatorConversionDispatcher(object):
if isinstance(validator, colander.All):
converted = {}
for v in validator.validators:
ret = self(schema_node, validator)
converted.update(ret)
return converted
|
class ValidatorConversionDispatcher(object):
if isinstance(validator, colander.All):
converted = {}
for v in validator.validators:
ret = self(schema_node, v)
converted.update(ret)
return converted
|
611 |
https://:@github.com/ucl-exoplanets/TauREx3_public.git
|
fdfa8c4e1d29dc715c7f42d55c21c0d911390a83
|
@@ -127,7 +127,7 @@ def main():
wlgrid = np.log10(10000/bindown_wngrid)
if args.plot:
- if get_rank()==0 and nprocs()==1:
+ if get_rank()==0 and nprocs()<=1:
import matplotlib.pyplot as plt
if args.contrib:
for name,value in contrib:
|
taurex/taurex.py
|
ReplaceText(target='<=' @(130,38)->(130,40))
|
def main():
wlgrid = np.log10(10000/bindown_wngrid)
if args.plot:
if get_rank()==0 and nprocs()==1:
import matplotlib.pyplot as plt
if args.contrib:
for name,value in contrib:
|
def main():
wlgrid = np.log10(10000/bindown_wngrid)
if args.plot:
if get_rank()==0 and nprocs()<=1:
import matplotlib.pyplot as plt
if args.contrib:
for name,value in contrib:
|
612 |
https://:@github.com/ucl-exoplanets/TauREx3_public.git
|
b159dcc22b3e753aaea101031b3c8df14e5affdc
|
@@ -135,7 +135,7 @@ def main():
priors = {}
priors['Profiles'] = profiles
priors['Spectra'] = spectrum
- out.store_dictionary(solution,group_name='Priors')
+ out.store_dictionary(priors,group_name='Priors')
else:
out.store_dictionary(profiles,group_name='Profiles')
out.store_dictionary(spectrum,group_name='Spectra')
|
taurex/taurex.py
|
ReplaceText(target='priors' @(138,37)->(138,45))
|
def main():
priors = {}
priors['Profiles'] = profiles
priors['Spectra'] = spectrum
out.store_dictionary(solution,group_name='Priors')
else:
out.store_dictionary(profiles,group_name='Profiles')
out.store_dictionary(spectrum,group_name='Spectra')
|
def main():
priors = {}
priors['Profiles'] = profiles
priors['Spectra'] = spectrum
out.store_dictionary(priors,group_name='Priors')
else:
out.store_dictionary(profiles,group_name='Profiles')
out.store_dictionary(spectrum,group_name='Spectra')
|
613 |
https://:@github.com/ucl-exoplanets/TauREx3_public.git
|
1aa67f68d7086afcf2390add80728193d7a9024e
|
@@ -13,7 +13,7 @@ def nprocs():
try:
from mpi4py import MPI
except ImportError:
- return 0
+ return 1
comm = MPI.COMM_WORLD
|
taurex/mpi.py
|
ReplaceText(target='1' @(16,15)->(16,16))
|
def nprocs():
try:
from mpi4py import MPI
except ImportError:
return 0
comm = MPI.COMM_WORLD
|
def nprocs():
try:
from mpi4py import MPI
except ImportError:
return 1
comm = MPI.COMM_WORLD
|
614 |
https://:@github.com/sjoerdk/yeahyeah.git
|
11a1a12a02c9fea724f0dc4072b5e86e688e33fd
|
@@ -66,7 +66,7 @@ def add(context: ClockifyPluginContext, message, project, time):
project_obj = None
log_start = time
- click.echo(f"Adding {message} at {as_local(log_start)} to project {project}")
+ click.echo(f"Adding {message} at {as_local(log_start)} to project {project_obj}")
context.session.add_time_entry(
start_time=time, description=message, project=project_obj
)
|
plugins/clockify_plugin/cli.py
|
ReplaceText(target='project_obj' @(69,71)->(69,78))
|
def add(context: ClockifyPluginContext, message, project, time):
project_obj = None
log_start = time
click.echo(f"Adding {message} at {as_local(log_start)} to project {project}")
context.session.add_time_entry(
start_time=time, description=message, project=project_obj
)
|
def add(context: ClockifyPluginContext, message, project, time):
project_obj = None
log_start = time
click.echo(f"Adding {message} at {as_local(log_start)} to project {project_obj}")
context.session.add_time_entry(
start_time=time, description=message, project=project_obj
)
|
615 |
https://:@bitbucket.org/synerty/peek-plugin-graphdb.git
|
c47b1c7df8ba01b9a47a9afda0f1c1f829517990
|
@@ -58,7 +58,7 @@ class PackedSegmentTupleProvider(TuplesProviderABC):
# Create the new object
foundDocuments.append(GraphDbPackedSegmentTuple(
- key=key,
+ key=subKey,
packedJson=segmentsByKey[subKey]
))
|
peek_plugin_graphdb/_private/client/tuple_providers/PackedSegmentTupleProvider.py
|
ReplaceText(target='subKey' @(61,24)->(61,27))
|
class PackedSegmentTupleProvider(TuplesProviderABC):
# Create the new object
foundDocuments.append(GraphDbPackedSegmentTuple(
key=key,
packedJson=segmentsByKey[subKey]
))
|
class PackedSegmentTupleProvider(TuplesProviderABC):
# Create the new object
foundDocuments.append(GraphDbPackedSegmentTuple(
key=subKey,
packedJson=segmentsByKey[subKey]
))
|
616 |
https://:@github.com/ihgazni2/ematmap.git
|
d6f160d8c7b85fdca2d552ca6de1c1c3c75b3245
|
@@ -50,7 +50,7 @@ def get_matsize(m):
size = 0
depth = len(m)
for i in range(depth):
- layer = m[depth]
+ layer = m[i]
lngth = len(layer)
for j in range(lngth):
size = size + 1
|
ematmap/utils.py
|
ReplaceText(target='i' @(53,18)->(53,23))
|
def get_matsize(m):
size = 0
depth = len(m)
for i in range(depth):
layer = m[depth]
lngth = len(layer)
for j in range(lngth):
size = size + 1
|
def get_matsize(m):
size = 0
depth = len(m)
for i in range(depth):
layer = m[i]
lngth = len(layer)
for j in range(lngth):
size = size + 1
|
617 |
https://:@github.com/ndawe/goodruns.git
|
fa5a7a24b6ebaa80141a0fd5b887e61eeb60d0d0
|
@@ -258,7 +258,7 @@ class GRL(object):
version = root.find('NamedLumiRange/Version')
if version is not None:
self.version = version.text
- self.metadata = root.findall('NamedLumiRange/Metadata')
+ self.metadata += root.findall('NamedLumiRange/Metadata')
lbcols = root.findall(
'NamedLumiRange/LumiBlockCollection')
for lbcol in lbcols:
|
goodruns/grl.py
|
ReplaceText(target='+=' @(261,22)->(261,23))
|
class GRL(object):
version = root.find('NamedLumiRange/Version')
if version is not None:
self.version = version.text
self.metadata = root.findall('NamedLumiRange/Metadata')
lbcols = root.findall(
'NamedLumiRange/LumiBlockCollection')
for lbcol in lbcols:
|
class GRL(object):
version = root.find('NamedLumiRange/Version')
if version is not None:
self.version = version.text
self.metadata += root.findall('NamedLumiRange/Metadata')
lbcols = root.findall(
'NamedLumiRange/LumiBlockCollection')
for lbcol in lbcols:
|
618 |
https://:@github.com/churchill-lab/scBASE.git
|
456bacc4227fd3ccb5a901a205b0add65f9d8dfc
|
@@ -37,7 +37,7 @@ except NameError:
def select(loomfile, min_read_count, min_cell_count, layer):
with loompy.connect(loomfile) as ds:
- gsurv = (ds.sparse(layer=layer) >= min_read_count).sum(axis=1) > min_cell_count
+ gsurv = (ds.sparse(layer=layer) >= min_read_count).sum(axis=1) >= min_cell_count
ds.ra.Selected = np.squeeze(np.asarray(gsurv))
LOG.info('Total %d genes selected' % gsurv.sum())
# totals = ds.map([np.sum], axis=1)[0] # Select based upon cell size?
|
scbase/scbase.py
|
ReplaceText(target='>=' @(40,71)->(40,72))
|
except NameError:
def select(loomfile, min_read_count, min_cell_count, layer):
with loompy.connect(loomfile) as ds:
gsurv = (ds.sparse(layer=layer) >= min_read_count).sum(axis=1) > min_cell_count
ds.ra.Selected = np.squeeze(np.asarray(gsurv))
LOG.info('Total %d genes selected' % gsurv.sum())
# totals = ds.map([np.sum], axis=1)[0] # Select based upon cell size?
|
except NameError:
def select(loomfile, min_read_count, min_cell_count, layer):
with loompy.connect(loomfile) as ds:
gsurv = (ds.sparse(layer=layer) >= min_read_count).sum(axis=1) >= min_cell_count
ds.ra.Selected = np.squeeze(np.asarray(gsurv))
LOG.info('Total %d genes selected' % gsurv.sum())
# totals = ds.map([np.sum], axis=1)[0] # Select based upon cell size?
|
619 |
https://:@github.com/glottolog/treedb.git
|
af327b021d5aa5ee8c593903f663f5653181217d
|
@@ -48,7 +48,7 @@ def iterrecords(bind=ENGINE, windowsize=WINDOWSIZE, skip_unknown=True):
with bind.connect() as conn:
select_files.bind = conn
select_values.bind = conn
- for in_slice in window_slices(File.id, size=windowsize, bind=bind):
+ for in_slice in window_slices(File.id, size=windowsize, bind=conn):
if log.level <= logging.DEBUG:
where = literal_compile(in_slice(File.id))
log.debug('fetch rows %r', where.string)
|
treedb/raw/records.py
|
ReplaceText(target='conn' @(51,69)->(51,73))
|
def iterrecords(bind=ENGINE, windowsize=WINDOWSIZE, skip_unknown=True):
with bind.connect() as conn:
select_files.bind = conn
select_values.bind = conn
for in_slice in window_slices(File.id, size=windowsize, bind=bind):
if log.level <= logging.DEBUG:
where = literal_compile(in_slice(File.id))
log.debug('fetch rows %r', where.string)
|
def iterrecords(bind=ENGINE, windowsize=WINDOWSIZE, skip_unknown=True):
with bind.connect() as conn:
select_files.bind = conn
select_values.bind = conn
for in_slice in window_slices(File.id, size=windowsize, bind=conn):
if log.level <= logging.DEBUG:
where = literal_compile(in_slice(File.id))
log.debug('fetch rows %r', where.string)
|
620 |
https://:@github.com/funkybob/django-rated.git
|
4c68393abfdbb42030e0211c8c99ac8f2fa251d0
|
@@ -14,7 +14,7 @@ class RatedMiddleware(object):
def process_view(self, request, view_func, view_args, view_kwargs):
# Try to determine the realm for this view
try:
- realm = request._rated_realm
+ realm = view_func._rated_realm
except AttributeError:
try:
realm = settings.REALM_MAP[request.resolver_match.url_name]
|
rated/middleware.py
|
ReplaceText(target='view_func' @(17,20)->(17,27))
|
class RatedMiddleware(object):
def process_view(self, request, view_func, view_args, view_kwargs):
# Try to determine the realm for this view
try:
realm = request._rated_realm
except AttributeError:
try:
realm = settings.REALM_MAP[request.resolver_match.url_name]
|
class RatedMiddleware(object):
def process_view(self, request, view_func, view_args, view_kwargs):
# Try to determine the realm for this view
try:
realm = view_func._rated_realm
except AttributeError:
try:
realm = settings.REALM_MAP[request.resolver_match.url_name]
|
621 |
https://:@github.com/StevenGolovkine/FDApy.git
|
f1768ccf93593162be890f8685027b9d9a1d3ad2
|
@@ -25,7 +25,7 @@ def _check_argvals(argvals):
------
argvals : list of numpy.ndarray
"""
- if isinstance(argvals, (np.ndarray, list)):
+ if not isinstance(argvals, (np.ndarray, list)):
raise ValueError(
'argvals has to be a list of numpy.ndarray or a numpy.ndarray!')
# TODO: Modify the condition to accept multidimensional irregular
|
FDApy/irregular_functional.py
|
ReplaceText(target='not ' @(28,7)->(28,7))
|
def _check_argvals(argvals):
------
argvals : list of numpy.ndarray
"""
if isinstance(argvals, (np.ndarray, list)):
raise ValueError(
'argvals has to be a list of numpy.ndarray or a numpy.ndarray!')
# TODO: Modify the condition to accept multidimensional irregular
|
def _check_argvals(argvals):
------
argvals : list of numpy.ndarray
"""
if not isinstance(argvals, (np.ndarray, list)):
raise ValueError(
'argvals has to be a list of numpy.ndarray or a numpy.ndarray!')
# TODO: Modify the condition to accept multidimensional irregular
|
622 |
https://:@github.com/StevenGolovkine/FDApy.git
|
f1768ccf93593162be890f8685027b9d9a1d3ad2
|
@@ -30,7 +30,7 @@ def _check_argvals(argvals):
------
argvals : list of numpy.ndarray
"""
- if isinstance(argvals, (np.ndarray, list)):
+ if not isinstance(argvals, (np.ndarray, list)):
raise ValueError(
'argvals has to be a list of numpy.ndarray or a numpy.ndarray!')
if isinstance(argvals, list) and \
|
FDApy/univariate_functional.py
|
ReplaceText(target='not ' @(33,7)->(33,7))
|
def _check_argvals(argvals):
------
argvals : list of numpy.ndarray
"""
if isinstance(argvals, (np.ndarray, list)):
raise ValueError(
'argvals has to be a list of numpy.ndarray or a numpy.ndarray!')
if isinstance(argvals, list) and \
|
def _check_argvals(argvals):
------
argvals : list of numpy.ndarray
"""
if not isinstance(argvals, (np.ndarray, list)):
raise ValueError(
'argvals has to be a list of numpy.ndarray or a numpy.ndarray!')
if isinstance(argvals, list) and \
|
623 |
https://:@github.com/StevenGolovkine/FDApy.git
|
4fbe69f439588f469d858b25c3d063e02b45ed97
|
@@ -24,9 +24,9 @@ def _check_data(data):
------
data : list of UnivariateFunctionalData ot IrregularFunctionalData
"""
- if isinstance(data, (list,
- UnivariateFunctionalData,
- IrregularFunctionalData)):
+ if not isinstance(data, (list,
+ UnivariateFunctionalData,
+ IrregularFunctionalData)):
raise ValueError(
"""Data has to be a list or elements of UnivariateFunctionalData
or IrregularFunctionalData!""")
|
FDApy/multivariate_functional.py
|
ReplaceText(target='not ' @(27,7)->(27,7))
|
def _check_data(data):
------
data : list of UnivariateFunctionalData ot IrregularFunctionalData
"""
if isinstance(data, (list,
UnivariateFunctionalData,
IrregularFunctionalData)):
raise ValueError(
"""Data has to be a list or elements of UnivariateFunctionalData
or IrregularFunctionalData!""")
|
def _check_data(data):
------
data : list of UnivariateFunctionalData ot IrregularFunctionalData
"""
if not isinstance(data, (list,
UnivariateFunctionalData,
IrregularFunctionalData)):
raise ValueError(
"""Data has to be a list or elements of UnivariateFunctionalData
or IrregularFunctionalData!""")
|
624 |
https://:@github.com/StevenGolovkine/FDApy.git
|
a671e9da96d43a8cd21778b535374dce8942e7da
|
@@ -1075,7 +1075,7 @@ class IrregularFunctionalData(FunctionalData):
bandwidth=b,
degree=degree)
pred = lp.fit_predict(arg, val, points_estim)
- smooth_argvals[i] = arg
+ smooth_argvals[i] = points_estim
smooth_values[i] = pred
return IrregularFunctionalData({'input_dim_0': smooth_argvals},
smooth_values)
|
FDApy/representation/functional_data.py
|
ReplaceText(target='points_estim' @(1078,32)->(1078,35))
|
class IrregularFunctionalData(FunctionalData):
bandwidth=b,
degree=degree)
pred = lp.fit_predict(arg, val, points_estim)
smooth_argvals[i] = arg
smooth_values[i] = pred
return IrregularFunctionalData({'input_dim_0': smooth_argvals},
smooth_values)
|
class IrregularFunctionalData(FunctionalData):
bandwidth=b,
degree=degree)
pred = lp.fit_predict(arg, val, points_estim)
smooth_argvals[i] = points_estim
smooth_values[i] = pred
return IrregularFunctionalData({'input_dim_0': smooth_argvals},
smooth_values)
|
625 |
https://:@github.com/Flowminder/pytest-airflow.git
|
47c128f0affa875e4baed2f7223fcd0747f3bb55
|
@@ -138,7 +138,7 @@ def _task_gen(item, **kwds):
provide_context=True,
dag=dag,
)
- dag.set_dependency(task_id, "__pytest_branch")
+ dag.set_dependency("__pytest_branch", task_id)
return task
|
pytest_airflow/plugin.py
|
ArgSwap(idxs=0<->1 @(141,4)->(141,22))
|
def _task_gen(item, **kwds):
provide_context=True,
dag=dag,
)
dag.set_dependency(task_id, "__pytest_branch")
return task
|
def _task_gen(item, **kwds):
provide_context=True,
dag=dag,
)
dag.set_dependency("__pytest_branch", task_id)
return task
|
626 |
https://:@github.com/datadrivencontrol/pyvrft.git
|
d21df29ac62c08e4de3bfbcc1c01a6943cfe78fe
|
@@ -77,7 +77,7 @@ def design(u,y,y_iv,Td,C,L):
y_iv=y_iv[0:N,:]
# virtual error
ebar=rv-y
- ebar_iv=rv-y_iv
+ ebar_iv=rv_iv-y_iv
# remove the last samples of the input (to match the dimension of the virtual error)
uf=uf[0:N,:]
|
vrft/control.py
|
ReplaceText(target='rv_iv' @(80,16)->(80,18))
|
def design(u,y,y_iv,Td,C,L):
y_iv=y_iv[0:N,:]
# virtual error
ebar=rv-y
ebar_iv=rv-y_iv
# remove the last samples of the input (to match the dimension of the virtual error)
uf=uf[0:N,:]
|
def design(u,y,y_iv,Td,C,L):
y_iv=y_iv[0:N,:]
# virtual error
ebar=rv-y
ebar_iv=rv_iv-y_iv
# remove the last samples of the input (to match the dimension of the virtual error)
uf=uf[0:N,:]
|
627 |
https://:@github.com/onecommons/unfurl.git
|
c7b04c15dc919919696f6d20fef4465c25fda6d3
|
@@ -67,7 +67,7 @@ class Resource(object):
@property
def root(self):
- return self.ancestors[0]
+ return self.ancestors[-1]
def __getitem__(self, name):
if not name:
|
giterop/resource.py
|
ReplaceText(target='-1' @(70,26)->(70,27))
|
class Resource(object):
@property
def root(self):
return self.ancestors[0]
def __getitem__(self, name):
if not name:
|
class Resource(object):
@property
def root(self):
return self.ancestors[-1]
def __getitem__(self, name):
if not name:
|
628 |
https://:@github.com/onecommons/unfurl.git
|
7b9fe40414b2646ba7ee98e1f7ab770feed1c80a
|
@@ -336,7 +336,7 @@ Returns:
if not configSpec:
raise UnfurlError(
'unable to find an implementation to "%s" "%s" on ""%s": %s'
- % (action, resource.template.name, resource.template.name, reason)
+ % (action, resource.template.name, resource.template.name, notfoundmsg)
)
logger.debug(
"creating configuration %s with %s to run for %s: %s",
|
unfurl/plan.py
|
ReplaceText(target='notfoundmsg' @(339,75)->(339,81))
|
Returns:
if not configSpec:
raise UnfurlError(
'unable to find an implementation to "%s" "%s" on ""%s": %s'
% (action, resource.template.name, resource.template.name, reason)
)
logger.debug(
"creating configuration %s with %s to run for %s: %s",
|
Returns:
if not configSpec:
raise UnfurlError(
'unable to find an implementation to "%s" "%s" on ""%s": %s'
% (action, resource.template.name, resource.template.name, notfoundmsg)
)
logger.debug(
"creating configuration %s with %s to run for %s: %s",
|
629 |
https://:@github.com/heartexlabs/label-studio-evalme.git
|
9b7f13ab32802d5ef602d1c4f9399e949b9f3df8
|
@@ -35,7 +35,7 @@ class HTMLTagsEvalItem(EvalItem):
def _as_html_tags_eval_item(item):
- if not isinstance(HTMLTagsEvalItem, item):
+ if not isinstance(item, HTMLTagsEvalItem):
return HTMLTagsEvalItem(item)
return item
|
evalme/text/text.py
|
ArgSwap(idxs=0<->1 @(38,11)->(38,21))
|
class HTMLTagsEvalItem(EvalItem):
def _as_html_tags_eval_item(item):
if not isinstance(HTMLTagsEvalItem, item):
return HTMLTagsEvalItem(item)
return item
|
class HTMLTagsEvalItem(EvalItem):
def _as_html_tags_eval_item(item):
if not isinstance(item, HTMLTagsEvalItem):
return HTMLTagsEvalItem(item)
return item
|
630 |
https://:@github.com/parlance/ctcdecode.git
|
1a35bb5fc07eee0c9939fdf824fa8158ec52499a
|
@@ -20,7 +20,7 @@ class CTCBeamDecoder(object):
def decode(self, probs, seq_lens):
# We expect batch x seq x label_size
probs = probs.cpu().float()
- seq_lens = probs.cpu().int()
+ seq_lens = seq_lens.cpu().int()
batch_size, max_seq_len = probs.size(0), probs.size(1)
output = torch.IntTensor(batch_size, self._beam_width, max_seq_len).cpu().int()
timesteps = torch.IntTensor(batch_size, self._beam_width, max_seq_len).cpu().int()
|
ctcdecode/__init__.py
|
ReplaceText(target='seq_lens' @(23,19)->(23,24))
|
class CTCBeamDecoder(object):
def decode(self, probs, seq_lens):
# We expect batch x seq x label_size
probs = probs.cpu().float()
seq_lens = probs.cpu().int()
batch_size, max_seq_len = probs.size(0), probs.size(1)
output = torch.IntTensor(batch_size, self._beam_width, max_seq_len).cpu().int()
timesteps = torch.IntTensor(batch_size, self._beam_width, max_seq_len).cpu().int()
|
class CTCBeamDecoder(object):
def decode(self, probs, seq_lens):
# We expect batch x seq x label_size
probs = probs.cpu().float()
seq_lens = seq_lens.cpu().int()
batch_size, max_seq_len = probs.size(0), probs.size(1)
output = torch.IntTensor(batch_size, self._beam_width, max_seq_len).cpu().int()
timesteps = torch.IntTensor(batch_size, self._beam_width, max_seq_len).cpu().int()
|
631 |
https://:@github.com/benmaier/binpacking.git
|
6ada2c62c319d56cd0f5918a2f01ff61d0e45348
|
@@ -107,7 +107,7 @@ def to_constant_bin_number(d,N_bin,weight_pos=None,lower_bound=None,upper_bound=
while not found_bin:
#if this weight fits in the bin
- if new_weight_sum < V_bin_max:
+ if new_weight_sum <= V_bin_max:
#...put it in
if isdict:
|
binpacking/to_constant_bin_number.py
|
ReplaceText(target='<=' @(110,30)->(110,31))
|
def to_constant_bin_number(d,N_bin,weight_pos=None,lower_bound=None,upper_bound=
while not found_bin:
#if this weight fits in the bin
if new_weight_sum < V_bin_max:
#...put it in
if isdict:
|
def to_constant_bin_number(d,N_bin,weight_pos=None,lower_bound=None,upper_bound=
while not found_bin:
#if this weight fits in the bin
if new_weight_sum <= V_bin_max:
#...put it in
if isdict:
|
632 |
https://:@github.com/amatino-code/nozomi.git
|
dc608f09a68fc8972f563e2b9974692581d40efc
|
@@ -257,7 +257,7 @@ integers'.format(
min_value=min_value
))
- return values
+ return validated
def optionally_parse_bool(
self,
|
nozomi/http/parseable_data.py
|
ReplaceText(target='validated' @(260,15)->(260,21))
|
integers'.format(
min_value=min_value
))
return values
def optionally_parse_bool(
self,
|
integers'.format(
min_value=min_value
))
return validated
def optionally_parse_bool(
self,
|
633 |
https://:@github.com/amatino-code/nozomi.git
|
b486a1109ac83dcabb4022d071644cadc4734769
|
@@ -70,7 +70,7 @@ class Resource:
if not candidate.grants_read_to(unauthorised_agent):
raise NotAuthorised
continue
- return broadcast_candidate
+ return unauthorised_agent
if not broadcast_candidate.grants_read_to(unauthorised_agent):
raise NotAuthorised
|
nozomi/resources/resource.py
|
ReplaceText(target='unauthorised_agent' @(73,19)->(73,38))
|
class Resource:
if not candidate.grants_read_to(unauthorised_agent):
raise NotAuthorised
continue
return broadcast_candidate
if not broadcast_candidate.grants_read_to(unauthorised_agent):
raise NotAuthorised
|
class Resource:
if not candidate.grants_read_to(unauthorised_agent):
raise NotAuthorised
continue
return unauthorised_agent
if not broadcast_candidate.grants_read_to(unauthorised_agent):
raise NotAuthorised
|
634 |
https://:@github.com/Puumanamana/CoCoNet.git
|
5e966cbf19199b62e265f1320a5e60a0cdb2e26e
|
@@ -54,7 +54,7 @@ def make_positive_pairs(label, frag_steps, contig_frags, fppc, encoding_len=128)
if k < fppc:
# print("WARNING: cannot make {} unique pairs with genome of {} fragments".format(fppc, contig_frags), end='\r')
pairs.sp = np.tile(label, [fppc, 2])
- pairs.start = np.random.choice(frag_steps, [fppc, 2])
+ pairs.start = np.random.choice(contig_frags, [fppc, 2])
pairs.end = pairs.start + frag_steps
return pairs
|
coconet/fragmentation.py
|
ReplaceText(target='contig_frags' @(57,39)->(57,49))
|
def make_positive_pairs(label, frag_steps, contig_frags, fppc, encoding_len=128)
if k < fppc:
# print("WARNING: cannot make {} unique pairs with genome of {} fragments".format(fppc, contig_frags), end='\r')
pairs.sp = np.tile(label, [fppc, 2])
pairs.start = np.random.choice(frag_steps, [fppc, 2])
pairs.end = pairs.start + frag_steps
return pairs
|
def make_positive_pairs(label, frag_steps, contig_frags, fppc, encoding_len=128)
if k < fppc:
# print("WARNING: cannot make {} unique pairs with genome of {} fragments".format(fppc, contig_frags), end='\r')
pairs.sp = np.tile(label, [fppc, 2])
pairs.start = np.random.choice(contig_frags, [fppc, 2])
pairs.end = pairs.start + frag_steps
return pairs
|
635 |
https://:@github.com/struts2spring/sql-editor.git
|
92d594a22fc8cf532f18a445961615037bfa2685
|
@@ -305,7 +305,7 @@ class FileBrowser(FileTree):
fileName=os.path.split(path)[-1]
- stc.SetText(FileOperations().readFile(filePath=fname))
+ stc.SetText(FileOperations().readFile(filePath=path))
centerPaneTab.window.addTab(name='openFileLoad'+fileName, worksheetPanel=stc)
# win = wx.GetApp().GetActiveWindow()
|
src/view/views/file/explorer/FileBrowserPanel.py
|
ReplaceText(target='path' @(308,67)->(308,72))
|
class FileBrowser(FileTree):
fileName=os.path.split(path)[-1]
stc.SetText(FileOperations().readFile(filePath=fname))
centerPaneTab.window.addTab(name='openFileLoad'+fileName, worksheetPanel=stc)
# win = wx.GetApp().GetActiveWindow()
|
class FileBrowser(FileTree):
fileName=os.path.split(path)[-1]
stc.SetText(FileOperations().readFile(filePath=path))
centerPaneTab.window.addTab(name='openFileLoad'+fileName, worksheetPanel=stc)
# win = wx.GetApp().GetActiveWindow()
|
636 |
https://:@github.com/struts2spring/sql-editor.git
|
3b18738cabd125bf7e4faeb0170edcc888f22c0b
|
@@ -2306,7 +2306,7 @@ class ScrolledThumbnail(wx.ScrolledWindow):
logger.error(e, exc_info=True)
logger.error('selectedBookIndex: %s, len: %s', selectedBookIndex, len(self._items))
# logger.debug(.0deleteBooks)
- if len(deleteBooks) > 0:
+ if len(deleteBooks) >= 0:
self.updateStatusBar(text=f'{len(deleteBooks)} books deleted')
self.GetParent().GetParent().loadingBook()
self.GetParent().GetParent().updatePangnation()
|
src/view/views/calibre/book/browser/BookThumbCrtl.py
|
ReplaceText(target='>=' @(2309,28)->(2309,29))
|
class ScrolledThumbnail(wx.ScrolledWindow):
logger.error(e, exc_info=True)
logger.error('selectedBookIndex: %s, len: %s', selectedBookIndex, len(self._items))
# logger.debug(.0deleteBooks)
if len(deleteBooks) > 0:
self.updateStatusBar(text=f'{len(deleteBooks)} books deleted')
self.GetParent().GetParent().loadingBook()
self.GetParent().GetParent().updatePangnation()
|
class ScrolledThumbnail(wx.ScrolledWindow):
logger.error(e, exc_info=True)
logger.error('selectedBookIndex: %s, len: %s', selectedBookIndex, len(self._items))
# logger.debug(.0deleteBooks)
if len(deleteBooks) >= 0:
self.updateStatusBar(text=f'{len(deleteBooks)} books deleted')
self.GetParent().GetParent().loadingBook()
self.GetParent().GetParent().updatePangnation()
|
637 |
https://:@github.com/khaledghobashy/uraeus.git
|
d0011bf8d00b0212dd67ce4cd64b21719fbed709
|
@@ -186,7 +186,7 @@ class internal_force(generic_force):
defflection = self.LF - distance
velocity = unit_vector.T*self.joint.dijd
- self.Fi = unit_vector*(self.Fs(defflection) + self.Fd(velocity))
+ self.Fi = unit_vector*(self.Fs(defflection) - self.Fd(velocity))
Ti_e = 2*G(self.Pi).T*(self.Ti + Skew(self.ui).T*self.Fi)
force_vector = sm.BlockMatrix([[self.Fi], [Ti_e]])
|
source/symbolic_classes/forces.py
|
ReplaceText(target='-' @(189,52)->(189,53))
|
class internal_force(generic_force):
defflection = self.LF - distance
velocity = unit_vector.T*self.joint.dijd
self.Fi = unit_vector*(self.Fs(defflection) + self.Fd(velocity))
Ti_e = 2*G(self.Pi).T*(self.Ti + Skew(self.ui).T*self.Fi)
force_vector = sm.BlockMatrix([[self.Fi], [Ti_e]])
|
class internal_force(generic_force):
defflection = self.LF - distance
velocity = unit_vector.T*self.joint.dijd
self.Fi = unit_vector*(self.Fs(defflection) - self.Fd(velocity))
Ti_e = 2*G(self.Pi).T*(self.Ti + Skew(self.ui).T*self.Fi)
force_vector = sm.BlockMatrix([[self.Fi], [Ti_e]])
|
638 |
https://:@github.com/naglis/odd-bunch.git
|
6e9e55c327eaa6bccd5a54a1da850db418fa3a3a
|
@@ -74,7 +74,7 @@ class FieldAttrStringRedundant(Plugin):
f'for field "{field.name}". The same value will be computed '
f"by Odoo automatically.",
addon,
- locations=[Location(path, [column_index_1(string_kwarg.start_pos)])],
+ locations=[Location(path, [column_index_1(field.start_pos)])],
confidence=Confidence.LOW,
categories=["redundancy"],
sources=sources,
|
odd_bunch/plugin/field_attr_string_redundant.py
|
ReplaceText(target='field' @(77,58)->(77,70))
|
class FieldAttrStringRedundant(Plugin):
f'for field "{field.name}". The same value will be computed '
f"by Odoo automatically.",
addon,
locations=[Location(path, [column_index_1(string_kwarg.start_pos)])],
confidence=Confidence.LOW,
categories=["redundancy"],
sources=sources,
|
class FieldAttrStringRedundant(Plugin):
f'for field "{field.name}". The same value will be computed '
f"by Odoo automatically.",
addon,
locations=[Location(path, [column_index_1(field.start_pos)])],
confidence=Confidence.LOW,
categories=["redundancy"],
sources=sources,
|
639 |
https://:@github.com/naglis/odd-bunch.git
|
6e9e55c327eaa6bccd5a54a1da850db418fa3a3a
|
@@ -23,7 +23,7 @@ class TrackVisibilityAlways(Plugin):
"deprecated since version 12.0",
addon,
locations=[
- Location(field.model.path, [column_index_1(kwarg.start_pos)])
+ Location(field.model.path, [column_index_1(field.start_pos)])
],
categories=["deprecated"],
sources=[
|
odd_bunch/plugin/track_visibility_always.py
|
ReplaceText(target='field' @(26,67)->(26,72))
|
class TrackVisibilityAlways(Plugin):
"deprecated since version 12.0",
addon,
locations=[
Location(field.model.path, [column_index_1(kwarg.start_pos)])
],
categories=["deprecated"],
sources=[
|
class TrackVisibilityAlways(Plugin):
"deprecated since version 12.0",
addon,
locations=[
Location(field.model.path, [column_index_1(field.start_pos)])
],
categories=["deprecated"],
sources=[
|
640 |
https://:@github.com/haipdev/config.git
|
c81fb07972b62e9c51d47b7306ad0cb39b90025d
|
@@ -115,7 +115,7 @@ def get(*paths, **options):
elif value is not MANDATORY:
result[key] = value
else:
- path = '/'.join(path)
+ path = '/'.join(paths)
raise HaipConfigException(f'option "{key}" not found in section "{path}"')
return result
|
haip/config.py
|
ReplaceText(target='paths' @(118,28)->(118,32))
|
def get(*paths, **options):
elif value is not MANDATORY:
result[key] = value
else:
path = '/'.join(path)
raise HaipConfigException(f'option "{key}" not found in section "{path}"')
return result
|
def get(*paths, **options):
elif value is not MANDATORY:
result[key] = value
else:
path = '/'.join(paths)
raise HaipConfigException(f'option "{key}" not found in section "{path}"')
return result
|
641 |
https://:@github.com/woblers/rightmove_webscraper.py.git
|
75bc8dc28e5a998582ddf86ae43a3160b5729a90
|
@@ -37,7 +37,7 @@ class rightmove_data(object):
There are 24 results on each results page, but note that the
rightmove website limits results pages to a maximum of 42 pages."""
- page_count = self.results_count() / 24
+ page_count = self.results_count() // 24
if self.results_count() % 24 > 0:
page_count += 1
|
rightmove_webscraper.py
|
ReplaceText(target='//' @(40,42)->(40,43))
|
class rightmove_data(object):
There are 24 results on each results page, but note that the
rightmove website limits results pages to a maximum of 42 pages."""
page_count = self.results_count() / 24
if self.results_count() % 24 > 0:
page_count += 1
|
class rightmove_data(object):
There are 24 results on each results page, but note that the
rightmove website limits results pages to a maximum of 42 pages."""
page_count = self.results_count() // 24
if self.results_count() % 24 > 0:
page_count += 1
|
642 |
https://:@github.com/DomBennett/MassPhylogenyEstimation.git
|
e72cb1554f059c77b45c8c74af96bd0b2fb140b9
|
@@ -39,7 +39,7 @@ with open(os.path.join(working_dir, "data", "test_alignment.p"),
# MOCK
def dummy_blast(query, subj, minoverlap):
# should return bools and positions
- bools = [True for e in subj]
+ bools = [True for e in query]
positions = [0 for e in subj]
max_positions = [len(e) for e in subj]
positions.extend(max_positions)
|
tests/test_tools_alignment.py
|
ReplaceText(target='query' @(42,27)->(42,31))
|
with open(os.path.join(working_dir, "data", "test_alignment.p"),
# MOCK
def dummy_blast(query, subj, minoverlap):
# should return bools and positions
bools = [True for e in subj]
positions = [0 for e in subj]
max_positions = [len(e) for e in subj]
positions.extend(max_positions)
|
with open(os.path.join(working_dir, "data", "test_alignment.p"),
# MOCK
def dummy_blast(query, subj, minoverlap):
# should return bools and positions
bools = [True for e in query]
positions = [0 for e in subj]
max_positions = [len(e) for e in subj]
positions.extend(max_positions)
|
643 |
https://:@github.com/DomBennett/MassPhylogenyEstimation.git
|
832e9df9733c4e266c0583d4e1a329b5f72d4f4c
|
@@ -159,7 +159,7 @@ class Stager(object):
@classmethod
def run_all(klass, wd, stages):
for s in stages:
- if check(stage=s, directory=wd):
+ if not check(stage=s, directory=wd):
Stager(wd, s).run()
|
pglt/tools/system_tools.py
|
ReplaceText(target='not ' @(162,15)->(162,15))
|
class Stager(object):
@classmethod
def run_all(klass, wd, stages):
for s in stages:
if check(stage=s, directory=wd):
Stager(wd, s).run()
|
class Stager(object):
@classmethod
def run_all(klass, wd, stages):
for s in stages:
if not check(stage=s, directory=wd):
Stager(wd, s).run()
|
644 |
https://:@bitbucket.org/bowaggonerpublic/bomail.git
|
383fe87f4b5a54ce110d33850ce10f19e088a001
|
@@ -62,7 +62,7 @@ def main():
exit(0)
if sys.argv[1] == "help":
- if len(sys.argv) < 2:
+ if len(sys.argv) <= 2:
print(usage_str)
elif sys.argv[2] == "datestr":
print(bomail.util.datestr.datestr_str)
|
bomail/bomail.py
|
ReplaceText(target='<=' @(65,21)->(65,22))
|
def main():
exit(0)
if sys.argv[1] == "help":
if len(sys.argv) < 2:
print(usage_str)
elif sys.argv[2] == "datestr":
print(bomail.util.datestr.datestr_str)
|
def main():
exit(0)
if sys.argv[1] == "help":
if len(sys.argv) <= 2:
print(usage_str)
elif sys.argv[2] == "datestr":
print(bomail.util.datestr.datestr_str)
|
645 |
https://:@bitbucket.org/bowaggonerpublic/bomail.git
|
6769b3f3dc022b9674b2f26d2ff842f74703da7e
|
@@ -73,7 +73,7 @@ class TabNoThread:
new_fileset = set(new_filenames)
self.remove_files([t[0] for t in self.file_data if t[0] not in new_fileset], old_disp_info)
# assume, worst-case, that all matching files have changed/added
- self.update_for_change(new_fileset, old_disp_info)
+ self.update_for_change(new_filenames, old_disp_info)
# lazily load display data and return disp_data, is_unread, is_marked
|
bomail/guistuff/tabnothread.py
|
ReplaceText(target='new_filenames' @(76,27)->(76,38))
|
class TabNoThread:
new_fileset = set(new_filenames)
self.remove_files([t[0] for t in self.file_data if t[0] not in new_fileset], old_disp_info)
# assume, worst-case, that all matching files have changed/added
self.update_for_change(new_fileset, old_disp_info)
# lazily load display data and return disp_data, is_unread, is_marked
|
class TabNoThread:
new_fileset = set(new_filenames)
self.remove_files([t[0] for t in self.file_data if t[0] not in new_fileset], old_disp_info)
# assume, worst-case, that all matching files have changed/added
self.update_for_change(new_filenames, old_disp_info)
# lazily load display data and return disp_data, is_unread, is_marked
|
646 |
https://:@github.com/GainCompliance/gain-requests-futures.git
|
2779819b9b7554d787280d5889878237ba1937b5
|
@@ -69,7 +69,7 @@ class FuturesSession(Session):
func = super(FuturesSession, self).send
if isinstance(self.executor, ProcessPoolExecutor):
try:
- dumps(request)
+ dumps(func)
except (TypeError, PickleError):
raise RuntimeError(PICKLE_ERROR)
return self.executor.submit(func, request, **kwargs)
|
requests_futures/sessions.py
|
ReplaceText(target='func' @(72,22)->(72,29))
|
class FuturesSession(Session):
func = super(FuturesSession, self).send
if isinstance(self.executor, ProcessPoolExecutor):
try:
dumps(request)
except (TypeError, PickleError):
raise RuntimeError(PICKLE_ERROR)
return self.executor.submit(func, request, **kwargs)
|
class FuturesSession(Session):
func = super(FuturesSession, self).send
if isinstance(self.executor, ProcessPoolExecutor):
try:
dumps(func)
except (TypeError, PickleError):
raise RuntimeError(PICKLE_ERROR)
return self.executor.submit(func, request, **kwargs)
|
647 |
https://:@github.com/praekelt/casepropods.family_connect_subscription.git
|
9f04ceacb29a64763e11de6c8fd3008faf9eddb2
|
@@ -95,7 +95,7 @@ class SubscriptionPod(Pod):
'subscription_ids': active_sub_ids
}
})
- if len(active_sub_ids) > 0:
+ if len(active_sub_ids) > 1:
actions.append(self.get_cancel_action(active_sub_ids))
content['actions'] = actions
|
casepropods/family_connect_subscription/plugin.py
|
ReplaceText(target='1' @(98,33)->(98,34))
|
class SubscriptionPod(Pod):
'subscription_ids': active_sub_ids
}
})
if len(active_sub_ids) > 0:
actions.append(self.get_cancel_action(active_sub_ids))
content['actions'] = actions
|
class SubscriptionPod(Pod):
'subscription_ids': active_sub_ids
}
})
if len(active_sub_ids) > 1:
actions.append(self.get_cancel_action(active_sub_ids))
content['actions'] = actions
|
648 |
https://:@github.com/fmilthaler/FinQuant.git
|
075430f74799040aa1d46c722e16a52a82637c63
|
@@ -783,7 +783,7 @@ def _yfinance_request(names, start_date=None, end_date=None):
try:
import datetime
if isinstance(start_date, str):
- start_date = datetime.datetime.strptime(end_date, "%Y-%m-%d")
+ start_date = datetime.datetime.strptime(start_date, "%Y-%m-%d")
if isinstance(end_date, str):
end_date = datetime.datetime.strptime(end_date, "%Y-%m-%d")
except ImportError:
|
finquant/portfolio.py
|
ReplaceText(target='start_date' @(786,52)->(786,60))
|
def _yfinance_request(names, start_date=None, end_date=None):
try:
import datetime
if isinstance(start_date, str):
start_date = datetime.datetime.strptime(end_date, "%Y-%m-%d")
if isinstance(end_date, str):
end_date = datetime.datetime.strptime(end_date, "%Y-%m-%d")
except ImportError:
|
def _yfinance_request(names, start_date=None, end_date=None):
try:
import datetime
if isinstance(start_date, str):
start_date = datetime.datetime.strptime(start_date, "%Y-%m-%d")
if isinstance(end_date, str):
end_date = datetime.datetime.strptime(end_date, "%Y-%m-%d")
except ImportError:
|
649 |
https://:@github.com/MrTango/click.git
|
a6af25df9c2e82e94c3aa15d579f9347881e5efb
|
@@ -1173,7 +1173,7 @@ class Argument(Parameter):
if attrs.get('default') is not None:
required = False
else:
- required = attrs.get('nargs', 0) > 0
+ required = attrs.get('nargs', 1) > 0
Parameter.__init__(self, param_decls, required=required, **attrs)
def make_metavar(self):
|
click/core.py
|
ReplaceText(target='1' @(1176,46)->(1176,47))
|
class Argument(Parameter):
if attrs.get('default') is not None:
required = False
else:
required = attrs.get('nargs', 0) > 0
Parameter.__init__(self, param_decls, required=required, **attrs)
def make_metavar(self):
|
class Argument(Parameter):
if attrs.get('default') is not None:
required = False
else:
required = attrs.get('nargs', 1) > 0
Parameter.__init__(self, param_decls, required=required, **attrs)
def make_metavar(self):
|
650 |
https://:@github.com/MrTango/click.git
|
336e5e08acf98a4033e5aa4c6fcef118d4f469ec
|
@@ -224,7 +224,7 @@ def version_option(version=None, *param_decls, **attrs):
message = attrs.pop('message', '%(prog)s, version %(version)s')
def callback(ctx, param, value):
- if value or ctx.resilient_parsing:
+ if not value or ctx.resilient_parsing:
return
prog = prog_name
if prog is None:
|
click/decorators.py
|
ReplaceText(target='not ' @(227,15)->(227,15))
|
def version_option(version=None, *param_decls, **attrs):
message = attrs.pop('message', '%(prog)s, version %(version)s')
def callback(ctx, param, value):
if value or ctx.resilient_parsing:
return
prog = prog_name
if prog is None:
|
def version_option(version=None, *param_decls, **attrs):
message = attrs.pop('message', '%(prog)s, version %(version)s')
def callback(ctx, param, value):
if not value or ctx.resilient_parsing:
return
prog = prog_name
if prog is None:
|
651 |
https://:@github.com/MrTango/click.git
|
598c6d76fbc036fb3219d9f09948a682cda66601
|
@@ -213,7 +213,7 @@ class CliRunner(object):
old_env = {}
try:
for key, value in iteritems(env):
- old_env[key] = os.environ.get(value)
+ old_env[key] = os.environ.get(key)
if value is None:
try:
del os.environ[key]
|
click/testing.py
|
ReplaceText(target='key' @(216,46)->(216,51))
|
class CliRunner(object):
old_env = {}
try:
for key, value in iteritems(env):
old_env[key] = os.environ.get(value)
if value is None:
try:
del os.environ[key]
|
class CliRunner(object):
old_env = {}
try:
for key, value in iteritems(env):
old_env[key] = os.environ.get(key)
if value is None:
try:
del os.environ[key]
|
652 |
https://:@github.com/epeios-q37/atlas-python.git
|
c310fd7273b7ec139c0eca6be43506cb611d5bfc
|
@@ -69,7 +69,7 @@ class Chatroom:
def displayMessages(this, dom):
global messages
- if len(messages) >= this.lastMessage:
+ if len(messages) > this.lastMessage:
id = dom.createElement("span")
dom.setLayoutXSL(id, this.buildXML(), "Messages.xsl")
dom.insertChild(id, "Board")
|
Chatroom/main.py
|
ReplaceText(target='>' @(72,19)->(72,21))
|
class Chatroom:
def displayMessages(this, dom):
global messages
if len(messages) >= this.lastMessage:
id = dom.createElement("span")
dom.setLayoutXSL(id, this.buildXML(), "Messages.xsl")
dom.insertChild(id, "Board")
|
class Chatroom:
def displayMessages(this, dom):
global messages
if len(messages) > this.lastMessage:
id = dom.createElement("span")
dom.setLayoutXSL(id, this.buildXML(), "Messages.xsl")
dom.insertChild(id, "Board")
|
653 |
https://:@github.com/herrersystem/apize.git
|
3f4ce76b32fdc1cddc66cde54f0d7552b2ab2101
|
@@ -15,7 +15,7 @@ def send_request(url, method,
"""
## Parse url args
for p in args:
- url = url.replace(':'+p, str(params[p]))
+ url = url.replace(':' + p, str(args[p]))
try:
if data:
|
apize/decorators.py
|
ReplaceText(target='args' @(18,31)->(18,37))
|
def send_request(url, method,
"""
## Parse url args
for p in args:
url = url.replace(':'+p, str(params[p]))
try:
if data:
|
def send_request(url, method,
"""
## Parse url args
for p in args:
url = url.replace(':' + p, str(args[p]))
try:
if data:
|
654 |
https://:@github.com/silvacms/silva.core.services.git
|
a674128c54bb10f2abdda32808285fabc985e363
|
@@ -39,7 +39,7 @@ class SecretService(SilvaService):
assert len(args) > 1, u'Too few arguments'
challenge = hmac.new(self.__key, str(args[0]), hashlib.sha1)
for arg in args[1:]:
- challenge.update(str(args))
+ challenge.update(str(arg))
return challenge.hexdigest()
InitializeClass(SecretService)
|
src/silva/core/services/secret.py
|
ReplaceText(target='arg' @(42,33)->(42,37))
|
class SecretService(SilvaService):
assert len(args) > 1, u'Too few arguments'
challenge = hmac.new(self.__key, str(args[0]), hashlib.sha1)
for arg in args[1:]:
challenge.update(str(args))
return challenge.hexdigest()
InitializeClass(SecretService)
|
class SecretService(SilvaService):
assert len(args) > 1, u'Too few arguments'
challenge = hmac.new(self.__key, str(args[0]), hashlib.sha1)
for arg in args[1:]:
challenge.update(str(arg))
return challenge.hexdigest()
InitializeClass(SecretService)
|
655 |
https://:@github.com/SatelliteApplicationsCatapult/sedas_pyapi.git
|
db1d3308de5180dd9a26e8bc73b82c97d2f07507
|
@@ -225,7 +225,7 @@ class SeDASAPI:
req = Request(url, headers=self.headers)
try:
decoded = json.load(urlopen(req))
- if len(decoded) > 1 and 'downloadUrl' in decoded[0]:
+ if len(decoded) >= 1 and 'downloadUrl' in decoded[0]:
return decoded[0]['downloadUrl']
return None
except HTTPError as e:
|
getthestuff/sedas_api.py
|
ReplaceText(target='>=' @(228,28)->(228,29))
|
class SeDASAPI:
req = Request(url, headers=self.headers)
try:
decoded = json.load(urlopen(req))
if len(decoded) > 1 and 'downloadUrl' in decoded[0]:
return decoded[0]['downloadUrl']
return None
except HTTPError as e:
|
class SeDASAPI:
req = Request(url, headers=self.headers)
try:
decoded = json.load(urlopen(req))
if len(decoded) >= 1 and 'downloadUrl' in decoded[0]:
return decoded[0]['downloadUrl']
return None
except HTTPError as e:
|
656 |
https://:@github.com/gigaquads/pybiz.git
|
9431e28a54c7a64f4fabcd861239a9651a75dde5
|
@@ -91,7 +91,7 @@ class YamlDao(Dao):
cur_data = self.fetch(_id)
new_data = DictUtils.merge(cur_data, data)
Yaml.to_file(file_path=file_path, data=new_data)
- return data
+ return new_data
def delete(self, _id) -> None:
"""
|
pybiz/dao/yaml_dao.py
|
ReplaceText(target='new_data' @(94,15)->(94,19))
|
class YamlDao(Dao):
cur_data = self.fetch(_id)
new_data = DictUtils.merge(cur_data, data)
Yaml.to_file(file_path=file_path, data=new_data)
return data
def delete(self, _id) -> None:
"""
|
class YamlDao(Dao):
cur_data = self.fetch(_id)
new_data = DictUtils.merge(cur_data, data)
Yaml.to_file(file_path=file_path, data=new_data)
return new_data
def delete(self, _id) -> None:
"""
|
657 |
https://:@github.com/gigaquads/pybiz.git
|
cc4bc8499bdffbf4bef4704afb722fa55c7ccc1d
|
@@ -790,7 +790,7 @@ class BizObject(
related_bizobj_list.append(obj)
else:
related_bizobj_list.append(
- rel.target(related_data)
+ rel.target(obj)
)
self._related_bizobjs[rel.name] = related_bizobj_list
|
pybiz/biz.py
|
ReplaceText(target='obj' @(793,39)->(793,51))
|
class BizObject(
related_bizobj_list.append(obj)
else:
related_bizobj_list.append(
rel.target(related_data)
)
self._related_bizobjs[rel.name] = related_bizobj_list
|
class BizObject(
related_bizobj_list.append(obj)
else:
related_bizobj_list.append(
rel.target(obj)
)
self._related_bizobjs[rel.name] = related_bizobj_list
|
658 |
https://:@github.com/gigaquads/pybiz.git
|
4bfdaf78df6eec9213f65df0656d346cfd4a45f2
|
@@ -79,6 +79,6 @@ class BreadthFirstSaver(Saver):
v_type = v.__class__
if v._id is None:
to_create[v_type].append(v)
- elif x.dirty:
+ elif v.dirty:
to_update[v_type].append(x)
self._aggregate_related(v, to_create, to_update)
|
pybiz/biz/internal/save.py
|
ReplaceText(target='v' @(82,21)->(82,22))
|
class BreadthFirstSaver(Saver):
v_type = v.__class__
if v._id is None:
to_create[v_type].append(v)
elif x.dirty:
to_update[v_type].append(x)
self._aggregate_related(v, to_create, to_update)
|
class BreadthFirstSaver(Saver):
v_type = v.__class__
if v._id is None:
to_create[v_type].append(v)
elif v.dirty:
to_update[v_type].append(x)
self._aggregate_related(v, to_create, to_update)
|
659 |
https://:@github.com/gigaquads/pybiz.git
|
9ccaa42fdf4677090e93c27b2326c5d935d568f9
|
@@ -80,5 +80,5 @@ class BreadthFirstSaver(Saver):
if v._id is None:
to_create[v_type].append(v)
elif v.dirty:
- to_update[v_type].append(x)
+ to_update[v_type].append(v)
self._aggregate_related(v, to_create, to_update)
|
pybiz/biz/internal/save.py
|
ReplaceText(target='v' @(83,45)->(83,46))
|
class BreadthFirstSaver(Saver):
if v._id is None:
to_create[v_type].append(v)
elif v.dirty:
to_update[v_type].append(x)
self._aggregate_related(v, to_create, to_update)
|
class BreadthFirstSaver(Saver):
if v._id is None:
to_create[v_type].append(v)
elif v.dirty:
to_update[v_type].append(v)
self._aggregate_related(v, to_create, to_update)
|
660 |
https://:@github.com/gigaquads/pybiz.git
|
c042a85234732c1ff96c0240b378595d24631fbe
|
@@ -116,7 +116,7 @@ class CompositeGuard(Guard):
if rhs_exc is not None and lhs_exc is not None:
return CompositeGuardException(lhs_exc, rhs_exc)
elif self._op == OP_CODE.NOT:
- if lhs_exc is not None:
+ if lhs_exc is None:
return lhs_exc
else:
return ValueError(f'op not recognized, "{self._op}"')
|
pybiz/api/middleware/guard_middleware/guard.py
|
ReplaceText(target=' is ' @(119,22)->(119,30))
|
class CompositeGuard(Guard):
if rhs_exc is not None and lhs_exc is not None:
return CompositeGuardException(lhs_exc, rhs_exc)
elif self._op == OP_CODE.NOT:
if lhs_exc is not None:
return lhs_exc
else:
return ValueError(f'op not recognized, "{self._op}"')
|
class CompositeGuard(Guard):
if rhs_exc is not None and lhs_exc is not None:
return CompositeGuardException(lhs_exc, rhs_exc)
elif self._op == OP_CODE.NOT:
if lhs_exc is None:
return lhs_exc
else:
return ValueError(f'op not recognized, "{self._op}"')
|
661 |
https://:@github.com/gigaquads/pybiz.git
|
30e14e8c946edb447a76ea243a271c6a03895def
|
@@ -43,7 +43,7 @@ class ActionDecorator(object):
else:
func = obj
action = self.setup_action(func, False)
- return action
+ return func
def setup_action(self, func, overwrite):
action = self.app.action_type(func, self)
|
ravel/app/base/action_decorator.py
|
ReplaceText(target='func' @(46,19)->(46,25))
|
class ActionDecorator(object):
else:
func = obj
action = self.setup_action(func, False)
return action
def setup_action(self, func, overwrite):
action = self.app.action_type(func, self)
|
class ActionDecorator(object):
else:
func = obj
action = self.setup_action(func, False)
return func
def setup_action(self, func, overwrite):
action = self.app.action_type(func, self)
|
662 |
https://:@github.com/a1phat0ny/noteboard.git
|
82eea493ff696d09af702a1cfd0c645f5f61b86e
|
@@ -429,7 +429,7 @@ def display_board(date=False, sort=False, im=False):
(Fore.LIGHTBLACK_EX + "(due: {})".format(color + str(duedate) + Fore.LIGHTBLACK_EX)) if item["due"] else "",
Fore.LIGHTBLACK_EX + str(item["date"]))
else:
- p(star, Fore.LIGHTMAGENTA_EX + str(item["id"]).rjust(2), mark, text_color + item["text"], tag_text, due_text, day_text)
+ p(star, Fore.LIGHTMAGENTA_EX + str(item["id"]).rjust(2), mark, text_color + item["text"], tag_text, day_text, due_text)
print()
print_footer()
print_total()
|
noteboard/cli.py
|
ArgSwap(idxs=5<->6 @(432,16)->(432,17))
|
def display_board(date=False, sort=False, im=False):
(Fore.LIGHTBLACK_EX + "(due: {})".format(color + str(duedate) + Fore.LIGHTBLACK_EX)) if item["due"] else "",
Fore.LIGHTBLACK_EX + str(item["date"]))
else:
p(star, Fore.LIGHTMAGENTA_EX + str(item["id"]).rjust(2), mark, text_color + item["text"], tag_text, due_text, day_text)
print()
print_footer()
print_total()
|
def display_board(date=False, sort=False, im=False):
(Fore.LIGHTBLACK_EX + "(due: {})".format(color + str(duedate) + Fore.LIGHTBLACK_EX)) if item["due"] else "",
Fore.LIGHTBLACK_EX + str(item["date"]))
else:
p(star, Fore.LIGHTMAGENTA_EX + str(item["id"]).rjust(2), mark, text_color + item["text"], tag_text, day_text, due_text)
print()
print_footer()
print_total()
|
663 |
https://:@github.com/tlevine/sheetmusic.git
|
5c919c8d4c6be39cd42847e44942305521c7fa52
|
@@ -54,7 +54,7 @@ def _next_note(first_note, second_note_name):
If the second note name is less than the first ("G" is greater than "C"),
return a note of the second name in the octave above the first.
'''
- if second_note_name > first_note.name:
+ if second_note_name >= first_note.name:
second_note_octave = first_note.octave
else:
second_note_octave = first_note.octave + 1
|
libsheetmusic/music.py
|
ReplaceText(target='>=' @(57,24)->(57,25))
|
def _next_note(first_note, second_note_name):
If the second note name is less than the first ("G" is greater than "C"),
return a note of the second name in the octave above the first.
'''
if second_note_name > first_note.name:
second_note_octave = first_note.octave
else:
second_note_octave = first_note.octave + 1
|
def _next_note(first_note, second_note_name):
If the second note name is less than the first ("G" is greater than "C"),
return a note of the second name in the octave above the first.
'''
if second_note_name >= first_note.name:
second_note_octave = first_note.octave
else:
second_note_octave = first_note.octave + 1
|
664 |
https://:@github.com/tlevine/sheetmusic.git
|
62a714388992483a00824d0ce16af7a7c8b9ee7e
|
@@ -80,4 +80,4 @@ def util_functions():
def functions():
callables = reduce(u.merge, [scale_functions(), chord_functions(), progression_functions(), interval_functions(), util_functions()])
- return {k:u.to_function(v, k) for k,v in callables.items()}
+ return {k:u.to_function(k, v) for k,v in callables.items()}
|
libsheetmusic/main.py
|
ArgSwap(idxs=0<->1 @(83,14)->(83,27))
|
def util_functions():
def functions():
callables = reduce(u.merge, [scale_functions(), chord_functions(), progression_functions(), interval_functions(), util_functions()])
return {k:u.to_function(v, k) for k,v in callables.items()}
|
def util_functions():
def functions():
callables = reduce(u.merge, [scale_functions(), chord_functions(), progression_functions(), interval_functions(), util_functions()])
return {k:u.to_function(k, v) for k,v in callables.items()}
|
665 |
https://:@gitlab.com/ebenhoeh/modelbase.git
|
dcc3cdf01cf74859ff59f4a641a9caf0faa21069
|
@@ -207,7 +207,7 @@ class Model(core.ParameterModel):
raise TypeError("Rate name must be str")
if not callable(rate_function):
raise TypeError("Rate function must be a function")
- if variables is not None:
+ if variables is None:
variables = []
if not isinstance(variables, list):
raise TypeError("Variables must be a list")
|
modelbase/ode/model.py
|
ReplaceText(target=' is ' @(210,20)->(210,28))
|
class Model(core.ParameterModel):
raise TypeError("Rate name must be str")
if not callable(rate_function):
raise TypeError("Rate function must be a function")
if variables is not None:
variables = []
if not isinstance(variables, list):
raise TypeError("Variables must be a list")
|
class Model(core.ParameterModel):
raise TypeError("Rate name must be str")
if not callable(rate_function):
raise TypeError("Rate function must be a function")
if variables is None:
variables = []
if not isinstance(variables, list):
raise TypeError("Variables must be a list")
|
666 |
https://:@gitlab.com/ebenhoeh/modelbase.git
|
34fc0fc7c745eef34ae0edf0377347d83b733890
|
@@ -281,7 +281,7 @@ class Model(core.ParameterModel):
def get_rate_indexes(self, rate_name=None):
v, k = zip(*enumerate(self.get_rate_names()))
rate_idx = dict(zip(k, v))
- if rate_name is not None:
+ if rate_name is None:
return rate_idx
return rate_idx[rate_name]
|
modelbase/ode/model.py
|
ReplaceText(target=' is ' @(284,20)->(284,28))
|
class Model(core.ParameterModel):
def get_rate_indexes(self, rate_name=None):
v, k = zip(*enumerate(self.get_rate_names()))
rate_idx = dict(zip(k, v))
if rate_name is not None:
return rate_idx
return rate_idx[rate_name]
|
class Model(core.ParameterModel):
def get_rate_indexes(self, rate_name=None):
v, k = zip(*enumerate(self.get_rate_names()))
rate_idx = dict(zip(k, v))
if rate_name is None:
return rate_idx
return rate_idx[rate_name]
|
667 |
https://:@github.com/kalombos/pynetsnmp.git
|
812b5789589ca0d99f6e6d2339fee7e4254e9c01
|
@@ -637,7 +637,7 @@ class Session(object):
MAXFD = 1024
-fdset = c_int32 * (MAXFD/32)
+fdset = c_int32 * (MAXFD//32)
class timeval(Structure):
_fields_ = [
|
pynetsnmp/netsnmp.py
|
ReplaceText(target='//' @(640,24)->(640,25))
|
class Session(object):
MAXFD = 1024
fdset = c_int32 * (MAXFD/32)
class timeval(Structure):
_fields_ = [
|
class Session(object):
MAXFD = 1024
fdset = c_int32 * (MAXFD//32)
class timeval(Structure):
_fields_ = [
|
668 |
https://:@github.com/kalombos/pynetsnmp.git
|
f2883247d0b1df1804aa12653b06dce1d2137697
|
@@ -312,7 +312,7 @@ def strToOid(oidStr):
return mkoid(tuple([int(x) for x in oidStr.strip('.').split('.')]))
def decodeOid(pdu):
- return tuple([pdu.val.objid[i] for i in range(pdu.val_len / sizeof(u_long))])
+ return tuple([pdu.val.objid[i] for i in range(pdu.val_len // sizeof(u_long))])
def decodeIp(pdu):
return '.'.join(map(str, pdu.val.bitstring[:4]))
|
pynetsnmp/netsnmp.py
|
ReplaceText(target='//' @(315,62)->(315,63))
|
def strToOid(oidStr):
return mkoid(tuple([int(x) for x in oidStr.strip('.').split('.')]))
def decodeOid(pdu):
return tuple([pdu.val.objid[i] for i in range(pdu.val_len / sizeof(u_long))])
def decodeIp(pdu):
return '.'.join(map(str, pdu.val.bitstring[:4]))
|
def strToOid(oidStr):
return mkoid(tuple([int(x) for x in oidStr.strip('.').split('.')]))
def decodeOid(pdu):
return tuple([pdu.val.objid[i] for i in range(pdu.val_len // sizeof(u_long))])
def decodeIp(pdu):
return '.'.join(map(str, pdu.val.bitstring[:4]))
|
669 |
https://:@github.com/Swiftea/Crawler.git
|
fb03cfc257939d5b86fe00037ab6b00fd54c9afa
|
@@ -14,7 +14,7 @@ def stats(dir_stats=DIR_STATS):
stat_links = ('Average links in webpage: ' + str(average(content)))
if len(content) > 10000:
compress_stats(dir_stats + 'stat_links')
- result += stat_links + '\n'
+ result = stat_links + '\n'
try:
with open(dir_stats + 'stat_webpages', 'r') as myfile:
content = myfile.read().split()
|
crawler/stats.py
|
ReplaceText(target='=' @(17,8)->(17,10))
|
def stats(dir_stats=DIR_STATS):
stat_links = ('Average links in webpage: ' + str(average(content)))
if len(content) > 10000:
compress_stats(dir_stats + 'stat_links')
result += stat_links + '\n'
try:
with open(dir_stats + 'stat_webpages', 'r') as myfile:
content = myfile.read().split()
|
def stats(dir_stats=DIR_STATS):
stat_links = ('Average links in webpage: ' + str(average(content)))
if len(content) > 10000:
compress_stats(dir_stats + 'stat_links')
result = stat_links + '\n'
try:
with open(dir_stats + 'stat_webpages', 'r') as myfile:
content = myfile.read().split()
|
670 |
https://:@bitbucket.org/mikhail-makovenko/save-to-db.git
|
0b152880bfce8af5f211bfbb3d5677f283823bdc
|
@@ -187,7 +187,7 @@ class AdapterBase(object):
:returns: Item list and corresponding ORM models as a list of lists
(in case one item updates multiple models).
"""
- return db_persist(cls, item, adapter_settings)
+ return db_persist(item, cls, adapter_settings)
@classmethod
|
save_to_db/adapters/utils/adapter_base.py
|
ArgSwap(idxs=0<->1 @(190,15)->(190,25))
|
class AdapterBase(object):
:returns: Item list and corresponding ORM models as a list of lists
(in case one item updates multiple models).
"""
return db_persist(cls, item, adapter_settings)
@classmethod
|
class AdapterBase(object):
:returns: Item list and corresponding ORM models as a list of lists
(in case one item updates multiple models).
"""
return db_persist(item, cls, adapter_settings)
@classmethod
|
671 |
https://:@github.com/itu-algorithms/itu.algs4.git
|
8a06e126f13f6d54802e342b1ad7c44ec792ffc3
|
@@ -64,7 +64,7 @@ class Queue:
if __name__ == '__main__':
queue = Queue()
- if len(sys.argv) > 0:
+ if len(sys.argv) > 1:
sys.stdin = open(sys.argv[1])
while not stdio.isEmpty():
input_item = stdio.readString()
|
fundamentals/queue.py
|
ReplaceText(target='1' @(67,23)->(67,24))
|
class Queue:
if __name__ == '__main__':
queue = Queue()
if len(sys.argv) > 0:
sys.stdin = open(sys.argv[1])
while not stdio.isEmpty():
input_item = stdio.readString()
|
class Queue:
if __name__ == '__main__':
queue = Queue()
if len(sys.argv) > 1:
sys.stdin = open(sys.argv[1])
while not stdio.isEmpty():
input_item = stdio.readString()
|
672 |
https://:@github.com/itu-algorithms/itu.algs4.git
|
2282d1fa58d8c525d83890def4dc5b4d1902a0dd
|
@@ -9,6 +9,6 @@ class ThreeSumFast:
count = 0
for i in range(n):
for j in range(i+1, n):
- if binary_search.index_of(a, -a[i]-a[j]) > i:
+ if binary_search.index_of(a, -a[i]-a[j]) > j:
count += 1
return count
|
algs4/fundamentals/three_sum_fast.py
|
ReplaceText(target='j' @(12,59)->(12,60))
|
class ThreeSumFast:
count = 0
for i in range(n):
for j in range(i+1, n):
if binary_search.index_of(a, -a[i]-a[j]) > i:
count += 1
return count
|
class ThreeSumFast:
count = 0
for i in range(n):
for j in range(i+1, n):
if binary_search.index_of(a, -a[i]-a[j]) > j:
count += 1
return count
|
673 |
https://:@github.com/itu-algorithms/itu.algs4.git
|
62cc19d6f09e3f24abbe1551d69d67474518a7cb
|
@@ -183,7 +183,7 @@ class BinarySearchST:
while j < self._n-1:
self._keys[j] = self._keys[j+1]
self._vals[j] = self._vals[j+1]
- j = 1
+ j += 1
self._n -= 1
n = self._n
|
itu/algs4/searching/binary_search_st.py
|
ReplaceText(target='+=' @(186,14)->(186,15))
|
class BinarySearchST:
while j < self._n-1:
self._keys[j] = self._keys[j+1]
self._vals[j] = self._vals[j+1]
j = 1
self._n -= 1
n = self._n
|
class BinarySearchST:
while j < self._n-1:
self._keys[j] = self._keys[j+1]
self._vals[j] = self._vals[j+1]
j += 1
self._n -= 1
n = self._n
|
674 |
https://:@github.com/itu-algorithms/itu.algs4.git
|
616a6dd32cf80578bfae1ce36dbede8eb2e241cc
|
@@ -481,7 +481,7 @@ class RedBlackBST(Generic[Key, Val]):
return
if lo < x.key:
self._keys(x.left, queue, lo, hi)
- if not x.key < lo and x.key < hi:
+ if not x.key < lo and x.key <= hi:
queue.enqueue(x.key)
if hi > x.key:
self._keys(x.right, queue, lo, hi)
|
itu/algs4/searching/red_black_bst.py
|
ReplaceText(target='<=' @(484,37)->(484,38))
|
class RedBlackBST(Generic[Key, Val]):
return
if lo < x.key:
self._keys(x.left, queue, lo, hi)
if not x.key < lo and x.key < hi:
queue.enqueue(x.key)
if hi > x.key:
self._keys(x.right, queue, lo, hi)
|
class RedBlackBST(Generic[Key, Val]):
return
if lo < x.key:
self._keys(x.left, queue, lo, hi)
if not x.key < lo and x.key <= hi:
queue.enqueue(x.key)
if hi > x.key:
self._keys(x.right, queue, lo, hi)
|
675 |
https://:@github.com/kbytesys/django-recaptcha3.git
|
69219ca34dc834fede05f4e7f107ba17156f8f45
|
@@ -15,7 +15,7 @@ logger = logging.getLogger(__name__)
class ReCaptchaField(forms.CharField):
def __init__(self, attrs=None, *args, **kwargs):
- if os.environ.get('RECAPTCHA_DISABLE', None) is not None:
+ if os.environ.get('RECAPTCHA_DISABLE', None) is None:
self._private_key = kwargs.pop('private_key', settings.RECAPTCHA_PRIVATE_KEY)
self._score_threshold = kwargs.pop('score_threshold', settings.RECAPTCHA_SCORE_THRESHOLD)
|
snowpenguin/django/recaptcha3/fields.py
|
ReplaceText(target=' is ' @(18,52)->(18,60))
|
logger = logging.getLogger(__name__)
class ReCaptchaField(forms.CharField):
def __init__(self, attrs=None, *args, **kwargs):
if os.environ.get('RECAPTCHA_DISABLE', None) is not None:
self._private_key = kwargs.pop('private_key', settings.RECAPTCHA_PRIVATE_KEY)
self._score_threshold = kwargs.pop('score_threshold', settings.RECAPTCHA_SCORE_THRESHOLD)
|
logger = logging.getLogger(__name__)
class ReCaptchaField(forms.CharField):
def __init__(self, attrs=None, *args, **kwargs):
if os.environ.get('RECAPTCHA_DISABLE', None) is None:
self._private_key = kwargs.pop('private_key', settings.RECAPTCHA_PRIVATE_KEY)
self._score_threshold = kwargs.pop('score_threshold', settings.RECAPTCHA_SCORE_THRESHOLD)
|
676 |
https://:@github.com/MonetDBSolutions/mal_analytics.git
|
0b7cd6d9394adc932e19a29eda69bb11e5a3fb19
|
@@ -375,7 +375,7 @@ class ProfilerObjectParser:
except json.JSONDecodeError as json_error:
LOGGER.warning("W001: Cannot parse object")
LOGGER.warning(json_string)
- LOGGER.warning("Decoder reports %s", json_string)
+ LOGGER.warning("Decoder reports %s", json_error)
return
dispatcher = {
|
mal_profiler/profiler_parser.py
|
ReplaceText(target='json_error' @(378,49)->(378,60))
|
class ProfilerObjectParser:
except json.JSONDecodeError as json_error:
LOGGER.warning("W001: Cannot parse object")
LOGGER.warning(json_string)
LOGGER.warning("Decoder reports %s", json_string)
return
dispatcher = {
|
class ProfilerObjectParser:
except json.JSONDecodeError as json_error:
LOGGER.warning("W001: Cannot parse object")
LOGGER.warning(json_string)
LOGGER.warning("Decoder reports %s", json_error)
return
dispatcher = {
|
677 |
https://:@github.com/MonetDBSolutions/mal_analytics.git
|
a4e4a3d115ffc81721248d71176d8205c1866d98
|
@@ -148,7 +148,7 @@ class DatabaseManager(object, metaclass=Singleton):
stmt = list()
for ln in sql_in:
cline = ln.strip()
- if ln.startswith('--') or len(cline) == 0:
+ if cline.startswith('--') or len(cline) == 0:
continue
stmt.append(cline)
|
mal_analytics/db_manager.py
|
ReplaceText(target='cline' @(151,15)->(151,17))
|
class DatabaseManager(object, metaclass=Singleton):
stmt = list()
for ln in sql_in:
cline = ln.strip()
if ln.startswith('--') or len(cline) == 0:
continue
stmt.append(cline)
|
class DatabaseManager(object, metaclass=Singleton):
stmt = list()
for ln in sql_in:
cline = ln.strip()
if cline.startswith('--') or len(cline) == 0:
continue
stmt.append(cline)
|
678 |
https://:@github.com/codepost-io/codePost-api-python.git
|
00320258dd53e987c66c9af2d021fb93b38ac20c
|
@@ -812,7 +812,7 @@ def remove_comments(api_key, submission_id=None, file_id=None):
headers=auth_headers
)
- if r.status_code != 204:
+ if r.status_code == 204:
comments_to_delete += r.json().get("comments", list())
deleted_comments += 1
except:
|
codePost_api/helpers.py
|
ReplaceText(target='==' @(815,29)->(815,31))
|
def remove_comments(api_key, submission_id=None, file_id=None):
headers=auth_headers
)
if r.status_code != 204:
comments_to_delete += r.json().get("comments", list())
deleted_comments += 1
except:
|
def remove_comments(api_key, submission_id=None, file_id=None):
headers=auth_headers
)
if r.status_code == 204:
comments_to_delete += r.json().get("comments", list())
deleted_comments += 1
except:
|
679 |
https://:@github.com/optimatorlab/veroviz.git
|
0c34d475219e023bbc77e96bbcf8c7bd2ec09fde
|
@@ -527,7 +527,7 @@ def geoAreaOfPolygon(poly):
polyArea = 0
# Use polygon triangulation to cut the bounding region into a list of triangles, calculate the area of each triangle
- lstTriangle = tripy.earclip(poly)
+ lstTriangle = tripy.earclip(cleanPoly)
lstArea = []
for i in range(len(lstTriangle)):
lstArea.append(geoAreaOfTriangle(lstTriangle[i][0], lstTriangle[i][1], lstTriangle[i][2]))
|
veroviz/_geometry.py
|
ReplaceText(target='cleanPoly' @(530,29)->(530,33))
|
def geoAreaOfPolygon(poly):
polyArea = 0
# Use polygon triangulation to cut the bounding region into a list of triangles, calculate the area of each triangle
lstTriangle = tripy.earclip(poly)
lstArea = []
for i in range(len(lstTriangle)):
lstArea.append(geoAreaOfTriangle(lstTriangle[i][0], lstTriangle[i][1], lstTriangle[i][2]))
|
def geoAreaOfPolygon(poly):
polyArea = 0
# Use polygon triangulation to cut the bounding region into a list of triangles, calculate the area of each triangle
lstTriangle = tripy.earclip(cleanPoly)
lstArea = []
for i in range(len(lstTriangle)):
lstArea.append(geoAreaOfTriangle(lstTriangle[i][0], lstTriangle[i][1], lstTriangle[i][2]))
|
680 |
https://:@github.com/slipguru/adenine.git
|
0ea659ee40e7d0eff55de0da241e5e2566de4a48
|
@@ -380,7 +380,7 @@ def analysis_worker(elem, root, y, feat_names, class_names, lock):
model=voronoi_mdl_obj)
elif hasattr(mdl_obj, 'n_leaves_'):
plotting.tree(root=rootname, data_in=step_in,
- labels=step_out, model=mdl_obj)
+ labels=y, model=mdl_obj)
plotting.dendrogram(root=rootname, data_in=step_in,
labels=y, model=mdl_obj)
|
adenine/core/analyze_results.py
|
ReplaceText(target='y' @(383,37)->(383,45))
|
def analysis_worker(elem, root, y, feat_names, class_names, lock):
model=voronoi_mdl_obj)
elif hasattr(mdl_obj, 'n_leaves_'):
plotting.tree(root=rootname, data_in=step_in,
labels=step_out, model=mdl_obj)
plotting.dendrogram(root=rootname, data_in=step_in,
labels=y, model=mdl_obj)
|
def analysis_worker(elem, root, y, feat_names, class_names, lock):
model=voronoi_mdl_obj)
elif hasattr(mdl_obj, 'n_leaves_'):
plotting.tree(root=rootname, data_in=step_in,
labels=y, model=mdl_obj)
plotting.dendrogram(root=rootname, data_in=step_in,
labels=y, model=mdl_obj)
|
681 |
https://:@github.com/Tenchi2xh/Almonds.git
|
79cd9da8e404df197cbe23586aeacec156080722
|
@@ -135,7 +135,7 @@ class Cursebox(object):
return EVENT_RIGHT
elif ch == 3:
return EVENT_CTRL_C
- elif 0 >= ch < 256:
+ elif 0 <= ch < 256:
return chr(ch)
else:
return EVENT_UNHANDLED
|
almonds/cursebox/cursebox.py
|
ReplaceText(target='<=' @(138,15)->(138,17))
|
class Cursebox(object):
return EVENT_RIGHT
elif ch == 3:
return EVENT_CTRL_C
elif 0 >= ch < 256:
return chr(ch)
else:
return EVENT_UNHANDLED
|
class Cursebox(object):
return EVENT_RIGHT
elif ch == 3:
return EVENT_CTRL_C
elif 0 <= ch < 256:
return chr(ch)
else:
return EVENT_UNHANDLED
|
682 |
https://:@github.com/abrahamrhoffman/anaxdb.git
|
0ff2588e2af89bb06d04834ad6bef887ed5ebb14
|
@@ -263,7 +263,7 @@ class Database(object):
try:
tableFile = (self._path + "/" + aTableName + ".pq")
tableFileEnc = (self._path + "/" + aTableName + ".enc")
- self._decrypt(tableFileEnc)
+ self._decrypt(tableFile)
dataframe = pq.read_table(tableFile).to_pandas()
os.remove(tableFile)
return dataframe
|
anaxdb/anaxdb.py
|
ReplaceText(target='tableFile' @(266,30)->(266,42))
|
class Database(object):
try:
tableFile = (self._path + "/" + aTableName + ".pq")
tableFileEnc = (self._path + "/" + aTableName + ".enc")
self._decrypt(tableFileEnc)
dataframe = pq.read_table(tableFile).to_pandas()
os.remove(tableFile)
return dataframe
|
class Database(object):
try:
tableFile = (self._path + "/" + aTableName + ".pq")
tableFileEnc = (self._path + "/" + aTableName + ".enc")
self._decrypt(tableFile)
dataframe = pq.read_table(tableFile).to_pandas()
os.remove(tableFile)
return dataframe
|
683 |
https://:@github.com/badmetacoder/calculator.git
|
531135ec2a5b354165ad6e6e6b8d2e4d84b8ee38
|
@@ -96,7 +96,7 @@ class SimpleCalculator():
elif self.op == '+':
self.r1 = self.r1 + self.r2
elif self.op == '-':
- self.r1 = self.r1 + self.r2
+ self.r1 = self.r1 - self.r2
elif self.op == '*':
self.r1 = self.r1 * self.r2
elif self.op == '/':
|
calculator/simple.py
|
ReplaceText(target='-' @(99,34)->(99,35))
|
class SimpleCalculator():
elif self.op == '+':
self.r1 = self.r1 + self.r2
elif self.op == '-':
self.r1 = self.r1 + self.r2
elif self.op == '*':
self.r1 = self.r1 * self.r2
elif self.op == '/':
|
class SimpleCalculator():
elif self.op == '+':
self.r1 = self.r1 + self.r2
elif self.op == '-':
self.r1 = self.r1 - self.r2
elif self.op == '*':
self.r1 = self.r1 * self.r2
elif self.op == '/':
|
684 |
https://:@github.com/mhantke/h5writer.git
|
b70deaa06e1b8043aa658410e6ffe2310f796c35
|
@@ -150,7 +150,7 @@ class H5WriterMPI(AbstractH5Writer):
def _write_solocache_group_to_file(self, data_dict, group_prefix="/"):
if self._is_master() and group_prefix != "/":
- if group_prefix in self._f:
+ if group_prefix not in self._f:
self._f.create_group(group_prefix)
keys = data_dict.keys()
keys.sort()
|
src/h5writer_mpi.py
|
ReplaceText(target=' not in ' @(153,27)->(153,31))
|
class H5WriterMPI(AbstractH5Writer):
def _write_solocache_group_to_file(self, data_dict, group_prefix="/"):
if self._is_master() and group_prefix != "/":
if group_prefix in self._f:
self._f.create_group(group_prefix)
keys = data_dict.keys()
keys.sort()
|
class H5WriterMPI(AbstractH5Writer):
def _write_solocache_group_to_file(self, data_dict, group_prefix="/"):
if self._is_master() and group_prefix != "/":
if group_prefix not in self._f:
self._f.create_group(group_prefix)
keys = data_dict.keys()
keys.sort()
|
685 |
https://:@github.com/MushroomRL/mushroom-rl.git
|
21a7d99f2c2f28a1de150b3464c7b649b096d757
|
@@ -6,7 +6,7 @@ class EpsGreedy(object):
self._epsilon = epsilon
def __call__(self):
- if np.random.uniform() > self._epsilon:
+ if np.random.uniform() < self._epsilon:
return False
return True
|
PyPi/policy/policy.py
|
ReplaceText(target='<' @(9,31)->(9,32))
|
class EpsGreedy(object):
self._epsilon = epsilon
def __call__(self):
if np.random.uniform() > self._epsilon:
return False
return True
|
class EpsGreedy(object):
self._epsilon = epsilon
def __call__(self):
if np.random.uniform() < self._epsilon:
return False
return True
|
686 |
https://:@github.com/MushroomRL/mushroom-rl.git
|
86fae8d69f4906e0e395163d1b2fa43371d28deb
|
@@ -103,7 +103,7 @@ class Algorithm(object):
if render:
self.mdp._render()
- last = 0 if n_steps < self.mdp.horizon or not absorbing else 1
+ last = 0 if n_steps < self.mdp.horizon and not absorbing else 1
sample = self.state.ravel().tolist() + action.ravel().tolist() + \
[reward] + next_state.ravel().tolist() + \
[absorbing, last]
|
PyPi/algorithms/algorithm.py
|
ReplaceText(target='and' @(106,51)->(106,53))
|
class Algorithm(object):
if render:
self.mdp._render()
last = 0 if n_steps < self.mdp.horizon or not absorbing else 1
sample = self.state.ravel().tolist() + action.ravel().tolist() + \
[reward] + next_state.ravel().tolist() + \
[absorbing, last]
|
class Algorithm(object):
if render:
self.mdp._render()
last = 0 if n_steps < self.mdp.horizon and not absorbing else 1
sample = self.state.ravel().tolist() + action.ravel().tolist() + \
[reward] + next_state.ravel().tolist() + \
[absorbing, last]
|
687 |
https://:@github.com/MushroomRL/mushroom-rl.git
|
2f134a73ac9cdab98206afeab6cd39bb02b6a6fc
|
@@ -113,7 +113,7 @@ class Core(object):
action_idx = self.agent.draw_action(self.state,
self.agent.approximator)
action_value = self.mdp.action_space.get_value(action_idx)
- next_state, reward, absorbing, _ = self.mdp.step(action_idx)
+ next_state, reward, absorbing, _ = self.mdp.step(action_value)
J += self.mdp.gamma ** n_steps * reward
n_steps += 1
|
PyPi/core/core.py
|
ReplaceText(target='action_value' @(116,61)->(116,71))
|
class Core(object):
action_idx = self.agent.draw_action(self.state,
self.agent.approximator)
action_value = self.mdp.action_space.get_value(action_idx)
next_state, reward, absorbing, _ = self.mdp.step(action_idx)
J += self.mdp.gamma ** n_steps * reward
n_steps += 1
|
class Core(object):
action_idx = self.agent.draw_action(self.state,
self.agent.approximator)
action_value = self.mdp.action_space.get_value(action_idx)
next_state, reward, absorbing, _ = self.mdp.step(action_value)
J += self.mdp.gamma ** n_steps * reward
n_steps += 1
|
688 |
https://:@github.com/MushroomRL/mushroom-rl.git
|
a38031ed8b004f73983b53919acfd4c36e1f2bf1
|
@@ -75,4 +75,4 @@ class Binarizer(Preprocessor):
The binarized input data array.
"""
- return (x > self._threshold).astype(np.float)
+ return (x >= self._threshold).astype(np.float)
|
mushroom/utils/preprocessor.py
|
ReplaceText(target='>=' @(78,18)->(78,19))
|
class Binarizer(Preprocessor):
The binarized input data array.
"""
return (x > self._threshold).astype(np.float)
|
class Binarizer(Preprocessor):
The binarized input data array.
"""
return (x >= self._threshold).astype(np.float)
|
689 |
https://:@github.com/MushroomRL/mushroom-rl.git
|
bcf82aaeed185c53d3f512491f80ec793e264bab
|
@@ -237,7 +237,7 @@ class RDQN(DQN):
state, action, _, _, absorbing, _ =\
self._replay_memory.get_idxs(idxs)
- no_abs_idxs = idxs[np.argwhere(absorbing != 0).ravel()]
+ no_abs_idxs = idxs[np.argwhere(absorbing == 0).ravel()]
state, action, _, _, absorbing, _ =\
self._replay_memory.get_idxs(no_abs_idxs)
next_state, next_action, next_reward, _, next_absorbing, _ =\
|
mushroom/algorithms/dqn.py
|
ReplaceText(target='==' @(240,53)->(240,55))
|
class RDQN(DQN):
state, action, _, _, absorbing, _ =\
self._replay_memory.get_idxs(idxs)
no_abs_idxs = idxs[np.argwhere(absorbing != 0).ravel()]
state, action, _, _, absorbing, _ =\
self._replay_memory.get_idxs(no_abs_idxs)
next_state, next_action, next_reward, _, next_absorbing, _ =\
|
class RDQN(DQN):
state, action, _, _, absorbing, _ =\
self._replay_memory.get_idxs(idxs)
no_abs_idxs = idxs[np.argwhere(absorbing == 0).ravel()]
state, action, _, _, absorbing, _ =\
self._replay_memory.get_idxs(no_abs_idxs)
next_state, next_action, next_reward, _, next_absorbing, _ =\
|
690 |
https://:@github.com/MushroomRL/mushroom-rl.git
|
d4ec7569d1f7409b05754abe8a11a69f016efd01
|
@@ -258,7 +258,7 @@ class SARSALambdaDiscrete(TD):
for s in self.mdp_info.observation_space.values:
for a in self.mdp_info.action_space.values:
self.Q[s, a] += self.alpha(s, a) * delta * self.e[s, a]
- self.e[s, a] = self.mdp_info.gamma * self._lambda
+ self.e[s, a] *= self.mdp_info.gamma * self._lambda
class SARSALambdaContinuous(TD):
|
mushroom/algorithms/value/td.py
|
ReplaceText(target='*=' @(261,29)->(261,30))
|
class SARSALambdaDiscrete(TD):
for s in self.mdp_info.observation_space.values:
for a in self.mdp_info.action_space.values:
self.Q[s, a] += self.alpha(s, a) * delta * self.e[s, a]
self.e[s, a] = self.mdp_info.gamma * self._lambda
class SARSALambdaContinuous(TD):
|
class SARSALambdaDiscrete(TD):
for s in self.mdp_info.observation_space.values:
for a in self.mdp_info.action_space.values:
self.Q[s, a] += self.alpha(s, a) * delta * self.e[s, a]
self.e[s, a] *= self.mdp_info.gamma * self._lambda
class SARSALambdaContinuous(TD):
|
691 |
https://:@github.com/MushroomRL/mushroom-rl.git
|
809c24e9b50202c6c06fbe6fc7e4b067894230c4
|
@@ -161,7 +161,7 @@ class DoubleFQI(FQI):
next_state = list()
absorbing = list()
- half = len(x) / 2
+ half = len(x) // 2
for i in range(2):
s, a, r, ss, ab, _ = parse_dataset(x[i * half:(i + 1) * half])
state.append(s)
|
mushroom/algorithms/value/batch_td.py
|
ReplaceText(target='//' @(164,22)->(164,23))
|
class DoubleFQI(FQI):
next_state = list()
absorbing = list()
half = len(x) / 2
for i in range(2):
s, a, r, ss, ab, _ = parse_dataset(x[i * half:(i + 1) * half])
state.append(s)
|
class DoubleFQI(FQI):
next_state = list()
absorbing = list()
half = len(x) // 2
for i in range(2):
s, a, r, ss, ab, _ = parse_dataset(x[i * half:(i + 1) * half])
state.append(s)
|
692 |
https://:@github.com/MushroomRL/mushroom-rl.git
|
809c24e9b50202c6c06fbe6fc7e4b067894230c4
|
@@ -186,7 +186,7 @@ class AveragedDQN(DQN):
assert isinstance(self.target_approximator.model, Ensemble)
def _update_target(self):
- idx = self._n_updates / self._target_update_frequency\
+ idx = self._n_updates // self._target_update_frequency\
% self._n_approximators
self.target_approximator.model[idx].set_weights(
self.approximator.model.get_weights())
|
mushroom/algorithms/value/dqn.py
|
ReplaceText(target='//' @(189,30)->(189,31))
|
class AveragedDQN(DQN):
assert isinstance(self.target_approximator.model, Ensemble)
def _update_target(self):
idx = self._n_updates / self._target_update_frequency\
% self._n_approximators
self.target_approximator.model[idx].set_weights(
self.approximator.model.get_weights())
|
class AveragedDQN(DQN):
assert isinstance(self.target_approximator.model, Ensemble)
def _update_target(self):
idx = self._n_updates // self._target_update_frequency\
% self._n_approximators
self.target_approximator.model[idx].set_weights(
self.approximator.model.get_weights())
|
693 |
https://:@github.com/MushroomRL/mushroom-rl.git
|
809c24e9b50202c6c06fbe6fc7e4b067894230c4
|
@@ -108,7 +108,7 @@ def compute_probabilities(grid_map, cell_list, passenger_list, prob):
passenger_states = cartesian([[0, 1]] * len(passenger_list))
for i in range(n_states):
- idx = i / len(cell_list)
+ idx = i // len(cell_list)
collected_passengers = np.array(
passenger_list)[np.argwhere(passenger_states[idx] == 1).ravel()]
state = c[i % len(cell_list)]
|
mushroom/environments/generators/taxi.py
|
ReplaceText(target='//' @(111,16)->(111,17))
|
def compute_probabilities(grid_map, cell_list, passenger_list, prob):
passenger_states = cartesian([[0, 1]] * len(passenger_list))
for i in range(n_states):
idx = i / len(cell_list)
collected_passengers = np.array(
passenger_list)[np.argwhere(passenger_states[idx] == 1).ravel()]
state = c[i % len(cell_list)]
|
def compute_probabilities(grid_map, cell_list, passenger_list, prob):
passenger_states = cartesian([[0, 1]] * len(passenger_list))
for i in range(n_states):
idx = i // len(cell_list)
collected_passengers = np.array(
passenger_list)[np.argwhere(passenger_states[idx] == 1).ravel()]
state = c[i % len(cell_list)]
|
694 |
https://:@github.com/MushroomRL/mushroom-rl.git
|
809c24e9b50202c6c06fbe6fc7e4b067894230c4
|
@@ -54,7 +54,7 @@ class AbstractGridWorld(Environment):
@staticmethod
def convert_to_grid(state, width):
- return np.array([state[0] / width, state[0] % width])
+ return np.array([state[0] // width, state[0] % width])
@staticmethod
def convert_to_int(state, width):
|
mushroom/environments/grid_world.py
|
ReplaceText(target='//' @(57,34)->(57,35))
|
class AbstractGridWorld(Environment):
@staticmethod
def convert_to_grid(state, width):
return np.array([state[0] / width, state[0] % width])
@staticmethod
def convert_to_int(state, width):
|
class AbstractGridWorld(Environment):
@staticmethod
def convert_to_grid(state, width):
return np.array([state[0] // width, state[0] % width])
@staticmethod
def convert_to_int(state, width):
|
695 |
https://:@github.com/MushroomRL/mushroom-rl.git
|
809c24e9b50202c6c06fbe6fc7e4b067894230c4
|
@@ -90,7 +90,7 @@ def experiment(alg):
# evaluate initial policy
pi.set_epsilon(epsilon_test)
mdp.set_episode_end(ends_at_life=False)
- for n_epoch in range(1, max_steps / evaluation_frequency + 1):
+ for n_epoch in range(1, max_steps // evaluation_frequency + 1):
# learning step
pi.set_epsilon(epsilon)
mdp.set_episode_end(ends_at_life=True)
|
tests/atari_dqn/atari_dqn.py
|
ReplaceText(target='//' @(93,38)->(93,39))
|
def experiment(alg):
# evaluate initial policy
pi.set_epsilon(epsilon_test)
mdp.set_episode_end(ends_at_life=False)
for n_epoch in range(1, max_steps / evaluation_frequency + 1):
# learning step
pi.set_epsilon(epsilon)
mdp.set_episode_end(ends_at_life=True)
|
def experiment(alg):
# evaluate initial policy
pi.set_epsilon(epsilon_test)
mdp.set_episode_end(ends_at_life=False)
for n_epoch in range(1, max_steps // evaluation_frequency + 1):
# learning step
pi.set_epsilon(epsilon)
mdp.set_episode_end(ends_at_life=True)
|
696 |
https://:@github.com/MushroomRL/mushroom-rl.git
|
a3695d7feb30d5fbb277fb1e8a7e3711d84545a2
|
@@ -294,7 +294,7 @@ def experiment():
agent.policy.set_q(agent.approximator)
np.save(folder_name + '/scores.npy', scores)
- for n_epoch in range(1, max_steps / evaluation_frequency + 1):
+ for n_epoch in range(1, max_steps // evaluation_frequency + 1):
print_epoch(n_epoch)
print('- Learning:')
# learning step
|
examples/atari_dqn/atari_dqn.py
|
ReplaceText(target='//' @(297,42)->(297,43))
|
def experiment():
agent.policy.set_q(agent.approximator)
np.save(folder_name + '/scores.npy', scores)
for n_epoch in range(1, max_steps / evaluation_frequency + 1):
print_epoch(n_epoch)
print('- Learning:')
# learning step
|
def experiment():
agent.policy.set_q(agent.approximator)
np.save(folder_name + '/scores.npy', scores)
for n_epoch in range(1, max_steps // evaluation_frequency + 1):
print_epoch(n_epoch)
print('- Learning:')
# learning step
|
697 |
https://:@github.com/MushroomRL/mushroom-rl.git
|
238a6a652a8ce6c7fb23eba48dd52a2bce343b92
|
@@ -51,7 +51,7 @@ class DQN(Agent):
self._batch_size = batch_size
self._n_approximators = n_approximators
self._clip_reward = clip_reward
- self._target_update_frequency = target_update_frequency / train_frequency
+ self._target_update_frequency = target_update_frequency // train_frequency
self._max_no_op_actions = max_no_op_actions
self._no_op_action_value = no_op_action_value
|
mushroom/algorithms/value/dqn.py
|
ReplaceText(target='//' @(54,64)->(54,65))
|
class DQN(Agent):
self._batch_size = batch_size
self._n_approximators = n_approximators
self._clip_reward = clip_reward
self._target_update_frequency = target_update_frequency / train_frequency
self._max_no_op_actions = max_no_op_actions
self._no_op_action_value = no_op_action_value
|
class DQN(Agent):
self._batch_size = batch_size
self._n_approximators = n_approximators
self._clip_reward = clip_reward
self._target_update_frequency = target_update_frequency // train_frequency
self._max_no_op_actions = max_no_op_actions
self._no_op_action_value = no_op_action_value
|
698 |
https://:@github.com/MushroomRL/mushroom-rl.git
|
bdd275227ed4e37833414e33176bbe0585f02a8b
|
@@ -180,7 +180,7 @@ class InvertedPendulumDiscrete(Environment):
u = 0.
else:
u = self._max_u
- action += np.random.uniform(-self._noise_u, self._noise_u)
+ u += np.random.uniform(-self._noise_u, self._noise_u)
new_state = odeint(self._dynamics, self._state, [0, self._dt],
(u,))
|
mushroom/environments/inverted_pendulum.py
|
ReplaceText(target='u' @(183,8)->(183,14))
|
class InvertedPendulumDiscrete(Environment):
u = 0.
else:
u = self._max_u
action += np.random.uniform(-self._noise_u, self._noise_u)
new_state = odeint(self._dynamics, self._state, [0, self._dt],
(u,))
|
class InvertedPendulumDiscrete(Environment):
u = 0.
else:
u = self._max_u
u += np.random.uniform(-self._noise_u, self._noise_u)
new_state = odeint(self._dynamics, self._state, [0, self._dt],
(u,))
|
699 |
https://:@github.com/MushroomRL/mushroom-rl.git
|
590aabe042c74f6d6be4b1b821ad35d9ae1a47f7
|
@@ -232,7 +232,7 @@ class ReplayMemory(object):
allows it to be used.
"""
- return self.size > self._initial_size
+ return self.size >= self._initial_size
@property
def size(self):
|
mushroom/utils/replay_memory.py
|
ReplaceText(target='>=' @(235,25)->(235,26))
|
class ReplayMemory(object):
allows it to be used.
"""
return self.size > self._initial_size
@property
def size(self):
|
class ReplayMemory(object):
allows it to be used.
"""
return self.size >= self._initial_size
@property
def size(self):
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.