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
|
---|---|---|---|---|---|---|---|
200 | https://:@github.com/Timidger/Wikia.git | ff74a5711925274af13738f4b588a46356a1fa98 | @@ -395,7 +395,7 @@ class WikiaPage(object):
# Remove the /revision/ fluff after the image url
image = image.partition("/revision/")[0]
image_type = mimetypes.guess_type(image)[0]
- if image_type is None:
+ if image_type is not None:
image_type = "." + image_type.split("/")[-1]
else:
image_type = ".png" # in case mimetypes.guess cant find it it will return None
| wikia/wikia.py | ReplaceText(target=' is not ' @(398,23)->(398,27)) | class WikiaPage(object):
# Remove the /revision/ fluff after the image url
image = image.partition("/revision/")[0]
image_type = mimetypes.guess_type(image)[0]
if image_type is None:
image_type = "." + image_type.split("/")[-1]
else:
image_type = ".png" # in case mimetypes.guess cant find it it will return None | class WikiaPage(object):
# Remove the /revision/ fluff after the image url
image = image.partition("/revision/")[0]
image_type = mimetypes.guess_type(image)[0]
if image_type is not None:
image_type = "." + image_type.split("/")[-1]
else:
image_type = ".png" # in case mimetypes.guess cant find it it will return None |
201 | https://:@github.com/meetshah1995/pytorch-semseg.git | 81997cd5af36759773a67b11cf148d3876b13a69 | @@ -156,7 +156,7 @@ def train(cfg, writer, logger):
labels_val = labels_val.to(device)
outputs = model(images_val)
- val_loss = loss_fn(input=outputs, target=labels)
+ val_loss = loss_fn(input=outputs, target=labels_val)
pred = outputs.data.max(1)[1].cpu().numpy()
gt = labels_val.data.cpu().numpy()
| train.py | ReplaceText(target='labels_val' @(159,65)->(159,71)) | def train(cfg, writer, logger):
labels_val = labels_val.to(device)
outputs = model(images_val)
val_loss = loss_fn(input=outputs, target=labels)
pred = outputs.data.max(1)[1].cpu().numpy()
gt = labels_val.data.cpu().numpy() | def train(cfg, writer, logger):
labels_val = labels_val.to(device)
outputs = model(images_val)
val_loss = loss_fn(input=outputs, target=labels_val)
pred = outputs.data.max(1)[1].cpu().numpy()
gt = labels_val.data.cpu().numpy() |
202 | https://:@github.com/meetshah1995/pytorch-semseg.git | 801fb200547caa5b0d91b8dde56b837da029f746 | @@ -27,7 +27,7 @@ def multi_scale_cross_entropy2d(input, target, weight=None, size_average=True, s
n_inp = len(input)
scale = 0.4
scale_weight = torch.pow(scale * torch.ones(n_inp), torch.arange(n_inp).float()).to(
- input.device
+ target.device
)
loss = 0.0
| ptsemseg/loss/loss.py | ReplaceText(target='target' @(30,12)->(30,17)) | def multi_scale_cross_entropy2d(input, target, weight=None, size_average=True, s
n_inp = len(input)
scale = 0.4
scale_weight = torch.pow(scale * torch.ones(n_inp), torch.arange(n_inp).float()).to(
input.device
)
loss = 0.0 | def multi_scale_cross_entropy2d(input, target, weight=None, size_average=True, s
n_inp = len(input)
scale = 0.4
scale_weight = torch.pow(scale * torch.ones(n_inp), torch.arange(n_inp).float()).to(
target.device
)
loss = 0.0 |
203 | https://:@github.com/bhmm/bhmm.git | 34f1e00dc49a99094b5c492381d9f711e96fc4d9 | @@ -192,7 +192,7 @@ def estimate_initial_hmm(observations, nstates, reversible=True, eps_A=None, eps
# does the count matrix too few closed sets to give nstates metastable states? Then we need a prior
if len(_tmatrix_disconnected.closed_sets(C)) < nstates:
msm_prior = 0.001
- B = msm_prior * np.eye(C_full.shape[0]) # diagonal prior
+ B = msm_prior * np.eye(C.shape[0]) # diagonal prior
B += msmtools.estimation.prior_neighbor(C, alpha=msm_prior) # neighbor prior
C_post = C + B # posterior
P_for_pcca = _tmatrix_disconnected.estimate_P(C_post, reversible=True)
| bhmm/init/discrete.py | ReplaceText(target='C' @(195,31)->(195,37)) | def estimate_initial_hmm(observations, nstates, reversible=True, eps_A=None, eps
# does the count matrix too few closed sets to give nstates metastable states? Then we need a prior
if len(_tmatrix_disconnected.closed_sets(C)) < nstates:
msm_prior = 0.001
B = msm_prior * np.eye(C_full.shape[0]) # diagonal prior
B += msmtools.estimation.prior_neighbor(C, alpha=msm_prior) # neighbor prior
C_post = C + B # posterior
P_for_pcca = _tmatrix_disconnected.estimate_P(C_post, reversible=True) | def estimate_initial_hmm(observations, nstates, reversible=True, eps_A=None, eps
# does the count matrix too few closed sets to give nstates metastable states? Then we need a prior
if len(_tmatrix_disconnected.closed_sets(C)) < nstates:
msm_prior = 0.001
B = msm_prior * np.eye(C.shape[0]) # diagonal prior
B += msmtools.estimation.prior_neighbor(C, alpha=msm_prior) # neighbor prior
C_post = C + B # posterior
P_for_pcca = _tmatrix_disconnected.estimate_P(C_post, reversible=True) |
204 | https://:@github.com/rackspace/pyrax.git | 71a7f1924e2c53a4caac54e2b8eb985c207869c7 | @@ -220,7 +220,7 @@ class ManagerTest(unittest.TestCase):
ret = mgr.findall(some_att="ok")
self.assertTrue(o1 in ret)
self.assertFalse(o2 in ret)
- self.assertTrue(o1 in ret)
+ self.assertTrue(o3 in ret)
mgr.list = sav
def test_findall_bad_att(self):
| tests/unit/test_manager.py | ReplaceText(target='o3' @(223,24)->(223,26)) | class ManagerTest(unittest.TestCase):
ret = mgr.findall(some_att="ok")
self.assertTrue(o1 in ret)
self.assertFalse(o2 in ret)
self.assertTrue(o1 in ret)
mgr.list = sav
def test_findall_bad_att(self): | class ManagerTest(unittest.TestCase):
ret = mgr.findall(some_att="ok")
self.assertTrue(o1 in ret)
self.assertFalse(o2 in ret)
self.assertTrue(o3 in ret)
mgr.list = sav
def test_findall_bad_att(self): |
205 | https://:@github.com/deckbsd/glouton-satnogs-data-downloader.git | 7b3982a3ac4c7ecb086cf6ce504aa766a54f1211 | @@ -25,7 +25,7 @@ class ObservationRepo:
self.__read_page(r.json(), self.__cmd.start_date, self.__cmd.end_date)
page += 1
- params['page'] += str(page)
+ params['page'] = str(page)
print('\ndownloading started (Ctrl + F5 to stop)...\t~( ^o^)~')
self.__create_workers_and_wait()
| repositories/observation/observationsRepo.py | ReplaceText(target='=' @(28,27)->(28,29)) | class ObservationRepo:
self.__read_page(r.json(), self.__cmd.start_date, self.__cmd.end_date)
page += 1
params['page'] += str(page)
print('\ndownloading started (Ctrl + F5 to stop)...\t~( ^o^)~')
self.__create_workers_and_wait() | class ObservationRepo:
self.__read_page(r.json(), self.__cmd.start_date, self.__cmd.end_date)
page += 1
params['page'] = str(page)
print('\ndownloading started (Ctrl + F5 to stop)...\t~( ^o^)~')
self.__create_workers_and_wait() |
206 | https://:@github.com/vmware/pyvcloud.git | e250911c7ba7666c42c2fa197f32744424d647ff | @@ -121,7 +121,7 @@ class VCA(object):
#todo: check if vcloud session can be cached as well...
vCloudSession = self.create_vCloudSession(vdcReference[1])
if vCloudSession:
- vcd = VCD(vCloudSession, serviceId, serviceId)
+ vcd = VCD(vCloudSession, serviceId, vdcId)
return vcd
return None
| pyvcloud/vcloudair.py | ReplaceText(target='vdcId' @(124,52)->(124,61)) | class VCA(object):
#todo: check if vcloud session can be cached as well...
vCloudSession = self.create_vCloudSession(vdcReference[1])
if vCloudSession:
vcd = VCD(vCloudSession, serviceId, serviceId)
return vcd
return None
| class VCA(object):
#todo: check if vcloud session can be cached as well...
vCloudSession = self.create_vCloudSession(vdcReference[1])
if vCloudSession:
vcd = VCD(vCloudSession, serviceId, vdcId)
return vcd
return None
|
207 | https://:@github.com/vmware/pyvcloud.git | 0b7926b141b58afbf94168ac95f1ab3f00f14e71 | @@ -2129,7 +2129,7 @@ class VDC(object):
policy_list = []
for policy_reference in policy_references.VdcComputePolicyReference:
policy_list.append(policy_reference)
- return policy_reference
+ return policy_list
def add_compute_policy(self, href):
"""Add a VdcComputePolicy.
| pyvcloud/vcd/vdc.py | ReplaceText(target='policy_list' @(2132,15)->(2132,31)) | class VDC(object):
policy_list = []
for policy_reference in policy_references.VdcComputePolicyReference:
policy_list.append(policy_reference)
return policy_reference
def add_compute_policy(self, href):
"""Add a VdcComputePolicy. | class VDC(object):
policy_list = []
for policy_reference in policy_references.VdcComputePolicyReference:
policy_list.append(policy_reference)
return policy_list
def add_compute_policy(self, href):
"""Add a VdcComputePolicy. |
208 | https://:@github.com/springer-math/Mathematics-of-Epidemics-on-Networks.git | 1f069443a464955c87cfa926c0ad8c8ce66bc424 | @@ -851,7 +851,7 @@ def get_infected_nodes(G, tau, gamma, initial_infecteds=None):
elif G.has_node(initial_infecteds):
initial_infecteds=[initial_infecteds]
H = directed_percolate_network(G, tau, gamma)
- infected_nodes = _out_component_(G, initial_infecteds)
+ infected_nodes = _out_component_(H, initial_infecteds)
return infected_nodes
| EoN/simulation.py | ReplaceText(target='H' @(854,37)->(854,38)) | def get_infected_nodes(G, tau, gamma, initial_infecteds=None):
elif G.has_node(initial_infecteds):
initial_infecteds=[initial_infecteds]
H = directed_percolate_network(G, tau, gamma)
infected_nodes = _out_component_(G, initial_infecteds)
return infected_nodes
| def get_infected_nodes(G, tau, gamma, initial_infecteds=None):
elif G.has_node(initial_infecteds):
initial_infecteds=[initial_infecteds]
H = directed_percolate_network(G, tau, gamma)
infected_nodes = _out_component_(H, initial_infecteds)
return infected_nodes
|
209 | https://:@github.com/waipbmtd/python-client.git | 3d95fa3fb3d85c14d1b92da348b4f2f0b007424b | @@ -135,7 +135,7 @@ def show(path):
def validate_params(ctx, param, value):
if any(['=' not in item for item in value]):
raise click.BadParameter('Parameters need to be in format <field name>=<value>')
- return dict([tuple(item.split('=', 1)) for item in param])
+ return dict([tuple(item.split('=', 1)) for item in value])
def validate_inplace(ctx, param, value):
| coreapi/commandline.py | ReplaceText(target='value' @(138,55)->(138,60)) | def show(path):
def validate_params(ctx, param, value):
if any(['=' not in item for item in value]):
raise click.BadParameter('Parameters need to be in format <field name>=<value>')
return dict([tuple(item.split('=', 1)) for item in param])
def validate_inplace(ctx, param, value): | def show(path):
def validate_params(ctx, param, value):
if any(['=' not in item for item in value]):
raise click.BadParameter('Parameters need to be in format <field name>=<value>')
return dict([tuple(item.split('=', 1)) for item in value])
def validate_inplace(ctx, param, value): |
210 | https://:@github.com/waipbmtd/python-client.git | e630971368e28989484272ca7774af385ce3ddd6 | @@ -436,7 +436,7 @@ def credentials_show():
@click.option('--auth', metavar="AUTH_SCHEME", help='Auth scheme to apply to the credentials string. Options: "none", "basic". Default is "none".', default='none', type=click.Choice(['none', 'basic']))
def credentials_add(domain, credentials_string, auth):
if auth == 'none':
- header = auth
+ header = credentials_string
elif auth == 'basic':
header = 'Basic ' + b64encode(credentials_string)
credentials = get_credentials()
| coreapi/commandline.py | ReplaceText(target='credentials_string' @(439,17)->(439,21)) | def credentials_show():
@click.option('--auth', metavar="AUTH_SCHEME", help='Auth scheme to apply to the credentials string. Options: "none", "basic". Default is "none".', default='none', type=click.Choice(['none', 'basic']))
def credentials_add(domain, credentials_string, auth):
if auth == 'none':
header = auth
elif auth == 'basic':
header = 'Basic ' + b64encode(credentials_string)
credentials = get_credentials() | def credentials_show():
@click.option('--auth', metavar="AUTH_SCHEME", help='Auth scheme to apply to the credentials string. Options: "none", "basic". Default is "none".', default='none', type=click.Choice(['none', 'basic']))
def credentials_add(domain, credentials_string, auth):
if auth == 'none':
header = credentials_string
elif auth == 'basic':
header = 'Basic ' + b64encode(credentials_string)
credentials = get_credentials() |
211 | https://:@github.com/openfisca/openfisca-survey-manager.git | b1c6e08ca7ddd546171b5623ce0ae04ed9f597fd | @@ -24,7 +24,7 @@ def temporary_store_decorator(config_files_directory = default_config_files_dire
'tmp_directory is not set: {!r} in {}'.format(tmp_directory, read_config_file_name)
assert os.path.isabs(tmp_directory), \
'tmp_directory should be an absolut path: {!r} in {}'.format(tmp_directory, read_config_file_name)
- if os.path.isdir(tmp_directory):
+ if not os.path.isdir(tmp_directory):
'tmp_directory does not exist: {!r} in {}. Creating it.'.format(tmp_directory, read_config_file_name)
os.makedirs(tmp_directory)
| openfisca_survey_manager/temporary.py | ReplaceText(target='not ' @(27,7)->(27,7)) | def temporary_store_decorator(config_files_directory = default_config_files_dire
'tmp_directory is not set: {!r} in {}'.format(tmp_directory, read_config_file_name)
assert os.path.isabs(tmp_directory), \
'tmp_directory should be an absolut path: {!r} in {}'.format(tmp_directory, read_config_file_name)
if os.path.isdir(tmp_directory):
'tmp_directory does not exist: {!r} in {}. Creating it.'.format(tmp_directory, read_config_file_name)
os.makedirs(tmp_directory)
| def temporary_store_decorator(config_files_directory = default_config_files_dire
'tmp_directory is not set: {!r} in {}'.format(tmp_directory, read_config_file_name)
assert os.path.isabs(tmp_directory), \
'tmp_directory should be an absolut path: {!r} in {}'.format(tmp_directory, read_config_file_name)
if not os.path.isdir(tmp_directory):
'tmp_directory does not exist: {!r} in {}. Creating it.'.format(tmp_directory, read_config_file_name)
os.makedirs(tmp_directory)
|
212 | https://:@github.com/ARMmbed/yotta.git | e948620774774810165b28968ce0324b1f5bb953 | @@ -329,7 +329,7 @@ def satisfyTarget(name, version_required, working_directory, update_installed=No
# must rm the old target before continuing
fsutils.rmRf(target_path)
- if not v and update_installed is None:
+ if not v and update_installed is not None:
v = latestSuitableVersion(name, version_required, registry='target')
if not v:
| yotta/lib/access.py | ReplaceText(target=' is not ' @(332,33)->(332,37)) | def satisfyTarget(name, version_required, working_directory, update_installed=No
# must rm the old target before continuing
fsutils.rmRf(target_path)
if not v and update_installed is None:
v = latestSuitableVersion(name, version_required, registry='target')
if not v: | def satisfyTarget(name, version_required, working_directory, update_installed=No
# must rm the old target before continuing
fsutils.rmRf(target_path)
if not v and update_installed is not None:
v = latestSuitableVersion(name, version_required, registry='target')
if not v: |
213 | https://:@github.com/ARMmbed/yotta.git | 06a9d7e69861044818b5a5de490336f6be65d6f1 | @@ -371,7 +371,7 @@ def generateTest(**kwargs):
test_method.__name__ = test_name
setattr(TestCLITestGenerated, test_name, test_method)
-if not util.canBuildNatively():
+if util.canBuildNatively():
forAllReporterTests(generateTest)
else:
print('WARNING: skipping test reporter tests (cannot build natively on this platform)')
| yotta/test/cli/test_test.py | ReplaceText(target='' @(374,3)->(374,7)) | def generateTest(**kwargs):
test_method.__name__ = test_name
setattr(TestCLITestGenerated, test_name, test_method)
if not util.canBuildNatively():
forAllReporterTests(generateTest)
else:
print('WARNING: skipping test reporter tests (cannot build natively on this platform)') | def generateTest(**kwargs):
test_method.__name__ = test_name
setattr(TestCLITestGenerated, test_name, test_method)
if util.canBuildNatively():
forAllReporterTests(generateTest)
else:
print('WARNING: skipping test reporter tests (cannot build natively on this platform)') |
214 | https://:@github.com/b1naryth1ef/disco.git | bd75deb29adcc42f8de451d51e7dbc02eb360b1e | @@ -112,7 +112,7 @@ class Plugin(LoggingClass, PluginDeco):
def register_command(self, func, *args, **kwargs):
wrapped = functools.partial(self._dispatch, 'command', func)
- self.commands[func.__name__] = Command(self, func, *args, **kwargs)
+ self.commands[func.__name__] = Command(self, wrapped, *args, **kwargs)
def destroy(self):
map(lambda k: k.remove(), self._events)
| disco/bot/plugin.py | ReplaceText(target='wrapped' @(115,53)->(115,57)) | class Plugin(LoggingClass, PluginDeco):
def register_command(self, func, *args, **kwargs):
wrapped = functools.partial(self._dispatch, 'command', func)
self.commands[func.__name__] = Command(self, func, *args, **kwargs)
def destroy(self):
map(lambda k: k.remove(), self._events) | class Plugin(LoggingClass, PluginDeco):
def register_command(self, func, *args, **kwargs):
wrapped = functools.partial(self._dispatch, 'command', func)
self.commands[func.__name__] = Command(self, wrapped, *args, **kwargs)
def destroy(self):
map(lambda k: k.remove(), self._events) |
215 | https://:@github.com/b1naryth1ef/disco.git | c5848dbe8b66295598b4e6cad1c5ec8f5cc3a5fb | @@ -305,7 +305,7 @@ class Channel(SlottedModel, Permissible):
return
if self.can(self.client.state.me, Permissions.MANAGE_MESSAGES) and len(messages) > 2:
- for chunk in chunks(messages, 100):
+ for chunk in chunks(message_ids, 100):
self.client.api.channels_messages_delete_bulk(self.id, chunk)
else:
for msg in messages:
| disco/types/channel.py | ReplaceText(target='message_ids' @(308,32)->(308,40)) | class Channel(SlottedModel, Permissible):
return
if self.can(self.client.state.me, Permissions.MANAGE_MESSAGES) and len(messages) > 2:
for chunk in chunks(messages, 100):
self.client.api.channels_messages_delete_bulk(self.id, chunk)
else:
for msg in messages: | class Channel(SlottedModel, Permissible):
return
if self.can(self.client.state.me, Permissions.MANAGE_MESSAGES) and len(messages) > 2:
for chunk in chunks(message_ids, 100):
self.client.api.channels_messages_delete_bulk(self.id, chunk)
else:
for msg in messages: |
216 | https://:@github.com/yuru-yuri/manga-dl.git | 5cbcbd37c4f904720d08074241a890851b94a7dd | @@ -26,7 +26,7 @@ if __name__ == '__main__':
if parse_args.cli:
cli = Cli(args)
# cli
- exit(0 if cli.status else 0)
+ exit(0 if cli.status else 1)
# else run GUI
app = QApplication(argv)
| manga.py | ReplaceText(target='1' @(29,34)->(29,35)) | if __name__ == '__main__':
if parse_args.cli:
cli = Cli(args)
# cli
exit(0 if cli.status else 0)
# else run GUI
app = QApplication(argv) | if __name__ == '__main__':
if parse_args.cli:
cli = Cli(args)
# cli
exit(0 if cli.status else 1)
# else run GUI
app = QApplication(argv) |
217 | https://:@github.com/yuru-yuri/manga-dl.git | f10777831c4c128a6f6a9bb1d9903889a43ad1df | @@ -44,7 +44,7 @@ class WebDriver:
driver_path = self._driver_path()
if not is_file(driver_path):
self.download_drivder()
- self.is_win() and chmod(driver_path, 0o755)
+ self.is_win() or chmod(driver_path, 0o755)
driver = webdriver.Chrome(executable_path=driver_path)
driver.set_window_size(500, 600)
return driver
| src/base_classes/web_driver.py | ReplaceText(target='or' @(47,22)->(47,25)) | class WebDriver:
driver_path = self._driver_path()
if not is_file(driver_path):
self.download_drivder()
self.is_win() and chmod(driver_path, 0o755)
driver = webdriver.Chrome(executable_path=driver_path)
driver.set_window_size(500, 600)
return driver | class WebDriver:
driver_path = self._driver_path()
if not is_file(driver_path):
self.download_drivder()
self.is_win() or chmod(driver_path, 0o755)
driver = webdriver.Chrome(executable_path=driver_path)
driver.set_window_size(500, 600)
return driver |
218 | https://:@github.com/veg/bioext.git | 5fbb2b3fb52d1e59b787713f9d9521124cb2f24b | @@ -217,7 +217,7 @@ def _translate_gapped(seq, *args, **kwds):
elif gaps:
protein += '-' * gaps
gaps = 0
- lwr = j
+ lwr = i
if gaps:
protein += '-' * gaps
else:
| lib/BioExt/_util.py | ReplaceText(target='i' @(220,18)->(220,19)) | def _translate_gapped(seq, *args, **kwds):
elif gaps:
protein += '-' * gaps
gaps = 0
lwr = j
if gaps:
protein += '-' * gaps
else: | def _translate_gapped(seq, *args, **kwds):
elif gaps:
protein += '-' * gaps
gaps = 0
lwr = i
if gaps:
protein += '-' * gaps
else: |
219 | https://:@github.com/python-trio/trio.git | 82253caa8bd59b5b3bbb0ba61d196289c967f838 | @@ -371,7 +371,7 @@ def test_waitid_eintr():
sync_wait_reapable(sleeper.pid)
assert sleeper.wait(timeout=1) == -9
finally:
- if sleeper.returncode is not None:
+ if sleeper.returncode is None:
sleeper.kill()
sleeper.wait()
signal.signal(signal.SIGALRM, old_sigalrm)
| trio/tests/test_subprocess.py | ReplaceText(target=' is ' @(374,29)->(374,37)) | def test_waitid_eintr():
sync_wait_reapable(sleeper.pid)
assert sleeper.wait(timeout=1) == -9
finally:
if sleeper.returncode is not None:
sleeper.kill()
sleeper.wait()
signal.signal(signal.SIGALRM, old_sigalrm) | def test_waitid_eintr():
sync_wait_reapable(sleeper.pid)
assert sleeper.wait(timeout=1) == -9
finally:
if sleeper.returncode is None:
sleeper.kill()
sleeper.wait()
signal.signal(signal.SIGALRM, old_sigalrm) |
220 | https://:@github.com/python-trio/trio.git | 94a587f758f0597cd790505ca7bfbec17a247fb1 | @@ -37,7 +37,7 @@ def test_warn_deprecated(recwarn_always):
assert "water instead" in got.message.args[0]
assert "/issues/1" in got.message.args[0]
assert got.filename == filename
- assert got.lineno == lineno + 1
+ assert got.lineno == lineno - 1
def test_warn_deprecated_no_instead_or_issue(recwarn_always):
| trio/tests/test_deprecate.py | ReplaceText(target='-' @(40,32)->(40,33)) | def test_warn_deprecated(recwarn_always):
assert "water instead" in got.message.args[0]
assert "/issues/1" in got.message.args[0]
assert got.filename == filename
assert got.lineno == lineno + 1
def test_warn_deprecated_no_instead_or_issue(recwarn_always): | def test_warn_deprecated(recwarn_always):
assert "water instead" in got.message.args[0]
assert "/issues/1" in got.message.args[0]
assert got.filename == filename
assert got.lineno == lineno - 1
def test_warn_deprecated_no_instead_or_issue(recwarn_always): |
221 | https://:@github.com/python-trio/trio.git | 8d9effc1d32b8ef2f7a7a02c1b02a4de3f5f8e3d | @@ -90,7 +90,7 @@ def ki_protection_enabled(frame):
if frame.f_code.co_name == "__del__":
return True
frame = frame.f_back
- return False
+ return True
def currently_ki_protected():
| trio/_core/_ki.py | ReplaceText(target='True' @(93,11)->(93,16)) | def ki_protection_enabled(frame):
if frame.f_code.co_name == "__del__":
return True
frame = frame.f_back
return False
def currently_ki_protected(): | def ki_protection_enabled(frame):
if frame.f_code.co_name == "__del__":
return True
frame = frame.f_back
return True
def currently_ki_protected(): |
222 | https://:@github.com/tkrajina/srtm.py.git | b1e1c673b613780c6a7151ab3db53461e2b668c7 | @@ -187,7 +187,7 @@ class GeoElevationData:
for row in range(height):
for column in range(width):
latitude = latitude_from + float(row) / height * (latitude_to - latitude_from)
- longitude = longitude_from + float(column) / height * (longitude_to - longitude_from)
+ longitude = longitude_from + float(column) / width * (longitude_to - longitude_from)
elevation = self.get_elevation(latitude, longitude)
array[row,column] = elevation
| srtm/data.py | ReplaceText(target='width' @(190,65)->(190,71)) | class GeoElevationData:
for row in range(height):
for column in range(width):
latitude = latitude_from + float(row) / height * (latitude_to - latitude_from)
longitude = longitude_from + float(column) / height * (longitude_to - longitude_from)
elevation = self.get_elevation(latitude, longitude)
array[row,column] = elevation
| class GeoElevationData:
for row in range(height):
for column in range(width):
latitude = latitude_from + float(row) / height * (latitude_to - latitude_from)
longitude = longitude_from + float(column) / width * (longitude_to - longitude_from)
elevation = self.get_elevation(latitude, longitude)
array[row,column] = elevation
|
223 | https://:@github.com/tkrajina/srtm.py.git | 771bb0e73e7b478603f73644a8c8f441b0e02e9f | @@ -208,7 +208,7 @@ class GeoElevationData:
for row in range(height):
for column in range(width):
latitude = latitude_from + float(row) / height * (latitude_to - latitude_from)
- longitude = longitude_from + float(column) / height * (longitude_to - longitude_from)
+ longitude = longitude_from + float(column) / width * (longitude_to - longitude_from)
elevation = self.get_elevation(latitude, longitude)
if elevation == None:
color = unknown_color
| srtm/data.py | ReplaceText(target='width' @(211,65)->(211,71)) | class GeoElevationData:
for row in range(height):
for column in range(width):
latitude = latitude_from + float(row) / height * (latitude_to - latitude_from)
longitude = longitude_from + float(column) / height * (longitude_to - longitude_from)
elevation = self.get_elevation(latitude, longitude)
if elevation == None:
color = unknown_color | class GeoElevationData:
for row in range(height):
for column in range(width):
latitude = latitude_from + float(row) / height * (latitude_to - latitude_from)
longitude = longitude_from + float(column) / width * (longitude_to - longitude_from)
elevation = self.get_elevation(latitude, longitude)
if elevation == None:
color = unknown_color |
224 | https://:@github.com/mwouts/nbrmd.git | 628e3f952bb786220efc1e14b976809bf8ea96be | @@ -218,7 +218,7 @@ def readf(nb_file):
'Expected extensions are {}'.format(nb_file,
notebook_extensions))
with io.open(nb_file, encoding='utf-8') as fp:
- return read(nb_file, as_version=4, ext=ext)
+ return read(fp, as_version=4, ext=ext)
def writef(nb, nb_file):
| nbrmd/nbrmd.py | ReplaceText(target='fp' @(221,20)->(221,27)) | def readf(nb_file):
'Expected extensions are {}'.format(nb_file,
notebook_extensions))
with io.open(nb_file, encoding='utf-8') as fp:
return read(nb_file, as_version=4, ext=ext)
def writef(nb, nb_file): | def readf(nb_file):
'Expected extensions are {}'.format(nb_file,
notebook_extensions))
with io.open(nb_file, encoding='utf-8') as fp:
return read(fp, as_version=4, ext=ext)
def writef(nb, nb_file): |
225 | https://:@github.com/mwouts/nbrmd.git | 366614bce3dc65c6e88bcf37c4e2cd31ea36de92 | @@ -63,7 +63,7 @@ def test_load_save_rename_nbpy(nb_file, tmpdir):
cm.save(model=dict(type='notebook', content=nb), path=tmp_ipynb)
# rename nbpy
- cm.rename(tmp_ipynb, 'new.nb.py')
+ cm.rename(tmp_nbpy, 'new.nb.py')
assert not os.path.isfile(str(tmpdir.join(tmp_ipynb)))
assert not os.path.isfile(str(tmpdir.join(tmp_nbpy)))
| tests/test_contentsmanager.py | ReplaceText(target='tmp_nbpy' @(66,14)->(66,23)) | def test_load_save_rename_nbpy(nb_file, tmpdir):
cm.save(model=dict(type='notebook', content=nb), path=tmp_ipynb)
# rename nbpy
cm.rename(tmp_ipynb, 'new.nb.py')
assert not os.path.isfile(str(tmpdir.join(tmp_ipynb)))
assert not os.path.isfile(str(tmpdir.join(tmp_nbpy)))
| def test_load_save_rename_nbpy(nb_file, tmpdir):
cm.save(model=dict(type='notebook', content=nb), path=tmp_ipynb)
# rename nbpy
cm.rename(tmp_nbpy, 'new.nb.py')
assert not os.path.isfile(str(tmpdir.join(tmp_ipynb)))
assert not os.path.isfile(str(tmpdir.join(tmp_nbpy)))
|
226 | https://:@github.com/mwouts/nbrmd.git | 171256b67818ab86f43e35065fc828234e9abf98 | @@ -163,7 +163,7 @@ class CellExporter():
return True
if all([line.startswith('#') for line in self.source]):
return True
- if CellReader(self.ext).read(source)[1] != len(source):
+ if CellReader(self.ext).read(source)[1] < len(source):
return True
return False
| jupytext/cell_to_text.py | ReplaceText(target='<' @(166,48)->(166,50)) | class CellExporter():
return True
if all([line.startswith('#') for line in self.source]):
return True
if CellReader(self.ext).read(source)[1] != len(source):
return True
return False | class CellExporter():
return True
if all([line.startswith('#') for line in self.source]):
return True
if CellReader(self.ext).read(source)[1] < len(source):
return True
return False |
227 | https://:@github.com/mwouts/nbrmd.git | 8048c8d0a09eab875376c7a4d1efb3cd886b8d3c | @@ -122,7 +122,7 @@ def metadata_and_cell_to_header(notebook, text_format, ext):
if lines_to_next_cell is None and notebook.cells:
lines_to_next_cell = pep8_lines_between_cells(header, notebook.cells[0], ext)
else:
- lines_to_next_cell = 0
+ lines_to_next_cell = 1
header.extend([''] * lines_to_next_cell)
| jupytext/header.py | ReplaceText(target='1' @(125,29)->(125,30)) | def metadata_and_cell_to_header(notebook, text_format, ext):
if lines_to_next_cell is None and notebook.cells:
lines_to_next_cell = pep8_lines_between_cells(header, notebook.cells[0], ext)
else:
lines_to_next_cell = 0
header.extend([''] * lines_to_next_cell)
| def metadata_and_cell_to_header(notebook, text_format, ext):
if lines_to_next_cell is None and notebook.cells:
lines_to_next_cell = pep8_lines_between_cells(header, notebook.cells[0], ext)
else:
lines_to_next_cell = 1
header.extend([''] * lines_to_next_cell)
|
228 | https://:@github.com/mwouts/nbrmd.git | 120bebc0d37792cfa1418476d5f26809b996dca8 | @@ -615,7 +615,7 @@ def test_sync(nb_file, tmpdir):
compare_notebooks(nb, nb2)
# ipynb must be older than py file, otherwise our Contents Manager will complain
- assert os.path.getmtime(tmp_ipynb) < os.path.getmtime(tmp_py)
+ assert os.path.getmtime(tmp_ipynb) <= os.path.getmtime(tmp_py)
@pytest.mark.parametrize('nb_file,ext',
| tests/test_cli.py | ReplaceText(target='<=' @(618,39)->(618,40)) | def test_sync(nb_file, tmpdir):
compare_notebooks(nb, nb2)
# ipynb must be older than py file, otherwise our Contents Manager will complain
assert os.path.getmtime(tmp_ipynb) < os.path.getmtime(tmp_py)
@pytest.mark.parametrize('nb_file,ext', | def test_sync(nb_file, tmpdir):
compare_notebooks(nb, nb2)
# ipynb must be older than py file, otherwise our Contents Manager will complain
assert os.path.getmtime(tmp_ipynb) <= os.path.getmtime(tmp_py)
@pytest.mark.parametrize('nb_file,ext', |
229 | https://:@github.com/mwouts/nbrmd.git | dfa96996445cbc7514b93337dbf94d592ba06bad | @@ -19,4 +19,4 @@ def test_identity_source_write_read(nb_file, ext):
R = jupytext.writes(nb1, ext)
nb2 = jupytext.reads(R, ext)
- compare_notebooks(nb1, nb2)
+ compare_notebooks(nb2, nb1)
| tests/test_ipynb_to_R.py | ArgSwap(idxs=0<->1 @(22,4)->(22,21)) | def test_identity_source_write_read(nb_file, ext):
R = jupytext.writes(nb1, ext)
nb2 = jupytext.reads(R, ext)
compare_notebooks(nb1, nb2) | def test_identity_source_write_read(nb_file, ext):
R = jupytext.writes(nb1, ext)
nb2 = jupytext.reads(R, ext)
compare_notebooks(nb2, nb1) |
230 | https://:@github.com/mwouts/nbrmd.git | dfa96996445cbc7514b93337dbf94d592ba06bad | @@ -16,4 +16,4 @@ def test_identity_source_write_read(nb_file):
py = jupytext.writes(nb1, 'py')
nb2 = jupytext.reads(py, 'py')
- compare_notebooks(nb1, nb2)
+ compare_notebooks(nb2, nb1)
| tests/test_ipynb_to_py.py | ArgSwap(idxs=0<->1 @(19,4)->(19,21)) | def test_identity_source_write_read(nb_file):
py = jupytext.writes(nb1, 'py')
nb2 = jupytext.reads(py, 'py')
compare_notebooks(nb1, nb2) | def test_identity_source_write_read(nb_file):
py = jupytext.writes(nb1, 'py')
nb2 = jupytext.reads(py, 'py')
compare_notebooks(nb2, nb1) |
231 | https://:@github.com/mwouts/nbrmd.git | dfa96996445cbc7514b93337dbf94d592ba06bad | @@ -16,4 +16,4 @@ def test_identity_source_write_read(nb_file):
rmd = jupytext.writes(nb1, 'Rmd')
nb2 = jupytext.reads(rmd, 'Rmd')
- compare_notebooks(nb1, nb2, 'Rmd')
+ compare_notebooks(nb2, nb1, 'Rmd')
| tests/test_ipynb_to_rmd.py | ArgSwap(idxs=0<->1 @(19,4)->(19,21)) | def test_identity_source_write_read(nb_file):
rmd = jupytext.writes(nb1, 'Rmd')
nb2 = jupytext.reads(rmd, 'Rmd')
compare_notebooks(nb1, nb2, 'Rmd') | def test_identity_source_write_read(nb_file):
rmd = jupytext.writes(nb1, 'Rmd')
nb2 = jupytext.reads(rmd, 'Rmd')
compare_notebooks(nb2, nb1, 'Rmd') |
232 | https://:@github.com/splunk/splunk-sdk-python.git | 68f87378d5bac7efc97cf118f6754b5a6de73fa3 | @@ -48,7 +48,7 @@ class EventWriter(object):
else:
self._out = TextIOWrapper(output)
- if isinstance(output, TextIOBase):
+ if isinstance(error, TextIOBase):
self._err = error
else:
self._err = TextIOWrapper(error)
| splunklib/modularinput/event_writer.py | ReplaceText(target='error' @(51,22)->(51,28)) | class EventWriter(object):
else:
self._out = TextIOWrapper(output)
if isinstance(output, TextIOBase):
self._err = error
else:
self._err = TextIOWrapper(error) | class EventWriter(object):
else:
self._out = TextIOWrapper(output)
if isinstance(error, TextIOBase):
self._err = error
else:
self._err = TextIOWrapper(error) |
233 | https://:@github.com/tgbugs/pyontutils.git | 78db71bb8b163794ef9bafb5a0ee50453d29971a | @@ -56,7 +56,7 @@ def sysidpath(ignore_options=False):
)
for option in options:
if (option.exists() and
- os.access(options, os.R_OK) and
+ os.access(option, os.R_OK) and
option.stat().st_size > 0):
return option
| pyontutils/utils.py | ReplaceText(target='option' @(59,26)->(59,33)) | def sysidpath(ignore_options=False):
)
for option in options:
if (option.exists() and
os.access(options, os.R_OK) and
option.stat().st_size > 0):
return option
| def sysidpath(ignore_options=False):
)
for option in options:
if (option.exists() and
os.access(option, os.R_OK) and
option.stat().st_size > 0):
return option
|
234 | https://:@github.com/holgern/beem.git | 45ae6dc0380434d3544f5588fa24b379f5a62541 | @@ -224,7 +224,7 @@ class Blockchain(object):
else:
self.steem.rpc.get_block(blocknum, add_to_queue=True)
latest_block = blocknum
- if batches > 1:
+ if batches >= 1:
latest_block += 1
if latest_block <= head_block:
if self.steem.rpc.get_use_appbase():
| beem/blockchain.py | ReplaceText(target='>=' @(227,31)->(227,32)) | class Blockchain(object):
else:
self.steem.rpc.get_block(blocknum, add_to_queue=True)
latest_block = blocknum
if batches > 1:
latest_block += 1
if latest_block <= head_block:
if self.steem.rpc.get_use_appbase(): | class Blockchain(object):
else:
self.steem.rpc.get_block(blocknum, add_to_queue=True)
latest_block = blocknum
if batches >= 1:
latest_block += 1
if latest_block <= head_block:
if self.steem.rpc.get_use_appbase(): |
235 | https://:@github.com/holgern/beem.git | 9eb381d23d582979934e0d3256447aef7d67de55 | @@ -509,7 +509,7 @@ class Testcases(unittest.TestCase):
op_num = account.estimate_virtual_op_num(block_num, stop_diff=0.1, max_count=100)
if op_num > 0:
op_num -= 1
- self.assertTrue(op_num < i)
+ self.assertTrue(op_num <= i)
i += 1
last_block = new_block
| tests/beem/test_account.py | ReplaceText(target='<=' @(512,35)->(512,36)) | class Testcases(unittest.TestCase):
op_num = account.estimate_virtual_op_num(block_num, stop_diff=0.1, max_count=100)
if op_num > 0:
op_num -= 1
self.assertTrue(op_num < i)
i += 1
last_block = new_block
| class Testcases(unittest.TestCase):
op_num = account.estimate_virtual_op_num(block_num, stop_diff=0.1, max_count=100)
if op_num > 0:
op_num -= 1
self.assertTrue(op_num <= i)
i += 1
last_block = new_block
|
236 | https://:@github.com/holgern/beem.git | 5f156fdf5a75367c32d85efb02e456abfa2719f6 | @@ -714,6 +714,6 @@ class RecentByPath(list):
comments = []
for reply in replies:
post = state["content"][reply]
- if category is None or (category is not None and post["category"] != category):
+ if category is None or (category is not None and post["category"] == category):
comments.append(Comment(post, lazy=True, steem_instance=self.steem))
super(RecentByPath, self).__init__(comments)
| beem/comment.py | ReplaceText(target='==' @(717,78)->(717,80)) | class RecentByPath(list):
comments = []
for reply in replies:
post = state["content"][reply]
if category is None or (category is not None and post["category"] != category):
comments.append(Comment(post, lazy=True, steem_instance=self.steem))
super(RecentByPath, self).__init__(comments) | class RecentByPath(list):
comments = []
for reply in replies:
post = state["content"][reply]
if category is None or (category is not None and post["category"] == category):
comments.append(Comment(post, lazy=True, steem_instance=self.steem))
super(RecentByPath, self).__init__(comments) |
237 | https://:@github.com/holgern/beem.git | 7b9ee9c75cbf285d18c1b4913cffe3798444ac30 | @@ -50,7 +50,7 @@ class RC(object):
resource_count["resource_state_bytes"] += state_bytes_count
resource_count["resource_new_accounts"] = new_account_op_count
if market_op_count > 0:
- resource_count["resource_market_bytes"] = market_op_count
+ resource_count["resource_market_bytes"] = tx_size
return resource_count
def comment_dict(self, comment_dict):
| beem/rc.py | ReplaceText(target='tx_size' @(53,54)->(53,69)) | class RC(object):
resource_count["resource_state_bytes"] += state_bytes_count
resource_count["resource_new_accounts"] = new_account_op_count
if market_op_count > 0:
resource_count["resource_market_bytes"] = market_op_count
return resource_count
def comment_dict(self, comment_dict): | class RC(object):
resource_count["resource_state_bytes"] += state_bytes_count
resource_count["resource_new_accounts"] = new_account_op_count
if market_op_count > 0:
resource_count["resource_market_bytes"] = tx_size
return resource_count
def comment_dict(self, comment_dict): |
238 | https://:@github.com/holgern/beem.git | 9e96dc84f9965b25b6b2a56a1bca7b7652b93be8 | @@ -1456,7 +1456,7 @@ class Steem(object):
'key_auths': active_key_authority,
"address_auths": [],
'weight_threshold': 1},
- 'posting': {'account_auths': active_accounts_authority,
+ 'posting': {'account_auths': posting_accounts_authority,
'key_auths': posting_key_authority,
"address_auths": [],
'weight_threshold': 1},
| beem/steem.py | ReplaceText(target='posting_accounts_authority' @(1459,41)->(1459,66)) | class Steem(object):
'key_auths': active_key_authority,
"address_auths": [],
'weight_threshold': 1},
'posting': {'account_auths': active_accounts_authority,
'key_auths': posting_key_authority,
"address_auths": [],
'weight_threshold': 1}, | class Steem(object):
'key_auths': active_key_authority,
"address_auths": [],
'weight_threshold': 1},
'posting': {'account_auths': posting_accounts_authority,
'key_auths': posting_key_authority,
"address_auths": [],
'weight_threshold': 1}, |
239 | https://:@github.com/holgern/beem.git | 8e4214f27e746be7ed01c5d644911c830bfe988a | @@ -135,7 +135,7 @@ class Block(BlockchainObject):
if ops_ops is None:
ops = None
else:
- ops = ops["ops"]
+ ops = ops_ops["ops"]
except ApiNotSupported:
ops = self.steem.rpc.get_ops_in_block(self.identifier, self.only_virtual_ops, api="condenser")
else:
| beem/block.py | ReplaceText(target='ops_ops' @(138,30)->(138,33)) | class Block(BlockchainObject):
if ops_ops is None:
ops = None
else:
ops = ops["ops"]
except ApiNotSupported:
ops = self.steem.rpc.get_ops_in_block(self.identifier, self.only_virtual_ops, api="condenser")
else: | class Block(BlockchainObject):
if ops_ops is None:
ops = None
else:
ops = ops_ops["ops"]
except ApiNotSupported:
ops = self.steem.rpc.get_ops_in_block(self.identifier, self.only_virtual_ops, api="condenser")
else: |
240 | https://:@github.com/holgern/beem.git | d19894c85464f2bc5221e15f858326c4e8efdaf3 | @@ -367,7 +367,7 @@ class ActiveVotes(VotesObject):
elif isinstance(authorperm, string_types):
[author, permlink] = resolve_authorperm(authorperm)
if self.steem.rpc.get_use_appbase():
- self.steem.rpc.set_next_node_on_empty_reply(True)
+ self.steem.rpc.set_next_node_on_empty_reply(False)
try:
votes = self.steem.rpc.get_active_votes(author, permlink, api="condenser")
except:
| beem/vote.py | ReplaceText(target='False' @(370,60)->(370,64)) | class ActiveVotes(VotesObject):
elif isinstance(authorperm, string_types):
[author, permlink] = resolve_authorperm(authorperm)
if self.steem.rpc.get_use_appbase():
self.steem.rpc.set_next_node_on_empty_reply(True)
try:
votes = self.steem.rpc.get_active_votes(author, permlink, api="condenser")
except: | class ActiveVotes(VotesObject):
elif isinstance(authorperm, string_types):
[author, permlink] = resolve_authorperm(authorperm)
if self.steem.rpc.get_use_appbase():
self.steem.rpc.set_next_node_on_empty_reply(False)
try:
votes = self.steem.rpc.get_active_votes(author, permlink, api="condenser")
except: |
241 | https://:@github.com/holgern/beem.git | 8f173f0ab272a57a5c036589dcc19b8543026b3e | @@ -780,7 +780,7 @@ def keygen(import_word_list, strength, passphrase, path, network, role, account_
t.add_row(["Key role", role])
t.add_row(["path", path])
pubkey = ledgertx.ledgertx.get_pubkey(path, request_screen_approval=False)
- aprove_key = PrettyTable(["Approve %s Key" % r])
+ aprove_key = PrettyTable(["Approve %s Key" % role])
aprove_key.align = "l"
aprove_key.add_row([format(pubkey, "STM")])
print(aprove_key)
| beem/cli.py | ReplaceText(target='role' @(783,57)->(783,58)) | def keygen(import_word_list, strength, passphrase, path, network, role, account_
t.add_row(["Key role", role])
t.add_row(["path", path])
pubkey = ledgertx.ledgertx.get_pubkey(path, request_screen_approval=False)
aprove_key = PrettyTable(["Approve %s Key" % r])
aprove_key.align = "l"
aprove_key.add_row([format(pubkey, "STM")])
print(aprove_key) | def keygen(import_word_list, strength, passphrase, path, network, role, account_
t.add_row(["Key role", role])
t.add_row(["path", path])
pubkey = ledgertx.ledgertx.get_pubkey(path, request_screen_approval=False)
aprove_key = PrettyTable(["Approve %s Key" % role])
aprove_key.align = "l"
aprove_key.add_row([format(pubkey, "STM")])
print(aprove_key) |
242 | https://:@github.com/BlackLight/platypush.git | 56b87f343693e89131b3b30930acfeeaec4915fe | @@ -101,7 +101,7 @@ class MqttBackend(Backend):
format(response_topic, response))
client = get_plugin('mqtt')
- client.send_message(topic=self.topic, msg=msg, host=self.host,
+ client.send_message(topic=self.topic, msg=response, host=self.host,
port=self.port, username=self.username,
password=self.password, tls_cafile=self.tls_cafile,
tls_certfile=self.tls_certfile,
| platypush/backend/mqtt.py | ReplaceText(target='response' @(104,58)->(104,61)) | class MqttBackend(Backend):
format(response_topic, response))
client = get_plugin('mqtt')
client.send_message(topic=self.topic, msg=msg, host=self.host,
port=self.port, username=self.username,
password=self.password, tls_cafile=self.tls_cafile,
tls_certfile=self.tls_certfile, | class MqttBackend(Backend):
format(response_topic, response))
client = get_plugin('mqtt')
client.send_message(topic=self.topic, msg=response, host=self.host,
port=self.port, username=self.username,
password=self.password, tls_cafile=self.tls_cafile,
tls_certfile=self.tls_certfile, |
243 | https://:@github.com/BlackLight/platypush.git | c9dc1aac44ec4df76071092f4a17601d97955a38 | @@ -47,7 +47,7 @@ class SensorEnvirophatBackend(SensorBackend):
if enabled and sensor in sensors and sensors[sensor] != self._last_read.get(sensor)
}
- self._last_read = ret
+ self._last_read = sensors
return ret
| platypush/backend/sensor/envirophat.py | ReplaceText(target='sensors' @(50,26)->(50,29)) | class SensorEnvirophatBackend(SensorBackend):
if enabled and sensor in sensors and sensors[sensor] != self._last_read.get(sensor)
}
self._last_read = ret
return ret
| class SensorEnvirophatBackend(SensorBackend):
if enabled and sensor in sensors and sensors[sensor] != self._last_read.get(sensor)
}
self._last_read = sensors
return ret
|
244 | https://:@github.com/BlackLight/platypush.git | 7f440a9160619c699f7e8e58b3c0fad3c80ceaf3 | @@ -46,7 +46,7 @@ class GpioPlugin(Plugin):
import RPi.GPIO as GPIO
with self._init_lock:
- if self._initialized or GPIO.getmode():
+ if self._initialized and GPIO.getmode():
return
GPIO.setmode(self.mode)
| platypush/plugins/gpio/__init__.py | ReplaceText(target='and' @(49,33)->(49,35)) | class GpioPlugin(Plugin):
import RPi.GPIO as GPIO
with self._init_lock:
if self._initialized or GPIO.getmode():
return
GPIO.setmode(self.mode) | class GpioPlugin(Plugin):
import RPi.GPIO as GPIO
with self._init_lock:
if self._initialized and GPIO.getmode():
return
GPIO.setmode(self.mode) |
245 | https://:@github.com/BlackLight/platypush.git | c26d456109fea166f8fb5da25aed1d4fb7fc94ab | @@ -175,7 +175,7 @@ class SensorBackend(Backend):
def process_data(self, data, new_data):
if new_data:
- self.bus.post(SensorDataChangeEvent(data=data, source=self.plugin or self.__class__.__name__))
+ self.bus.post(SensorDataChangeEvent(data=new_data, source=self.plugin or self.__class__.__name__))
def run(self):
super().run()
| platypush/backend/sensor/__init__.py | ReplaceText(target='new_data' @(178,53)->(178,57)) | class SensorBackend(Backend):
def process_data(self, data, new_data):
if new_data:
self.bus.post(SensorDataChangeEvent(data=data, source=self.plugin or self.__class__.__name__))
def run(self):
super().run() | class SensorBackend(Backend):
def process_data(self, data, new_data):
if new_data:
self.bus.post(SensorDataChangeEvent(data=new_data, source=self.plugin or self.__class__.__name__))
def run(self):
super().run() |
246 | https://:@github.com/chrisjsewell/ipypublish.git | cfb66fb74d48cbcc99c695b64fe6336213877e04 | @@ -52,7 +52,7 @@ class LatexDocLinks(Preprocessor):
': {}'.format(bib))
else:
external_files.append(bib)
- resources['bibliopath'] = external_files
+ resources['bibliopath'] = bib
nb.metadata.latex_doc.bibliography = os.path.join(self.filesfolder,
os.path.basename(bib))
| ipypublish/preprocessors/latex_doc.py | ReplaceText(target='bib' @(55,46)->(55,60)) | class LatexDocLinks(Preprocessor):
': {}'.format(bib))
else:
external_files.append(bib)
resources['bibliopath'] = external_files
nb.metadata.latex_doc.bibliography = os.path.join(self.filesfolder,
os.path.basename(bib)) | class LatexDocLinks(Preprocessor):
': {}'.format(bib))
else:
external_files.append(bib)
resources['bibliopath'] = bib
nb.metadata.latex_doc.bibliography = os.path.join(self.filesfolder,
os.path.basename(bib)) |
247 | https://:@github.com/pazz/alot.git | dd7b2a15495ce5fddcac0d34c14e5ef9f1032482 | @@ -64,7 +64,7 @@ class ThreadlineWidget(urwid.AttrMap):
mailcountstring = "(%d)" % self.thread.get_total_messages()
else:
mailcountstring = "(?)"
- datestring = pad(mailcountstring)
+ mailcountstring = pad(mailcountstring)
width = len(mailcountstring)
mailcount_w = AttrFlipWidget(urwid.Text(mailcountstring),
struct['mailcount'])
| alot/widgets/search.py | ReplaceText(target='mailcountstring' @(67,12)->(67,22)) | class ThreadlineWidget(urwid.AttrMap):
mailcountstring = "(%d)" % self.thread.get_total_messages()
else:
mailcountstring = "(?)"
datestring = pad(mailcountstring)
width = len(mailcountstring)
mailcount_w = AttrFlipWidget(urwid.Text(mailcountstring),
struct['mailcount']) | class ThreadlineWidget(urwid.AttrMap):
mailcountstring = "(%d)" % self.thread.get_total_messages()
else:
mailcountstring = "(?)"
mailcountstring = pad(mailcountstring)
width = len(mailcountstring)
mailcount_w = AttrFlipWidget(urwid.Text(mailcountstring),
struct['mailcount']) |
248 | https://:@github.com/luozhouyang/python-string-similarity.git | 5f6717fe6d7cae48a664eaa76a47e3388ffd0cf2 | @@ -33,7 +33,7 @@ class Levenshtein(MetricStringDistance):
if len(s0) == 0:
return len(s1)
if len(s1) == 0:
- return len(s1)
+ return len(s0)
v0 = [0] * (len(s1) + 1)
v1 = [0] * (len(s1) + 1)
| strsimpy/levenshtein.py | ReplaceText(target='s0' @(36,23)->(36,25)) | class Levenshtein(MetricStringDistance):
if len(s0) == 0:
return len(s1)
if len(s1) == 0:
return len(s1)
v0 = [0] * (len(s1) + 1)
v1 = [0] * (len(s1) + 1) | class Levenshtein(MetricStringDistance):
if len(s0) == 0:
return len(s1)
if len(s1) == 0:
return len(s0)
v0 = [0] * (len(s1) + 1)
v1 = [0] * (len(s1) + 1) |
249 | https://:@github.com/ElementsProject/lightning.git | 84b9e3e72b2bf8590603072d709a3ea294dd5483 | @@ -943,7 +943,7 @@ def test_logging(node_factory):
def check_new_log():
log2 = open(logpath).readlines()
- return len(log2) > 1 and log2[0].endswith("Started log due to SIGHUP\n")
+ return len(log2) > 0 and log2[0].endswith("Started log due to SIGHUP\n")
wait_for(check_new_log)
| tests/test_misc.py | ReplaceText(target='0' @(946,27)->(946,28)) | def test_logging(node_factory):
def check_new_log():
log2 = open(logpath).readlines()
return len(log2) > 1 and log2[0].endswith("Started log due to SIGHUP\n")
wait_for(check_new_log)
| def test_logging(node_factory):
def check_new_log():
log2 = open(logpath).readlines()
return len(log2) > 0 and log2[0].endswith("Started log due to SIGHUP\n")
wait_for(check_new_log)
|
250 | https://:@github.com/ElementsProject/lightning.git | c8579b99d01d8b738feadd2d9f541daba5230a63 | @@ -305,7 +305,7 @@ other types. Since 'msgtype' is almost identical, it inherits from this too.
def read(self, io_in: BufferedIOBase, otherfields: Dict[str, Any]) -> Optional[Dict[str, Any]]:
vals = {}
for field in self.fields:
- val = field.fieldtype.read(io_in, otherfields)
+ val = field.fieldtype.read(io_in, vals)
if val is None:
# If first field fails to read, we return None.
if field == self.fields[0]:
| contrib/pyln-proto/pyln/proto/message/message.py | ReplaceText(target='vals' @(308,46)->(308,57)) | other types. Since 'msgtype' is almost identical, it inherits from this too.
def read(self, io_in: BufferedIOBase, otherfields: Dict[str, Any]) -> Optional[Dict[str, Any]]:
vals = {}
for field in self.fields:
val = field.fieldtype.read(io_in, otherfields)
if val is None:
# If first field fails to read, we return None.
if field == self.fields[0]: | other types. Since 'msgtype' is almost identical, it inherits from this too.
def read(self, io_in: BufferedIOBase, otherfields: Dict[str, Any]) -> Optional[Dict[str, Any]]:
vals = {}
for field in self.fields:
val = field.fieldtype.read(io_in, vals)
if val is None:
# If first field fails to read, we return None.
if field == self.fields[0]: |
251 | https://:@github.com/funilrys/PyFunceble.git | c766732abdf31c0c1ce283ee9aa2ec32f0ac7829 | @@ -301,7 +301,7 @@ class Generate(object): # pragma: no cover
regex_blogger = ["create-blog.g?", "87065", "doesn’t exist"]
if self.tested == PyFunceble.CONFIGURATION["domain"]:
- url_to_get = "http://%s" & self.tested
+ url_to_get = "http://%s" % self.tested
else:
url_to_get = self.tested
| PyFunceble/generate.py | ReplaceText(target='%' @(304,37)->(304,38)) | class Generate(object): # pragma: no cover
regex_blogger = ["create-blog.g?", "87065", "doesn’t exist"]
if self.tested == PyFunceble.CONFIGURATION["domain"]:
url_to_get = "http://%s" & self.tested
else:
url_to_get = self.tested
| class Generate(object): # pragma: no cover
regex_blogger = ["create-blog.g?", "87065", "doesn’t exist"]
if self.tested == PyFunceble.CONFIGURATION["domain"]:
url_to_get = "http://%s" % self.tested
else:
url_to_get = self.tested
|
252 | https://:@github.com/funilrys/PyFunceble.git | 08400b05f5f3e20c24c9222a9cb9216d1a76aea5 | @@ -80,7 +80,7 @@ class Load(object): # pylint: disable=too-few-public-methods
def __init__(self, path_to_config):
self.path_to_config = path_to_config
- if path_to_config.endswith(directory_separator):
+ if not path_to_config.endswith(directory_separator):
self.path_to_config += directory_separator
self.path_to_config += PyFunceble.CONFIGURATION_FILENAME
| PyFunceble/config.py | ReplaceText(target='not ' @(83,11)->(83,11)) | class Load(object): # pylint: disable=too-few-public-methods
def __init__(self, path_to_config):
self.path_to_config = path_to_config
if path_to_config.endswith(directory_separator):
self.path_to_config += directory_separator
self.path_to_config += PyFunceble.CONFIGURATION_FILENAME | class Load(object): # pylint: disable=too-few-public-methods
def __init__(self, path_to_config):
self.path_to_config = path_to_config
if not path_to_config.endswith(directory_separator):
self.path_to_config += directory_separator
self.path_to_config += PyFunceble.CONFIGURATION_FILENAME |
253 | https://:@github.com/funilrys/PyFunceble.git | fb9465acb6a7124aa84b8c419c9709243e001f94 | @@ -96,7 +96,7 @@ class Clean:
if (
number_of_tested == 0
or list_to_test[number_of_tested - 1] == list_to_test[-1]
- or number_of_tested == len(list_to_test)
+ or number_of_tested >= len(list_to_test)
):
# * If the number of tested is null,
# or
| PyFunceble/clean.py | ReplaceText(target='>=' @(99,40)->(99,42)) | class Clean:
if (
number_of_tested == 0
or list_to_test[number_of_tested - 1] == list_to_test[-1]
or number_of_tested == len(list_to_test)
):
# * If the number of tested is null,
# or | class Clean:
if (
number_of_tested == 0
or list_to_test[number_of_tested - 1] == list_to_test[-1]
or number_of_tested >= len(list_to_test)
):
# * If the number of tested is null,
# or |
254 | https://:@github.com/funilrys/PyFunceble.git | a9e45c83e13eca92389d0be56634cc45ef601bc1 | @@ -92,7 +92,7 @@ class DBTypeDownloader(DownloaderBase):
f"{PyFunceble.OUTPUTS.db_type.files[PyFunceble.CONFIGURATION.db_type]}"
)
- if is_cloned_version and (
+ if not is_cloned_version and (
PyFunceble.CONFIGURATION.db_type not in not_supported_db_types
):
destination_dir_instance.delete()
| PyFunceble/downloader/db_type.py | ReplaceText(target='not ' @(95,11)->(95,11)) | class DBTypeDownloader(DownloaderBase):
f"{PyFunceble.OUTPUTS.db_type.files[PyFunceble.CONFIGURATION.db_type]}"
)
if is_cloned_version and (
PyFunceble.CONFIGURATION.db_type not in not_supported_db_types
):
destination_dir_instance.delete() | class DBTypeDownloader(DownloaderBase):
f"{PyFunceble.OUTPUTS.db_type.files[PyFunceble.CONFIGURATION.db_type]}"
)
if not is_cloned_version and (
PyFunceble.CONFIGURATION.db_type not in not_supported_db_types
):
destination_dir_instance.delete() |
255 | https://:@github.com/funilrys/PyFunceble.git | 76bc73c57f4ac2865fc89d70ad330be2aa501c08 | @@ -154,7 +154,7 @@ class Credential:
regex = f"{name}=.*"
if not content:
- content += f"{to_write}\n"
+ content = f"{to_write}\n"
continue
if PyFunceble.helpers.Regex(f"^{regex}").get_matching_list(
| PyFunceble/engine/database/loader/credential.py | ReplaceText(target='=' @(157,28)->(157,30)) | class Credential:
regex = f"{name}=.*"
if not content:
content += f"{to_write}\n"
continue
if PyFunceble.helpers.Regex(f"^{regex}").get_matching_list( | class Credential:
regex = f"{name}=.*"
if not content:
content = f"{to_write}\n"
continue
if PyFunceble.helpers.Regex(f"^{regex}").get_matching_list( |
256 | https://:@github.com/valassis-digital-media/conda-mirror.git | e0b34555d779f9b440512f850da39aa5a0e29ece | @@ -85,5 +85,5 @@ def test_handling_bad_package(tmpdir, repodata):
with bz2.BZ2File(bad_pkg_path, 'wb') as f:
f.write("This is a fake package".encode())
assert bad_pkg_name in os.listdir(bad_pkg_root)
- conda_mirror._validate_packages(repodata, local_repo_root)
+ conda_mirror._validate_packages(repodata, bad_pkg_root)
assert bad_pkg_name not in os.listdir(bad_pkg_root)
\ No newline at end of file
| test/test_conda_mirror.py | ReplaceText(target='bad_pkg_root' @(88,46)->(88,61)) | def test_handling_bad_package(tmpdir, repodata):
with bz2.BZ2File(bad_pkg_path, 'wb') as f:
f.write("This is a fake package".encode())
assert bad_pkg_name in os.listdir(bad_pkg_root)
conda_mirror._validate_packages(repodata, local_repo_root)
assert bad_pkg_name not in os.listdir(bad_pkg_root)
\ No newline at end of file | def test_handling_bad_package(tmpdir, repodata):
with bz2.BZ2File(bad_pkg_path, 'wb') as f:
f.write("This is a fake package".encode())
assert bad_pkg_name in os.listdir(bad_pkg_root)
conda_mirror._validate_packages(repodata, bad_pkg_root)
assert bad_pkg_name not in os.listdir(bad_pkg_root)
\ No newline at end of file |
257 | https://:@github.com/fact-project/pycustos.git | e2432cee5bba6dc97b30d0b640c0c92f3bdd6961 | @@ -8,7 +8,7 @@ class Notifier(metaclass=ABCMeta):
self.categories = set(categories)
def handle_message(self, msg):
- if self.categories.intersection(msg.categories) and msg.level > self.level:
+ if self.categories.intersection(msg.categories) and msg.level >= self.level:
self.notify(msg)
@abstractmethod
| custos/notify/base.py | ReplaceText(target='>=' @(11,70)->(11,71)) | class Notifier(metaclass=ABCMeta):
self.categories = set(categories)
def handle_message(self, msg):
if self.categories.intersection(msg.categories) and msg.level > self.level:
self.notify(msg)
@abstractmethod | class Notifier(metaclass=ABCMeta):
self.categories = set(categories)
def handle_message(self, msg):
if self.categories.intersection(msg.categories) and msg.level >= self.level:
self.notify(msg)
@abstractmethod |
258 | https://:@github.com/danilobellini/audiolazy.git | 3119b12f8f0b175b3f55aecf3053ed6a0d1a477a | @@ -249,4 +249,4 @@ def gammatone(freq, bandwidth):
freqs = tee(freq, 4)
resons = [resonator.z_exp, resonator.poles_exp] * 2
return CascadeFilter(reson(f, bw)
- for reson, f, bw in zip(bws, freqs, resons))
+ for reson, f, bw in zip(resons, freqs, bws))
| audiolazy/lazy_auditory.py | ArgSwap(idxs=0<->2 @(252,43)->(252,46)) | def gammatone(freq, bandwidth):
freqs = tee(freq, 4)
resons = [resonator.z_exp, resonator.poles_exp] * 2
return CascadeFilter(reson(f, bw)
for reson, f, bw in zip(bws, freqs, resons)) | def gammatone(freq, bandwidth):
freqs = tee(freq, 4)
resons = [resonator.z_exp, resonator.poles_exp] * 2
return CascadeFilter(reson(f, bw)
for reson, f, bw in zip(resons, freqs, bws)) |
259 | https://:@github.com/ojii/django-sekizai.git | b0b50e0713a90e84acabe1ab39e951421fd4aa7a | @@ -91,6 +91,6 @@ class CSSSingleFileFilter(BaseMinifierFilter):
mtime = os.path.getmtime(master)
for f in files:
fpath = media_url_to_filepath(f)
- if os.path.getmtime(fpath) > mtime:
+ if os.path.getmtime(fpath) >= mtime:
return True
return False
\ No newline at end of file
| sekizai/filters/css.py | ReplaceText(target='>=' @(94,39)->(94,40)) | class CSSSingleFileFilter(BaseMinifierFilter):
mtime = os.path.getmtime(master)
for f in files:
fpath = media_url_to_filepath(f)
if os.path.getmtime(fpath) > mtime:
return True
return False
\ No newline at end of file | class CSSSingleFileFilter(BaseMinifierFilter):
mtime = os.path.getmtime(master)
for f in files:
fpath = media_url_to_filepath(f)
if os.path.getmtime(fpath) >= mtime:
return True
return False
\ No newline at end of file |
260 | https://:@github.com/websocket-client/websocket-client.git | 6410340fca47f258d50a34646138ba03b2b2783b | @@ -183,7 +183,7 @@ def _tunnel(sock, host, port, auth):
if status != 200:
raise WebSocketProxyException(
- "failed CONNECT via proxy status: %r" + status)
+ "failed CONNECT via proxy status: %r" % status)
return sock
| websocket/_http.py | ReplaceText(target='%' @(186,50)->(186,51)) | def _tunnel(sock, host, port, auth):
if status != 200:
raise WebSocketProxyException(
"failed CONNECT via proxy status: %r" + status)
return sock
| def _tunnel(sock, host, port, auth):
if status != 200:
raise WebSocketProxyException(
"failed CONNECT via proxy status: %r" % status)
return sock
|
261 | https://:@github.com/getsentry/raven-python.git | dedca8e5c98124f6a43a18986e142e8cb7ecc3cf | @@ -59,7 +59,7 @@ def setup_logging(handler, exclude=['raven', 'sentry.errors']):
Returns a boolean based on if logging was configured or not.
"""
logger = logging.getLogger()
- if handler.__class__ not in map(type, logger.handlers):
+ if handler.__class__ in map(type, logger.handlers):
return False
logger.addHandler(handler)
| raven/conf/__init__.py | ReplaceText(target=' in ' @(62,24)->(62,32)) | def setup_logging(handler, exclude=['raven', 'sentry.errors']):
Returns a boolean based on if logging was configured or not.
"""
logger = logging.getLogger()
if handler.__class__ not in map(type, logger.handlers):
return False
logger.addHandler(handler) | def setup_logging(handler, exclude=['raven', 'sentry.errors']):
Returns a boolean based on if logging was configured or not.
"""
logger = logging.getLogger()
if handler.__class__ in map(type, logger.handlers):
return False
logger.addHandler(handler) |
262 | https://:@github.com/getsentry/raven-python.git | f0ad0ca6a9de44128982de50c30157b779b69d71 | @@ -16,7 +16,7 @@ class TransportRegistry(object):
self.register_transport(transport)
def register_transport(self, transport):
- if not hasattr(transport, 'scheme') and not hasattr(transport.scheme, '__iter__'):
+ if not hasattr(transport, 'scheme') or not hasattr(transport.scheme, '__iter__'):
raise AttributeError('Transport %s must have a scheme list', transport.__class__.__name__)
for scheme in transport.scheme:
| raven/transport/registry.py | ReplaceText(target='or' @(19,44)->(19,47)) | class TransportRegistry(object):
self.register_transport(transport)
def register_transport(self, transport):
if not hasattr(transport, 'scheme') and not hasattr(transport.scheme, '__iter__'):
raise AttributeError('Transport %s must have a scheme list', transport.__class__.__name__)
for scheme in transport.scheme: | class TransportRegistry(object):
self.register_transport(transport)
def register_transport(self, transport):
if not hasattr(transport, 'scheme') or not hasattr(transport.scheme, '__iter__'):
raise AttributeError('Transport %s must have a scheme list', transport.__class__.__name__)
for scheme in transport.scheme: |
263 | https://:@github.com/ilius/pyglossary.git | 8ad925bbb4ce19207322471c4c758d1a66f0db9d | @@ -186,7 +186,7 @@ def write(
with open(filePathBase + ".xml", "w", encoding="utf8") as toFile:
write_header(glos, toFile, frontBackMatter)
for entryI, entry in enumerate(glos):
- if glos.isData():
+ if entry.isData():
entry.save(myResDir)
continue
| pyglossary/plugins/appledict/__init__.py | ReplaceText(target='entry' @(189,6)->(189,10)) | def write(
with open(filePathBase + ".xml", "w", encoding="utf8") as toFile:
write_header(glos, toFile, frontBackMatter)
for entryI, entry in enumerate(glos):
if glos.isData():
entry.save(myResDir)
continue
| def write(
with open(filePathBase + ".xml", "w", encoding="utf8") as toFile:
write_header(glos, toFile, frontBackMatter)
for entryI, entry in enumerate(glos):
if entry.isData():
entry.save(myResDir)
continue
|
264 | https://:@github.com/ilius/pyglossary.git | 194fea3e176f5c9caf090a58bee3c5b04fd483ef | @@ -450,7 +450,7 @@ class Glossary(GlossaryType):
wordCount = len(reader)
except Exception:
log.exception("")
- if wordCount > 0:
+ if wordCount >= 0:
progressbar = True
if progressbar:
self.progressInit("Converting")
| pyglossary/glossary.py | ReplaceText(target='>=' @(453,17)->(453,18)) | class Glossary(GlossaryType):
wordCount = len(reader)
except Exception:
log.exception("")
if wordCount > 0:
progressbar = True
if progressbar:
self.progressInit("Converting") | class Glossary(GlossaryType):
wordCount = len(reader)
except Exception:
log.exception("")
if wordCount >= 0:
progressbar = True
if progressbar:
self.progressInit("Converting") |
265 | https://:@github.com/ilius/pyglossary.git | a7237c6749dcd2f2cf34b5f8ec385b6ba0b5565a | @@ -99,7 +99,7 @@ class TextGlossaryReader(object):
try:
wordDefi = self.nextPair()
except StopIteration as e:
- if self._fileIndex < self._fileCount + 1:
+ if self._fileIndex < self._fileCount - 1:
if self.openNextFile():
return self.__next__()
self._wordCount = self._pos
| pyglossary/text_reader.py | ReplaceText(target='-' @(102,40)->(102,41)) | class TextGlossaryReader(object):
try:
wordDefi = self.nextPair()
except StopIteration as e:
if self._fileIndex < self._fileCount + 1:
if self.openNextFile():
return self.__next__()
self._wordCount = self._pos | class TextGlossaryReader(object):
try:
wordDefi = self.nextPair()
except StopIteration as e:
if self._fileIndex < self._fileCount - 1:
if self.openNextFile():
return self.__next__()
self._wordCount = self._pos |
266 | https://:@github.com/GOVCERT-LU/eml_parser.git | 5a129fd37081de0c3483a317e4eefced52fed44d | @@ -636,7 +636,7 @@ def parse_email(msg, include_raw_body=False, include_attachment_data=False):
if list_observed_dom:
bodie['domain'] = list(set(list_observed_dom))
- if list_observed_dom:
+ if list_observed_ip:
bodie['ip'] = list(set(list_observed_ip))
else:
| eml_parser/eml_parser.py | ReplaceText(target='list_observed_ip' @(639,15)->(639,32)) | def parse_email(msg, include_raw_body=False, include_attachment_data=False):
if list_observed_dom:
bodie['domain'] = list(set(list_observed_dom))
if list_observed_dom:
bodie['ip'] = list(set(list_observed_ip))
else: | def parse_email(msg, include_raw_body=False, include_attachment_data=False):
if list_observed_dom:
bodie['domain'] = list(set(list_observed_dom))
if list_observed_ip:
bodie['ip'] = list(set(list_observed_ip))
else: |
267 | https://:@github.com/noripyt/wagtail-react-streamfield.git | fcd366318ffd0f20f93efcc58e00658f1334899c | @@ -75,4 +75,4 @@ class NewListBlock(ListBlock):
_('The maximum number of items is %d') % self.meta.max_num
)
- return value
+ return result
| wagtail_react_streamfield/blocks/list_block.py | ReplaceText(target='result' @(78,15)->(78,20)) | class NewListBlock(ListBlock):
_('The maximum number of items is %d') % self.meta.max_num
)
return value | class NewListBlock(ListBlock):
_('The maximum number of items is %d') % self.meta.max_num
)
return result |
268 | https://:@github.com/noripyt/wagtail-react-streamfield.git | 4a33dab16bc9665349e6aaa011df3a47eea25277 | @@ -43,7 +43,7 @@ class NewBlock(Block):
else errors.as_data()[0].params.get(NON_FIELD_ERRORS, ()))
else:
non_block_errors = errors
- if help_text and non_block_errors:
+ if help_text or non_block_errors:
return render_to_string(
'wagtailadmin/block_forms/blocks_container.html',
{
| wagtail_react_streamfield/blocks/block.py | ReplaceText(target='or' @(46,21)->(46,24)) | class NewBlock(Block):
else errors.as_data()[0].params.get(NON_FIELD_ERRORS, ()))
else:
non_block_errors = errors
if help_text and non_block_errors:
return render_to_string(
'wagtailadmin/block_forms/blocks_container.html',
{ | class NewBlock(Block):
else errors.as_data()[0].params.get(NON_FIELD_ERRORS, ()))
else:
non_block_errors = errors
if help_text or non_block_errors:
return render_to_string(
'wagtailadmin/block_forms/blocks_container.html',
{ |
269 | https://:@github.com/PMBio/MOFA.git | f7cd442f209ce679001b67e2ed439016bdef6991 | @@ -82,7 +82,7 @@ class initModel(object):
elif qmean == "pca": # Latent variables are initialised from PCA in the concatenated matrix
pca = sklearn.decomposition.PCA(n_components=self.K, copy=True, whiten=True)
- pca.fit(s.concatenate(self.data,axis=0).T)
+ pca.fit(s.concatenate(self.data,axis=1).T)
qmean = pca.components_.T
elif isinstance(qmean,s.ndarray):
| mofa/core/init_nodes.py | ReplaceText(target='1' @(85,57)->(85,58)) | class initModel(object):
elif qmean == "pca": # Latent variables are initialised from PCA in the concatenated matrix
pca = sklearn.decomposition.PCA(n_components=self.K, copy=True, whiten=True)
pca.fit(s.concatenate(self.data,axis=0).T)
qmean = pca.components_.T
elif isinstance(qmean,s.ndarray): | class initModel(object):
elif qmean == "pca": # Latent variables are initialised from PCA in the concatenated matrix
pca = sklearn.decomposition.PCA(n_components=self.K, copy=True, whiten=True)
pca.fit(s.concatenate(self.data,axis=1).T)
qmean = pca.components_.T
elif isinstance(qmean,s.ndarray): |
270 | https://:@github.com/twisted/tubes.git | 836d6021f14ad923bb595dffb0a6ca39f0b884b5 | @@ -168,7 +168,7 @@ class _SiphonFount(_SiphonPiece):
def _actuallyPause():
fount = self._siphon._tdrain.fount
self._siphon._pending.suspend()
- if fount is None:
+ if fount is not None:
pbpc = fount.pauseFlow()
else:
pbpc = NoPause()
| tubes/_siphon.py | ReplaceText(target=' is not ' @(171,20)->(171,24)) | class _SiphonFount(_SiphonPiece):
def _actuallyPause():
fount = self._siphon._tdrain.fount
self._siphon._pending.suspend()
if fount is None:
pbpc = fount.pauseFlow()
else:
pbpc = NoPause() | class _SiphonFount(_SiphonPiece):
def _actuallyPause():
fount = self._siphon._tdrain.fount
self._siphon._pending.suspend()
if fount is not None:
pbpc = fount.pauseFlow()
else:
pbpc = NoPause() |
271 | https://:@github.com/deschler/django-modeltranslation.git | 656dca3e4031d8f030a0aae833fc43c0c09cb51c | @@ -57,7 +57,7 @@ class TranslationBaseModelAdmin(BaseModelAdmin):
else:
orig_formfield = self.formfield_for_dbfield(orig_field, **kwargs)
field.widget = deepcopy(orig_formfield.widget)
- if orig_field.null and isinstance(field.widget, (forms.TextInput, forms.Textarea)):
+ if db_field.null and isinstance(field.widget, (forms.TextInput, forms.Textarea)):
field.widget = ClearableWidgetWrapper(field.widget)
css_classes = field.widget.attrs.get('class', '').split(' ')
css_classes.append('mt')
| modeltranslation/admin.py | ReplaceText(target='db_field' @(60,15)->(60,25)) | class TranslationBaseModelAdmin(BaseModelAdmin):
else:
orig_formfield = self.formfield_for_dbfield(orig_field, **kwargs)
field.widget = deepcopy(orig_formfield.widget)
if orig_field.null and isinstance(field.widget, (forms.TextInput, forms.Textarea)):
field.widget = ClearableWidgetWrapper(field.widget)
css_classes = field.widget.attrs.get('class', '').split(' ')
css_classes.append('mt') | class TranslationBaseModelAdmin(BaseModelAdmin):
else:
orig_formfield = self.formfield_for_dbfield(orig_field, **kwargs)
field.widget = deepcopy(orig_formfield.widget)
if db_field.null and isinstance(field.widget, (forms.TextInput, forms.Textarea)):
field.widget = ClearableWidgetWrapper(field.widget)
css_classes = field.widget.attrs.get('class', '').split(' ')
css_classes.append('mt') |
272 | https://:@github.com/xcgspring/AXUI.git | 82f7d6f7f2565d28553fda3c12bb1a2aafb5bab9 | @@ -123,7 +123,7 @@ class AppMap(object):
UI_element_group.stop_func = self.get_func_by_name(xml_element.attrib["stop_func"])
if xml_element.attrib.has_key("identifier"):
UI_element_group.identifier_string = xml_element.attrib["identifier"]
- UI_element_group.identifier = identifier_parser.parse(UI_element.identifier_string, lexer=identifier_lexer)
+ UI_element_group.identifier = identifier_parser.parse(UI_element_group.identifier_string, lexer=identifier_lexer)
return UI_element_group
| AXUI/XML/app_map.py | ReplaceText(target='UI_element_group' @(126,70)->(126,80)) | class AppMap(object):
UI_element_group.stop_func = self.get_func_by_name(xml_element.attrib["stop_func"])
if xml_element.attrib.has_key("identifier"):
UI_element_group.identifier_string = xml_element.attrib["identifier"]
UI_element_group.identifier = identifier_parser.parse(UI_element.identifier_string, lexer=identifier_lexer)
return UI_element_group
| class AppMap(object):
UI_element_group.stop_func = self.get_func_by_name(xml_element.attrib["stop_func"])
if xml_element.attrib.has_key("identifier"):
UI_element_group.identifier_string = xml_element.attrib["identifier"]
UI_element_group.identifier = identifier_parser.parse(UI_element_group.identifier_string, lexer=identifier_lexer)
return UI_element_group
|
273 | https://:@github.com/docker/compose.git | 0e19c92e82c75f821c231367b5cda88eefdf1427 | @@ -577,7 +577,7 @@ class VolumeConfigTest(unittest.TestCase):
def test_volume_path_with_non_ascii_directory(self):
volume = u'/Füü/data:/data'
- container_path = config.resolve_volume_path(volume, ".", "test")
+ container_path = config.resolve_volume_path(".", volume, "test")
self.assertEqual(container_path, volume)
| tests/unit/config/config_test.py | ArgSwap(idxs=0<->1 @(580,25)->(580,51)) | class VolumeConfigTest(unittest.TestCase):
def test_volume_path_with_non_ascii_directory(self):
volume = u'/Füü/data:/data'
container_path = config.resolve_volume_path(volume, ".", "test")
self.assertEqual(container_path, volume)
| class VolumeConfigTest(unittest.TestCase):
def test_volume_path_with_non_ascii_directory(self):
volume = u'/Füü/data:/data'
container_path = config.resolve_volume_path(".", volume, "test")
self.assertEqual(container_path, volume)
|
274 | https://:@github.com/docker/compose.git | c4f59e731d540780a767d105bcb8d7d164ba4cd5 | @@ -577,7 +577,7 @@ class VolumeConfigTest(unittest.TestCase):
def test_volume_path_with_non_ascii_directory(self):
volume = u'/Füü/data:/data'
- container_path = config.resolve_volume_path(volume, ".", "test")
+ container_path = config.resolve_volume_path(".", volume, "test")
self.assertEqual(container_path, volume)
| tests/unit/config/config_test.py | ArgSwap(idxs=0<->1 @(580,25)->(580,51)) | class VolumeConfigTest(unittest.TestCase):
def test_volume_path_with_non_ascii_directory(self):
volume = u'/Füü/data:/data'
container_path = config.resolve_volume_path(volume, ".", "test")
self.assertEqual(container_path, volume)
| class VolumeConfigTest(unittest.TestCase):
def test_volume_path_with_non_ascii_directory(self):
volume = u'/Füü/data:/data'
container_path = config.resolve_volume_path(".", volume, "test")
self.assertEqual(container_path, volume)
|
275 | https://:@github.com/ranaroussi/qtpylib.git | e5eac01b67e908823c80b1bdeac57dcb68dbb164 | @@ -65,7 +65,7 @@ def _gen_symbol_group(sym):
def _gen_asset_class(sym):
sym_class = str(sym).split("_")
- if len(sym_class) > 0:
+ if len(sym_class) > 1:
return sym_class[1]
return "STK"
| qtpylib/blotter.py | ReplaceText(target='1' @(68,24)->(68,25)) | def _gen_symbol_group(sym):
def _gen_asset_class(sym):
sym_class = str(sym).split("_")
if len(sym_class) > 0:
return sym_class[1]
return "STK"
| def _gen_symbol_group(sym):
def _gen_asset_class(sym):
sym_class = str(sym).split("_")
if len(sym_class) > 1:
return sym_class[1]
return "STK"
|
276 | https://:@github.com/lmjohns3/theanets.git | 507eac0d7fe007cdc93d89ca6cb0db9521908eac | @@ -253,7 +253,7 @@ class Network(object):
h = self.hiddens[-1]
a, b = self.weights[i].get_value(borrow=True).shape
logging.info('tied weights from layer %d: %s x %s', i, b, a)
- o = theano.shared(np.zeros((b, ), FLOAT), name='b_out{}'.format(i))
+ o = theano.shared(np.zeros((a, ), FLOAT), name='b_out{}'.format(i))
self.preacts.append(TT.dot(h, self.weights[i].T) + o)
func = self._output_func if i == 0 else self._hidden_func
self.hiddens.append(func(self.preacts[-1]))
| theanets/feedforward.py | ReplaceText(target='a' @(256,44)->(256,45)) | class Network(object):
h = self.hiddens[-1]
a, b = self.weights[i].get_value(borrow=True).shape
logging.info('tied weights from layer %d: %s x %s', i, b, a)
o = theano.shared(np.zeros((b, ), FLOAT), name='b_out{}'.format(i))
self.preacts.append(TT.dot(h, self.weights[i].T) + o)
func = self._output_func if i == 0 else self._hidden_func
self.hiddens.append(func(self.preacts[-1])) | class Network(object):
h = self.hiddens[-1]
a, b = self.weights[i].get_value(borrow=True).shape
logging.info('tied weights from layer %d: %s x %s', i, b, a)
o = theano.shared(np.zeros((a, ), FLOAT), name='b_out{}'.format(i))
self.preacts.append(TT.dot(h, self.weights[i].T) + o)
func = self._output_func if i == 0 else self._hidden_func
self.hiddens.append(func(self.preacts[-1])) |
277 | https://:@github.com/lmjohns3/theanets.git | 62f7125e1b179df846fdcd5d213c8bca18595648 | @@ -83,7 +83,7 @@ class SequenceDataset:
slices = [slice(None), slice(None)]
self.batches = []
i = 0
- while i + size < shape[axis]:
+ while i + size <= shape[axis]:
slices[axis] = slice(i, i + size)
self.batches.append([d[tuple(slices)] for d in data])
i += size
| theanets/dataset.py | ReplaceText(target='<=' @(86,27)->(86,28)) | class SequenceDataset:
slices = [slice(None), slice(None)]
self.batches = []
i = 0
while i + size < shape[axis]:
slices[axis] = slice(i, i + size)
self.batches.append([d[tuple(slices)] for d in data])
i += size | class SequenceDataset:
slices = [slice(None), slice(None)]
self.batches = []
i = 0
while i + size <= shape[axis]:
slices[axis] = slice(i, i + size)
self.batches.append([d[tuple(slices)] for d in data])
i += size |
278 | https://:@github.com/lmjohns3/theanets.git | 8fa4792eaae89e4da7d041178fdcb341f5313914 | @@ -834,4 +834,4 @@ class Classifier(Network):
k : ndarray (num-examples, )
A vector of class index values, one per row of input data.
'''
- return self.predict(x).argmax(axis=1)
+ return self.predict(x).argmax(axis=-1)
| theanets/feedforward.py | ReplaceText(target='-1' @(837,43)->(837,44)) | class Classifier(Network):
k : ndarray (num-examples, )
A vector of class index values, one per row of input data.
'''
return self.predict(x).argmax(axis=1) | class Classifier(Network):
k : ndarray (num-examples, )
A vector of class index values, one per row of input data.
'''
return self.predict(x).argmax(axis=-1) |
279 | https://:@github.com/lmjohns3/theanets.git | 114f37976b5c00330da9c5fed75ecf7b727eff58 | @@ -338,7 +338,7 @@ class Network(object):
if i == 0:
noise = kwargs.get('input_noise', 0)
dropout = kwargs.get('input_dropouts', 0)
- elif i == len(self.layers) - 1:
+ elif i != len(self.layers) - 1:
noise = kwargs.get('hidden_noise', 0)
dropout = kwargs.get('hidden_dropouts', 0)
out, mon, upd = layer.connect(inputs, noise=noise, dropout=dropout)
| theanets/graph.py | ReplaceText(target='!=' @(341,23)->(341,25)) | class Network(object):
if i == 0:
noise = kwargs.get('input_noise', 0)
dropout = kwargs.get('input_dropouts', 0)
elif i == len(self.layers) - 1:
noise = kwargs.get('hidden_noise', 0)
dropout = kwargs.get('hidden_dropouts', 0)
out, mon, upd = layer.connect(inputs, noise=noise, dropout=dropout) | class Network(object):
if i == 0:
noise = kwargs.get('input_noise', 0)
dropout = kwargs.get('input_dropouts', 0)
elif i != len(self.layers) - 1:
noise = kwargs.get('hidden_noise', 0)
dropout = kwargs.get('hidden_dropouts', 0)
out, mon, upd = layer.connect(inputs, noise=noise, dropout=dropout) |
280 | https://:@github.com/pyiron/pyiron_base.git | f9ea8a31ec8fe36704c4c8f73e127ee3e077ca3a | @@ -98,7 +98,7 @@ class Vasprun(object):
d["cells"] = np.array(d["cells"])
d["positions"] = np.array(d["positions"])
# Check if the parsed coordinates are in absolute/relative coordinates. If absolute, convert to relative
- if len(np.argwhere(d["positions"].flatten() > 1).flatten()) / len(d["positions"].flatten()) < 0.01:
+ if len(np.argwhere(d["positions"].flatten() > 1).flatten()) / len(d["positions"].flatten()) > 0.01:
pos_new = d["positions"].copy()
for i, pos in enumerate(pos_new):
d["positions"][i] = np.dot(pos, np.linalg.inv(d["cells"][i]))
| pyiron_vasp/vasprun.py | ReplaceText(target='>' @(101,100)->(101,101)) | class Vasprun(object):
d["cells"] = np.array(d["cells"])
d["positions"] = np.array(d["positions"])
# Check if the parsed coordinates are in absolute/relative coordinates. If absolute, convert to relative
if len(np.argwhere(d["positions"].flatten() > 1).flatten()) / len(d["positions"].flatten()) < 0.01:
pos_new = d["positions"].copy()
for i, pos in enumerate(pos_new):
d["positions"][i] = np.dot(pos, np.linalg.inv(d["cells"][i])) | class Vasprun(object):
d["cells"] = np.array(d["cells"])
d["positions"] = np.array(d["positions"])
# Check if the parsed coordinates are in absolute/relative coordinates. If absolute, convert to relative
if len(np.argwhere(d["positions"].flatten() > 1).flatten()) / len(d["positions"].flatten()) > 0.01:
pos_new = d["positions"].copy()
for i, pos in enumerate(pos_new):
d["positions"][i] = np.dot(pos, np.linalg.inv(d["cells"][i])) |
281 | https://:@github.com/pyiron/pyiron_base.git | 5d9677db9fcbca5fce348a7208830467381cd643 | @@ -487,7 +487,7 @@ class ParallelMaster(GenericMaster):
job_lst.append(ham._process)
ham = next(self._job_generator, None)
if ham is None and self.server.run_mode.modal:
- while ham is not None:
+ while ham is None:
time.sleep(10)
ham = next(self._job_generator, None)
else:
| pyiron_base/objects/job/parallel.py | ReplaceText(target=' is ' @(490,29)->(490,37)) | class ParallelMaster(GenericMaster):
job_lst.append(ham._process)
ham = next(self._job_generator, None)
if ham is None and self.server.run_mode.modal:
while ham is not None:
time.sleep(10)
ham = next(self._job_generator, None)
else: | class ParallelMaster(GenericMaster):
job_lst.append(ham._process)
ham = next(self._job_generator, None)
if ham is None and self.server.run_mode.modal:
while ham is None:
time.sleep(10)
ham = next(self._job_generator, None)
else: |
282 | https://:@github.com/pyiron/pyiron_base.git | a4ed8375fa375ff740a8334f7ce5eb5bf9d7d4a2 | @@ -477,7 +477,7 @@ class Settings(with_metaclass(Singleton)):
else:
# SQLite is raising ugly error messages when the database directory does not exist.
if config["sql_file"] is None:
- if len(config["resource_paths"]) > 1:
+ if len(config["resource_paths"]) >= 1:
config["sql_file"] = "/".join(
[config["resource_paths"][0], "pyiron.db"]
)
| pyiron_base/settings/generic.py | ReplaceText(target='>=' @(480,49)->(480,50)) | class Settings(with_metaclass(Singleton)):
else:
# SQLite is raising ugly error messages when the database directory does not exist.
if config["sql_file"] is None:
if len(config["resource_paths"]) > 1:
config["sql_file"] = "/".join(
[config["resource_paths"][0], "pyiron.db"]
) | class Settings(with_metaclass(Singleton)):
else:
# SQLite is raising ugly error messages when the database directory does not exist.
if config["sql_file"] is None:
if len(config["resource_paths"]) >= 1:
config["sql_file"] = "/".join(
[config["resource_paths"][0], "pyiron.db"]
) |
283 | https://:@github.com/ESSolutions/django-mssql-backend.git | 06578347a5e775088cfe3a2c2e9c528c5ffb7de0 | @@ -201,7 +201,7 @@ class DatabaseWrapper(BaseDatabaseWrapper):
# Only append DRIVER if DATABASE_ODBC_DSN hasn't been set
cstr_parts.append('DRIVER={%s}' % driver)
if ms_drivers.match(driver) or driver == 'FreeTDS' and \
- conn_params.get('host_is_server', False):
+ options.get('host_is_server', False):
if port:
host += ';PORT=%s' % port
cstr_parts.append('SERVER=%s' % host)
| sql_server/pyodbc/base.py | ReplaceText(target='options' @(204,16)->(204,27)) | class DatabaseWrapper(BaseDatabaseWrapper):
# Only append DRIVER if DATABASE_ODBC_DSN hasn't been set
cstr_parts.append('DRIVER={%s}' % driver)
if ms_drivers.match(driver) or driver == 'FreeTDS' and \
conn_params.get('host_is_server', False):
if port:
host += ';PORT=%s' % port
cstr_parts.append('SERVER=%s' % host) | class DatabaseWrapper(BaseDatabaseWrapper):
# Only append DRIVER if DATABASE_ODBC_DSN hasn't been set
cstr_parts.append('DRIVER={%s}' % driver)
if ms_drivers.match(driver) or driver == 'FreeTDS' and \
options.get('host_is_server', False):
if port:
host += ';PORT=%s' % port
cstr_parts.append('SERVER=%s' % host) |
284 | https://:@github.com/bykof/billomapy.git | 29dc1fcd8f491c158a713b07680ea1305748c959 | @@ -112,7 +112,7 @@ todo_include_todos = False
# a list of builtin themes.
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
-if not on_rtd: # only import and set the theme if we're building docs locally
+if on_rtd: # only import and set the theme if we're building docs locally
import sphinx_rtd_theme
html_theme = 'sphinx_rtd_theme'
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
| docs/source/conf.py | ReplaceText(target='' @(115,3)->(115,7)) | todo_include_todos = False
# a list of builtin themes.
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
if not on_rtd: # only import and set the theme if we're building docs locally
import sphinx_rtd_theme
html_theme = 'sphinx_rtd_theme'
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()] | todo_include_todos = False
# a list of builtin themes.
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
if on_rtd: # only import and set the theme if we're building docs locally
import sphinx_rtd_theme
html_theme = 'sphinx_rtd_theme'
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()] |
285 | https://:@github.com/quva-lab/artemis.git | 26ae4a7049b0f6ac2aef7daf4c2a5184748be516 | @@ -76,7 +76,7 @@ def get_new_positions(fixed_positions, layout, n_plots):
positions.append(fixed_positions[i])
else:
while True:
- row, col = ix/n_cols, ix%n_cols
+ row, col = ix//n_cols, ix%n_cols
if (row, col) not in taken_positions:
positions.append((row, col))
taken_positions.add((row, col))
| artemis/plotting/expanding_subplots.py | ReplaceText(target='//' @(79,29)->(79,30)) | def get_new_positions(fixed_positions, layout, n_plots):
positions.append(fixed_positions[i])
else:
while True:
row, col = ix/n_cols, ix%n_cols
if (row, col) not in taken_positions:
positions.append((row, col))
taken_positions.add((row, col)) | def get_new_positions(fixed_positions, layout, n_plots):
positions.append(fixed_positions[i])
else:
while True:
row, col = ix//n_cols, ix%n_cols
if (row, col) not in taken_positions:
positions.append((row, col))
taken_positions.add((row, col)) |
286 | https://:@github.com/OCR-D/core.git | e82299a48e4cf4677535819f81bb944ad4f64f8a | @@ -312,7 +312,7 @@ def validate_consistency(node, page_textequiv_consistency, page_textequiv_strate
pass # already reported in recursive call above
elif not child_poly.within(node_poly.buffer(PARENT_SLACK)):
# TODO: automatic repair?
- report.add_error(CoordinateConsistencyError(tag, child.id, file_id,
+ report.add_error(CoordinateConsistencyError(child_tag, child.id, file_id,
parent_points, child_points))
log.debug("Inconsistent coords of %s %s", child_tag, child.id)
consistent = False
| ocrd_validators/ocrd_validators/page_validator.py | ReplaceText(target='child_tag' @(315,64)->(315,67)) | def validate_consistency(node, page_textequiv_consistency, page_textequiv_strate
pass # already reported in recursive call above
elif not child_poly.within(node_poly.buffer(PARENT_SLACK)):
# TODO: automatic repair?
report.add_error(CoordinateConsistencyError(tag, child.id, file_id,
parent_points, child_points))
log.debug("Inconsistent coords of %s %s", child_tag, child.id)
consistent = False | def validate_consistency(node, page_textequiv_consistency, page_textequiv_strate
pass # already reported in recursive call above
elif not child_poly.within(node_poly.buffer(PARENT_SLACK)):
# TODO: automatic repair?
report.add_error(CoordinateConsistencyError(child_tag, child.id, file_id,
parent_points, child_points))
log.debug("Inconsistent coords of %s %s", child_tag, child.id)
consistent = False |
287 | https://:@github.com/jhuapl-boss/heaviside.git | 3adb4902a04dc3e1d9a325ab1752c4b2d856b677 | @@ -69,7 +69,7 @@ class ASTCompAndOr(ASTNode):
super(ASTCompAndOr, self).__init__(comp.token)
self.comps = [comp]
for c in comps:
- self.comps.append(comp)
+ self.comps.append(c)
class ASTCompAnd(ASTCompAndOr):
op = 'And'
| heaviside/ast.py | ReplaceText(target='c' @(72,30)->(72,34)) | class ASTCompAndOr(ASTNode):
super(ASTCompAndOr, self).__init__(comp.token)
self.comps = [comp]
for c in comps:
self.comps.append(comp)
class ASTCompAnd(ASTCompAndOr):
op = 'And' | class ASTCompAndOr(ASTNode):
super(ASTCompAndOr, self).__init__(comp.token)
self.comps = [comp]
for c in comps:
self.comps.append(c)
class ASTCompAnd(ASTCompAndOr):
op = 'And' |
288 | https://:@github.com/google-research/text-to-text-transfer-transformer.git | d2c010b48b702f22fb665d2e5723c7baaf4f6a1c | @@ -98,7 +98,7 @@ def main(_):
" ".join(str(i) for i in v) if FLAGS.tokenize
else v.decode("utf-8"))
else:
- v[k] = ""
+ key_to_string[k] = ""
return FLAGS.format_string.format(**key_to_string)
for shard_path in files:
| t5/scripts/dump_task.py | ReplaceText(target='key_to_string' @(101,8)->(101,9)) | def main(_):
" ".join(str(i) for i in v) if FLAGS.tokenize
else v.decode("utf-8"))
else:
v[k] = ""
return FLAGS.format_string.format(**key_to_string)
for shard_path in files: | def main(_):
" ".join(str(i) for i in v) if FLAGS.tokenize
else v.decode("utf-8"))
else:
key_to_string[k] = ""
return FLAGS.format_string.format(**key_to_string)
for shard_path in files: |
289 | https://:@github.com/lvieirajr/mongorest.git | 470f17173b63b14ab60bbc99db7ca3b3f93afdac | @@ -401,4 +401,4 @@ class CoercionError(SchemaValidationError):
self['collection'] = collection
self['field'] = field
- self['coercion_type'] = coercion_type
+ self['coercion_type'] = coercion_type_repr
| mongorest/errors.py | ReplaceText(target='coercion_type_repr' @(404,32)->(404,45)) | class CoercionError(SchemaValidationError):
self['collection'] = collection
self['field'] = field
self['coercion_type'] = coercion_type | class CoercionError(SchemaValidationError):
self['collection'] = collection
self['field'] = field
self['coercion_type'] = coercion_type_repr |
290 | https://:@github.com/internetarchive/fatcat.git | 89b729feac30a272b557542c5c4149d3611f869a | @@ -295,7 +295,7 @@ def container_to_elasticsearch(entity):
t['in_sherpa_romeo'] = in_sherpa_romeo
t['is_oa'] = in_doaj or in_road or is_longtail_oa or is_oa
t['is_longtail_oa'] = is_longtail_oa
- t['any_kbart'] = any_ia_sim
+ t['any_kbart'] = any_kbart
t['any_jstor'] = any_jstor
t['any_ia_sim'] = bool(any_ia_sim)
return t
| python/fatcat_tools/transforms.py | ReplaceText(target='any_kbart' @(298,21)->(298,31)) | def container_to_elasticsearch(entity):
t['in_sherpa_romeo'] = in_sherpa_romeo
t['is_oa'] = in_doaj or in_road or is_longtail_oa or is_oa
t['is_longtail_oa'] = is_longtail_oa
t['any_kbart'] = any_ia_sim
t['any_jstor'] = any_jstor
t['any_ia_sim'] = bool(any_ia_sim)
return t | def container_to_elasticsearch(entity):
t['in_sherpa_romeo'] = in_sherpa_romeo
t['is_oa'] = in_doaj or in_road or is_longtail_oa or is_oa
t['is_longtail_oa'] = is_longtail_oa
t['any_kbart'] = any_kbart
t['any_jstor'] = any_jstor
t['any_ia_sim'] = bool(any_ia_sim)
return t |
291 | https://:@github.com/internetarchive/fatcat.git | 11dfac5f8f9ced9b56cf277d0e3adeccc572b251 | @@ -57,7 +57,7 @@ class ArabesqueMatchImporter(EntityImporter):
eg_extra = kwargs.get('editgroup_extra', dict())
eg_extra['agent'] = eg_extra.get('agent', 'fatcat_tools.ArabesqueMatchImporter')
if kwargs.get('crawl_id'):
- eg_extra['crawl_id'] = eg_extra.get('crawl_id')
+ eg_extra['crawl_id'] = kwargs.get('crawl_id')
super().__init__(api,
editgroup_description=eg_desc,
editgroup_extra=eg_extra,
| python/fatcat_tools/importers/arabesque.py | ReplaceText(target='kwargs' @(60,35)->(60,43)) | class ArabesqueMatchImporter(EntityImporter):
eg_extra = kwargs.get('editgroup_extra', dict())
eg_extra['agent'] = eg_extra.get('agent', 'fatcat_tools.ArabesqueMatchImporter')
if kwargs.get('crawl_id'):
eg_extra['crawl_id'] = eg_extra.get('crawl_id')
super().__init__(api,
editgroup_description=eg_desc,
editgroup_extra=eg_extra, | class ArabesqueMatchImporter(EntityImporter):
eg_extra = kwargs.get('editgroup_extra', dict())
eg_extra['agent'] = eg_extra.get('agent', 'fatcat_tools.ArabesqueMatchImporter')
if kwargs.get('crawl_id'):
eg_extra['crawl_id'] = kwargs.get('crawl_id')
super().__init__(api,
editgroup_description=eg_desc,
editgroup_extra=eg_extra, |
292 | https://:@github.com/internetarchive/fatcat.git | 7104e6dfb99717353e3819853ae61ac6387a02a1 | @@ -128,7 +128,7 @@ class EntityUpdatesWorker(FatcatWorker):
# update release when a file changes
# TODO: fetch old revision as well, and only update
# releases for which list changed
- release_ids.extend(e['release_ids'])
+ release_ids.extend(file_entity['release_ids'])
file_dict = self.api.api_client.sanitize_for_serialization(file_entity)
file_producer.produce(
message=json.dumps(file_dict).encode('utf-8'),
| python/fatcat_tools/workers/changelog.py | ReplaceText(target='file_entity' @(131,35)->(131,36)) | class EntityUpdatesWorker(FatcatWorker):
# update release when a file changes
# TODO: fetch old revision as well, and only update
# releases for which list changed
release_ids.extend(e['release_ids'])
file_dict = self.api.api_client.sanitize_for_serialization(file_entity)
file_producer.produce(
message=json.dumps(file_dict).encode('utf-8'), | class EntityUpdatesWorker(FatcatWorker):
# update release when a file changes
# TODO: fetch old revision as well, and only update
# releases for which list changed
release_ids.extend(file_entity['release_ids'])
file_dict = self.api.api_client.sanitize_for_serialization(file_entity)
file_producer.produce(
message=json.dumps(file_dict).encode('utf-8'), |
293 | https://:@github.com/internetarchive/fatcat.git | 80b756d6feec3f66225287b9ca73c8b02d012027 | @@ -167,7 +167,7 @@ class IngestFileResultImporter(EntityImporter):
urls=urls,
)
if request.get('edit_extra'):
- fe.edit_extra = fatcat['edit_extra']
+ fe.edit_extra = request['edit_extra']
else:
fe.edit_extra = dict()
if request.get('ingest_request_source'):
| python/fatcat_tools/importers/ingest.py | ReplaceText(target='request' @(170,28)->(170,34)) | class IngestFileResultImporter(EntityImporter):
urls=urls,
)
if request.get('edit_extra'):
fe.edit_extra = fatcat['edit_extra']
else:
fe.edit_extra = dict()
if request.get('ingest_request_source'): | class IngestFileResultImporter(EntityImporter):
urls=urls,
)
if request.get('edit_extra'):
fe.edit_extra = request['edit_extra']
else:
fe.edit_extra = dict()
if request.get('ingest_request_source'): |
294 | https://:@github.com/pallets/flask-ext-migrate.git | ea6a0666e08ce176031456dced635ca3c92c1386 | @@ -43,7 +43,7 @@ def fix_from_imports(red):
modules = node.value
if (len(modules) < 2 or
- modules[0].value != 'flask' and modules[1].value != 'ext'):
+ modules[0].value != 'flask' or modules[1].value != 'ext'):
continue
if len(modules) >= 3:
| flask_ext_migrate/__init__.py | ReplaceText(target='or' @(46,44)->(46,47)) | def fix_from_imports(red):
modules = node.value
if (len(modules) < 2 or
modules[0].value != 'flask' and modules[1].value != 'ext'):
continue
if len(modules) >= 3: | def fix_from_imports(red):
modules = node.value
if (len(modules) < 2 or
modules[0].value != 'flask' or modules[1].value != 'ext'):
continue
if len(modules) >= 3: |
295 | https://:@github.com/SpockBotMC/SpockBot.git | 6c8e63b97e3d9617ce0ca9bea9a677902b5ef2fb | @@ -42,7 +42,7 @@ class SelectSocket:
else:
slist = [(self.sock,), (), (self.sock,)]
timeout = self.timer.get_timeout()
- if timeout>0:
+ if timeout>=0:
slist.append(timeout)
try:
rlist, wlist, xlist = select.select(*slist)
| spock/plugins/core/net.py | ReplaceText(target='>=' @(45,12)->(45,13)) | class SelectSocket:
else:
slist = [(self.sock,), (), (self.sock,)]
timeout = self.timer.get_timeout()
if timeout>0:
slist.append(timeout)
try:
rlist, wlist, xlist = select.select(*slist) | class SelectSocket:
else:
slist = [(self.sock,), (), (self.sock,)]
timeout = self.timer.get_timeout()
if timeout>=0:
slist.append(timeout)
try:
rlist, wlist, xlist = select.select(*slist) |
296 | https://:@github.com/SpockBotMC/SpockBot.git | bebe1187dd6432ec3b4b6dddb8246baef83c2203 | @@ -15,7 +15,7 @@ class PloaderFetch:
@pl_announce('PloaderFetch')
class SettingsPlugin:
def __init__(self, ploader, kwargs):
- settings = get_settings(kwargs, kwargs.get('settings', {}))
+ settings = get_settings(kwargs.get('settings', {}), kwargs)
plugin_list = settings.get('plugins', DefaultPlugins)
plugins = []
plugin_settings = {}
| spock/plugins/core/settings.py | ArgSwap(idxs=0<->1 @(18,13)->(18,25)) | class PloaderFetch:
@pl_announce('PloaderFetch')
class SettingsPlugin:
def __init__(self, ploader, kwargs):
settings = get_settings(kwargs, kwargs.get('settings', {}))
plugin_list = settings.get('plugins', DefaultPlugins)
plugins = []
plugin_settings = {} | class PloaderFetch:
@pl_announce('PloaderFetch')
class SettingsPlugin:
def __init__(self, ploader, kwargs):
settings = get_settings(kwargs.get('settings', {}), kwargs)
plugin_list = settings.get('plugins', DefaultPlugins)
plugins = []
plugin_settings = {} |
297 | https://:@github.com/SpockBotMC/SpockBot.git | bebe1187dd6432ec3b4b6dddb8246baef83c2203 | @@ -19,7 +19,7 @@ default_settings = {
class StartPlugin:
def __init__(self, ploader, settings):
- self.settings = utils.get_settings(settings, default_settings)
+ self.settings = utils.get_settings(default_settings, settings)
self.event = ploader.requires('Event')
self.net = ploader.requires('Net')
self.auth = ploader.requires('Auth')
| spock/plugins/helpers/start.py | ArgSwap(idxs=0<->1 @(22,18)->(22,36)) | default_settings = {
class StartPlugin:
def __init__(self, ploader, settings):
self.settings = utils.get_settings(settings, default_settings)
self.event = ploader.requires('Event')
self.net = ploader.requires('Net')
self.auth = ploader.requires('Auth') | default_settings = {
class StartPlugin:
def __init__(self, ploader, settings):
self.settings = utils.get_settings(default_settings, settings)
self.event = ploader.requires('Event')
self.net = ploader.requires('Net')
self.auth = ploader.requires('Auth') |
298 | https://:@github.com/hungpham2511/toppra.git | fefd8430ad55fb09414a1d4c6d8be41e81977842 | @@ -19,7 +19,7 @@ def _find_left_index(ss_waypoints, s):
for i in range(1, len(ss_waypoints)):
if ss_waypoints[i - 1] <= s and s < ss_waypoints[i]:
return i - 1
- return len(ss_waypoints) - 1
+ return len(ss_waypoints) - 2
class Interpolator(object):
| toppra/interpolator.py | ReplaceText(target='2' @(22,31)->(22,32)) | def _find_left_index(ss_waypoints, s):
for i in range(1, len(ss_waypoints)):
if ss_waypoints[i - 1] <= s and s < ss_waypoints[i]:
return i - 1
return len(ss_waypoints) - 1
class Interpolator(object): | def _find_left_index(ss_waypoints, s):
for i in range(1, len(ss_waypoints)):
if ss_waypoints[i - 1] <= s and s < ss_waypoints[i]:
return i - 1
return len(ss_waypoints) - 2
class Interpolator(object): |
299 | https://:@github.com/cmrivers/epipy.git | c541e6f7f559c92279623aa3c2cb7f644247280e | @@ -34,7 +34,7 @@ def generate_example_data(cluster_size, outbreak_len, clusters, gen_time, attrib
for i in range(clusters):
cluster_letter = np.random.choice([i for i in string.ascii_uppercase if i not in used])[0]
cluster_name = 'Cluster' + cluster_letter
- used.append(cluster_name)
+ used.append(cluster_letter)
ix_rng = pd.date_range('1/1/2014', periods=outbreak_len, freq='D')
ix_date = np.random.choice(ix_rng, size=1)
| epipy/data_generator.py | ReplaceText(target='cluster_letter' @(37,20)->(37,32)) | def generate_example_data(cluster_size, outbreak_len, clusters, gen_time, attrib
for i in range(clusters):
cluster_letter = np.random.choice([i for i in string.ascii_uppercase if i not in used])[0]
cluster_name = 'Cluster' + cluster_letter
used.append(cluster_name)
ix_rng = pd.date_range('1/1/2014', periods=outbreak_len, freq='D')
ix_date = np.random.choice(ix_rng, size=1) | def generate_example_data(cluster_size, outbreak_len, clusters, gen_time, attrib
for i in range(clusters):
cluster_letter = np.random.choice([i for i in string.ascii_uppercase if i not in used])[0]
cluster_name = 'Cluster' + cluster_letter
used.append(cluster_letter)
ix_rng = pd.date_range('1/1/2014', periods=outbreak_len, freq='D')
ix_date = np.random.choice(ix_rng, size=1) |