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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

sourcery-ai[bot]
Copy link

@sourcery-ai sourcery-ai bot commented Feb 4, 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 harunpehlivan February 4, 2023 01:19
path = lambda root, fn: root / "{}.py".format(fn)
# if file_name == "menu" or file_name == "stats":
# full_path = path(ext, file_name)
path = lambda root, fn: root / f"{fn}.py"
Copy link
Author

Choose a reason for hiding this comment

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

Function Parser.__init__ refactored with the following changes:

This removes the following comments ( why? ):

# if file_name == "menu" or file_name == "stats":
# full_path = path(ext, file_name)

Comment on lines -88 to +86
return "{} on or around line {} in `{}`.".format(
self.data["message"], self.data["start_pos"], self.data["full_path"]
)
return f'{self.data["message"]} on or around line {self.data["start_pos"]} in `{self.data["full_path"]}`.'
Copy link
Author

Choose a reason for hiding this comment

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

Function Parser.message refactored with the following changes:

Comment on lines -97 to +98
if isinstance(result, (generator, chain, map)):
process = list(result)
return (
Parser(None, process[0]) if len(process) == 1 else Parser(None, process)
)
else:
if not isinstance(result, (generator, chain, map)):
return Parser(None, result)
process = list(result)
return (
Parser(None, process[0]) if len(process) == 1 else Parser(None, process)
)
Copy link
Author

Choose a reason for hiding this comment

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

Function Parser.execute refactored with the following changes:

Comment on lines -120 to -123
return Parser(None, [flatten(self.execute("$.body[@.type is 'FunctionDef' and @.name is '{}']".format(
name
return Parser(
None,
[
flatten(
self.execute(
f"$.body[@.type is 'FunctionDef' and @.name is '{name}']"
).n
)
],
)
).n)])
Copy link
Author

Choose a reason for hiding this comment

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

Function Parser.def_args_ refactored with the following changes:

Comment on lines -136 to +137
"$.body[@.type is 'FunctionDef' and @.name is '{}'].(name, args, body, decorator_list)".format(
name
)
f"$.body[@.type is 'FunctionDef' and @.name is '{name}'].(name, args, body, decorator_list)"
Copy link
Author

Choose a reason for hiding this comment

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

Function Parser.defines refactored with the following changes:

Comment on lines -382 to +364
return ("Mismatch at {}.\n" "Found : {}\n" "Expected: {}").format(
format_path(self.path), self.got, self.expected
)
return f"Mismatch at {format_path(self.path)}.\nFound : {self.got}\nExpected: {self.expected}"
Copy link
Author

Choose a reason for hiding this comment

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

Function TemplateMismatch.__str__ refactored with the following changes:

Comment on lines -394 to +374
return "At {}, found {} node instead of {}".format(
format_path(self.path), type(self.got).__name__, expected
)
return f"At {format_path(self.path)}, found {type(self.got).__name__} node instead of {expected}"
Copy link
Author

Choose a reason for hiding this comment

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

Function TemplateNodeTypeMismatch.__str__ refactored with the following changes:

Comment on lines -401 to +379
return "At {}, found {} node(s) instead of {}".format(
format_path(self.path), len(self.got), len(self.expected)
)
return f"At {format_path(self.path)}, found {len(self.got)} node(s) instead of {len(self.expected)}"
Copy link
Author

Choose a reason for hiding this comment

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

Function TemplateNodeListMismatch.__str__ refactored with the following changes:

Comment on lines -408 to +384
return ("At {}, lists differ.\nFound : {}\nExpected: {}").format(
format_path(self.path), self.got, self.expected
)
return f"At {format_path(self.path)}, lists differ.\nFound : {self.got}\nExpected: {self.expected}"
Copy link
Author

Choose a reason for hiding this comment

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

Function TemplatePlainListMismatch.__str__ refactored with the following changes:

Comment on lines -474 to +448
path +
["kwonlyargs"], "(missing)", "keyword arg %s" % argname
path + ["kwonlyargs"], "(missing)", f"keyword arg {argname}"
Copy link
Author

Choose a reason for hiding this comment

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

Function DefArgsCheck.__call__ refactored with the following changes:

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

Successfully merging this pull request may close these issues.

0 participants