pincer_bot.bot.Bot.__init__()   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 8
Code Lines 6

Duplication

Lines 8
Ratio 100 %

Importance

Changes 0
Metric Value
cc 1
eloc 6
nop 3
dl 8
loc 8
rs 10
c 0
b 0
f 0
1
import os
0 ignored issues
show
introduced by
Missing module docstring
Loading history...
2
from glob import glob
3
from time import perf_counter
4
5
import dotenv
6
from pincer import Client
7
from pincer_bot.classes.pypi import PyPI
8
9
10 View Code Duplication
class Bot(Client):
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
introduced by
Missing class docstring
Loading history...
11
12
    def __init__(self, *args, **kwargs):
13
        self.load_cogs()
14
15
        dotenv.load_dotenv('.env')
16
        super().__init__(token=os.environ.get('TOKEN'), *args, **kwargs)
17
18
        self.pypi = PyPI()
19
        self.start_time = perf_counter()
20
21
    def load_cogs(self):
22
        """Load all cogs from the `cogs` directory."""
23
        for cog in glob("pincer_bot/cogs/*.py"):
24
            self.load_cog(cog.replace("/", ".").replace("\\", ".")[:-3])
25
            print("Loaded cogs from", cog)
26
27
    @Client.event
28
    async def on_ready(self):
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
29
        print(
30
            f"Logged in as {self.bot} "
31
            f"after {perf_counter() - self.start_time:.3f} seconds."
32
        )
33