Skip to content

Commit

Permalink
Merge pull request #77 from akrherz/ump
Browse files Browse the repository at this point in the history
chore: format code with ruff
  • Loading branch information
akrherz authored Dec 16, 2023
2 parents 9717f78 + a46d877 commit 39f848b
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 10 deletions.
7 changes: 2 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
ci:
autoupdate_schedule: quarterly
repos:
- repo: https://github.com/psf/black
rev: 23.10.0
hooks:
- id: black
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.1.0"
rev: "v0.1.8"
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- id: ruff-format

3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[tool.black]
line-length = 79

[tool.ruff]
line-length = 79
select = ["E", "F", "I"]
target-version = "py39"

3 changes: 2 additions & 1 deletion src/iembot/iemchatbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,8 @@ def processMessagePC(self, elem):
for user_id in self.md_routingtable.get(channel, []):
if user_id not in self.md_users:
log.msg(
f"Failed to send to Mastodon due to no access_tokens {user_id}"
"Failed to send to Mastodon due to no "
f"access_tokens {user_id}"
)
continue
# Require the x.twitter attribute to be set to prevent
Expand Down
5 changes: 3 additions & 2 deletions src/iembot/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ def toot(bot, user_id, twttxt, **kwargs):
api_base_url=bot.md_users[user_id]["api_base_url"],
)
log.msg(
f"Sending to Mastodon {bot.md_users[user_id]['screen_name']}({user_id}) "
"Sending to Mastodon "
f"{bot.md_users[user_id]['screen_name']}({user_id}) "
f"'{twttxt}' media:{kwargs.get('twitter_media')}"
)
media = kwargs.get("twitter_media")
Expand All @@ -142,7 +143,7 @@ def toot(bot, user_id, twttxt, **kwargs):
time.sleep(kwargs.get("sleep", 10))
res = api.status_post(**params)
except mastodon.errors.MastodonError as exp:
# Something else bad happened when submitting this to the Mastodon server
# Something else bad happened when submitting this to the Mastodon
log.err(exp)
params.pop("media_ids", None) # Try again without media
# Since this called from a thread, sleeping should not jam us up
Expand Down

0 comments on commit 39f848b

Please sign in to comment.