Skip to content
This repository was archived by the owner on Aug 24, 2022. It is now read-only.

Sourcery refactored main branch #18

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

Sourcery refactored main branch #18

wants to merge 1 commit into from

Conversation

sourcery-ai[bot]
Copy link

@sourcery-ai sourcery-ai bot commented Apr 1, 2022

Branch main 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 main branch, then run:

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

Help us improve this pull request!

@sourcery-ai sourcery-ai bot requested a review from vlebourl April 1, 2022 09:27
if self.catalog.get(name):
return self.catalog.get(name)
return name
return self.catalog.get(name) or name
Copy link
Author

Choose a reason for hiding this comment

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

Function BringData.convert_name refactored with the following changes:

Comment on lines -310 to +309
specification = name[name.index(" [") + 2 : len(name) - 1]
name = name[0 : name.index(" [")]
specification = name[name.index(" [") + 2:-1]
name = name[:name.index(" [")]
Copy link
Author

Choose a reason for hiding this comment

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

Function ShoppingData.ha_to_shopping_item refactored with the following changes:

Comment on lines -342 to +341
specification = name[name.index(" [") + 2 : len(name) - 1]
name = name[0 : name.index(" [")]
specification = name[name.index(" [") + 2:-1]
name = name[:name.index(" [")]
Copy link
Author

Choose a reason for hiding this comment

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

Function ShoppingData.async_add refactored with the following changes:

Comment on lines -374 to +373
specification = name[name.index(" [") + 2 : len(name) - 1]
name = name[0 : name.index(" [")]
specification = name[name.index(" [") + 2:-1]
name = name[:name.index(" [")]
Copy link
Author

Choose a reason for hiding this comment

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

Function ShoppingData.async_update refactored with the following changes:

self.session = session if session else ClientSession()
self.session = session or ClientSession()
Copy link
Author

Choose a reason for hiding this comment

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

Function BringApi.__init__ refactored with the following changes:

Comment on lines -84 to +85
message = None
if result.get("errorCode"):
message = result.get("error")

raise Exception(message if message else result)
message = result.get("error") if result.get("errorCode") else None
raise Exception(message or result)
Copy link
Author

Choose a reason for hiding this comment

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

Function BringApi.check_response refactored with the following changes:

Comment on lines -279 to +283
for val, key in self.load_translations(locale).items():
if key == item:
return val
return item
return next(
(
val
for val, key in self.load_translations(locale).items()
if key == item
),
item,
)
Copy link
Author

Choose a reason for hiding this comment

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

Function BringApi.translate_to_ch refactored with the following changes:

  • Use the built-in function next instead of a for-loop (use-next)

Comment on lines -50 to +52
"These are the top {} items on your shopping list: {}".format(
min(len(items), 5),
", ".join(itm["name"] for itm in reversed(items)),
)
f'These are the top {min(len(items), 5)} items on your shopping list: {", ".join((itm["name"] for itm in reversed(items)))}'
)

Copy link
Author

Choose a reason for hiding this comment

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

Function ListTopItemsIntent.async_handle refactored with the following changes:

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

Successfully merging this pull request may close these issues.

0 participants