diff options
-rw-r--r-- | bot/exts/christmas/adventofcode.py | 2 | ||||
-rw-r--r-- | bot/exts/easter/april_fools_vids.py | 2 | ||||
-rw-r--r-- | bot/exts/easter/egg_decorating.py | 4 | ||||
-rw-r--r-- | bot/exts/evergreen/branding.py | 2 | ||||
-rw-r--r-- | bot/exts/evergreen/magic_8ball.py | 2 | ||||
-rw-r--r-- | bot/exts/evergreen/recommend_game.py | 2 | ||||
-rw-r--r-- | bot/exts/evergreen/snakes/converter.py | 4 | ||||
-rw-r--r-- | bot/exts/evergreen/speedrun.py | 2 | ||||
-rw-r--r-- | bot/exts/evergreen/trivia_quiz.py | 2 |
9 files changed, 11 insertions, 11 deletions
diff --git a/bot/exts/christmas/adventofcode.py b/bot/exts/christmas/adventofcode.py index cc3923c8..00607074 100644 --- a/bot/exts/christmas/adventofcode.py +++ b/bot/exts/christmas/adventofcode.py @@ -429,7 +429,7 @@ class AdventOfCode(commands.Cog): def _build_about_embed(self) -> discord.Embed: """Build and return the informational "About AoC" embed from the resources file.""" - with self.about_aoc_filepath.open("r") as f: + with self.about_aoc_filepath.open("r", encoding="utf8") as f: embed_fields = json.load(f) about_embed = discord.Embed(title=self._base_url, colour=Colours.soft_green, url=self._base_url) diff --git a/bot/exts/easter/april_fools_vids.py b/bot/exts/easter/april_fools_vids.py index 06108f02..efe7e677 100644 --- a/bot/exts/easter/april_fools_vids.py +++ b/bot/exts/easter/april_fools_vids.py @@ -20,7 +20,7 @@ class AprilFoolVideos(commands.Cog): def load_json() -> dict: """A function to load JSON data.""" p = Path('bot/resources/easter/april_fools_vids.json') - with p.open() as json_file: + with p.open(encoding="utf-8") as json_file: all_vids = load(json_file) return all_vids diff --git a/bot/exts/easter/egg_decorating.py b/bot/exts/easter/egg_decorating.py index be228b2c..b18e6636 100644 --- a/bot/exts/easter/egg_decorating.py +++ b/bot/exts/easter/egg_decorating.py @@ -12,10 +12,10 @@ from discord.ext import commands log = logging.getLogger(__name__) -with open(Path("bot/resources/evergreen/html_colours.json")) as f: +with open(Path("bot/resources/evergreen/html_colours.json"), encoding="utf8") as f: HTML_COLOURS = json.load(f) -with open(Path("bot/resources/evergreen/xkcd_colours.json")) as f: +with open(Path("bot/resources/evergreen/xkcd_colours.json"), encoding="utf8") as f: XKCD_COLOURS = json.load(f) COLOURS = [ diff --git a/bot/exts/evergreen/branding.py b/bot/exts/evergreen/branding.py index 1d463c5b..6553830c 100644 --- a/bot/exts/evergreen/branding.py +++ b/bot/exts/evergreen/branding.py @@ -171,7 +171,7 @@ class BrandingManager(commands.Cog): def _read_config(self) -> t.Dict[str, bool]: """Read and return persistent config file.""" - with self.config_file.open("r") as persistent_file: + with self.config_file.open("r", encoding="utf8") as persistent_file: return json.load(persistent_file) def _write_config(self, key: str, value: bool) -> None: diff --git a/bot/exts/evergreen/magic_8ball.py b/bot/exts/evergreen/magic_8ball.py index c10f1f51..f974e487 100644 --- a/bot/exts/evergreen/magic_8ball.py +++ b/bot/exts/evergreen/magic_8ball.py @@ -13,7 +13,7 @@ class Magic8ball(commands.Cog): def __init__(self, bot: commands.Bot): self.bot = bot - with open(Path("bot/resources/evergreen/magic8ball.json"), "r") as file: + with open(Path("bot/resources/evergreen/magic8ball.json"), "r", encoding="utf8") as file: self.answers = json.load(file) @commands.command(name="8ball") diff --git a/bot/exts/evergreen/recommend_game.py b/bot/exts/evergreen/recommend_game.py index 7cd52c2c..5e262a5b 100644 --- a/bot/exts/evergreen/recommend_game.py +++ b/bot/exts/evergreen/recommend_game.py @@ -11,7 +11,7 @@ game_recs = [] # Populate the list `game_recs` with resource files for rec_path in Path("bot/resources/evergreen/game_recs").glob("*.json"): - with rec_path.open(encoding='utf-8') as file: + with rec_path.open(encoding='utf8') as file: data = json.load(file) game_recs.append(data) shuffle(game_recs) diff --git a/bot/exts/evergreen/snakes/converter.py b/bot/exts/evergreen/snakes/converter.py index d4e93b56..55609b8e 100644 --- a/bot/exts/evergreen/snakes/converter.py +++ b/bot/exts/evergreen/snakes/converter.py @@ -63,12 +63,12 @@ class Snake(Converter): """Build list of snakes from the static snake resources.""" # Get all the snakes if cls.snakes is None: - with (SNAKE_RESOURCES / "snake_names.json").open() as snakefile: + with (SNAKE_RESOURCES / "snake_names.json").open(encoding="utf8") as snakefile: cls.snakes = json.load(snakefile) # Get the special cases if cls.special_cases is None: - with (SNAKE_RESOURCES / "special_snakes.json").open() as snakefile: + with (SNAKE_RESOURCES / "special_snakes.json").open(encoding="utf8") as snakefile: special_cases = json.load(snakefile) cls.special_cases = {snake['name'].lower(): snake for snake in special_cases} diff --git a/bot/exts/evergreen/speedrun.py b/bot/exts/evergreen/speedrun.py index 4e8d7aee..21aad5aa 100644 --- a/bot/exts/evergreen/speedrun.py +++ b/bot/exts/evergreen/speedrun.py @@ -6,7 +6,7 @@ from random import choice from discord.ext import commands log = logging.getLogger(__name__) -with Path('bot/resources/evergreen/speedrun_links.json').open(encoding="utf-8") as file: +with Path('bot/resources/evergreen/speedrun_links.json').open(encoding="utf8") as file: LINKS = json.load(file) diff --git a/bot/exts/evergreen/trivia_quiz.py b/bot/exts/evergreen/trivia_quiz.py index faac0ee6..8dceceac 100644 --- a/bot/exts/evergreen/trivia_quiz.py +++ b/bot/exts/evergreen/trivia_quiz.py @@ -40,7 +40,7 @@ class TriviaQuiz(commands.Cog): def load_questions() -> dict: """Load the questions from the JSON file.""" p = Path("bot", "resources", "evergreen", "trivia_quiz.json") - with p.open(encoding="utf-8") as json_data: + with p.open(encoding="utf8") as json_data: questions = json.load(json_data) return questions |