Skip to content
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

Sourcery refactored master branch #1

Closed
wants to merge 1 commit into from
Closed

Conversation

sourcery-ai[bot]
Copy link

@sourcery-ai sourcery-ai bot commented Sep 19, 2023

Branch master refactored by Sourcery.

If you're happy with these changes, merge this Pull Request using the Squash and merge strategy.

See our documentation here.

Run Sourcery locally

Reduce the feedback loop during development by using the Sourcery editor plugin:

Review changes via command line

To manually merge these changes, make sure you're on the master branch, then run:

git fetch origin sourcery/master
git merge --ff-only FETCH_HEAD
git reset HEAD^

Help us improve this pull request!

@sourcery-ai sourcery-ai bot requested a review from Remi-Gau September 19, 2023 00:28
Copy link
Author

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Due to GitHub API limits, only the first 60 comments can be shown.

@@ -6,6 +6,7 @@ Create a database suitable for use with MKDA toolbox
@copyright: University of Warwick 2013-2014
"""

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lines 36-50 refactored with the following changes:

@@ -7,6 +7,7 @@ specification. The path to feat directory must be passed as first argument.
@copyright: University of Warwick 2013-2014
"""

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lines 28-28 refactored with the following changes:

print('Downloading ' + nidmpack)
print(f'Downloading {nidmpack}')
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lines 14-14 refactored with the following changes:

Comment on lines -44 to +53
out_dirname = out_dirname+".nidm"
out_dirname = f"{out_dirname}.nidm"
else:
out_dirname = out_dirname+".nidm.zip"
out_dirname = f"{out_dirname}.nidm.zip"
out_dir = os.path.join(out_path, out_dirname)

# Quit if output path already exists and user doesn't want to overwrite
# it
if os.path.exists(out_dir):
msg = out_dir+" already exists, overwrite?"
if not input("%s (y/N) " % msg).lower() == 'y':
msg = f"{out_dir} already exists, overwrite?"
if input(f"{msg} (y/N) ").lower() != 'y':
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function NIDMExporter.__init__ refactored with the following changes:

if not export_file:
export_dir = None
else:
export_dir = self.export_dir

export_dir = None if not export_file else self.export_dir
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function NIDMExporter.add_object refactored with the following changes:

Comment on lines -127 to +133
filename = 'Contrast' + self.num + '.nii.gz'
filename = f'Contrast{self.num}.nii.gz'
self.file = NIDMFile(self.id, contrast_file, filename, sha=sha,
fmt=fmt)
self.coord_space = coord_space
self.type = NIDM_CONTRAST_MAP
self.prov_type = PROV['Entity']
if label is None:
if self.name:
self.label = "Contrast Map: " + self.name
else:
self.label = None
self.label = f"Contrast Map: {self.name}" if self.name else None
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function ContrastMap.__init__ refactored with the following changes:

Comment on lines -152 to +157
def get_query(klass, oid=None):
if oid is None:
oid_var = "?oid"
else:
oid_var = "<" + str(oid) + ">"

query = """
def get_query(cls, oid=None):
oid_var = "?oid" if oid is None else f"<{str(oid)}>"
return (
"""
prefix nidm_ContrastMap: <http://purl.org/nidash/nidm#NIDM_0000002>

