junepark678 / GIRRewrite

Unnecessary use of json.loads() for file data PY-W0078
Anti-pattern
Major
a year agoa year old
json.loads(open(file, 'r', encoding='utf-8').read()) can be replaced with json.load(open(file, 'r', encoding='utf-8'))
1763    async def playlist_func(self, ctx, *, args=None):
1764        file = f"./music/playlist_{ctx.author.id}.json"
1765        if os.path.isfile(file):
1766            data = json.loads(open(file, "r", encoding="utf-8").read())1767        else:
1768            data = {}
1769        if args is None:
json.loads(f.read()) can be replaced with json.load(f)
 29
 30        try:
 31            with open('emojis.json') as f:
 32                self.emojis = json.loads(f.read()) 33        except:
 34            raise Exception(
 35                "Could not find emojis.json. Make sure to run scrape_emojis.py")