Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Sourcery refactored master branch#1

Open
sourcery-ai[bot] wants to merge 1 commit into
masterharunpehlivan/python-decoding-sensor-data:masterfrom
sourcery/masterharunpehlivan/python-decoding-sensor-data:sourcery/masterCopy head branch name to clipboard
Open

Sourcery refactored master branch#1
sourcery-ai[bot] wants to merge 1 commit into
masterharunpehlivan/python-decoding-sensor-data:masterfrom
sourcery/masterharunpehlivan/python-decoding-sensor-data:sourcery/masterCopy head branch name to clipboard

Conversation

@sourcery-ai

@sourcery-ai sourcery-ai Bot commented Feb 4, 2023

Copy link
Copy Markdown

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
Comment thread conftest.py
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
Copy Markdown
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 thread conftest.py
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
Copy Markdown
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 thread conftest.py
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
Copy Markdown
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 thread conftest.py
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
Copy Markdown
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 thread conftest.py
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
Copy Markdown
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 thread tests/template.py
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
Copy Markdown
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 thread tests/template.py
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
Copy Markdown
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 thread tests/template.py
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
Copy Markdown
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 thread tests/template.py
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
Copy Markdown
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 thread tests/template.py
Comment on lines -474 to +448
path +
["kwonlyargs"], "(missing)", "keyword arg %s" % argname
path + ["kwonlyargs"], "(missing)", f"keyword arg {argname}"

Copy link
Copy Markdown
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

Morty Proxy This is a proxified and sanitized view of the page, visit original site.