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
|
---|---|---|---|---|---|---|---|
300 | https://:@github.com/parmed/ParmEd.git | 9eda010f0342ace7a3ccc6452a8c8014c73bd130 | @@ -282,7 +282,7 @@ class AmberFormat(object):
rawdata = self.parm_data[flag]
self.parm_data[flag] = []
for line in rawdata:
- self.parm_data[flag].extend(self.formats[key].read(line))
+ self.parm_data[flag].extend(self.formats[flag].read(line))
try:
for i, chg in enumerate(self.parm_data[self.charge_flag]):
| chemistry/amber/amberformat.py | ReplaceText(target='flag' @(285,61)->(285,64)) | class AmberFormat(object):
rawdata = self.parm_data[flag]
self.parm_data[flag] = []
for line in rawdata:
self.parm_data[flag].extend(self.formats[key].read(line))
try:
for i, chg in enumerate(self.parm_data[self.charge_flag]): | class AmberFormat(object):
rawdata = self.parm_data[flag]
self.parm_data[flag] = []
for line in rawdata:
self.parm_data[flag].extend(self.formats[flag].read(line))
try:
for i, chg in enumerate(self.parm_data[self.charge_flag]): |
301 | https://:@github.com/parmed/ParmEd.git | 9167bf221e4fe5d71ccaa6bf310fce60f09dc873 | @@ -192,7 +192,7 @@ def diff_files(file1, file2, ignore_whitespace=True,
i = 1
same = True
if ignore_whitespace:
- while l1 and l2:
+ while l1 or l2:
if l1.strip() != l2.strip():
if l1.startswith('%VERSION') and l2.startswith('%VERSION'):
l1 = f1.readline()
| test/utils.py | ReplaceText(target='or' @(195,21)->(195,24)) | def diff_files(file1, file2, ignore_whitespace=True,
i = 1
same = True
if ignore_whitespace:
while l1 and l2:
if l1.strip() != l2.strip():
if l1.startswith('%VERSION') and l2.startswith('%VERSION'):
l1 = f1.readline() | def diff_files(file1, file2, ignore_whitespace=True,
i = 1
same = True
if ignore_whitespace:
while l1 or l2:
if l1.strip() != l2.strip():
if l1.startswith('%VERSION') and l2.startswith('%VERSION'):
l1 = f1.readline() |
302 | https://:@github.com/parmed/ParmEd.git | b5fdf3d9b7095b96bcb8ac0bdbdfb3694d1d5220 | @@ -334,7 +334,7 @@ class ChamberParm(AmberParm):
for i, j, k, l, m, n in zip(it, it, it, it, it, it):
self.cmaps.append(
Cmap(self.atoms[i-1], self.atoms[j-1], self.atoms[k-1],
- self.atoms[k-1], self.atoms[m-1], self.cmap_types[n-1])
+ self.atoms[l-1], self.atoms[m-1], self.cmap_types[n-1])
)
#===================================================
| chemistry/amber/_chamberparm.py | ReplaceText(target='l' @(337,36)->(337,37)) | class ChamberParm(AmberParm):
for i, j, k, l, m, n in zip(it, it, it, it, it, it):
self.cmaps.append(
Cmap(self.atoms[i-1], self.atoms[j-1], self.atoms[k-1],
self.atoms[k-1], self.atoms[m-1], self.cmap_types[n-1])
)
#=================================================== | class ChamberParm(AmberParm):
for i, j, k, l, m, n in zip(it, it, it, it, it, it):
self.cmaps.append(
Cmap(self.atoms[i-1], self.atoms[j-1], self.atoms[k-1],
self.atoms[l-1], self.atoms[m-1], self.cmap_types[n-1])
)
#=================================================== |
303 | https://:@github.com/parmed/ParmEd.git | 820a80ccad22ee881042f03b83a0f07b5f1b537d | @@ -1272,7 +1272,7 @@ class Structure(object):
break
elif a2.residue is None:
break
- elif a1.residue.name != a1.residue.name:
+ elif a1.residue.name != a2.residue.name:
break
if not a1.type and not a2.type:
if a1.name != a2.name: break
| chemistry/structure.py | ReplaceText(target='a2' @(1275,48)->(1275,50)) | class Structure(object):
break
elif a2.residue is None:
break
elif a1.residue.name != a1.residue.name:
break
if not a1.type and not a2.type:
if a1.name != a2.name: break | class Structure(object):
break
elif a2.residue is None:
break
elif a1.residue.name != a2.residue.name:
break
if not a1.type and not a2.type:
if a1.name != a2.name: break |
304 | https://:@github.com/parmed/ParmEd.git | 4cba8197ae90a1af4abe0dee3f19e1c8c61c959f | @@ -313,7 +313,7 @@ class Mol2File(object):
if a == '0': continue
for atom in res:
if atom.name == a:
- atom.connections.append(atom)
+ res.connections.append(atom)
break
else:
raise Mol2Error('Residue connection atom %s not '
| parmed/formats/mol2.py | ReplaceText(target='res' @(316,32)->(316,36)) | class Mol2File(object):
if a == '0': continue
for atom in res:
if atom.name == a:
atom.connections.append(atom)
break
else:
raise Mol2Error('Residue connection atom %s not ' | class Mol2File(object):
if a == '0': continue
for atom in res:
if atom.name == a:
res.connections.append(atom)
break
else:
raise Mol2Error('Residue connection atom %s not ' |
305 | https://:@github.com/parmed/ParmEd.git | 9be43ac3521aca71f84de9b2b11740b00dfdb1b6 | @@ -696,6 +696,6 @@ def _set_owner(atoms, owner_array, atm, mol_id):
if not partner.marked:
owner_array.append(partner.idx)
_set_owner(atoms, owner_array, partner.idx, mol_id)
- assert partner.marked != mol_id, 'Atom in multiple molecules!'
+ assert partner.marked == mol_id, 'Atom in multiple molecules!'
# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
| parmed/charmm/psf.py | ReplaceText(target='==' @(699,30)->(699,32)) | def _set_owner(atoms, owner_array, atm, mol_id):
if not partner.marked:
owner_array.append(partner.idx)
_set_owner(atoms, owner_array, partner.idx, mol_id)
assert partner.marked != mol_id, 'Atom in multiple molecules!'
# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | def _set_owner(atoms, owner_array, atm, mol_id):
if not partner.marked:
owner_array.append(partner.idx)
_set_owner(atoms, owner_array, partner.idx, mol_id)
assert partner.marked == mol_id, 'Atom in multiple molecules!'
# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
306 | https://:@github.com/parmed/ParmEd.git | 8f1dc98d485ea57e4046494ad1e6f84cfbd17f4f | @@ -449,7 +449,7 @@ class ParameterSet(object):
for name, residue in iteritems(self.residues):
if isinstance(residue, ResidueTemplateContainer):
for res in residue:
- for atom in residue:
+ for atom in res:
atom.atom_type = self.atom_types[atom.type]
else:
assert isinstance(residue, ResidueTemplate), 'Wrong type!'
| parmed/parameters.py | ReplaceText(target='res' @(452,32)->(452,39)) | class ParameterSet(object):
for name, residue in iteritems(self.residues):
if isinstance(residue, ResidueTemplateContainer):
for res in residue:
for atom in residue:
atom.atom_type = self.atom_types[atom.type]
else:
assert isinstance(residue, ResidueTemplate), 'Wrong type!' | class ParameterSet(object):
for name, residue in iteritems(self.residues):
if isinstance(residue, ResidueTemplateContainer):
for res in residue:
for atom in res:
atom.atom_type = self.atom_types[atom.type]
else:
assert isinstance(residue, ResidueTemplate), 'Wrong type!' |
307 | https://:@github.com/parmed/ParmEd.git | 403c2874c1826cbe182386959a23118b33d1e27c | @@ -219,7 +219,7 @@ class OpenMMParameterSet(ParameterSet):
if tag not in sub_content:
raise KeyError('Content of an attribute-containing element '
'specified incorrectly.')
- attributes = [key for key in content if key != tag]
+ attributes = [key for key in sub_content if key != tag]
element_content = sub_content[tag]
dest.write(' <%s' % tag)
for attribute in attributes:
| parmed/openmm/parameters.py | ReplaceText(target='sub_content' @(222,49)->(222,56)) | class OpenMMParameterSet(ParameterSet):
if tag not in sub_content:
raise KeyError('Content of an attribute-containing element '
'specified incorrectly.')
attributes = [key for key in content if key != tag]
element_content = sub_content[tag]
dest.write(' <%s' % tag)
for attribute in attributes: | class OpenMMParameterSet(ParameterSet):
if tag not in sub_content:
raise KeyError('Content of an attribute-containing element '
'specified incorrectly.')
attributes = [key for key in sub_content if key != tag]
element_content = sub_content[tag]
dest.write(' <%s' % tag)
for attribute in attributes: |
308 | https://:@github.com/parmed/ParmEd.git | 657ba99e2338df75ef118155d95d144c7b33ab32 | @@ -281,7 +281,7 @@ T = RNAResidue('Thymine', 'T', ['THY', 'T3', 'T5', 'TN',
WATER_NAMES = set(['WAT', 'HOH', 'TIP3', 'TIP4',
'TIP5', 'SPCE', 'SPC'])
-SOLVENT_NAMES = WATER_NAMES ^ set({'SOL'})
+SOLVENT_NAMES = WATER_NAMES | set({'SOL'})
EXTRA_POINT_NAMES = set(['EP', 'LP'])
CATION_NAMES = set(['Na+', 'Li+', 'Mg+', 'Rb+', 'MG', 'Cs+', 'POT', 'SOD',
'MG2', 'CAL', 'RUB', 'LIT', 'ZN2', 'CD2', 'NA', 'K+', 'K',
| parmed/residue.py | ReplaceText(target='|' @(284,28)->(284,29)) | T = RNAResidue('Thymine', 'T', ['THY', 'T3', 'T5', 'TN',
WATER_NAMES = set(['WAT', 'HOH', 'TIP3', 'TIP4',
'TIP5', 'SPCE', 'SPC'])
SOLVENT_NAMES = WATER_NAMES ^ set({'SOL'})
EXTRA_POINT_NAMES = set(['EP', 'LP'])
CATION_NAMES = set(['Na+', 'Li+', 'Mg+', 'Rb+', 'MG', 'Cs+', 'POT', 'SOD',
'MG2', 'CAL', 'RUB', 'LIT', 'ZN2', 'CD2', 'NA', 'K+', 'K', | T = RNAResidue('Thymine', 'T', ['THY', 'T3', 'T5', 'TN',
WATER_NAMES = set(['WAT', 'HOH', 'TIP3', 'TIP4',
'TIP5', 'SPCE', 'SPC'])
SOLVENT_NAMES = WATER_NAMES | set({'SOL'})
EXTRA_POINT_NAMES = set(['EP', 'LP'])
CATION_NAMES = set(['Na+', 'Li+', 'Mg+', 'Rb+', 'MG', 'Cs+', 'POT', 'SOD',
'MG2', 'CAL', 'RUB', 'LIT', 'ZN2', 'CD2', 'NA', 'K+', 'K', |
309 | https://:@github.com/parmed/ParmEd.git | bd2a1120adf53ab364dda802a272c19c7d335fdd | @@ -374,7 +374,7 @@ class OpenMMParameterSet(ParameterSet):
for attribute in attributes:
dest.write(' %s="%s"' % (attribute, sub_content[attribute]))
escaped_element_content = escape(element_content, XML_ESCAPES)
- dest.write('>%s</%s>\n' % (element_content, tag))
+ dest.write('>%s</%s>\n' % (escaped_element_content, tag))
else:
raise TypeError('Incorrect type of the %s element content' % tag)
dest.write(' </Info>\n')
| parmed/openmm/parameters.py | ReplaceText(target='escaped_element_content' @(377,47)->(377,62)) | class OpenMMParameterSet(ParameterSet):
for attribute in attributes:
dest.write(' %s="%s"' % (attribute, sub_content[attribute]))
escaped_element_content = escape(element_content, XML_ESCAPES)
dest.write('>%s</%s>\n' % (element_content, tag))
else:
raise TypeError('Incorrect type of the %s element content' % tag)
dest.write(' </Info>\n') | class OpenMMParameterSet(ParameterSet):
for attribute in attributes:
dest.write(' %s="%s"' % (attribute, sub_content[attribute]))
escaped_element_content = escape(element_content, XML_ESCAPES)
dest.write('>%s</%s>\n' % (escaped_element_content, tag))
else:
raise TypeError('Incorrect type of the %s element content' % tag)
dest.write(' </Info>\n') |
310 | https://:@github.com/parmed/ParmEd.git | 62e0c8aa4561628d005e84bbe97b1ef37f32dee5 | @@ -502,7 +502,7 @@ class OpenMMParameterSet(ParameterSet):
patched_residue = residue.apply_patch(patch)
for atom in patch.atoms:
- if atom.name not in patched_residue:
+ if atom.name not in residue:
dest.write(' <AddAtom name="%s" type="%s" charge="%s"/>\n' %
(atom.name, atom.type, atom.charge))
else:
| parmed/openmm/parameters.py | ReplaceText(target='residue' @(505,36)->(505,51)) | class OpenMMParameterSet(ParameterSet):
patched_residue = residue.apply_patch(patch)
for atom in patch.atoms:
if atom.name not in patched_residue:
dest.write(' <AddAtom name="%s" type="%s" charge="%s"/>\n' %
(atom.name, atom.type, atom.charge))
else: | class OpenMMParameterSet(ParameterSet):
patched_residue = residue.apply_patch(patch)
for atom in patch.atoms:
if atom.name not in residue:
dest.write(' <AddAtom name="%s" type="%s" charge="%s"/>\n' %
(atom.name, atom.type, atom.charge))
else: |
311 | https://:@github.com/parmed/ParmEd.git | 90fa4626c3db158047991044f4dd4619a7cc2599 | @@ -502,7 +502,7 @@ class AmberFormat(object):
own_handle = True
elif hasattr(fname, 'read'):
prm = fname
- own_handle = True
+ own_handle = False
else:
raise TypeError('%s must be a file name or file-like object' % fname)
| parmed/amber/amberformat.py | ReplaceText(target='False' @(505,25)->(505,29)) | class AmberFormat(object):
own_handle = True
elif hasattr(fname, 'read'):
prm = fname
own_handle = True
else:
raise TypeError('%s must be a file name or file-like object' % fname)
| class AmberFormat(object):
own_handle = True
elif hasattr(fname, 'read'):
prm = fname
own_handle = False
else:
raise TypeError('%s must be a file name or file-like object' % fname)
|
312 | https://:@github.com/xmunoz/sodapy.git | 76bdcfd9670e94c833b66b8894ea4153c27004ee | @@ -71,7 +71,7 @@ class Socrata(object):
else:
self.uri_prefix = "https://"
- if isinstance(timeout, (int, long, float)):
+ if not isinstance(timeout, (int, long, float)):
raise TypeError("Timeout must be numeric.")
self.timeout = timeout
| sodapy/__init__.py | ReplaceText(target='not ' @(74,11)->(74,11)) | class Socrata(object):
else:
self.uri_prefix = "https://"
if isinstance(timeout, (int, long, float)):
raise TypeError("Timeout must be numeric.")
self.timeout = timeout
| class Socrata(object):
else:
self.uri_prefix = "https://"
if not isinstance(timeout, (int, long, float)):
raise TypeError("Timeout must be numeric.")
self.timeout = timeout
|
313 | https://:@github.com/xmunoz/sodapy.git | be6804a7f566eda08af7bb5d67f9c75512581189 | @@ -129,7 +129,7 @@ class Socrata(object):
next(iter(kwargs)))
if order:
- kwargs.append(('order', order))
+ params.append(('order', order))
results = self._perform_request("get", DATASETS_PATH,
params=params + [('offset', offset)])
| sodapy/__init__.py | ReplaceText(target='params' @(132,12)->(132,18)) | class Socrata(object):
next(iter(kwargs)))
if order:
kwargs.append(('order', order))
results = self._perform_request("get", DATASETS_PATH,
params=params + [('offset', offset)]) | class Socrata(object):
next(iter(kwargs)))
if order:
params.append(('order', order))
results = self._perform_request("get", DATASETS_PATH,
params=params + [('offset', offset)]) |
314 | https://:@github.com/visgence/teleceptor.git | 4a8db10b79207b4bf8b48bbcaafdd03cc1166a2f | @@ -397,7 +397,7 @@ def _updateCalibration(sensor, coefficients, timestamp, session):
logging.debug("Comparing coefficients.")
# check if coefficients are different
- if "{}".format(Cal.coefficients) == "{}".format(coefficients):
+ if "{}".format(Cal.coefficients) != "{}".format(coefficients):
logging.debug("Coefficients are different, updating...")
assert isinstance(coefficients, list)
| teleceptor/api/sensors.py | ReplaceText(target='!=' @(400,49)->(400,51)) | def _updateCalibration(sensor, coefficients, timestamp, session):
logging.debug("Comparing coefficients.")
# check if coefficients are different
if "{}".format(Cal.coefficients) == "{}".format(coefficients):
logging.debug("Coefficients are different, updating...")
assert isinstance(coefficients, list) | def _updateCalibration(sensor, coefficients, timestamp, session):
logging.debug("Comparing coefficients.")
# check if coefficients are different
if "{}".format(Cal.coefficients) != "{}".format(coefficients):
logging.debug("Coefficients are different, updating...")
assert isinstance(coefficients, list) |
315 | https://:@github.com/projectmesa/mesa.git | 0893a8f03d7f22f1b064e66c97da3dddd987b7ea | @@ -50,7 +50,7 @@ class Schelling(Model):
self.homophily = homophily
self.schedule = RandomActivation(self)
- self.grid = SingleGrid(height, width, torus=True)
+ self.grid = SingleGrid(width, height, torus=True)
self.happy = 0
self.datacollector = DataCollector(
| examples/schelling/model.py | ArgSwap(idxs=0<->1 @(53,20)->(53,30)) | class Schelling(Model):
self.homophily = homophily
self.schedule = RandomActivation(self)
self.grid = SingleGrid(height, width, torus=True)
self.happy = 0
self.datacollector = DataCollector( | class Schelling(Model):
self.homophily = homophily
self.schedule = RandomActivation(self)
self.grid = SingleGrid(width, height, torus=True)
self.happy = 0
self.datacollector = DataCollector( |
316 | https://:@github.com/projectmesa/mesa.git | 9277b0f55ed63d3b8a32c7f3e52e3df1e7de6579 | @@ -31,7 +31,7 @@ class PdGrid(Model):
Determines the agent activation regime.
payoffs: (optional) Dictionary of (move, neighbor_move) payoffs.
'''
- self.grid = SingleGrid(height, width, torus=True)
+ self.grid = SingleGrid(width, height, torus=True)
self.schedule_type = schedule_type
self.schedule = self.schedule_types[self.schedule_type](self)
| examples/pd_grid/pd_grid/model.py | ArgSwap(idxs=0<->1 @(34,20)->(34,30)) | class PdGrid(Model):
Determines the agent activation regime.
payoffs: (optional) Dictionary of (move, neighbor_move) payoffs.
'''
self.grid = SingleGrid(height, width, torus=True)
self.schedule_type = schedule_type
self.schedule = self.schedule_types[self.schedule_type](self)
| class PdGrid(Model):
Determines the agent activation regime.
payoffs: (optional) Dictionary of (move, neighbor_move) payoffs.
'''
self.grid = SingleGrid(width, height, torus=True)
self.schedule_type = schedule_type
self.schedule = self.schedule_types[self.schedule_type](self)
|
317 | https://:@github.com/iCHEF/queryfilter.git | 96c25a4e5e750ae3415712d6812eee04d2187e64 | @@ -70,7 +70,7 @@ class DictFilterMixin(object):
if not dictobj:
# Point to which level doesn't exist exactly
return handle_missing_field(
- "__".join(level_field_names[:index+1])
+ "__".join(parent_field_names[:index+1])
)
if final_field_name not in dictobj:
return handle_missing_field(field_name)
| queryfilter/base.py | ReplaceText(target='parent_field_names' @(73,30)->(73,47)) | class DictFilterMixin(object):
if not dictobj:
# Point to which level doesn't exist exactly
return handle_missing_field(
"__".join(level_field_names[:index+1])
)
if final_field_name not in dictobj:
return handle_missing_field(field_name) | class DictFilterMixin(object):
if not dictobj:
# Point to which level doesn't exist exactly
return handle_missing_field(
"__".join(parent_field_names[:index+1])
)
if final_field_name not in dictobj:
return handle_missing_field(field_name) |
318 | https://:@github.com/slaclab/paws.git | 953037e723903e2213495189c9a99eb5445ecc9a | @@ -293,7 +293,7 @@ class XRSDFitGUI(Operation):
ubnd = xrsdkit.param_bound_defaults[param_nm][1]
if xrsdkit.contains_param(self.inputs['param_bounds'],pop_nm,param_nm):
lbnd = self.inputs['param_bounds'][pop_nm]['parameters'][param_nm][0]
- lbnd = self.inputs['param_bounds'][pop_nm]['parameters'][param_nm][1]
+ ubnd = self.inputs['param_bounds'][pop_nm]['parameters'][param_nm][1]
# TODO: the bounds entries need to be connected to DoubleVars.
pbnde1.insert(0,str(lbnd))
pbnde2.insert(0,str(ubnd))
| paws/core/operations/PROCESSING/FITTING/XRSDFitGUI.py | ReplaceText(target='ubnd' @(296,16)->(296,20)) | class XRSDFitGUI(Operation):
ubnd = xrsdkit.param_bound_defaults[param_nm][1]
if xrsdkit.contains_param(self.inputs['param_bounds'],pop_nm,param_nm):
lbnd = self.inputs['param_bounds'][pop_nm]['parameters'][param_nm][0]
lbnd = self.inputs['param_bounds'][pop_nm]['parameters'][param_nm][1]
# TODO: the bounds entries need to be connected to DoubleVars.
pbnde1.insert(0,str(lbnd))
pbnde2.insert(0,str(ubnd)) | class XRSDFitGUI(Operation):
ubnd = xrsdkit.param_bound_defaults[param_nm][1]
if xrsdkit.contains_param(self.inputs['param_bounds'],pop_nm,param_nm):
lbnd = self.inputs['param_bounds'][pop_nm]['parameters'][param_nm][0]
ubnd = self.inputs['param_bounds'][pop_nm]['parameters'][param_nm][1]
# TODO: the bounds entries need to be connected to DoubleVars.
pbnde1.insert(0,str(lbnd))
pbnde2.insert(0,str(ubnd)) |
319 | https://:@github.com/PyFilesystem/pyfilesystem2.git | cd1a973dd80e4083502db51844981f3457d13760 | @@ -258,7 +258,7 @@ class OSFS(FS):
with convert_os_errors("getinfo", path):
_stat = os.stat(fsencode(sys_path))
if "lstat" in namespaces:
- _stat = os.lstat(fsencode(sys_path))
+ _lstat = os.lstat(fsencode(sys_path))
info = {
"basic": {"name": basename(_path), "is_dir": stat.S_ISDIR(_stat.st_mode)}
| fs/osfs.py | ReplaceText(target='_lstat' @(261,16)->(261,21)) | class OSFS(FS):
with convert_os_errors("getinfo", path):
_stat = os.stat(fsencode(sys_path))
if "lstat" in namespaces:
_stat = os.lstat(fsencode(sys_path))
info = {
"basic": {"name": basename(_path), "is_dir": stat.S_ISDIR(_stat.st_mode)} | class OSFS(FS):
with convert_os_errors("getinfo", path):
_stat = os.stat(fsencode(sys_path))
if "lstat" in namespaces:
_lstat = os.lstat(fsencode(sys_path))
info = {
"basic": {"name": basename(_path), "is_dir": stat.S_ISDIR(_stat.st_mode)} |
320 | https://:@github.com/kevinzg/facebook-scraper.git | c11dffbc1beef25271fb5bc6d2aa3aeb5b2079aa | @@ -83,7 +83,7 @@ def _get_posts(path, pages=10, timeout=5, sleep=0, credentials=None, extra_info=
yield post
pages -= 1
- if pages == 0:
+ if pages <= 0:
return
cursor = _find_cursor(cursor_blob)
| facebook_scraper.py | ReplaceText(target='<=' @(86,17)->(86,19)) | def _get_posts(path, pages=10, timeout=5, sleep=0, credentials=None, extra_info=
yield post
pages -= 1
if pages == 0:
return
cursor = _find_cursor(cursor_blob) | def _get_posts(path, pages=10, timeout=5, sleep=0, credentials=None, extra_info=
yield post
pages -= 1
if pages <= 0:
return
cursor = _find_cursor(cursor_blob) |
321 | https://:@github.com/linkedin/naarad.git | 897858ba0d80fb74bbad40bfc8f96b0f59b0900e | @@ -75,10 +75,10 @@ class Report(object):
for metric in self.metric_list:
metric_stats = []
metric_stats_file, summary_stats, metric_plots, correlated_plots = self.discover_metric_data(self.output_directory, metric)
- if metric_stats_file != '' and len(metric_plots) > 0:
+ if metric_stats_file != '' or len(metric_plots) > 0:
metric_stats = self.get_summary_table(metric_stats_file)
metric_html = template_environment.get_template(self.report_templates['header']).render(custom_javascript_includes=["http://www.kryogenix.org/code/browser/sorttable/sorttable.js"])
metric_html += template_environment.get_template(self.report_templates['metric']).render(metric_stats=metric_stats, metric_plots=metric_plots, correlated_plots=correlated_plots, metric=metric)
metric_html += template_environment.get_template(self.report_templates['footer']).render()
- with open(os.path.join(self.output_directory, metric + '_report.html'),'w') as metric_report:
+ with open(os.path.join(self.output_directory, metric + '_report.html'), 'w') as metric_report:
metric_report.write(metric_html)
| src/naarad/reporting/report.py | ReplaceText(target='or' @(78,33)->(78,36)) | class Report(object):
for metric in self.metric_list:
metric_stats = []
metric_stats_file, summary_stats, metric_plots, correlated_plots = self.discover_metric_data(self.output_directory, metric)
if metric_stats_file != '' and len(metric_plots) > 0:
metric_stats = self.get_summary_table(metric_stats_file)
metric_html = template_environment.get_template(self.report_templates['header']).render(custom_javascript_includes=["http://www.kryogenix.org/code/browser/sorttable/sorttable.js"])
metric_html += template_environment.get_template(self.report_templates['metric']).render(metric_stats=metric_stats, metric_plots=metric_plots, correlated_plots=correlated_plots, metric=metric)
metric_html += template_environment.get_template(self.report_templates['footer']).render()
with open(os.path.join(self.output_directory, metric + '_report.html'),'w') as metric_report:
metric_report.write(metric_html) | class Report(object):
for metric in self.metric_list:
metric_stats = []
metric_stats_file, summary_stats, metric_plots, correlated_plots = self.discover_metric_data(self.output_directory, metric)
if metric_stats_file != '' or len(metric_plots) > 0:
metric_stats = self.get_summary_table(metric_stats_file)
metric_html = template_environment.get_template(self.report_templates['header']).render(custom_javascript_includes=["http://www.kryogenix.org/code/browser/sorttable/sorttable.js"])
metric_html += template_environment.get_template(self.report_templates['metric']).render(metric_stats=metric_stats, metric_plots=metric_plots, correlated_plots=correlated_plots, metric=metric)
metric_html += template_environment.get_template(self.report_templates['footer']).render()
with open(os.path.join(self.output_directory, metric + '_report.html'), 'w') as metric_report:
metric_report.write(metric_html) |
322 | https://:@github.com/linkedin/naarad.git | 74c5928b9c26fb7bd708fb9480dd2014b4305b89 | @@ -67,7 +67,7 @@ def graph_data(list_of_plots, output_directory, output_filename):
plot_count = len(plots)
if plot_count == 0:
- return True, None
+ return False, None
graph_height, graph_width, graph_title = get_graph_metadata(list_of_plots)
| src/naarad/graphing/matplotlib_naarad.py | ReplaceText(target='False' @(70,11)->(70,15)) | def graph_data(list_of_plots, output_directory, output_filename):
plot_count = len(plots)
if plot_count == 0:
return True, None
graph_height, graph_width, graph_title = get_graph_metadata(list_of_plots)
| def graph_data(list_of_plots, output_directory, output_filename):
plot_count = len(plots)
if plot_count == 0:
return False, None
graph_height, graph_width, graph_title = get_graph_metadata(list_of_plots)
|
323 | https://:@github.com/linkedin/naarad.git | fa8753e74e301602fd50281ef36bc13cde421ac2 | @@ -204,7 +204,7 @@ class Metric(object):
if i+1 in groupby_idxes:
continue
else:
- out_csv = self.get_csv(groupby_names, self.columns[i])
+ out_csv = self.get_csv(self.columns[i], groupby_names)
if out_csv in data:
data[out_csv].append(ts + ',' + words[i+1])
else:
| src/naarad/metrics/metric.py | ArgSwap(idxs=0<->1 @(207,26)->(207,38)) | class Metric(object):
if i+1 in groupby_idxes:
continue
else:
out_csv = self.get_csv(groupby_names, self.columns[i])
if out_csv in data:
data[out_csv].append(ts + ',' + words[i+1])
else: | class Metric(object):
if i+1 in groupby_idxes:
continue
else:
out_csv = self.get_csv(self.columns[i], groupby_names)
if out_csv in data:
data[out_csv].append(ts + ',' + words[i+1])
else: |
324 | https://:@gitlab.com/mailman/postorius.git | 308434aa505637da8275150484943b2442bc4b3c | @@ -232,6 +232,6 @@ class ListMembersTest(ViewTestCase):
{'q': 'not_a_member'})
self.assertEqual(response.status_code, 200)
self.assertEqual(len(response.context['members']), 0)
- self.assertNotContains(response, member_2.email)
+ self.assertNotContains(response, member_1.email)
self.assertNotContains(response, member_2.email)
| src/postorius/tests/mailman_api_tests/test_list_members.py | ReplaceText(target='member_1' @(235,41)->(235,49)) | class ListMembersTest(ViewTestCase):
{'q': 'not_a_member'})
self.assertEqual(response.status_code, 200)
self.assertEqual(len(response.context['members']), 0)
self.assertNotContains(response, member_2.email)
self.assertNotContains(response, member_2.email)
| class ListMembersTest(ViewTestCase):
{'q': 'not_a_member'})
self.assertEqual(response.status_code, 200)
self.assertEqual(len(response.context['members']), 0)
self.assertNotContains(response, member_1.email)
self.assertNotContains(response, member_2.email)
|
325 | https://:@github.com/crsmithdev/arrow.git | fa5bce04765198071c17fa2ee889c16b5dbe6377 | @@ -94,7 +94,7 @@ class DateTimeFormatter(object):
tz = dateutil_tz.tzutc() if dt.tzinfo is None else dt.tzinfo
total_minutes = int(util.total_seconds(tz.utcoffset(dt)) / 60)
- sign = '+' if total_minutes > 0 else '-'
+ sign = '+' if total_minutes >= 0 else '-'
total_minutes = abs(total_minutes)
hour, minute = divmod(total_minutes, 60)
| arrow/formatter.py | ReplaceText(target='>=' @(97,40)->(97,41)) | class DateTimeFormatter(object):
tz = dateutil_tz.tzutc() if dt.tzinfo is None else dt.tzinfo
total_minutes = int(util.total_seconds(tz.utcoffset(dt)) / 60)
sign = '+' if total_minutes > 0 else '-'
total_minutes = abs(total_minutes)
hour, minute = divmod(total_minutes, 60)
| class DateTimeFormatter(object):
tz = dateutil_tz.tzutc() if dt.tzinfo is None else dt.tzinfo
total_minutes = int(util.total_seconds(tz.utcoffset(dt)) / 60)
sign = '+' if total_minutes >= 0 else '-'
total_minutes = abs(total_minutes)
hour, minute = divmod(total_minutes, 60)
|
326 | https://:@github.com/AICoE/log-anomaly-detector.git | cd462c169c77152ae10cf3b0b99adfa51d53c043 | @@ -37,4 +37,4 @@ class SOMPYModel(BaseModel):
dist = np.linalg.norm(self.model[x][y] - log)
if dist < dist_smallest:
dist_smallest = dist
- return dist
+ return dist_smallest
| anomaly_detector/model/sompy_model.py | ReplaceText(target='dist_smallest' @(40,15)->(40,19)) | class SOMPYModel(BaseModel):
dist = np.linalg.norm(self.model[x][y] - log)
if dist < dist_smallest:
dist_smallest = dist
return dist | class SOMPYModel(BaseModel):
dist = np.linalg.norm(self.model[x][y] - log)
if dist < dist_smallest:
dist_smallest = dist
return dist_smallest |
327 | https://:@github.com/ksmet1977/luxpy.git | 6b6e6f7dd1dd257c8394dcd439f2bbb39be46fef | @@ -896,7 +896,7 @@ def plot_spectrum_colors(spd = None, spdmax = None,\
cmfs = _CMF[cieobs]['bar']
else:
cmfs = cieobs
- cmfs = cmfs[:,cmfs[1:].sum(axis=1)>0] # avoid div by zero in xyz-to-Yxy conversion
+ cmfs = cmfs[:,cmfs[1:].sum(axis=0)>0] # avoid div by zero in xyz-to-Yxy conversion
wavs = cmfs[0:1].T
SL = cmfs[1:4].T
| luxpy/color/utils/plotters.py | ReplaceText(target='0' @(899,36)->(899,37)) | def plot_spectrum_colors(spd = None, spdmax = None,\
cmfs = _CMF[cieobs]['bar']
else:
cmfs = cieobs
cmfs = cmfs[:,cmfs[1:].sum(axis=1)>0] # avoid div by zero in xyz-to-Yxy conversion
wavs = cmfs[0:1].T
SL = cmfs[1:4].T | def plot_spectrum_colors(spd = None, spdmax = None,\
cmfs = _CMF[cieobs]['bar']
else:
cmfs = cieobs
cmfs = cmfs[:,cmfs[1:].sum(axis=0)>0] # avoid div by zero in xyz-to-Yxy conversion
wavs = cmfs[0:1].T
SL = cmfs[1:4].T |
328 | https://:@github.com/melexis/sphinx-traceability-extension.git | 64a00adbbbec4088a6e0bb88b1ed43e26c2776bd | @@ -760,7 +760,7 @@ def process_item_nodes(app, doctree, fromdocname):
for source in node['sources']:
for target in node['targets']:
try:
- env.traceability_collection.add_relation(target, node['type'], source)
+ env.traceability_collection.add_relation(source, node['type'], target)
except TraceabilityException as err:
report_warning(env, err, env.docname, self.lineno)
# The ItemLink node has no final representation, so is removed from the tree
| mlx/traceability.py | ArgSwap(idxs=0<->2 @(763,20)->(763,60)) | def process_item_nodes(app, doctree, fromdocname):
for source in node['sources']:
for target in node['targets']:
try:
env.traceability_collection.add_relation(target, node['type'], source)
except TraceabilityException as err:
report_warning(env, err, env.docname, self.lineno)
# The ItemLink node has no final representation, so is removed from the tree | def process_item_nodes(app, doctree, fromdocname):
for source in node['sources']:
for target in node['targets']:
try:
env.traceability_collection.add_relation(source, node['type'], target)
except TraceabilityException as err:
report_warning(env, err, env.docname, self.lineno)
# The ItemLink node has no final representation, so is removed from the tree |
329 | https://:@github.com/rocky/python3-trepan.git | 2ff3e8439122926251ef9e7e4b7b89018feb9892 | @@ -47,7 +47,7 @@ and recolor all source code output."""
pass
def run(self, args):
- if len(args) >= 1 and 'reset' == args[0]:
+ if len(args) > 1 and 'reset' == args[0]:
highlight_type = self.get_highlight_type(args[1])
if not highlight_type: return
clear_file_format_cache()
| trepan/processor/command/set_subcmd/highlight.py | ReplaceText(target='>' @(50,21)->(50,23)) | and recolor all source code output."""
pass
def run(self, args):
if len(args) >= 1 and 'reset' == args[0]:
highlight_type = self.get_highlight_type(args[1])
if not highlight_type: return
clear_file_format_cache() | and recolor all source code output."""
pass
def run(self, args):
if len(args) > 1 and 'reset' == args[0]:
highlight_type = self.get_highlight_type(args[1])
if not highlight_type: return
clear_file_format_cache() |
330 | https://:@github.com/rocky/python3-trepan.git | 7fe5f2be86cf60c41b67ea4a6d24990b06dd536a | @@ -4,7 +4,7 @@ from fn_helper import strarray_setup, compare_output
class TestSkip(unittest.TestCase):
- @unittest.skipIf('TRAVIS' not in os.environ,
+ @unittest.skipIf('TRAVIS' in os.environ,
"FIXME: figure out why this doesn't work in travis")
def test_skip(self):
| test/functional/test-skip.py | ReplaceText(target=' in ' @(7,29)->(7,37)) | from fn_helper import strarray_setup, compare_output
class TestSkip(unittest.TestCase):
@unittest.skipIf('TRAVIS' not in os.environ,
"FIXME: figure out why this doesn't work in travis")
def test_skip(self):
| from fn_helper import strarray_setup, compare_output
class TestSkip(unittest.TestCase):
@unittest.skipIf('TRAVIS' in os.environ,
"FIXME: figure out why this doesn't work in travis")
def test_skip(self):
|
331 | https://:@github.com/rocky/python3-trepan.git | ce7705f666154604fb580ca56cd22ec7cc6eae69 | @@ -183,7 +183,7 @@ dictionary that gets fed to trepan.Debugger.core.start().
Parameter "step_ignore" specifies how many line events to ignore after the
debug() call. 0 means don't even wait for the debug() call to finish.
"""
- if isinstance(Mdebugger.debugger_obj, Mdebugger.Trepan):
+ if not isinstance(Mdebugger.debugger_obj, Mdebugger.Trepan):
Mdebugger.debugger_obj = Mdebugger.Trepan(dbg_opts)
Mdebugger.debugger_obj.core.add_ignore(debug, stop)
pass
| trepan/api.py | ReplaceText(target='not ' @(186,7)->(186,7)) | dictionary that gets fed to trepan.Debugger.core.start().
Parameter "step_ignore" specifies how many line events to ignore after the
debug() call. 0 means don't even wait for the debug() call to finish.
"""
if isinstance(Mdebugger.debugger_obj, Mdebugger.Trepan):
Mdebugger.debugger_obj = Mdebugger.Trepan(dbg_opts)
Mdebugger.debugger_obj.core.add_ignore(debug, stop)
pass | dictionary that gets fed to trepan.Debugger.core.start().
Parameter "step_ignore" specifies how many line events to ignore after the
debug() call. 0 means don't even wait for the debug() call to finish.
"""
if not isinstance(Mdebugger.debugger_obj, Mdebugger.Trepan):
Mdebugger.debugger_obj = Mdebugger.Trepan(dbg_opts)
Mdebugger.debugger_obj.core.add_ignore(debug, stop)
pass |
332 | https://:@github.com/rocky/python3-trepan.git | 342c05260ac86fcc4e6d711a3f579c71d1d53d64 | @@ -116,7 +116,7 @@ See also:
pass
sys_version = version_info.major + (version_info.minor / 10.0)
- if len(args) >= 1 and args[1] == '.':
+ if len(args) >= 1 and args[0] == '.':
try:
if pretty:
deparsed = deparse_code(sys_version, co)
| trepan/processor/command/deparse.py | ReplaceText(target='0' @(119,35)->(119,36)) | See also:
pass
sys_version = version_info.major + (version_info.minor / 10.0)
if len(args) >= 1 and args[1] == '.':
try:
if pretty:
deparsed = deparse_code(sys_version, co) | See also:
pass
sys_version = version_info.major + (version_info.minor / 10.0)
if len(args) >= 1 and args[0] == '.':
try:
if pretty:
deparsed = deparse_code(sys_version, co) |
333 | https://:@github.com/kanaka/websockify.git | 0da91c7fdb3a49873121594e1820eef7ac078595 | @@ -225,7 +225,7 @@ Sec-WebSocket-Accept: %s\r
payload_len = len(buf)
if payload_len <= 125:
header = struct.pack('>BB', b1, payload_len)
- elif payload_len > 125 and payload_len <= 65536:
+ elif payload_len > 125 and payload_len < 65536:
header = struct.pack('>BBH', b1, 126, payload_len)
elif payload_len >= 65536:
header = struct.pack('>BBQ', b1, 127, payload_len)
| websocket.py | ReplaceText(target='<' @(228,47)->(228,49)) | Sec-WebSocket-Accept: %s\r
payload_len = len(buf)
if payload_len <= 125:
header = struct.pack('>BB', b1, payload_len)
elif payload_len > 125 and payload_len <= 65536:
header = struct.pack('>BBH', b1, 126, payload_len)
elif payload_len >= 65536:
header = struct.pack('>BBQ', b1, 127, payload_len) | Sec-WebSocket-Accept: %s\r
payload_len = len(buf)
if payload_len <= 125:
header = struct.pack('>BB', b1, payload_len)
elif payload_len > 125 and payload_len < 65536:
header = struct.pack('>BBH', b1, 126, payload_len)
elif payload_len >= 65536:
header = struct.pack('>BBQ', b1, 127, payload_len) |
334 | https://:@github.com/annoviko/pyclustering.git | 70597e34bed02d7c3cb4a3d2e2ed6b30cd6cb3df | @@ -320,7 +320,7 @@ class hysteresis_network(network):
if (collect_dynamic is False):
dyn_state.append(self._states);
- dyn_time.append(t);
+ dyn_time.append(time);
return hysteresis_dynamic(dyn_state, dyn_time);
| pyclustering/nnet/hysteresis.py | ReplaceText(target='time' @(323,28)->(323,29)) | class hysteresis_network(network):
if (collect_dynamic is False):
dyn_state.append(self._states);
dyn_time.append(t);
return hysteresis_dynamic(dyn_state, dyn_time);
| class hysteresis_network(network):
if (collect_dynamic is False):
dyn_state.append(self._states);
dyn_time.append(time);
return hysteresis_dynamic(dyn_state, dyn_time);
|
335 | https://:@github.com/annoviko/pyclustering.git | 7e1bf5ed9cc2817c00c7e5e216adb4cc9fa8fc49 | @@ -123,7 +123,7 @@ class ttsas(bsas):
index_cluster, distance = self._find_nearest_cluster(point);
- if distance < self._threshold:
+ if distance <= self._threshold:
self.__append_to_cluster(index_cluster, index_point, point);
elif distance > self._threshold2:
self.__allocate_cluster(index_point, point);
| pyclustering/cluster/ttsas.py | ReplaceText(target='<=' @(126,20)->(126,21)) | class ttsas(bsas):
index_cluster, distance = self._find_nearest_cluster(point);
if distance < self._threshold:
self.__append_to_cluster(index_cluster, index_point, point);
elif distance > self._threshold2:
self.__allocate_cluster(index_point, point); | class ttsas(bsas):
index_cluster, distance = self._find_nearest_cluster(point);
if distance <= self._threshold:
self.__append_to_cluster(index_cluster, index_point, point);
elif distance > self._threshold2:
self.__allocate_cluster(index_point, point); |
336 | https://:@github.com/annoviko/pyclustering.git | cdb0ca92c076282084f54816d681f7d0a1588066 | @@ -64,7 +64,7 @@ class XmeansTestTemplates:
assertion.eq(expected_wce, wce)
if expected_cluster_length is not None:
- assertion.eq(len(centers), len(expected_cluster_length))
+ assertion.eq(len(expected_cluster_length), len(centers))
obtained_cluster_sizes.sort()
expected_cluster_length.sort()
| pyclustering/cluster/tests/xmeans_templates.py | ArgSwap(idxs=0<->1 @(67,12)->(67,24)) | class XmeansTestTemplates:
assertion.eq(expected_wce, wce)
if expected_cluster_length is not None:
assertion.eq(len(centers), len(expected_cluster_length))
obtained_cluster_sizes.sort()
expected_cluster_length.sort() | class XmeansTestTemplates:
assertion.eq(expected_wce, wce)
if expected_cluster_length is not None:
assertion.eq(len(expected_cluster_length), len(centers))
obtained_cluster_sizes.sort()
expected_cluster_length.sort() |
337 | https://:@github.com/evolbioinfo/pastml.git | 06384fd264d834bff88efdc6bf70a098b06f307d | @@ -232,7 +232,7 @@ def parsimonious_acr(tree, feature, prediction_method, states, num_nodes, num_ti
.format(feature, num_steps))
num_scenarios, unresolved_nodes = choose_parsimonious_states(tree, feature)
logger.debug('{} node{} unresolved ({:.2f}%) for {}, leading to {:g} ancestral scenario{}.'
- .format(unresolved_nodes, 's are' if unresolved_nodes > 1 else ' is',
+ .format(unresolved_nodes, 's are' if unresolved_nodes != 1 else ' is',
unresolved_nodes * 100 / num_nodes, feature,
num_scenarios, 's' if num_scenarios > 1 else ''))
| pastml/parsimony.py | ReplaceText(target='!=' @(235,71)->(235,72)) | def parsimonious_acr(tree, feature, prediction_method, states, num_nodes, num_ti
.format(feature, num_steps))
num_scenarios, unresolved_nodes = choose_parsimonious_states(tree, feature)
logger.debug('{} node{} unresolved ({:.2f}%) for {}, leading to {:g} ancestral scenario{}.'
.format(unresolved_nodes, 's are' if unresolved_nodes > 1 else ' is',
unresolved_nodes * 100 / num_nodes, feature,
num_scenarios, 's' if num_scenarios > 1 else ''))
| def parsimonious_acr(tree, feature, prediction_method, states, num_nodes, num_ti
.format(feature, num_steps))
num_scenarios, unresolved_nodes = choose_parsimonious_states(tree, feature)
logger.debug('{} node{} unresolved ({:.2f}%) for {}, leading to {:g} ancestral scenario{}.'
.format(unresolved_nodes, 's are' if unresolved_nodes != 1 else ' is',
unresolved_nodes * 100 / num_nodes, feature,
num_scenarios, 's' if num_scenarios > 1 else ''))
|
338 | https://:@github.com/jirifilip/pyARC.git | e18a6c280f30bc753192bfa83f311ce36915aca4 | @@ -42,7 +42,7 @@ class TestClassAssociationRule(unittest.TestCase):
sorted_cars = sorted([car1, car2, car3, car4], reverse=True)
assert car1 < car2
- assert car2 < car3
+ assert car2 > car3
assert car3 < car2
assert car4 > car3
assert car1.antecedent <= transaction1
| cba/test/test_class_association_rule.py | ReplaceText(target='>' @(45,20)->(45,21)) | class TestClassAssociationRule(unittest.TestCase):
sorted_cars = sorted([car1, car2, car3, car4], reverse=True)
assert car1 < car2
assert car2 < car3
assert car3 < car2
assert car4 > car3
assert car1.antecedent <= transaction1 | class TestClassAssociationRule(unittest.TestCase):
sorted_cars = sorted([car1, car2, car3, car4], reverse=True)
assert car1 < car2
assert car2 > car3
assert car3 < car2
assert car4 > car3
assert car1.antecedent <= transaction1 |
339 | https://:@github.com/oblalex/verboselib.git | 5ec91a09ae9f0674513f4953111009b93eaad74a | @@ -123,4 +123,4 @@ class VerboselibTranslationTestCase(unittest.TestCase):
t1.merge(t2)
self.assertEqual(t1.ugettext("Hello"), "Вітаю")
- self.assertEqual(t2.ugettext("Good bye"), "До зустрічі")
+ self.assertEqual(t1.ugettext("Good bye"), "До зустрічі")
| tests/test_package.py | ReplaceText(target='t1' @(126,25)->(126,27)) | class VerboselibTranslationTestCase(unittest.TestCase):
t1.merge(t2)
self.assertEqual(t1.ugettext("Hello"), "Вітаю")
self.assertEqual(t2.ugettext("Good bye"), "До зустрічі") | class VerboselibTranslationTestCase(unittest.TestCase):
t1.merge(t2)
self.assertEqual(t1.ugettext("Hello"), "Вітаю")
self.assertEqual(t1.ugettext("Good bye"), "До зустрічі") |
340 | https://:@github.com/lexndru/hap.git | 5ef18f88572400983578d8723663562329066779 | @@ -87,7 +87,7 @@ class Cache(object):
tuple: Boolean for success read and string for size or error.
"""
- if len(cache) == 0:
+ if len(cache_path) == 0:
return False, "missing cache path"
if len(cache) == 0:
return False, "missing cache data"
| hap/cache.py | ReplaceText(target='cache_path' @(90,15)->(90,20)) | class Cache(object):
tuple: Boolean for success read and string for size or error.
"""
if len(cache) == 0:
return False, "missing cache path"
if len(cache) == 0:
return False, "missing cache data" | class Cache(object):
tuple: Boolean for success read and string for size or error.
"""
if len(cache_path) == 0:
return False, "missing cache path"
if len(cache) == 0:
return False, "missing cache data" |
341 | https://:@github.com/littlezz/island-backup.git | fed75aebccfa31e418e351492618a2d50c15b9cb | @@ -103,7 +103,7 @@ class ImageManager:
print('this is {} in busying'.format(len(self.busying)))
urls = []
for i, url in enumerate(self.busying):
- if i > 3:
+ if i >= 3:
break
urls.append(url)
| main.py | ReplaceText(target='>=' @(106,17)->(106,18)) | class ImageManager:
print('this is {} in busying'.format(len(self.busying)))
urls = []
for i, url in enumerate(self.busying):
if i > 3:
break
urls.append(url)
| class ImageManager:
print('this is {} in busying'.format(len(self.busying)))
urls = []
for i, url in enumerate(self.busying):
if i >= 3:
break
urls.append(url)
|
342 | https://:@github.com/parrt/dtreeviz.git | aa5b4811af5c5a5c9620705fc44ffd9e48377664 | @@ -1121,7 +1121,7 @@ def draw_legend(shadow_tree, target_name, filename, colors=None):
boxes = []
for i, c in enumerate(class_values):
box = patches.Rectangle((0, 0), 20, 10, linewidth=.4, edgecolor=colors['rect_edge'],
- facecolor=color_map[c], label=class_names[c])
+ facecolor=color_map[c], label=class_names[i])
boxes.append(box)
fig, ax = plt.subplots(1, 1, figsize=(1,1))
| dtreeviz/trees.py | ReplaceText(target='i' @(1124,74)->(1124,75)) | def draw_legend(shadow_tree, target_name, filename, colors=None):
boxes = []
for i, c in enumerate(class_values):
box = patches.Rectangle((0, 0), 20, 10, linewidth=.4, edgecolor=colors['rect_edge'],
facecolor=color_map[c], label=class_names[c])
boxes.append(box)
fig, ax = plt.subplots(1, 1, figsize=(1,1)) | def draw_legend(shadow_tree, target_name, filename, colors=None):
boxes = []
for i, c in enumerate(class_values):
box = patches.Rectangle((0, 0), 20, 10, linewidth=.4, edgecolor=colors['rect_edge'],
facecolor=color_map[c], label=class_names[i])
boxes.append(box)
fig, ax = plt.subplots(1, 1, figsize=(1,1)) |
343 | https://:@github.com/parrt/dtreeviz.git | 01cc13f495decbd6f8f716d7be586e02864f3434 | @@ -809,7 +809,7 @@ def dtreeviz(tree_model: (tree.DecisionTreeRegressor, tree.DecisionTreeClassifie
lcolor = colors['highlight']
lpw = "1.2"
if node.right.id in highlight_path:
- lcolor = colors['highlight']
+ rcolor = colors['highlight']
rpw = "1.2"
edges.append( f'{nname} -> {left_node_name} [penwidth={lpw} color="{lcolor}" label=<{llabel}>]' )
edges.append( f'{nname} -> {right_node_name} [penwidth={rpw} color="{rcolor}" label=<{rlabel}>]' )
| dtreeviz/trees.py | ReplaceText(target='rcolor' @(812,12)->(812,18)) | def dtreeviz(tree_model: (tree.DecisionTreeRegressor, tree.DecisionTreeClassifie
lcolor = colors['highlight']
lpw = "1.2"
if node.right.id in highlight_path:
lcolor = colors['highlight']
rpw = "1.2"
edges.append( f'{nname} -> {left_node_name} [penwidth={lpw} color="{lcolor}" label=<{llabel}>]' )
edges.append( f'{nname} -> {right_node_name} [penwidth={rpw} color="{rcolor}" label=<{rlabel}>]' ) | def dtreeviz(tree_model: (tree.DecisionTreeRegressor, tree.DecisionTreeClassifie
lcolor = colors['highlight']
lpw = "1.2"
if node.right.id in highlight_path:
rcolor = colors['highlight']
rpw = "1.2"
edges.append( f'{nname} -> {left_node_name} [penwidth={lpw} color="{lcolor}" label=<{llabel}>]' )
edges.append( f'{nname} -> {right_node_name} [penwidth={rpw} color="{rcolor}" label=<{rlabel}>]' ) |
344 | https://:@github.com/4teamwork/ftw.workspace.git | b12970101f5ca213e4604c2c3cf2f767f911b71e | @@ -75,7 +75,7 @@ class AssignableUsersVocabulary(object):
if user not in groups:
groups.add(user)
- if getattr(aq_base(workspace), '__ac_local_roles_block__', None):
+ if getattr(aq_base(context), '__ac_local_roles_block__', None):
cont = False
else:
context = aq_parent(context)
| ftw/workspace/vocabularies.py | ReplaceText(target='context' @(78,31)->(78,40)) | class AssignableUsersVocabulary(object):
if user not in groups:
groups.add(user)
if getattr(aq_base(workspace), '__ac_local_roles_block__', None):
cont = False
else:
context = aq_parent(context) | class AssignableUsersVocabulary(object):
if user not in groups:
groups.add(user)
if getattr(aq_base(context), '__ac_local_roles_block__', None):
cont = False
else:
context = aq_parent(context) |
345 | https://:@github.com/regulusweb/wagtail-extensions.git | ea388649a0c6dc6fbc1ce018d767c8b583486523 | @@ -74,7 +74,7 @@ class ContactDetailsSetting(BaseSetting):
today = date.today()
cache_key = self.get_opening_today_cache_key(today)
times = cache.get(cache_key)
- if times is not None:
+ if times is None:
opening_times = self.primary_opening_times
if opening_times:
specific_times = utils.first_true(opening_times, lambda x: x.get('date') == today)
| wagtail_extensions/models.py | ReplaceText(target=' is ' @(77,16)->(77,24)) | class ContactDetailsSetting(BaseSetting):
today = date.today()
cache_key = self.get_opening_today_cache_key(today)
times = cache.get(cache_key)
if times is not None:
opening_times = self.primary_opening_times
if opening_times:
specific_times = utils.first_true(opening_times, lambda x: x.get('date') == today) | class ContactDetailsSetting(BaseSetting):
today = date.today()
cache_key = self.get_opening_today_cache_key(today)
times = cache.get(cache_key)
if times is None:
opening_times = self.primary_opening_times
if opening_times:
specific_times = utils.first_true(opening_times, lambda x: x.get('date') == today) |
346 | https://:@github.com/tjcsl/cslbot.git | eaa1165f7ceb19b8e98828fea2894d275ffe5743 | @@ -394,7 +394,7 @@ class MyHandler():
elif cmd[0] == "get":
if cmd[1] == "disabled" and cmd[2] == "modules":
send(str(self.disabled_mods))
- if cmd[2] == "enabled" and cmd[2] == "modules":
+ if cmd[1] == "enabled" and cmd[2] == "modules":
send(str([i for i in self.modules if i not in self.disabled_mods]))
def handle_msg(self, msgtype, c, e):
| handler.py | ReplaceText(target='1' @(397,19)->(397,20)) | class MyHandler():
elif cmd[0] == "get":
if cmd[1] == "disabled" and cmd[2] == "modules":
send(str(self.disabled_mods))
if cmd[2] == "enabled" and cmd[2] == "modules":
send(str([i for i in self.modules if i not in self.disabled_mods]))
def handle_msg(self, msgtype, c, e): | class MyHandler():
elif cmd[0] == "get":
if cmd[1] == "disabled" and cmd[2] == "modules":
send(str(self.disabled_mods))
if cmd[1] == "enabled" and cmd[2] == "modules":
send(str([i for i in self.modules if i not in self.disabled_mods]))
def handle_msg(self, msgtype, c, e): |
347 | https://:@github.com/tjcsl/cslbot.git | 6c801ad70e0a9d1a963b9b560f9c654616e64a3b | @@ -260,7 +260,7 @@ class BotHandler():
if self.log_to_ctrlchan:
# somewhat hacky fix
if target != CTRLCHAN:
- self.connection.send_raw(("PRIVMSG %s :(%s) <%s> %s" % (CTRLCHAN, target, nick, log))\
+ self.connection.send_raw(("PRIVMSG %s :(%s) <%s> %s" % (CTRLCHAN, target, nick, msg))\
.replace("\n", "").replace("\r", ""))
self.logs[target].append([day, log])
self.logfiles[target].write(log)
| handler.py | ReplaceText(target='msg' @(263,96)->(263,99)) | class BotHandler():
if self.log_to_ctrlchan:
# somewhat hacky fix
if target != CTRLCHAN:
self.connection.send_raw(("PRIVMSG %s :(%s) <%s> %s" % (CTRLCHAN, target, nick, log))\
.replace("\n", "").replace("\r", ""))
self.logs[target].append([day, log])
self.logfiles[target].write(log) | class BotHandler():
if self.log_to_ctrlchan:
# somewhat hacky fix
if target != CTRLCHAN:
self.connection.send_raw(("PRIVMSG %s :(%s) <%s> %s" % (CTRLCHAN, target, nick, msg))\
.replace("\n", "").replace("\r", ""))
self.logs[target].append([day, log])
self.logfiles[target].write(log) |
348 | https://:@github.com/tjcsl/cslbot.git | b5c181736ff1adc6b665d2d4a80bd6141aaa549e | @@ -331,7 +331,7 @@ class BotHandler():
return
if cmdargs[0] != '#':
cmdargs = '#' + cmdargs
- if cmdargs in self.channels and len(cmd) > 0 and cmd[1] != "force":
+ if cmdargs in self.channels or len(cmd) > 0 and cmd[1] != "force":
send("%s is already a member of %s" % (NICK, cmdargs))
return
c.join(cmd[0])
| handler.py | ReplaceText(target='or' @(334,36)->(334,39)) | class BotHandler():
return
if cmdargs[0] != '#':
cmdargs = '#' + cmdargs
if cmdargs in self.channels and len(cmd) > 0 and cmd[1] != "force":
send("%s is already a member of %s" % (NICK, cmdargs))
return
c.join(cmd[0]) | class BotHandler():
return
if cmdargs[0] != '#':
cmdargs = '#' + cmdargs
if cmdargs in self.channels or len(cmd) > 0 and cmd[1] != "force":
send("%s is already a member of %s" % (NICK, cmdargs))
return
c.join(cmd[0]) |
349 | https://:@github.com/tjcsl/cslbot.git | 20dab902837bb40599cb34afe152dfc780f2854e | @@ -315,7 +315,7 @@ class BotHandler():
# -pub
# -private
#log to sqlite logger
- self.logger.log(target, nick, isop, msg, msgtype)
+ self.logger.log(nick, target, isop, msg, msgtype)
if self.log_to_ctrlchan:
ctrlchan = self.config['core']['ctrlchan']
| handler.py | ArgSwap(idxs=0<->1 @(318,8)->(318,23)) | class BotHandler():
# -pub
# -private
#log to sqlite logger
self.logger.log(target, nick, isop, msg, msgtype)
if self.log_to_ctrlchan:
ctrlchan = self.config['core']['ctrlchan'] | class BotHandler():
# -pub
# -private
#log to sqlite logger
self.logger.log(nick, target, isop, msg, msgtype)
if self.log_to_ctrlchan:
ctrlchan = self.config['core']['ctrlchan'] |
350 | https://:@github.com/tjcsl/cslbot.git | 7b544654a37dd0ca467157c76aaa51bb6e9a73e8 | @@ -442,7 +442,7 @@ class BotHandler():
if cmd_obj.is_limited() and self.abusecheck(send, nick, cmd_obj.limit, msgtype, cmd[len(cmdchar):]):
return
args = self.do_args(cmd_obj.args, send, nick, target, e.source, c, cmd_name, msgtype)
- cmd_obj.run(send, cmdargs, args, cmd_name, target, nick, self.db.get())
+ cmd_obj.run(send, cmdargs, args, cmd_name, nick, target, self.db.get())
# special commands
if cmd.startswith(cmdchar):
if cmd[len(cmdchar):] == 'reload':
| handler.py | ArgSwap(idxs=4<->5 @(445,16)->(445,27)) | class BotHandler():
if cmd_obj.is_limited() and self.abusecheck(send, nick, cmd_obj.limit, msgtype, cmd[len(cmdchar):]):
return
args = self.do_args(cmd_obj.args, send, nick, target, e.source, c, cmd_name, msgtype)
cmd_obj.run(send, cmdargs, args, cmd_name, target, nick, self.db.get())
# special commands
if cmd.startswith(cmdchar):
if cmd[len(cmdchar):] == 'reload': | class BotHandler():
if cmd_obj.is_limited() and self.abusecheck(send, nick, cmd_obj.limit, msgtype, cmd[len(cmdchar):]):
return
args = self.do_args(cmd_obj.args, send, nick, target, e.source, c, cmd_name, msgtype)
cmd_obj.run(send, cmdargs, args, cmd_name, nick, target, self.db.get())
# special commands
if cmd.startswith(cmdchar):
if cmd[len(cmdchar):] == 'reload': |
351 | https://:@github.com/tjcsl/cslbot.git | 8d5e5ff45a32d6849e0daf38414e818b4d8e4a96 | @@ -38,7 +38,7 @@ def cmd(send, msg, args):
name = 'passthrough'
else:
name = name[4:]
- names.append(i)
+ names.append(name)
send("Current filter(s): %s" % ", ".join(names))
elif msg == 'list':
send("Available filters are %s" % ", ".join(output_filters.keys()))
| commands/filter.py | ReplaceText(target='name' @(41,25)->(41,26)) | def cmd(send, msg, args):
name = 'passthrough'
else:
name = name[4:]
names.append(i)
send("Current filter(s): %s" % ", ".join(names))
elif msg == 'list':
send("Available filters are %s" % ", ".join(output_filters.keys())) | def cmd(send, msg, args):
name = 'passthrough'
else:
name = name[4:]
names.append(name)
send("Current filter(s): %s" % ", ".join(names))
elif msg == 'list':
send("Available filters are %s" % ", ".join(output_filters.keys())) |
352 | https://:@github.com/tjcsl/cslbot.git | 0e38c8226ab070d321cbed3ade449c2833d0f36e | @@ -154,7 +154,7 @@ def handle_accept(handler, cmd):
return "Missing argument."
if not cmd[1].isdigit():
return "Not A Valid Positive Integer"
- elif not handler.issues or len(handler.issues) < int(cmd[1]):
+ elif not handler.issues or len(handler.issues) <= int(cmd[1]):
return "Not a valid issue"
else:
num = int(cmd[1])
| helpers/control.py | ReplaceText(target='<=' @(157,51)->(157,52)) | def handle_accept(handler, cmd):
return "Missing argument."
if not cmd[1].isdigit():
return "Not A Valid Positive Integer"
elif not handler.issues or len(handler.issues) < int(cmd[1]):
return "Not a valid issue"
else:
num = int(cmd[1]) | def handle_accept(handler, cmd):
return "Missing argument."
if not cmd[1].isdigit():
return "Not A Valid Positive Integer"
elif not handler.issues or len(handler.issues) <= int(cmd[1]):
return "Not a valid issue"
else:
num = int(cmd[1]) |
353 | https://:@github.com/tjcsl/cslbot.git | 1694edfac9e6ee93ce648c78be52d19360b7e364 | @@ -54,7 +54,7 @@ def do_add_quote(cmd, conn, isadmin, send, args):
cursor = conn.execute('INSERT INTO quotes(quote, nick, submitter) VALUES(?,?,?)', (quote[0], quote[1], args['nick']))
qid = cursor.lastrowid
if isadmin:
- cursor.execute('UPDATE quotes SET approved=1 WHERE id=?', (qid,))
+ conn.execute('UPDATE quotes SET approved=1 WHERE id=?', (qid,))
send("Added quote %d!" % qid)
else:
send("Quote submitted for approval.", target=args['nick'])
| commands/quote.py | ReplaceText(target='conn' @(57,8)->(57,14)) | def do_add_quote(cmd, conn, isadmin, send, args):
cursor = conn.execute('INSERT INTO quotes(quote, nick, submitter) VALUES(?,?,?)', (quote[0], quote[1], args['nick']))
qid = cursor.lastrowid
if isadmin:
cursor.execute('UPDATE quotes SET approved=1 WHERE id=?', (qid,))
send("Added quote %d!" % qid)
else:
send("Quote submitted for approval.", target=args['nick']) | def do_add_quote(cmd, conn, isadmin, send, args):
cursor = conn.execute('INSERT INTO quotes(quote, nick, submitter) VALUES(?,?,?)', (quote[0], quote[1], args['nick']))
qid = cursor.lastrowid
if isadmin:
conn.execute('UPDATE quotes SET approved=1 WHERE id=?', (qid,))
send("Added quote %d!" % qid)
else:
send("Quote submitted for approval.", target=args['nick']) |
354 | https://:@github.com/tjcsl/cslbot.git | aa3079c68c6bfed92fe95cf92dbed87d1f3c91d2 | @@ -33,7 +33,7 @@ def handle_traceback(ex, c, target, config, source="the bot"):
errtarget = ctrlchan if prettyerrors else target
if prettyerrors:
if name == 'CSLException':
- c.privmsg(target, "%s -- %s" % (name, output))
+ c.privmsg(target, "%s -- %s" % (source, output))
else:
c.privmsg(target, "An %s has occured in %s. See the control channel for details." % (name, source))
c.privmsg(errtarget, '%s -- %s in %s on line %s: %s' % (source, name, trace[0], trace[1], output))
| helpers/traceback.py | ReplaceText(target='source' @(36,44)->(36,48)) | def handle_traceback(ex, c, target, config, source="the bot"):
errtarget = ctrlchan if prettyerrors else target
if prettyerrors:
if name == 'CSLException':
c.privmsg(target, "%s -- %s" % (name, output))
else:
c.privmsg(target, "An %s has occured in %s. See the control channel for details." % (name, source))
c.privmsg(errtarget, '%s -- %s in %s on line %s: %s' % (source, name, trace[0], trace[1], output)) | def handle_traceback(ex, c, target, config, source="the bot"):
errtarget = ctrlchan if prettyerrors else target
if prettyerrors:
if name == 'CSLException':
c.privmsg(target, "%s -- %s" % (source, output))
else:
c.privmsg(target, "An %s has occured in %s. See the control channel for details." % (name, source))
c.privmsg(errtarget, '%s -- %s in %s on line %s: %s' % (source, name, trace[0], trace[1], output)) |
355 | https://:@github.com/tjcsl/cslbot.git | 8bd3d1038ba16c4c097b51c1bdce1a54a5fb43af | @@ -38,7 +38,7 @@ def get_definition(msg):
elif not index.isdigit() or int(index) >= len(data) or int(index) == 0:
output = "Invalid Index"
else:
- output = data[int(index)+1]['definition']
+ output = data[int(index)-1]['definition']
output = output.splitlines()
return ' '.join(output)
| commands/urban.py | ReplaceText(target='-' @(41,32)->(41,33)) | def get_definition(msg):
elif not index.isdigit() or int(index) >= len(data) or int(index) == 0:
output = "Invalid Index"
else:
output = data[int(index)+1]['definition']
output = output.splitlines()
return ' '.join(output)
| def get_definition(msg):
elif not index.isdigit() or int(index) >= len(data) or int(index) == 0:
output = "Invalid Index"
else:
output = data[int(index)-1]['definition']
output = output.splitlines()
return ' '.join(output)
|
356 | https://:@github.com/tjcsl/cslbot.git | a72f1944cc07392f2f1c023448bfc0eceb6cd8cd | @@ -40,7 +40,7 @@ def get_definition(msg):
output = "UrbanDictionary doesn't have an answer for you."
elif index is None:
output = data[0]['definition']
- elif not index.isdigit() or int(index) >= len(data) or int(index) == 0:
+ elif not index.isdigit() or int(index) > len(data) or int(index) == 0:
output = "Invalid Index"
else:
output = data[int(index)-1]['definition']
| commands/urban.py | ReplaceText(target='>' @(43,43)->(43,45)) | def get_definition(msg):
output = "UrbanDictionary doesn't have an answer for you."
elif index is None:
output = data[0]['definition']
elif not index.isdigit() or int(index) >= len(data) or int(index) == 0:
output = "Invalid Index"
else:
output = data[int(index)-1]['definition'] | def get_definition(msg):
output = "UrbanDictionary doesn't have an answer for you."
elif index is None:
output = data[0]['definition']
elif not index.isdigit() or int(index) > len(data) or int(index) == 0:
output = "Invalid Index"
else:
output = data[int(index)-1]['definition'] |
357 | https://:@github.com/tjcsl/cslbot.git | ffc2cedcd394bf7076f4e8882d7f8773fc2a529b | @@ -24,7 +24,7 @@ from helpers.command import Command
def cmd(send, msg, args):
"""Finds a random quote from tjbash.org given search criteria
"""
- if len(msg) < 0:
+ if len(msg) == 0:
url = 'http://tjbash.org/random1'
else:
url = 'http://tjbash.org/search?query='
| commands/tjbash.py | ReplaceText(target='==' @(27,16)->(27,17)) | from helpers.command import Command
def cmd(send, msg, args):
"""Finds a random quote from tjbash.org given search criteria
"""
if len(msg) < 0:
url = 'http://tjbash.org/random1'
else:
url = 'http://tjbash.org/search?query=' | from helpers.command import Command
def cmd(send, msg, args):
"""Finds a random quote from tjbash.org given search criteria
"""
if len(msg) == 0:
url = 'http://tjbash.org/random1'
else:
url = 'http://tjbash.org/search?query=' |
358 | https://:@github.com/tjcsl/cslbot.git | 0a9fcb6ce10d7d7dca87496e3abb02faa1c35794 | @@ -87,7 +87,7 @@ def build_markov(cursor, speaker, cmdchar, ctrlchan):
def get_markov(cursor, speaker, handler, cmdchar, ctrlchan):
markov = cursor.query(Babble).filter(Babble.nick == speaker).first()
if not markov:
- update_markov(cursor, speaker, cmdchar, ctrlchan)
+ update_markov(handler, speaker, cmdchar, ctrlchan)
markov = cursor.query(Babble).filter(Babble.nick == speaker).first()
elif time.time() - markov.time > CACHE_LIFE:
handler.workers.defer(0, False, update_markov, handler, speaker, cmdchar, ctrlchan)
| commands/babble.py | ReplaceText(target='handler' @(90,22)->(90,28)) | def build_markov(cursor, speaker, cmdchar, ctrlchan):
def get_markov(cursor, speaker, handler, cmdchar, ctrlchan):
markov = cursor.query(Babble).filter(Babble.nick == speaker).first()
if not markov:
update_markov(cursor, speaker, cmdchar, ctrlchan)
markov = cursor.query(Babble).filter(Babble.nick == speaker).first()
elif time.time() - markov.time > CACHE_LIFE:
handler.workers.defer(0, False, update_markov, handler, speaker, cmdchar, ctrlchan) | def build_markov(cursor, speaker, cmdchar, ctrlchan):
def get_markov(cursor, speaker, handler, cmdchar, ctrlchan):
markov = cursor.query(Babble).filter(Babble.nick == speaker).first()
if not markov:
update_markov(handler, speaker, cmdchar, ctrlchan)
markov = cursor.query(Babble).filter(Babble.nick == speaker).first()
elif time.time() - markov.time > CACHE_LIFE:
handler.workers.defer(0, False, update_markov, handler, speaker, cmdchar, ctrlchan) |
359 | https://:@github.com/ThibHlln/smartpy.git | 6e02ac69689bff3802de8dcc5b15237996379aae | @@ -26,7 +26,7 @@ def nash_sutcliffe(evaluation, simulation):
def groundwater_constraint(evaluation, simulation):
- if (evaluation[0] - 0.1 <= simulation[0]) or (simulation[0] <= evaluation[0] + 0.1):
+ if (evaluation[0] - 0.1 <= simulation[0]) and (simulation[0] <= evaluation[0] + 0.1):
return 1.0
else:
return 0.0
| SMARTobjective.py | ReplaceText(target='and' @(29,46)->(29,48)) | def nash_sutcliffe(evaluation, simulation):
def groundwater_constraint(evaluation, simulation):
if (evaluation[0] - 0.1 <= simulation[0]) or (simulation[0] <= evaluation[0] + 0.1):
return 1.0
else:
return 0.0 | def nash_sutcliffe(evaluation, simulation):
def groundwater_constraint(evaluation, simulation):
if (evaluation[0] - 0.1 <= simulation[0]) and (simulation[0] <= evaluation[0] + 0.1):
return 1.0
else:
return 0.0 |
360 | https://:@github.com/satellogic/orbit-predictor.git | 672c75a9b64b6735c08bd5270855588e3d514065 | @@ -30,7 +30,7 @@ from orbit_predictor.predictors.base import CartesianPredictor, logger
class TLEPredictor(CartesianPredictor):
def __init__(self, sate_id, source):
- super(TLEPredictor, self).__init__(source, sate_id)
+ super(TLEPredictor, self).__init__(sate_id, source)
self._iterations = 0
def _propagate_eci(self, when_utc=None):
| orbit_predictor/predictors/tle.py | ArgSwap(idxs=0<->1 @(33,8)->(33,42)) | from orbit_predictor.predictors.base import CartesianPredictor, logger
class TLEPredictor(CartesianPredictor):
def __init__(self, sate_id, source):
super(TLEPredictor, self).__init__(source, sate_id)
self._iterations = 0
def _propagate_eci(self, when_utc=None): | from orbit_predictor.predictors.base import CartesianPredictor, logger
class TLEPredictor(CartesianPredictor):
def __init__(self, sate_id, source):
super(TLEPredictor, self).__init__(sate_id, source)
self._iterations = 0
def _propagate_eci(self, when_utc=None): |
361 | https://:@github.com/dipu-bd/lightnovel-crawler.git | 773695654f273c9f7191817c4dd64e8322325809 | @@ -39,7 +39,7 @@ class LightNovelOnline(Crawler):
logger.debug('Visiting %s', self.novel_url)
soup = self.get_soup(self.novel_url)
- self.novel_id = urlparse(self.novel_url).path.split('/')[1]
+ self.novel_id = urlparse(self.novel_url).path.split('/')[-1]
logger.info("Novel Id: %s", self.novel_id)
self.novel_title = soup.select_one(
| lncrawl/sources/lightnovelonline.py | ReplaceText(target='-1' @(42,65)->(42,66)) | class LightNovelOnline(Crawler):
logger.debug('Visiting %s', self.novel_url)
soup = self.get_soup(self.novel_url)
self.novel_id = urlparse(self.novel_url).path.split('/')[1]
logger.info("Novel Id: %s", self.novel_id)
self.novel_title = soup.select_one( | class LightNovelOnline(Crawler):
logger.debug('Visiting %s', self.novel_url)
soup = self.get_soup(self.novel_url)
self.novel_id = urlparse(self.novel_url).path.split('/')[-1]
logger.info("Novel Id: %s", self.novel_id)
self.novel_title = soup.select_one( |
362 | https://:@github.com/raphaelm/python-sepaxml.git | 024a11dd1e26d08bbeb028a2a13dabcb509011ec | @@ -54,7 +54,7 @@ def make_id(name):
12 char rand hex string.
"""
r = get_rand_string(12)
- if len(name) <= 22:
+ if len(name) > 22:
name = name[:22]
return name + "-" + r
| sepadd/utils.py | ReplaceText(target='>' @(57,17)->(57,19)) | def make_id(name):
12 char rand hex string.
"""
r = get_rand_string(12)
if len(name) <= 22:
name = name[:22]
return name + "-" + r
| def make_id(name):
12 char rand hex string.
"""
r = get_rand_string(12)
if len(name) > 22:
name = name[:22]
return name + "-" + r
|
363 | https://:@github.com/raphaelm/python-sepaxml.git | 98934ba5c863ffbc2bc770a34dd9ddea8edf2577 | @@ -70,7 +70,7 @@ def int_to_decimal_str(integer):
@return string The amount in currency with full stop decimal separator
"""
int_string = str(integer)
- if len(int_string) < 2:
+ if len(int_string) <= 2:
return "0." + int_string.zfill(2)
else:
return int_string[:-2] + "." + int_string[-2:]
| sepaxml/utils.py | ReplaceText(target='<=' @(73,23)->(73,24)) | def int_to_decimal_str(integer):
@return string The amount in currency with full stop decimal separator
"""
int_string = str(integer)
if len(int_string) < 2:
return "0." + int_string.zfill(2)
else:
return int_string[:-2] + "." + int_string[-2:] | def int_to_decimal_str(integer):
@return string The amount in currency with full stop decimal separator
"""
int_string = str(integer)
if len(int_string) <= 2:
return "0." + int_string.zfill(2)
else:
return int_string[:-2] + "." + int_string[-2:] |
364 | https://:@github.com/scikit-image/scikit-image.git | 2585a323ac57004179b0ba643f953162650f39ee | @@ -51,7 +51,7 @@ def peak_local_max(image, min_distance=10, threshold='deprecated',
threshold_rel = threshold
# find top corner candidates above a threshold
corner_threshold = max(np.max(image.ravel()) * threshold_rel, threshold_abs)
- image_t = (image >= corner_threshold) * 1
+ image_t = (image > corner_threshold) * 1
# get coordinates of peaks
coordinates = np.transpose(image_t.nonzero())
| skimage/feature/peak.py | ReplaceText(target='>' @(54,21)->(54,23)) | def peak_local_max(image, min_distance=10, threshold='deprecated',
threshold_rel = threshold
# find top corner candidates above a threshold
corner_threshold = max(np.max(image.ravel()) * threshold_rel, threshold_abs)
image_t = (image >= corner_threshold) * 1
# get coordinates of peaks
coordinates = np.transpose(image_t.nonzero()) | def peak_local_max(image, min_distance=10, threshold='deprecated',
threshold_rel = threshold
# find top corner candidates above a threshold
corner_threshold = max(np.max(image.ravel()) * threshold_rel, threshold_abs)
image_t = (image > corner_threshold) * 1
# get coordinates of peaks
coordinates = np.transpose(image_t.nonzero()) |
365 | https://:@github.com/scikit-image/scikit-image.git | 8084faf1f69c2c4ba79b6e85c7a2a06e1e7c77b8 | @@ -133,7 +133,7 @@ def reconstruction(seed, mask, method='dilation', selem=None, offset=None):
if offset == None:
if not all([d % 2 == 1 for d in selem.shape]):
ValueError("Footprint dimensions must all be odd")
- offset = np.array([d / 2 for d in selem.shape])
+ offset = np.array([d // 2 for d in selem.shape])
# Cross out the center of the selem
selem[[slice(d, d + 1) for d in offset]] = False
| skimage/morphology/greyreconstruct.py | ReplaceText(target='//' @(136,29)->(136,30)) | def reconstruction(seed, mask, method='dilation', selem=None, offset=None):
if offset == None:
if not all([d % 2 == 1 for d in selem.shape]):
ValueError("Footprint dimensions must all be odd")
offset = np.array([d / 2 for d in selem.shape])
# Cross out the center of the selem
selem[[slice(d, d + 1) for d in offset]] = False
| def reconstruction(seed, mask, method='dilation', selem=None, offset=None):
if offset == None:
if not all([d % 2 == 1 for d in selem.shape]):
ValueError("Footprint dimensions must all be odd")
offset = np.array([d // 2 for d in selem.shape])
# Cross out the center of the selem
selem[[slice(d, d + 1) for d in offset]] = False
|
366 | https://:@github.com/scikit-image/scikit-image.git | d1629aec0f1a861106d54cb015b238e7fe542936 | @@ -28,7 +28,7 @@ def approximate_polygon(coords, tolerance):
----------
.. [1] http://en.wikipedia.org/wiki/Ramer-Douglas-Peucker_algorithm
"""
- if tolerance == 0:
+ if tolerance <= 0:
return coords
chain = np.zeros(coords.shape[0], 'bool')
| skimage/measure/_polygon.py | ReplaceText(target='<=' @(31,17)->(31,19)) | def approximate_polygon(coords, tolerance):
----------
.. [1] http://en.wikipedia.org/wiki/Ramer-Douglas-Peucker_algorithm
"""
if tolerance == 0:
return coords
chain = np.zeros(coords.shape[0], 'bool') | def approximate_polygon(coords, tolerance):
----------
.. [1] http://en.wikipedia.org/wiki/Ramer-Douglas-Peucker_algorithm
"""
if tolerance <= 0:
return coords
chain = np.zeros(coords.shape[0], 'bool') |
367 | https://:@github.com/scikit-image/scikit-image.git | 22f94d8707d3d9d2a36493403cbaeb61213dd68b | @@ -163,7 +163,7 @@ def rotate(image, angle, resize=False, order=1, mode='constant', cval=0.):
tform = tform1 + tform2 + tform3
output_shape = None
- if not resize:
+ if resize:
# determine shape of output image
corners = np.array([[1, 1], [1, rows], [cols, rows], [cols, 1]])
corners = tform(corners - 1)
| skimage/transform/_warps.py | ReplaceText(target='' @(166,7)->(166,11)) | def rotate(image, angle, resize=False, order=1, mode='constant', cval=0.):
tform = tform1 + tform2 + tform3
output_shape = None
if not resize:
# determine shape of output image
corners = np.array([[1, 1], [1, rows], [cols, rows], [cols, 1]])
corners = tform(corners - 1) | def rotate(image, angle, resize=False, order=1, mode='constant', cval=0.):
tform = tform1 + tform2 + tform3
output_shape = None
if resize:
# determine shape of output image
corners = np.array([[1, 1], [1, rows], [cols, rows], [cols, 1]])
corners = tform(corners - 1) |
368 | https://:@github.com/scikit-image/scikit-image.git | 794a4d7daebfdcb217fbf0a73b9d42e256ce45cd | @@ -1085,7 +1085,7 @@ def _validate_lengths(narray, number_elements):
normshp = _normalize_shape(narray, number_elements)
for i in normshp:
chk = [1 if x is None else x for x in i]
- chk = [1 if x > 0 else -1 for x in chk]
+ chk = [1 if x >= 0 else -1 for x in chk]
if (chk[0] < 0) or (chk[1] < 0):
fmt = "%s cannot contain negative values."
raise ValueError(fmt % (number_elements,))
| skimage/util/arraypad.py | ReplaceText(target='>=' @(1088,22)->(1088,23)) | def _validate_lengths(narray, number_elements):
normshp = _normalize_shape(narray, number_elements)
for i in normshp:
chk = [1 if x is None else x for x in i]
chk = [1 if x > 0 else -1 for x in chk]
if (chk[0] < 0) or (chk[1] < 0):
fmt = "%s cannot contain negative values."
raise ValueError(fmt % (number_elements,)) | def _validate_lengths(narray, number_elements):
normshp = _normalize_shape(narray, number_elements)
for i in normshp:
chk = [1 if x is None else x for x in i]
chk = [1 if x >= 0 else -1 for x in chk]
if (chk[0] < 0) or (chk[1] < 0):
fmt = "%s cannot contain negative values."
raise ValueError(fmt % (number_elements,)) |
369 | https://:@github.com/scikit-image/scikit-image.git | 5f46fd01be76ac8c7252ab35ba58609e81ad0ca0 | @@ -124,7 +124,7 @@ def _star_filter_kernel(m, n):
def _suppress_lines(feature_mask, image, sigma, line_threshold):
Axx, Axy, Ayy = _compute_auto_correlation(image, sigma)
feature_mask[(Axx + Ayy) * (Axx + Ayy)
- < line_threshold * (Axx * Ayy - Axy * Axy)] = 0
+ > line_threshold * (Axx * Ayy - Axy * Axy)] = 0
return feature_mask
| skimage/feature/censure.py | ReplaceText(target='>' @(127,17)->(127,18)) | def _star_filter_kernel(m, n):
def _suppress_lines(feature_mask, image, sigma, line_threshold):
Axx, Axy, Ayy = _compute_auto_correlation(image, sigma)
feature_mask[(Axx + Ayy) * (Axx + Ayy)
< line_threshold * (Axx * Ayy - Axy * Axy)] = 0
return feature_mask
| def _star_filter_kernel(m, n):
def _suppress_lines(feature_mask, image, sigma, line_threshold):
Axx, Axy, Ayy = _compute_auto_correlation(image, sigma)
feature_mask[(Axx + Ayy) * (Axx + Ayy)
> line_threshold * (Axx * Ayy - Axy * Axy)] = 0
return feature_mask
|
370 | https://:@github.com/scikit-image/scikit-image.git | 05aeb7c7fe89a70fa18294d69c9e12dd58fa5c08 | @@ -159,7 +159,7 @@ def reconstruction(seed, mask, method='dilation', selem=None, offset=None):
# Create a list of strides across the array to get the neighbors within
# a flattened array
value_stride = np.array(images.strides[1:]) / images.dtype.itemsize
- image_stride = images.strides[0] / images.dtype.itemsize
+ image_stride = images.strides[0] // images.dtype.itemsize
selem_mgrid = np.mgrid[[slice(-o, d - o)
for d, o in zip(selem.shape, offset)]]
selem_offsets = selem_mgrid[:, selem].transpose()
| skimage/morphology/greyreconstruct.py | ReplaceText(target='//' @(162,37)->(162,38)) | def reconstruction(seed, mask, method='dilation', selem=None, offset=None):
# Create a list of strides across the array to get the neighbors within
# a flattened array
value_stride = np.array(images.strides[1:]) / images.dtype.itemsize
image_stride = images.strides[0] / images.dtype.itemsize
selem_mgrid = np.mgrid[[slice(-o, d - o)
for d, o in zip(selem.shape, offset)]]
selem_offsets = selem_mgrid[:, selem].transpose() | def reconstruction(seed, mask, method='dilation', selem=None, offset=None):
# Create a list of strides across the array to get the neighbors within
# a flattened array
value_stride = np.array(images.strides[1:]) / images.dtype.itemsize
image_stride = images.strides[0] // images.dtype.itemsize
selem_mgrid = np.mgrid[[slice(-o, d - o)
for d, o in zip(selem.shape, offset)]]
selem_offsets = selem_mgrid[:, selem].transpose() |
371 | https://:@github.com/scikit-image/scikit-image.git | 05fbc3fbfcc00157841c18b15b171d6477bfb5da | @@ -119,7 +119,7 @@ def slic(image, n_segments=100, compactness=10., max_iter=10, sigma=None,
spacing = np.array(spacing, np.double)
if not isinstance(sigma, coll.Iterable):
sigma = np.array([sigma, sigma, sigma], np.double)
- elif isinstance(spacing, (list, tuple)):
+ elif isinstance(sigma, (list, tuple)):
sigma = np.array(sigma, np.double)
if (sigma > 0).any():
sigma /= spacing.astype(np.double)
| skimage/segmentation/slic_superpixels.py | ReplaceText(target='sigma' @(122,20)->(122,27)) | def slic(image, n_segments=100, compactness=10., max_iter=10, sigma=None,
spacing = np.array(spacing, np.double)
if not isinstance(sigma, coll.Iterable):
sigma = np.array([sigma, sigma, sigma], np.double)
elif isinstance(spacing, (list, tuple)):
sigma = np.array(sigma, np.double)
if (sigma > 0).any():
sigma /= spacing.astype(np.double) | def slic(image, n_segments=100, compactness=10., max_iter=10, sigma=None,
spacing = np.array(spacing, np.double)
if not isinstance(sigma, coll.Iterable):
sigma = np.array([sigma, sigma, sigma], np.double)
elif isinstance(sigma, (list, tuple)):
sigma = np.array(sigma, np.double)
if (sigma > 0).any():
sigma /= spacing.astype(np.double) |
372 | https://:@github.com/scikit-image/scikit-image.git | 1ca0eef825188ac5e9fc84b232b4783c166933ac | @@ -94,7 +94,7 @@ def view_as_blocks(arr_in, block_shape):
arr_in = np.ascontiguousarray(arr_in)
- new_shape = tuple(arr_shape / block_shape) + tuple(block_shape)
+ new_shape = tuple(arr_shape // block_shape) + tuple(block_shape)
new_strides = tuple(arr_in.strides * block_shape) + arr_in.strides
arr_out = as_strided(arr_in, shape=new_shape, strides=new_strides)
| skimage/util/shape.py | ReplaceText(target='//' @(97,32)->(97,33)) | def view_as_blocks(arr_in, block_shape):
arr_in = np.ascontiguousarray(arr_in)
new_shape = tuple(arr_shape / block_shape) + tuple(block_shape)
new_strides = tuple(arr_in.strides * block_shape) + arr_in.strides
arr_out = as_strided(arr_in, shape=new_shape, strides=new_strides) | def view_as_blocks(arr_in, block_shape):
arr_in = np.ascontiguousarray(arr_in)
new_shape = tuple(arr_shape // block_shape) + tuple(block_shape)
new_strides = tuple(arr_in.strides * block_shape) + arr_in.strides
arr_out = as_strided(arr_in, shape=new_shape, strides=new_strides) |
373 | https://:@github.com/scikit-image/scikit-image.git | a38b1c12579214cf77785e9c85f30202b2048c4f | @@ -136,7 +136,7 @@ def _clahe(image, ntiles_x, ntiles_y, clip_limit, nbins=128):
image = pad(image, ((0, h_pad), (0, w_pad)), mode='reflect')
h_inner, w_inner = image.shape
- bin_size = 1 + NR_OF_GREY / nbins
+ bin_size = 1 + NR_OF_GREY // nbins
lut = np.arange(NR_OF_GREY)
lut //= bin_size
img_blocks = view_as_blocks(image, (height, width))
| skimage/exposure/_adapthist.py | ReplaceText(target='//' @(139,30)->(139,31)) | def _clahe(image, ntiles_x, ntiles_y, clip_limit, nbins=128):
image = pad(image, ((0, h_pad), (0, w_pad)), mode='reflect')
h_inner, w_inner = image.shape
bin_size = 1 + NR_OF_GREY / nbins
lut = np.arange(NR_OF_GREY)
lut //= bin_size
img_blocks = view_as_blocks(image, (height, width)) | def _clahe(image, ntiles_x, ntiles_y, clip_limit, nbins=128):
image = pad(image, ((0, h_pad), (0, w_pad)), mode='reflect')
h_inner, w_inner = image.shape
bin_size = 1 + NR_OF_GREY // nbins
lut = np.arange(NR_OF_GREY)
lut //= bin_size
img_blocks = view_as_blocks(image, (height, width)) |
374 | https://:@github.com/scikit-image/scikit-image.git | 9a192bf1cb899632253619385ad9814dbd61f63a | @@ -16,7 +16,7 @@ from skimage import graph, data, io, segmentation, color
img = data.coffee()
labels = segmentation.slic(img, compactness=30, n_segments=400)
g = graph.rag_mean_color(img, labels)
-labels2 = graph.merge_hierarchical(g, labels, 40)
+labels2 = graph.merge_hierarchical(labels, g, 40)
g2 = graph.rag_mean_color(img, labels2)
out = color.label2rgb(labels2, img, kind='avg')
| doc/examples/plot_rag_merge.py | ArgSwap(idxs=0<->1 @(19,10)->(19,34)) | from skimage import graph, data, io, segmentation, color
img = data.coffee()
labels = segmentation.slic(img, compactness=30, n_segments=400)
g = graph.rag_mean_color(img, labels)
labels2 = graph.merge_hierarchical(g, labels, 40)
g2 = graph.rag_mean_color(img, labels2)
out = color.label2rgb(labels2, img, kind='avg') | from skimage import graph, data, io, segmentation, color
img = data.coffee()
labels = segmentation.slic(img, compactness=30, n_segments=400)
g = graph.rag_mean_color(img, labels)
labels2 = graph.merge_hierarchical(labels, g, 40)
g2 = graph.rag_mean_color(img, labels2)
out = color.label2rgb(labels2, img, kind='avg') |
375 | https://:@github.com/scikit-image/scikit-image.git | 4bdde3d2aef2dd184e0b907983a15167326aec55 | @@ -254,7 +254,7 @@ class ImageCollection(object):
if ((self.conserve_memory and n != self._cached) or
(self.data[idx] is None)):
if self._frame_index:
- fname, img_num = self._frame_index[idx]
+ fname, img_num = self._frame_index[n]
self.data[idx] = self.load_func(fname, img_num=img_num,
**self.load_func_kwargs)
else:
| skimage/io/collection.py | ReplaceText(target='n' @(257,55)->(257,58)) | class ImageCollection(object):
if ((self.conserve_memory and n != self._cached) or
(self.data[idx] is None)):
if self._frame_index:
fname, img_num = self._frame_index[idx]
self.data[idx] = self.load_func(fname, img_num=img_num,
**self.load_func_kwargs)
else: | class ImageCollection(object):
if ((self.conserve_memory and n != self._cached) or
(self.data[idx] is None)):
if self._frame_index:
fname, img_num = self._frame_index[n]
self.data[idx] = self.load_func(fname, img_num=img_num,
**self.load_func_kwargs)
else: |
376 | https://:@github.com/scikit-image/scikit-image.git | 84bcb583d76c1ec507b3d5794b6705d06383ced8 | @@ -288,7 +288,7 @@ def hessian_matrix_eigvals(Hxx, Hxy, Hyy):
"""
- return _image_orthogonal_matrix22_eigvals(Hyy, Hxy, Hyy)
+ return _image_orthogonal_matrix22_eigvals(Hxx, Hxy, Hyy)
def corner_kitchen_rosenfeld(image, mode='constant', cval=0):
| skimage/feature/corner.py | ReplaceText(target='Hxx' @(291,46)->(291,49)) | def hessian_matrix_eigvals(Hxx, Hxy, Hyy):
"""
return _image_orthogonal_matrix22_eigvals(Hyy, Hxy, Hyy)
def corner_kitchen_rosenfeld(image, mode='constant', cval=0): | def hessian_matrix_eigvals(Hxx, Hxy, Hyy):
"""
return _image_orthogonal_matrix22_eigvals(Hxx, Hxy, Hyy)
def corner_kitchen_rosenfeld(image, mode='constant', cval=0): |
377 | https://:@github.com/scikit-image/scikit-image.git | 33e36542d5f457a50c5fa00371fb9fe18a620f15 | @@ -84,7 +84,7 @@ def hough_line_peaks(hspace, angles, dists, min_distance=9, min_angle=10,
-min_angle:min_angle + 1]
for dist_idx, angle_idx in coords:
- accum = hspace[dist_idx, angle_idx]
+ accum = hspace_max[dist_idx, angle_idx]
if accum > threshold:
# absolute coordinate grid for local neighbourhood suppression
dist_nh = dist_idx + dist_ext
| skimage/transform/hough_transform.py | ReplaceText(target='hspace_max' @(87,16)->(87,22)) | def hough_line_peaks(hspace, angles, dists, min_distance=9, min_angle=10,
-min_angle:min_angle + 1]
for dist_idx, angle_idx in coords:
accum = hspace[dist_idx, angle_idx]
if accum > threshold:
# absolute coordinate grid for local neighbourhood suppression
dist_nh = dist_idx + dist_ext | def hough_line_peaks(hspace, angles, dists, min_distance=9, min_angle=10,
-min_angle:min_angle + 1]
for dist_idx, angle_idx in coords:
accum = hspace_max[dist_idx, angle_idx]
if accum > threshold:
# absolute coordinate grid for local neighbourhood suppression
dist_nh = dist_idx + dist_ext |
378 | https://:@github.com/scikit-image/scikit-image.git | bc52e4a411ab6d4aa10d38281e979158e6f21f19 | @@ -105,7 +105,7 @@ def hough_line_peaks(hspace, angles, dists, min_distance=9, min_angle=10,
angle_nh[angle_high] -= cols
# suppress neighbourhood
- hspace[dist_nh, angle_nh] = 0
+ hspace_max[dist_nh, angle_nh] = 0
# add current line to peaks
hspace_peaks.append(accum)
| skimage/transform/hough_transform.py | ReplaceText(target='hspace_max' @(108,12)->(108,18)) | def hough_line_peaks(hspace, angles, dists, min_distance=9, min_angle=10,
angle_nh[angle_high] -= cols
# suppress neighbourhood
hspace[dist_nh, angle_nh] = 0
# add current line to peaks
hspace_peaks.append(accum) | def hough_line_peaks(hspace, angles, dists, min_distance=9, min_angle=10,
angle_nh[angle_high] -= cols
# suppress neighbourhood
hspace_max[dist_nh, angle_nh] = 0
# add current line to peaks
hspace_peaks.append(accum) |
379 | https://:@github.com/scikit-image/scikit-image.git | 2fb59b92435b9f67c091871cba701323b784ade7 | @@ -48,7 +48,7 @@ def imread(fname, dtype=None, img_num=None, **kwargs):
im = Image.open(f)
return pil_to_ndarray(im, dtype=dtype, img_num=img_num)
else:
- im = Image.open(f)
+ im = Image.open(fname)
return pil_to_ndarray(im, dtype=dtype, img_num=img_num)
| skimage/io/_plugins/pil_plugin.py | ReplaceText(target='fname' @(51,24)->(51,25)) | def imread(fname, dtype=None, img_num=None, **kwargs):
im = Image.open(f)
return pil_to_ndarray(im, dtype=dtype, img_num=img_num)
else:
im = Image.open(f)
return pil_to_ndarray(im, dtype=dtype, img_num=img_num)
| def imread(fname, dtype=None, img_num=None, **kwargs):
im = Image.open(f)
return pil_to_ndarray(im, dtype=dtype, img_num=img_num)
else:
im = Image.open(fname)
return pil_to_ndarray(im, dtype=dtype, img_num=img_num)
|
380 | https://:@github.com/scikit-image/scikit-image.git | 4ee3b2c5ac89f946a9b4bbf26665411bb7241ff4 | @@ -20,7 +20,7 @@ image = data.astronaut()
rows, cols, dim = image.shape
pyramid = tuple(pyramid_gaussian(image, downscale=2))
-composite_image = np.zeros((rows, cols + cols / 2, 3), dtype=np.double)
+composite_image = np.zeros((rows, cols + cols // 2, 3), dtype=np.double)
composite_image[:rows, :cols, :] = pyramid[0]
| doc/examples/transform/plot_pyramid.py | ReplaceText(target='//' @(23,46)->(23,47)) | image = data.astronaut()
rows, cols, dim = image.shape
pyramid = tuple(pyramid_gaussian(image, downscale=2))
composite_image = np.zeros((rows, cols + cols / 2, 3), dtype=np.double)
composite_image[:rows, :cols, :] = pyramid[0]
| image = data.astronaut()
rows, cols, dim = image.shape
pyramid = tuple(pyramid_gaussian(image, downscale=2))
composite_image = np.zeros((rows, cols + cols // 2, 3), dtype=np.double)
composite_image[:rows, :cols, :] = pyramid[0]
|
381 | https://:@github.com/scikit-image/scikit-image.git | 472a420d86ff363cbb11df4e4b76ec090e0d015c | @@ -634,7 +634,7 @@ def skeletonize_3d(image, *, img=None):
raise ValueError("skeletonize_3d can only handle 2D or 3D images; "
"got image.ndim = %s instead." % image.ndim)
image = np.ascontiguousarray(image)
- image = img_as_ubyte(img, force_copy=False)
+ image = img_as_ubyte(image, force_copy=False)
# make an in image 3D and pad it w/ zeros to simplify dealing w/ boundaries
# NB: careful here to not clobber the original *and* minimize copying
| skimage/morphology/_skeletonize.py | ReplaceText(target='image' @(637,25)->(637,28)) | def skeletonize_3d(image, *, img=None):
raise ValueError("skeletonize_3d can only handle 2D or 3D images; "
"got image.ndim = %s instead." % image.ndim)
image = np.ascontiguousarray(image)
image = img_as_ubyte(img, force_copy=False)
# make an in image 3D and pad it w/ zeros to simplify dealing w/ boundaries
# NB: careful here to not clobber the original *and* minimize copying | def skeletonize_3d(image, *, img=None):
raise ValueError("skeletonize_3d can only handle 2D or 3D images; "
"got image.ndim = %s instead." % image.ndim)
image = np.ascontiguousarray(image)
image = img_as_ubyte(image, force_copy=False)
# make an in image 3D and pad it w/ zeros to simplify dealing w/ boundaries
# NB: careful here to not clobber the original *and* minimize copying |
382 | https://:@github.com/scikit-image/scikit-image.git | 1539f238e52610f5e7607d5b447b5c491e3455eb | @@ -242,7 +242,7 @@ def test_arraymap_update():
in_values = np.unique(np.random.randint(0, 200, size=5))
out_values = np.random.random(len(in_values))
m = ArrayMap(in_values, out_values)
- image = np.random.randint(1, len(in_values), size=(512, 512))
+ image = np.random.randint(1, len(m), size=(512, 512))
assert np.all(m[image] < 1) # missing values map to 0.
m[1:] += 1
assert np.all(m[image] >= 1)
| skimage/segmentation/tests/test_join.py | ReplaceText(target='m' @(245,37)->(245,46)) | def test_arraymap_update():
in_values = np.unique(np.random.randint(0, 200, size=5))
out_values = np.random.random(len(in_values))
m = ArrayMap(in_values, out_values)
image = np.random.randint(1, len(in_values), size=(512, 512))
assert np.all(m[image] < 1) # missing values map to 0.
m[1:] += 1
assert np.all(m[image] >= 1) | def test_arraymap_update():
in_values = np.unique(np.random.randint(0, 200, size=5))
out_values = np.random.random(len(in_values))
m = ArrayMap(in_values, out_values)
image = np.random.randint(1, len(m), size=(512, 512))
assert np.all(m[image] < 1) # missing values map to 0.
m[1:] += 1
assert np.all(m[image] >= 1) |
383 | https://:@github.com/globusonline/agamemnon.git | 6460e336b2a3fd359364f85e39d6e3222077621e | @@ -233,7 +233,7 @@ class DataStore(object):
source_node_key = value
elif column.startswith('source__'):
source_attributes[column[8:]] = value
- source = prim.Node(self, source_node_type, source_node_key, values)
+ source = prim.Node(self, source_node_type, source_node_key, source_attributes)
rel_key = RELATIONSHIP_KEY_PATTERN % (rel_type, rel_key)
return self.get_outgoing_relationship(rel_type, source, (rel_key, values))
| agamemnon/factory.py | ReplaceText(target='source_attributes' @(236,68)->(236,74)) | class DataStore(object):
source_node_key = value
elif column.startswith('source__'):
source_attributes[column[8:]] = value
source = prim.Node(self, source_node_type, source_node_key, values)
rel_key = RELATIONSHIP_KEY_PATTERN % (rel_type, rel_key)
return self.get_outgoing_relationship(rel_type, source, (rel_key, values))
| class DataStore(object):
source_node_key = value
elif column.startswith('source__'):
source_attributes[column[8:]] = value
source = prim.Node(self, source_node_type, source_node_key, source_attributes)
rel_key = RELATIONSHIP_KEY_PATTERN % (rel_type, rel_key)
return self.get_outgoing_relationship(rel_type, source, (rel_key, values))
|
384 | https://:@github.com/chiptopher/guet.git | f95c54917b51e65f47789534ab88ecbede1838eb | @@ -11,6 +11,6 @@ def _recursive_directory_find(path: Path, directory_name: str) -> str:
raise FileNotFoundError()
joined_with_driectory = path.joinpath(directory_name)
if joined_with_driectory.is_dir():
- return str(joined_with_driectory)
+ return str(path)
else:
return _recursive_directory_find(path.parent, directory_name)
| guet/util/_recursive_directory_find.py | ReplaceText(target='path' @(14,19)->(14,40)) | def _recursive_directory_find(path: Path, directory_name: str) -> str:
raise FileNotFoundError()
joined_with_driectory = path.joinpath(directory_name)
if joined_with_driectory.is_dir():
return str(joined_with_driectory)
else:
return _recursive_directory_find(path.parent, directory_name) | def _recursive_directory_find(path: Path, directory_name: str) -> str:
raise FileNotFoundError()
joined_with_driectory = path.joinpath(directory_name)
if joined_with_driectory.is_dir():
return str(path)
else:
return _recursive_directory_find(path.parent, directory_name) |
385 | https://:@github.com/justinsalamon/scaper.git | 520ae608ebcbcc5e5438ca5c7967dc2479454038 | @@ -193,7 +193,7 @@ def generate_from_jams(jams_infile, audio_outfile, fg_path=None, bg_path=None,
tfm.trim(sliceop['slice_start'], sliceop['slice_end'])
tfm.build(audio_file, tmpfiles[-1].name)
# Copy result back to original file
- shutil.copyfile(tmpfiles[-1].name, audio_outfile)
+ shutil.copyfile(tmpfiles[-1].name, audio_file)
# Optionally save new jams file
if jams_outfile is not None:
| scaper/core.py | ReplaceText(target='audio_file' @(196,55)->(196,68)) | def generate_from_jams(jams_infile, audio_outfile, fg_path=None, bg_path=None,
tfm.trim(sliceop['slice_start'], sliceop['slice_end'])
tfm.build(audio_file, tmpfiles[-1].name)
# Copy result back to original file
shutil.copyfile(tmpfiles[-1].name, audio_outfile)
# Optionally save new jams file
if jams_outfile is not None: | def generate_from_jams(jams_infile, audio_outfile, fg_path=None, bg_path=None,
tfm.trim(sliceop['slice_start'], sliceop['slice_end'])
tfm.build(audio_file, tmpfiles[-1].name)
# Copy result back to original file
shutil.copyfile(tmpfiles[-1].name, audio_file)
# Optionally save new jams file
if jams_outfile is not None: |
386 | https://:@github.com/markokr/rarfile.git | 7fd6b2ca3efb81f7c4dffa6b6cef347b7d6ba043 | @@ -833,7 +833,7 @@ class RarFile:
if dirs:
dirs.sort(reverse=True)
for dst, inf in dirs:
- self._set_attrs(dst, inf)
+ self._set_attrs(inf, dst)
def testrar(self, pwd=None):
"""Read all files and test CRC.
| rarfile.py | ArgSwap(idxs=0<->1 @(836,16)->(836,31)) | class RarFile:
if dirs:
dirs.sort(reverse=True)
for dst, inf in dirs:
self._set_attrs(dst, inf)
def testrar(self, pwd=None):
"""Read all files and test CRC. | class RarFile:
if dirs:
dirs.sort(reverse=True)
for dst, inf in dirs:
self._set_attrs(inf, dst)
def testrar(self, pwd=None):
"""Read all files and test CRC. |
387 | https://:@github.com/rougier/freetype-py.git | b21f15fb02eb44a656c250357665d1d7dc50bef6 | @@ -44,7 +44,7 @@ if __name__ == '__main__':
y = height-baseline-top
kerning = face.get_kerning(previous, c)
x += (kerning.x >> 6)
- Z[y:y+h,x:x+w] |= numpy.array(bitmap.buffer).reshape(h,w)
+ Z[y:y+h,x:x+w] += numpy.array(bitmap.buffer).reshape(h,w)
x += (slot.advance.x >> 6)
previous = c
| examples/hello-world.py | ReplaceText(target='+=' @(47,23)->(47,25)) | if __name__ == '__main__':
y = height-baseline-top
kerning = face.get_kerning(previous, c)
x += (kerning.x >> 6)
Z[y:y+h,x:x+w] |= numpy.array(bitmap.buffer).reshape(h,w)
x += (slot.advance.x >> 6)
previous = c
| if __name__ == '__main__':
y = height-baseline-top
kerning = face.get_kerning(previous, c)
x += (kerning.x >> 6)
Z[y:y+h,x:x+w] += numpy.array(bitmap.buffer).reshape(h,w)
x += (slot.advance.x >> 6)
previous = c
|
388 | https://:@github.com/piotrmaslanka/satella.git | 24018c366401278a79da72097f1c594c188f5220 | @@ -15,7 +15,7 @@ def _merge(v1, v2):
if isinstance(v1, list) and isinstance(v2, list):
v1.extend(v2)
- return v2
+ return v1
raise TypeError
| satella/coding/algos.py | ReplaceText(target='v1' @(18,15)->(18,17)) | def _merge(v1, v2):
if isinstance(v1, list) and isinstance(v2, list):
v1.extend(v2)
return v2
raise TypeError
| def _merge(v1, v2):
if isinstance(v1, list) and isinstance(v2, list):
v1.extend(v2)
return v1
raise TypeError
|
389 | https://:@github.com/piotrmaslanka/satella.git | 4828537442e39bd6592413a5b4a2421a079edc91 | @@ -194,7 +194,7 @@ class Heap(object):
:return: Iterator
"""
while self:
- if self.heap[0] >= less:
+ if self.heap[0] < less:
return
yield self.pop()
| satella/coding/structures.py | ReplaceText(target='<' @(197,28)->(197,30)) | class Heap(object):
:return: Iterator
"""
while self:
if self.heap[0] >= less:
return
yield self.pop()
| class Heap(object):
:return: Iterator
"""
while self:
if self.heap[0] < less:
return
yield self.pop()
|
390 | https://:@github.com/piotrmaslanka/satella.git | fab19fa60841455e2ec0ec4493c618b7f5225f7d | @@ -35,7 +35,7 @@ class MeasurableMixin:
elapsed = value_getter() - future.old_value
self.handle(logging_level, elapsed, **labels)
- future.add_done_callback(future)
+ future.add_done_callback(on_future_done)
def measure(self, include_exceptions: bool = True,
logging_level: MetricLevel = MetricLevel.RUNTIME,
| satella/instrumentation/metrics/metric_types/measurable_mixin.py | ReplaceText(target='on_future_done' @(38,33)->(38,39)) | class MeasurableMixin:
elapsed = value_getter() - future.old_value
self.handle(logging_level, elapsed, **labels)
future.add_done_callback(future)
def measure(self, include_exceptions: bool = True,
logging_level: MetricLevel = MetricLevel.RUNTIME, | class MeasurableMixin:
elapsed = value_getter() - future.old_value
self.handle(logging_level, elapsed, **labels)
future.add_done_callback(on_future_done)
def measure(self, include_exceptions: bool = True,
logging_level: MetricLevel = MetricLevel.RUNTIME, |
391 | https://:@github.com/piotrmaslanka/satella.git | a9b866bd76586a440918130d52ca933529ac521a | @@ -117,7 +117,7 @@ class Proxy(tp.Generic[T]):
return self.__obj or other
def __and__(self, other):
- return self.__obj or other
+ return self.__obj and other
def __le__(self, other):
return self.__obj <= other
| satella/coding/structures/proxy.py | ReplaceText(target='and' @(120,26)->(120,28)) | class Proxy(tp.Generic[T]):
return self.__obj or other
def __and__(self, other):
return self.__obj or other
def __le__(self, other):
return self.__obj <= other | class Proxy(tp.Generic[T]):
return self.__obj or other
def __and__(self, other):
return self.__obj and other
def __le__(self, other):
return self.__obj <= other |
392 | https://:@github.com/dmlc/keras.git | 2662d81a9c925501831f0acb805c9e8adcde0a32 | @@ -160,7 +160,7 @@ class Adam(Optimizer):
m_b_t = m_t / (1 - beta_1_t)
v_b_t = v_t / (1 - beta_2_t)
- p_t = p - self.lr * m_b_t / (T.sqrt(v_t) + self.epsilon)
+ p_t = p - self.lr * m_b_t / (T.sqrt(v_b_t) + self.epsilon)
updates.append((m, m_t))
updates.append((v, v_t))
| keras/optimizers.py | ReplaceText(target='v_b_t' @(163,48)->(163,51)) | class Adam(Optimizer):
m_b_t = m_t / (1 - beta_1_t)
v_b_t = v_t / (1 - beta_2_t)
p_t = p - self.lr * m_b_t / (T.sqrt(v_t) + self.epsilon)
updates.append((m, m_t))
updates.append((v, v_t)) | class Adam(Optimizer):
m_b_t = m_t / (1 - beta_1_t)
v_b_t = v_t / (1 - beta_2_t)
p_t = p - self.lr * m_b_t / (T.sqrt(v_b_t) + self.epsilon)
updates.append((m, m_t))
updates.append((v, v_t)) |
393 | https://:@github.com/dmlc/keras.git | cc10c4d907d959eb9009ad502c727542a5259613 | @@ -69,7 +69,7 @@ def skipgrams(sequence, vocabulary_size,
if not wi:
continue
if sampling_table is not None:
- if sampling_table[i] < random.random():
+ if sampling_table[wi] < random.random():
continue
window_start = max(0, i-window_size)
| keras/preprocessing/sequence.py | ReplaceText(target='wi' @(72,30)->(72,31)) | def skipgrams(sequence, vocabulary_size,
if not wi:
continue
if sampling_table is not None:
if sampling_table[i] < random.random():
continue
window_start = max(0, i-window_size) | def skipgrams(sequence, vocabulary_size,
if not wi:
continue
if sampling_table is not None:
if sampling_table[wi] < random.random():
continue
window_start = max(0, i-window_size) |
394 | https://:@github.com/dmlc/keras.git | e3695591704a21c6d0d6236c11c1bad7de4e314c | @@ -58,7 +58,7 @@ class SimpleRNN(Layer):
mask = T.addbroadcast(mask[:, :, np.newaxis], 2)
mask_tm1 = alloc_zeros_matrix(*mask.shape)
- mask_tm1 = T.addbroadcast(T.set_subtensor(mask[1:, :, :], mask[:-1, :, :]), 2)
+ mask_tm1 = T.addbroadcast(T.set_subtensor(mask_tm1[1:, :, :], mask[:-1, :, :]), 2)
# scan = theano symbolic loop.
# See: http://deeplearning.net/software/theano/library/scan.html
| keras/layers/recurrent.py | ReplaceText(target='mask_tm1' @(61,50)->(61,54)) | class SimpleRNN(Layer):
mask = T.addbroadcast(mask[:, :, np.newaxis], 2)
mask_tm1 = alloc_zeros_matrix(*mask.shape)
mask_tm1 = T.addbroadcast(T.set_subtensor(mask[1:, :, :], mask[:-1, :, :]), 2)
# scan = theano symbolic loop.
# See: http://deeplearning.net/software/theano/library/scan.html | class SimpleRNN(Layer):
mask = T.addbroadcast(mask[:, :, np.newaxis], 2)
mask_tm1 = alloc_zeros_matrix(*mask.shape)
mask_tm1 = T.addbroadcast(T.set_subtensor(mask_tm1[1:, :, :], mask[:-1, :, :]), 2)
# scan = theano symbolic loop.
# See: http://deeplearning.net/software/theano/library/scan.html |
395 | https://:@github.com/dmlc/keras.git | c315b0d7a95b6677452300bdefd526b444951819 | @@ -218,7 +218,7 @@ class GaussianNoise(MaskedLayer):
def get_output(self, train=False):
X = self.get_input(train)
- if train or self.sigma == 0:
+ if not train or self.sigma == 0:
return X
else:
return X + srng.normal(size=X.shape, avg=0.0, std=self.sigma,
| keras/layers/core.py | ReplaceText(target='not ' @(221,11)->(221,11)) | class GaussianNoise(MaskedLayer):
def get_output(self, train=False):
X = self.get_input(train)
if train or self.sigma == 0:
return X
else:
return X + srng.normal(size=X.shape, avg=0.0, std=self.sigma, | class GaussianNoise(MaskedLayer):
def get_output(self, train=False):
X = self.get_input(train)
if not train or self.sigma == 0:
return X
else:
return X + srng.normal(size=X.shape, avg=0.0, std=self.sigma, |
396 | https://:@github.com/dmlc/keras.git | 46a2fb6fd8e52b02df78f1416cc9fbd4b3156604 | @@ -42,7 +42,7 @@ class Optimizer(object):
grads = [clip_norm(g, self.clipnorm, norm) for g in grads]
if hasattr(self, 'clipvalue') and self.clipvalue > 0:
- grads = [T.clip(g, self.clipvalue, -self.clipvalue) for g in grads]
+ grads = [T.clip(g, -self.clipvalue, self.clipvalue) for g in grads]
return grads
| keras/optimizers.py | ArgSwap(idxs=1<->2 @(45,21)->(45,27)) | class Optimizer(object):
grads = [clip_norm(g, self.clipnorm, norm) for g in grads]
if hasattr(self, 'clipvalue') and self.clipvalue > 0:
grads = [T.clip(g, self.clipvalue, -self.clipvalue) for g in grads]
return grads
| class Optimizer(object):
grads = [clip_norm(g, self.clipnorm, norm) for g in grads]
if hasattr(self, 'clipvalue') and self.clipvalue > 0:
grads = [T.clip(g, -self.clipvalue, self.clipvalue) for g in grads]
return grads
|
397 | https://:@github.com/dmlc/keras.git | c2534964b76015eb3d76261b025c7556b354764c | @@ -158,7 +158,7 @@ class SimpleRNN(Recurrent):
assert len(states) == 1
prev_output = states[0]
h = K.dot(x, self.W) + self.b
- output = self.activation(h * K.dot(prev_output, self.U))
+ output = self.activation(h + K.dot(prev_output, self.U))
return output, [output]
def get_config(self):
| keras/layers/recurrent.py | ReplaceText(target='+' @(161,35)->(161,36)) | class SimpleRNN(Recurrent):
assert len(states) == 1
prev_output = states[0]
h = K.dot(x, self.W) + self.b
output = self.activation(h * K.dot(prev_output, self.U))
return output, [output]
def get_config(self): | class SimpleRNN(Recurrent):
assert len(states) == 1
prev_output = states[0]
h = K.dot(x, self.W) + self.b
output = self.activation(h + K.dot(prev_output, self.U))
return output, [output]
def get_config(self): |
398 | https://:@github.com/dmlc/keras.git | 3d51a26749937cb1a1aec40c20bc505e82809dce | @@ -449,7 +449,7 @@ class Graph(Layer):
self.namespace.add(sh_name)
self.nodes[sh_name] = sh
self.node_config.append({'name': sh_name,
- 'inputs': [s],
+ 'inputs': [name],
'create_output': create_output})
if create_output:
self.add_output(sh_name, input=sh_name)
| keras/layers/containers.py | ReplaceText(target='name' @(452,52)->(452,53)) | class Graph(Layer):
self.namespace.add(sh_name)
self.nodes[sh_name] = sh
self.node_config.append({'name': sh_name,
'inputs': [s],
'create_output': create_output})
if create_output:
self.add_output(sh_name, input=sh_name) | class Graph(Layer):
self.namespace.add(sh_name)
self.nodes[sh_name] = sh
self.node_config.append({'name': sh_name,
'inputs': [name],
'create_output': create_output})
if create_output:
self.add_output(sh_name, input=sh_name) |
399 | https://:@github.com/dmlc/keras.git | 42b3d37a54545882699283b5764cf3c997f8d9cd | @@ -43,7 +43,7 @@ def test_skipgrams():
couples, labels = skipgrams(np.arange(5), vocabulary_size=5, window_size=1,
categorical=True)
for couple in couples:
- assert couple[0] - couple[1] < 3
+ assert couple[0] - couple[1] <= 3
for l in labels:
assert len(l) == 2
| tests/keras/preprocessing/test_sequence.py | ReplaceText(target='<=' @(46,37)->(46,38)) | def test_skipgrams():
couples, labels = skipgrams(np.arange(5), vocabulary_size=5, window_size=1,
categorical=True)
for couple in couples:
assert couple[0] - couple[1] < 3
for l in labels:
assert len(l) == 2
| def test_skipgrams():
couples, labels = skipgrams(np.arange(5), vocabulary_size=5, window_size=1,
categorical=True)
for couple in couples:
assert couple[0] - couple[1] <= 3
for l in labels:
assert len(l) == 2
|