SELECT DISTINCT * WHERE {
""" + oid_var + """ a nidm_ContrastMap: ;
"""
+ oid_var
+ """ a nidm_ContrastMap: ;
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function ContrastMap.get_query refactored with the following changes:

Comment on lines -228 to +235
def get_query(klass, oid=None):
if oid is None:
oid_var = "?oid"
else:
oid_var = "<" + str(oid) + ">"

query = """
def get_query(cls, oid=None):
oid_var = "?oid" if oid is None else f"<{str(oid)}>"
return (
"""
prefix nidm_ContrastExplainedMeanSquareMap: <http://purl.org/nidash/nidm#NIDM_\
0000163>

SELECT DISTINCT * WHERE {
""" + oid_var + """ a nidm_ContrastExplainedMeanSquareMap: ;
"""
+ oid_var
+ """ a nidm_ContrastExplainedMeanSquareMap: ;
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function ContrastExplainedMeanSquareMap.get_query refactored with the following changes:

Comment on lines -311 to +307
std_filename = "ContrastStandardError" + self.num + ".nii.gz"
std_filename = f"ContrastStandardError{self.num}.nii.gz"
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function ContrastStdErrMap.__init__ refactored with the following changes:

Comment on lines -347 to +363
def get_query(klass, oid=None):
if oid is None:
oid_var = "?oid"
else:
oid_var = "<" + str(oid) + ">"

query = """
def get_query(cls, oid=None):
oid_var = "?oid" if oid is None else f"<{str(oid)}>"
return (
"""
prefix nidm_ContrastStandardErrorMap: <http://purl.org/nidash/nidm#NIDM_000001\
3>
prefix nidm_ContrastVarianceMap: <http://purl.org/nidash/nidm#NIDM_0000135>

SELECT DISTINCT * WHERE {
""" + oid_var + """ a nidm_ContrastStandardErrorMap: ;
"""
+ oid_var
+ """ a nidm_ContrastStandardErrorMap: ;
rdfs:label ?label ;
prov:atLocation ?filepath ;
nfo:fileName ?filename ;
dct:format ?fmt ;
crypto:sha512 ?sha .

OPTIONAL {""" + oid_var + """ prov:wasDerivedFrom ?derfrom_id .
OPTIONAL {"""
+ oid_var
+ """ prov:wasDerivedFrom ?derfrom_id .
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function ContrastStdErrMap.get_query refactored with the following changes:

@pep8speaks
Copy link

Hello @sourcery-ai[bot]! Thanks for opening this PR. We checked the lines you've touched for PEP 8 issues, and found:

Line 180:29: E127 continuation line over-indented for visual indent
Line 305:29: E127 continuation line over-indented for visual indent
Line 356:33: E127 continuation line over-indented for visual indent
Line 541:80: E501 line too long (83 > 79 characters)
Line 625:80: E501 line too long (85 > 79 characters)

Line 432:80: E501 line too long (81 > 79 characters)

Line 152:21: E127 continuation line over-indented for visual indent
Line 200:80: E501 line too long (84 > 79 characters)
Line 278:17: E127 continuation line over-indented for visual indent
Line 279:17: E127 continuation line over-indented for visual indent
Line 280:17: E127 continuation line over-indented for visual indent
Line 330:25: E127 continuation line over-indented for visual indent
Line 490:80: E501 line too long (87 > 79 characters)

Line 53:80: E501 line too long (80 > 79 characters)
Line 295:16: E127 continuation line over-indented for visual indent
Line 452:80: E501 line too long (83 > 79 characters)
Line 659:80: E501 line too long (80 > 79 characters)
Line 986:80: E501 line too long (81 > 79 characters)
Line 998:80: E501 line too long (93 > 79 characters)
Line 1001:80: E501 line too long (93 > 79 characters)
Line 1030:20: E127 continuation line over-indented for visual indent
Line 1102:80: E501 line too long (82 > 79 characters)

Line 249:80: E501 line too long (85 > 79 characters)
Line 308:80: E501 line too long (80 > 79 characters)

Line 135:29: E127 continuation line over-indented for visual indent
Line 170:80: E501 line too long (82 > 79 characters)
Line 181:17: E127 continuation line over-indented for visual indent
Line 183:17: E127 continuation line over-indented for visual indent
Line 190:17: E127 continuation line over-indented for visual indent
Line 226:80: E501 line too long (84 > 79 characters)
Line 230:80: E501 line too long (96 > 79 characters)
Line 477:33: E127 continuation line over-indented for visual indent
Line 496:80: E501 line too long (87 > 79 characters)

Line 49:80: E501 line too long (81 > 79 characters)

Line 147:63: W291 trailing whitespace
Line 149:61: E225 missing whitespace around operator
Line 149:62: E502 the backslash is redundant between brackets
Line 150:29: E128 continuation line under-indented for visual indent
Line 150:41: E225 missing whitespace around operator
Line 150:42: E502 the backslash is redundant between brackets
Line 151:29: E128 continuation line under-indented for visual indent
Line 183:31: W291 trailing whitespace
Line 236:53: W292 no newline at end of file

Line 128:80: E501 line too long (84 > 79 characters)
Line 195:80: E501 line too long (110 > 79 characters)
Line 210:80: E501 line too long (83 > 79 characters)
Line 212:80: E501 line too long (83 > 79 characters)
Line 223:80: E501 line too long (91 > 79 characters)
Line 245:80: E501 line too long (162 > 79 characters)
Line 265:80: E501 line too long (123 > 79 characters)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants