From 463631b5b786db22d15d1aa6b546f99bf5616776 Mon Sep 17 00:00:00 2001 From: adamjmcgrath Date: Thu, 30 Mar 2023 13:32:33 +0100 Subject: [PATCH] Fix intellisense on Auth0 class --- auth0/management/async_auth0.py | 6 +-- auth0/management/auth0.py | 78 ++++++++++++++++----------------- 2 files changed, 41 insertions(+), 43 deletions(-) diff --git a/auth0/management/async_auth0.py b/auth0/management/async_auth0.py index 241c47f6..a0971512 100644 --- a/auth0/management/async_auth0.py +++ b/auth0/management/async_auth0.py @@ -1,7 +1,7 @@ import aiohttp from ..asyncify import asyncify -from .auth0 import modules +from .auth0 import Auth0 class AsyncAuth0: @@ -20,8 +20,8 @@ class AsyncAuth0: def __init__(self, domain, token, rest_options=None): self._services = [] - for name, cls in modules.items(): - cls = asyncify(cls) + for name, attr in vars(Auth0(domain, token, rest_options=rest_options)).items(): + cls = asyncify(attr.__class__) service = cls(domain=domain, token=token, rest_options=rest_options) self._services.append(service) setattr( diff --git a/auth0/management/auth0.py b/auth0/management/auth0.py index 9b1f3502..9e36ce96 100644 --- a/auth0/management/auth0.py +++ b/auth0/management/auth0.py @@ -1,4 +1,3 @@ -from ..utils import is_async_available from .actions import Actions from .attack_protection import AttackProtection from .blacklists import Blacklists @@ -30,39 +29,6 @@ from .users import Users from .users_by_email import UsersByEmail -modules = { - "actions": Actions, - "attack_protection": AttackProtection, - "blacklists": Blacklists, - "branding": Branding, - "client_credentials": ClientCredentials, - "client_grants": ClientGrants, - "clients": Clients, - "connections": Connections, - "custom_domains": CustomDomains, - "device_credentials": DeviceCredentials, - "email_templates": EmailTemplates, - "emails": Emails, - "grants": Grants, - "guardian": Guardian, - "hooks": Hooks, - "jobs": Jobs, - "log_streams": LogStreams, - "logs": Logs, - "organizations": Organizations, - "prompts": Prompts, - "resource_servers": ResourceServers, - "roles": Roles, - "rules_configs": RulesConfigs, - "rules": Rules, - "stats": Stats, - "tenants": Tenants, - "tickets": Tickets, - "user_blocks": UserBlocks, - "users_by_email": UsersByEmail, - "users": Users, -} - class Auth0: """Provides easy access to all endpoint classes @@ -79,9 +45,41 @@ class Auth0: """ def __init__(self, domain, token, rest_options=None): - for name, cls in modules.items(): - setattr( - self, - name, - cls(domain=domain, token=token, rest_options=rest_options), - ) + self.actions = Actions(domain, token, rest_options=rest_options) + self.attack_protection = AttackProtection( + domain, token, rest_options=rest_options + ) + self.blacklists = Blacklists(domain, token, rest_options=rest_options) + self.branding = Branding(domain, token, rest_options=rest_options) + self.client_credentials = ClientCredentials( + domain, token, rest_options=rest_options + ) + self.client_grants = ClientGrants(domain, token, rest_options=rest_options) + self.clients = Clients(domain, token, rest_options=rest_options) + self.connections = Connections(domain, token, rest_options=rest_options) + self.custom_domains = CustomDomains(domain, token, rest_options=rest_options) + self.device_credentials = DeviceCredentials( + domain, token, rest_options=rest_options + ) + self.email_templates = EmailTemplates(domain, token, rest_options=rest_options) + self.emails = Emails(domain, token, rest_options=rest_options) + self.grants = Grants(domain, token, rest_options=rest_options) + self.guardian = Guardian(domain, token, rest_options=rest_options) + self.hooks = Hooks(domain, token, rest_options=rest_options) + self.jobs = Jobs(domain, token, rest_options=rest_options) + self.log_streams = LogStreams(domain, token, rest_options=rest_options) + self.logs = Logs(domain, token, rest_options=rest_options) + self.organizations = Organizations(domain, token, rest_options=rest_options) + self.prompts = Prompts(domain, token, rest_options=rest_options) + self.resource_servers = ResourceServers( + domain, token, rest_options=rest_options + ) + self.roles = Roles(domain, token, rest_options=rest_options) + self.rules_configs = RulesConfigs(domain, token, rest_options=rest_options) + self.rules = Rules(domain, token, rest_options=rest_options) + self.stats = Stats(domain, token, rest_options=rest_options) + self.tenants = Tenants(domain, token, rest_options=rest_options) + self.tickets = Tickets(domain, token, rest_options=rest_options) + self.user_blocks = UserBlocks(domain, token, rest_options=rest_options) + self.users_by_email = UsersByEmail(domain, token, rest_options=rest_options) + self.users = Users(domain, token, rest_options=rest_options)