Skip to content

STY: Apply ruff/flynt rules (FLY) #3675

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 8 additions & 14 deletions nipype/algorithms/rapidart.py
Original file line number Diff line number Diff line change
Expand Up @@ -397,19 +397,13 @@ def _get_output_filenames(self, motionfile, output_dir):
else:
raise Exception("Unknown type of file")
_, filename, ext = split_filename(infile)
artifactfile = os.path.join(
output_dir, "".join(("art.", filename, "_outliers.txt"))
)
intensityfile = os.path.join(
output_dir, "".join(("global_intensity.", filename, ".txt"))
)
statsfile = os.path.join(output_dir, "".join(("stats.", filename, ".txt")))
normfile = os.path.join(output_dir, "".join(("norm.", filename, ".txt")))
plotfile = os.path.join(
output_dir, "".join(("plot.", filename, ".", self.inputs.plot_type))
)
displacementfile = os.path.join(output_dir, "".join(("disp.", filename, ext)))
maskfile = os.path.join(output_dir, "".join(("mask.", filename, ext)))
artifactfile = os.path.join(output_dir, f"art.{filename}_outliers.txt")
intensityfile = os.path.join(output_dir, f"global_intensity.{filename}.txt")
statsfile = os.path.join(output_dir, f"stats.{filename}.txt")
normfile = os.path.join(output_dir, f"norm.{filename}.txt")
plotfile = os.path.join(output_dir, f"plot.{filename}.{self.inputs.plot_type}")
displacementfile = os.path.join(output_dir, f"disp.{filename}{ext}")
maskfile = os.path.join(output_dir, f"mask.{filename}{ext}")
return (
artifactfile,
intensityfile,
Expand Down Expand Up @@ -760,7 +754,7 @@ def _get_output_filenames(self, motionfile, output_dir):
"""
(_, filename) = os.path.split(motionfile)
(filename, _) = os.path.splitext(filename)
corrfile = os.path.join(output_dir, "".join(("qa.", filename, "_stimcorr.txt")))
corrfile = os.path.join(output_dir, f"qa.{filename}_stimcorr.txt")
return corrfile

def _stimcorr_core(self, motionfile, intensityfile, designmatrix, cwd=None):
Expand Down
2 changes: 1 addition & 1 deletion nipype/interfaces/afni/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ def _gen_fname(self, basename, cwd=None, suffix=None, change_ext=True, ext=None)
if ext is None:
ext = Info.output_type_to_ext(self.inputs.outputtype)
if change_ext:
suffix = "".join((suffix, ext)) if suffix else ext
suffix = f"{suffix}{ext}" if suffix else ext

if suffix is None:
suffix = ""
Expand Down
4 changes: 2 additions & 2 deletions nipype/interfaces/ants/resampling.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def _list_outputs(self):
outputs = self._outputs().get()
_, name, ext = split_filename(os.path.abspath(self.inputs.input_image))
outputs["output_image"] = os.path.join(
os.getcwd(), "".join((name, self.inputs.out_postfix, ext))
os.getcwd(), f"{name}{self.inputs.out_postfix}{ext}"
)
return outputs

Expand Down Expand Up @@ -254,7 +254,7 @@ class WarpImageMultiTransform(ANTSCommand):
def _gen_filename(self, name):
if name == "output_image":
_, name, ext = split_filename(os.path.abspath(self.inputs.input_image))
return "".join((name, self.inputs.out_postfix, ext))
return f"{name}{self.inputs.out_postfix}{ext}"
return None

def _format_arg(self, opt, spec, val):
Expand Down
2 changes: 1 addition & 1 deletion nipype/interfaces/base/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,7 @@ def version_from_command(self, flag="-v", cmd=None):
out_environ = self._get_environ()
env.update(out_environ)
proc = sp.Popen(
" ".join((cmd, flag)),
f"{cmd} {flag}",
shell=True,
env=canonicalize_env(env),
stdout=sp.PIPE,
Expand Down
2 changes: 1 addition & 1 deletion nipype/interfaces/base/specs.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def _deprecated_warn(self, obj, name, old, new):
msg3 = "It has been replaced by %s." % trait_spec.new_name
else:
msg3 = ""
msg = " ".join((msg1, msg2, msg3))
msg = f"{msg1} {msg2} {msg3}"
if Version(str(trait_spec.deprecated)) < self.package_version:
raise TraitError(msg)
else:
Expand Down
2 changes: 1 addition & 1 deletion nipype/interfaces/brainsuite/brainsuite.py
Original file line number Diff line number Diff line change
Expand Up @@ -1801,7 +1801,7 @@
dotRegex = regex.compile("[^.]+")
# extract between last slash and first period
inputNoExtension = dotRegex.findall(fullInput)[0]
return os.path.abspath("".join((inputNoExtension, suffix)))
return os.path.abspath(f"{inputNoExtension}{suffix}")

Check warning on line 1804 in nipype/interfaces/brainsuite/brainsuite.py

View check run for this annotation

Codecov / codecov/patch

nipype/interfaces/brainsuite/brainsuite.py#L1804

Added line #L1804 was not covered by tests


def l_outputs(self):
Expand Down
4 changes: 2 additions & 2 deletions nipype/interfaces/cat12/surface.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@
outputs[name_hemisphere] = []
if not isdefined(outputs[all_files_hemisphere]):
outputs[all_files_hemisphere] = []
generated_filename = ".".join(
[hemisphere, parameter_name, original_filename]
generated_filename = (

Check warning on line 148 in nipype/interfaces/cat12/surface.py

View check run for this annotation

Codecov / codecov/patch

nipype/interfaces/cat12/surface.py#L148

Added line #L148 was not covered by tests
f"{hemisphere}.{parameter_name}.{original_filename}"
)
outputs[name_hemisphere].append(
os.path.join(pth, generated_filename)
Expand Down
2 changes: 1 addition & 1 deletion nipype/interfaces/dtitk/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
ext = Info.output_type_to_ext(self.inputs.output_type)
if change_ext:
if suffix:
suffix = "".join((suffix, ext))
suffix = f"{suffix}{ext}"

Check warning on line 92 in nipype/interfaces/dtitk/base.py

View check run for this annotation

Codecov / codecov/patch

nipype/interfaces/dtitk/base.py#L92

Added line #L92 was not covered by tests
else:
suffix = ext
if suffix is None:
Expand Down
2 changes: 1 addition & 1 deletion nipype/interfaces/freesurfer/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -674,7 +674,7 @@ def _list_outputs(self):
outfile = fname_presuffix(
self.inputs.in_file,
newpath=os.getcwd(),
suffix=".".join(("_thresh", self.inputs.out_type)),
suffix=f"_thresh.{self.inputs.out_type}",
use_ext=False,
)
else:
Expand Down
2 changes: 1 addition & 1 deletion nipype/interfaces/freesurfer/preprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -2541,7 +2541,7 @@ def _format_arg(self, name, spec, value):
cmd = " ".join((cmd, "-fa %.1f" % self.inputs.flip_list[i]))
if isdefined(self.inputs.xfm_list):
cmd = " ".join((cmd, "-at %s" % self.inputs.xfm_list[i]))
cmd = " ".join((cmd, file))
cmd = f"{cmd} {file}"
return cmd
return super()._format_arg(name, spec, value)

Expand Down
2 changes: 1 addition & 1 deletion nipype/interfaces/fsl/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ def _gen_fname(self, basename, cwd=None, suffix=None, change_ext=True, ext=None)
ext = Info.output_type_to_ext(self.inputs.output_type)
if change_ext:
if suffix:
suffix = "".join((suffix, ext))
suffix = f"{suffix}{ext}"
else:
suffix = ext
if suffix is None:
Expand Down
10 changes: 5 additions & 5 deletions nipype/interfaces/fsl/tests/test_preprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,21 +306,21 @@
# Handle autogeneration of outfile
pth, fname, ext = split_filename(infile)
outfile = fsl_name(fsl.FLIRT(), "%s_flirt" % fname)
outfile = " ".join(["-out", outfile])
outfile = f"-out {outfile}"

Check warning on line 309 in nipype/interfaces/fsl/tests/test_preprocess.py

View check run for this annotation

Codecov / codecov/patch

nipype/interfaces/fsl/tests/test_preprocess.py#L309

Added line #L309 was not covered by tests
# Handle autogeneration of outmatrix
outmatrix = "%s_flirt.mat" % fname
outmatrix = " ".join(["-omat", outmatrix])
outmatrix = f"-omat {outmatrix}"

Check warning on line 312 in nipype/interfaces/fsl/tests/test_preprocess.py

View check run for this annotation

Codecov / codecov/patch

nipype/interfaces/fsl/tests/test_preprocess.py#L312

Added line #L312 was not covered by tests
# Build command line
cmdline = " ".join([cmdline, outfile, outmatrix, param])
cmdline = f"{cmdline} {outfile} {outmatrix} {param}"

Check warning on line 314 in nipype/interfaces/fsl/tests/test_preprocess.py

View check run for this annotation

Codecov / codecov/patch

nipype/interfaces/fsl/tests/test_preprocess.py#L314

Added line #L314 was not covered by tests
flirter = fsl.FLIRT(in_file=infile, reference=reffile)
setattr(flirter.inputs, key, value)
assert flirter.cmdline == cmdline

# Test OutputSpec
flirter = fsl.FLIRT(in_file=infile, reference=reffile)
pth, fname, ext = split_filename(infile)
flirter.inputs.out_file = "".join(["foo", ext])
flirter.inputs.out_matrix_file = "".join(["bar", ext])
flirter.inputs.out_file = f"foo{ext}"
flirter.inputs.out_matrix_file = f"bar{ext}"

Check warning on line 323 in nipype/interfaces/fsl/tests/test_preprocess.py

View check run for this annotation

Codecov / codecov/patch

nipype/interfaces/fsl/tests/test_preprocess.py#L322-L323

Added lines #L322 - L323 were not covered by tests
outs = flirter._list_outputs()
assert outs["out_file"] == os.path.join(os.getcwd(), flirter.inputs.out_file)
assert outs["out_matrix_file"] == os.path.join(
Expand Down
2 changes: 1 addition & 1 deletion nipype/interfaces/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -1821,7 +1821,7 @@
else:
globprefix = "*"
keys = ensure_list(altkey) if altkey else [key]
globfmt = os.path.join(path, dirval, "".join((globprefix, "{}", globsuffix)))
globfmt = os.path.join(path, dirval, f"{globprefix}{{}}{globsuffix}")

Check warning on line 1824 in nipype/interfaces/io.py

View check run for this annotation

Codecov / codecov/patch

nipype/interfaces/io.py#L1824

Added line #L1824 was not covered by tests
return [
os.path.abspath(f) for key in keys for f in glob.glob(globfmt.format(key))
]
Expand Down
2 changes: 1 addition & 1 deletion nipype/interfaces/mne/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
keydir = op.join(path, dirval)
if altkey:
key = altkey
globpattern = op.join(keydir, "".join((globprefix, key, globsuffix)))
globpattern = op.join(keydir, f"{globprefix}{key}{globsuffix}")

Check warning on line 115 in nipype/interfaces/mne/base.py

View check run for this annotation

Codecov / codecov/patch

nipype/interfaces/mne/base.py#L115

Added line #L115 was not covered by tests
return glob.glob(globpattern)

def _list_outputs(self):
Expand Down
2 changes: 1 addition & 1 deletion nipype/interfaces/niftyfit/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,5 @@
if ext is not None:
final_ext = ext
if suffix is not None:
final_bn = "".join((final_bn, suffix))
final_bn = f"{final_bn}{suffix}"

Check warning on line 48 in nipype/interfaces/niftyfit/base.py

View check run for this annotation

Codecov / codecov/patch

nipype/interfaces/niftyfit/base.py#L48

Added line #L48 was not covered by tests
return os.path.abspath(os.path.join(out_dir, final_bn + final_ext))
2 changes: 1 addition & 1 deletion nipype/interfaces/niftyreg/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,5 +132,5 @@ def _gen_fname(self, basename, out_dir=None, suffix=None, ext=None):
if ext is not None:
final_ext = ext
if suffix is not None:
final_bn = "".join((final_bn, suffix))
final_bn = f"{final_bn}{suffix}"
return os.path.abspath(os.path.join(out_dir, final_bn + final_ext))
2 changes: 1 addition & 1 deletion nipype/interfaces/petpvc.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@
cwd = os.getcwd()
if change_ext:
if suffix:
suffix = "".join((suffix, ext))
suffix = f"{suffix}{ext}"

Check warning on line 228 in nipype/interfaces/petpvc.py

View check run for this annotation

Codecov / codecov/patch

nipype/interfaces/petpvc.py#L228

Added line #L228 was not covered by tests
else:
suffix = ext
if suffix is None:
Expand Down
2 changes: 1 addition & 1 deletion nipype/interfaces/spm/preprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -1263,7 +1263,7 @@
outputs["normalized_source"] = self.inputs.source
elif "write" in self.inputs.jobtype:
if isdefined(self.inputs.write_preserve) and self.inputs.write_preserve:
prefixNorm = "".join(["m", self.inputs.out_prefix])
prefixNorm = f"m{self.inputs.out_prefix}"

Check warning on line 1266 in nipype/interfaces/spm/preprocess.py

View check run for this annotation

Codecov / codecov/patch

nipype/interfaces/spm/preprocess.py#L1266

Added line #L1266 was not covered by tests
else:
prefixNorm = self.inputs.out_prefix
outputs["normalized_files"] = []
Expand Down
6 changes: 3 additions & 3 deletions nipype/pipeline/engine/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -457,9 +457,9 @@ def get_print_name(node, simple_form=True):
if len(pkglist) > 2:
destclass = ".%s" % pkglist[2]
if simple_form:
name = node.fullname + destclass
name = f"{node.fullname}{destclass}"
else:
name = ".".join([node.fullname, interface]) + destclass
name = f"{node.fullname}.{interface}{destclass}"
if simple_form:
parts = name.split(".")
if len(parts) > 2:
Expand Down Expand Up @@ -1565,7 +1565,7 @@ def write_workflow_prov(graph, filename=None, format="all"):
_, hashval, _, _ = node.hash_exists()
attrs = {
pm.PROV["type"]: nipype_ns[classname],
pm.PROV["label"]: "_".join((classname, node.name)),
pm.PROV["label"]: f"{classname}_{node.name}",
nipype_ns["hashval"]: hashval,
}
process = ps.g.activity(get_id(), None, None, attrs)
Expand Down
9 changes: 3 additions & 6 deletions nipype/pipeline/engine/workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,10 +394,7 @@
for node in nx.topological_sort(self._graph):
if isinstance(node, Workflow):
outlist.extend(
[
".".join((node.name, nodename))
for nodename in node.list_node_names()
]
f"{node.name}.{nodename}" for nodename in node.list_node_names()
)
else:
outlist.append(node.name)
Expand Down Expand Up @@ -931,7 +928,7 @@
if isinstance(node, Workflow):
node._reset_hierarchy()
for innernode in node._graph.nodes():
innernode._hierarchy = ".".join((self.name, innernode._hierarchy))
innernode._hierarchy = f"{self.name}.{innernode._hierarchy}"

Check warning on line 931 in nipype/pipeline/engine/workflows.py

View check run for this annotation

Codecov / codecov/patch

nipype/pipeline/engine/workflows.py#L931

Added line #L931 was not covered by tests
else:
node._hierarchy = self.name

Expand Down Expand Up @@ -995,7 +992,7 @@
# logger.debug('expanding workflow: %s', node)
node._generate_flatgraph()
for innernode in node._graph.nodes():
innernode._hierarchy = ".".join((self.name, innernode._hierarchy))
innernode._hierarchy = f"{self.name}.{innernode._hierarchy}"
self._graph.add_nodes_from(node._graph.nodes())
self._graph.add_edges_from(node._graph.edges(data=True))
if nodes2remove:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def run_multiproc_nondaemon_with_flag(nondaemon_flag):
plugin_args={"n_procs": 2, "non_daemon": nondaemon_flag},
)

names = [".".join((node._hierarchy, node.name)) for node in execgraph.nodes()]
names = [f"{node._hierarchy}.{node.name}" for node in execgraph.nodes()]
node = list(execgraph.nodes())[names.index("pipe.f2")]
result = node.get_output("sum_out")
os.chdir(cur_dir)
Expand Down
2 changes: 1 addition & 1 deletion nipype/pipeline/plugins/tests/test_linear.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def test_run_in_series(tmpdir):
pipe.base_dir = os.getcwd()
mod1.inputs.input1 = 1
execgraph = pipe.run(plugin="Linear")
names = [".".join((node._hierarchy, node.name)) for node in execgraph.nodes()]
names = [f"{node._hierarchy}.{node.name}" for node in execgraph.nodes()]
node = list(execgraph.nodes())[names.index("pipe.mod1")]
result = node.get_output("output1")
assert result == [1, 1]
2 changes: 1 addition & 1 deletion nipype/pipeline/plugins/tests/test_oar.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def test_run_oargraph(tmp_path):
pipe.base_dir = os.getcwd()
mod1.inputs.input1 = 1
execgraph = pipe.run(plugin="OAR")
names = [".".join((node._hierarchy, node.name)) for node in execgraph.nodes()]
names = [f"{node._hierarchy}.{node.name}" for node in execgraph.nodes()]
node = list(execgraph.nodes())[names.index("pipe.mod1")]
result = node.get_output("output1")
assert result == [1, 1]
2 changes: 1 addition & 1 deletion nipype/pipeline/plugins/tests/test_pbs.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def test_run_pbsgraph(tmp_path):
pipe.connect([(mod1, mod2, [("output1", "input1")])])
mod1.inputs.input1 = 1
execgraph = pipe.run(plugin="PBSGraph")
names = [".".join((node._hierarchy, node.name)) for node in execgraph.nodes()]
names = [f"{node._hierarchy}.{node.name}" for node in execgraph.nodes()]
node = list(execgraph.nodes())[names.index("pipe.mod1")]
result = node.get_output("output1")
assert result == [1, 1]
2 changes: 1 addition & 1 deletion nipype/pipeline/plugins/tests/test_somaflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def test_run_somaflow(tmpdir):
pipe.base_dir = os.getcwd()
mod1.inputs.input1 = 1
execgraph = pipe.run(plugin="SomaFlow")
names = [".".join((node._hierarchy, node.name)) for node in execgraph.nodes()]
names = [f"{node._hierarchy}.{node.name}" for node in execgraph.nodes()]
node = list(execgraph.nodes())[names.index("pipe.mod1")]
result = node.get_output("output1")
assert result == [1, 1]
6 changes: 2 additions & 4 deletions nipype/pipeline/plugins/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,8 @@ def report_nodes_not_run(notrun):
if notrun:
logger.info("***********************************")
for info in notrun:
logger.error(
"could not run node: %s"
% ".".join((info["node"]._hierarchy, info["node"]._id))
)
node = info["node"]
logger.error(f"could not run node: {node._hierarchy}.{node._id}")
logger.info("crashfile: %s" % info["crashfile"])
logger.debug("The following dependent nodes were not run")
for subnode in info["dependents"]:
Expand Down
6 changes: 3 additions & 3 deletions nipype/utils/docparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
otherlist.insert(0, hdr)
otherlist.insert(0, "\n")
otherparams = "\n".join(otherlist)
doc = "".join([doc, otherparams])
doc = f"{doc}{otherparams}"
return doc


Expand Down Expand Up @@ -251,7 +251,7 @@
if cmd_path == "":
raise Exception("Command %s not found" % cmd.split(" ")[0])
if help_flag:
cmd = " ".join((cmd, help_flag))
cmd = f"{cmd} {help_flag}"

Check warning on line 254 in nipype/utils/docparse.py

View check run for this annotation

Codecov / codecov/patch

nipype/utils/docparse.py#L254

Added line #L254 was not covered by tests
doc = grab_doc(cmd, trap_error)
opts = reverse_opt_map(opt_map)
return build_doc(doc, opts)
Expand Down Expand Up @@ -332,7 +332,7 @@
if cmd_path == "":
raise Exception("Command %s not found" % cmd.split(" ")[0])
if help_flag:
cmd = " ".join((cmd, help_flag))
cmd = f"{cmd} {help_flag}"

Check warning on line 335 in nipype/utils/docparse.py

View check run for this annotation

Codecov / codecov/patch

nipype/utils/docparse.py#L335

Added line #L335 was not covered by tests
doc = grab_doc(cmd, trap_error)
return _parse_doc(doc, style)

Expand Down
2 changes: 1 addition & 1 deletion nipype/utils/filemanip.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def hash_rename(filename, hashvalue):
and sets path to output_directory
"""
path, name, ext = split_filename(filename)
newfilename = "".join((name, "_0x", hashvalue, ext))
newfilename = f"{name}_0x{hashvalue}{ext}"
return op.join(path, newfilename)


Expand Down
2 changes: 1 addition & 1 deletion nipype/utils/tests/test_filemanip.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def test_hash_rename(filename, newname):
def test_check_forhash():
fname = "foobar"
orig_hash = "_0x4323dbcefdc51906decd8edcb3327943"
hashed_name = "".join((fname, orig_hash, ".nii"))
hashed_name = f"{fname}{orig_hash}.nii"
result, hash = check_forhash(hashed_name)
assert result
assert hash == [orig_hash]
Expand Down
6 changes: 3 additions & 3 deletions tools/checkspecs.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def _parse_lines(self, linesource, module):
# exclude private stuff
name = self._get_object_name(line)
if not name.startswith("_") and self._survives_exclude(
".".join((module, name)), "class"
f"{module}.{name}", "class"
):
classes.append(name)
else:
Expand Down Expand Up @@ -449,7 +449,7 @@ def discover_modules(self):
# Check directory names for packages
root_uri = self._path2uri(os.path.join(self.root_path, dirpath))
for dirname in dirnames[:]: # copy list - we modify inplace
package_uri = ".".join((root_uri, dirname))
package_uri = f"{root_uri}.{dirname}"
if self._uri2path(package_uri) and self._survives_exclude(
package_uri, "package"
):
Expand All @@ -459,7 +459,7 @@ def discover_modules(self):
# Check filenames for modules
for filename in filenames:
module_name = filename[:-3]
module_uri = ".".join((root_uri, module_name))
module_uri = f"{root_uri}.{module_name}"
if self._uri2path(module_uri) and self._survives_exclude(
module_uri, "module"
):
Expand Down