ajenti / ajenti

Field duplicates the name of its containing class PTC-W0052
Anti-pattern
Minor
6 months ago2 years old
Class member worker has same name as its encolising class Worker
 63
 64        self.context = Context(parent=aj.context)
 65        self.context.session = self.gate.session
 66        self.context.worker = self 67        self.handler = HttpMiddlewareAggregator([
 68            AuthenticationMiddleware.get(self.context),
 69            CentralDispatcher.get(self.context),
Class member worker has same name as its encolising class Worker
 47
 48class Worker():
 49    def __init__(self, stream, gate):
 50        aj.worker = self 51        self.stream = stream
 52        self.gate = gate
 53        aj.master = False
Class member pidfile has same name as its encolising class PidFile
11
12    def __init__(self, path):
13        self.path = path
14        self.pidfile = None15
16    def __enter__(self):
17        self.pidfile = open(self.path, "a+")
Class member totp has same name as its encolising class TOTP
 6class TOTP:
 7    def __init__(self, user, secret):
 8        self.user = user
 9        self.totp = pyotp.TOTP(secret)10
11    def make_b64qrcode(self):
12        url = f'otpauth://totp/{self.user}?secret={self.totp.secret}'