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 Starbot ⭐ refactored IceBotYT/lacrosse_view #1

Merged
merged 1 commit into from
Sep 16, 2022

Conversation

SourceryAI
Copy link
Contributor

Thanks for starring sourcery-ai/sourcery ✨ 🌟 ✨

Here's your pull request refactoring your most popular Python repo.

If you want Sourcery to refactor all your Python repos and incoming pull requests install our bot.

Review changes via command line

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

git fetch https://github.com/sourcery-ai-bot/lacrosse_view main
git merge --ff-only FETCH_HEAD
git reset HEAD^

Comment on lines +104 to +128
headers = {"Authorization": f"Bearer {self.token}"}

data: dict[str, Any]

locations_url = (
"https://lax-gateway.appspot.com/"
"_ah/api/lacrosseClient/v1.1/active-user/locations"
)
headers = {"Authorization": "Bearer " + self.token}

data: dict[str, Any]

if not self.websession:
async with aiohttp.ClientSession() as session:
async with session.get(locations_url, headers=headers) as response:
if response.status != 200:
raise HTTPError(
"Failed to get locations, status code: "
+ str(response.status)
f"Failed to get locations, status code: {str(response.status)}"
)

data = await response.json()
else:
async with self.websession.get(locations_url, headers=headers) as response:
if response.status != 200:
raise HTTPError(
"Failed to get locations, status code: " + str(response.status)
f"Failed to get locations, status code: {str(response.status)}"
)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function LaCrosse.get_locations refactored with the following changes:

Comment on lines -161 to +181
devices = list()
headers = {"Authorization": "Bearer " + self.token}
headers = {"Authorization": f"Bearer {self.token}"}

sensors_url = f"https://lax-gateway.appspot.com/_ah/api/lacrosseClient/v1.1/active-user/location/{str(location.id)}/sensorAssociations?prettyPrint=false"

sensors_url = (
"https://lax-gateway.appspot.com/"
"_ah/api/lacrosseClient/v1.1/active-user/location/"
+ str(location.id)
+ "/sensorAssociations?prettyPrint=false"
)
if not self.websession:
async with aiohttp.ClientSession() as session:
async with session.get(sensors_url, headers=headers) as response:
if response.status != 200:
raise HTTPError(
"Failed to get location, status code: "
+ str(response.status)
)
raise HTTPError(f"Failed to get location, status code: {str(response.status)}")
data = await response.json()
else:
async with self.websession.get(sensors_url, headers=headers) as response:
if response.status != 200:
raise HTTPError(
"Failed to get location, status code: " + str(response.status)
)
raise HTTPError(f"Failed to get location, status code: {str(response.status)}")
data = await response.json()

aggregates = "ai.ticks.1"

devices = []
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function LaCrosse.get_sensors refactored with the following changes:

Comment on lines -265 to +253
headers = {"Authorization": "Bearer " + self.token}
headers = {"Authorization": f"Bearer {self.token}"}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Function LaCrosse.logout refactored with the following changes:

@IceBotYT IceBotYT merged commit e0d3eba into IceBotYT:main Sep 16, 2022
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.

2 participants