*(minor): remove __name__ param from get_logger

This commit is contained in:
Langhammer, Jens 2019-10-04 10:08:53 +02:00
parent 2b8fed8f4e
commit c0df1f38b8
49 changed files with 48 additions and 50 deletions

View File

@ -1,7 +1,6 @@
[run] [run]
source = passbook source = passbook
omit = omit =
env/
*/wsgi.py */wsgi.py
manage.py manage.py
*/migrations/* */migrations/*

View File

@ -3,11 +3,9 @@ test-warnings: true
doc-warnings: false doc-warnings: false
ignore-paths: ignore-paths:
- env
- migrations - migrations
- docs - docs
- node_modules - node_modules
- client-packages
uses: uses:
- django - django

View File

@ -2,9 +2,10 @@
disable=redefined-outer-name,arguments-differ,no-self-use,cyclic-import,fixme,locally-disabled,unpacking-non-sequence,too-many-ancestors,too-many-branches,too-few-public-methods disable=redefined-outer-name,arguments-differ,no-self-use,cyclic-import,fixme,locally-disabled,unpacking-non-sequence,too-many-ancestors,too-many-branches,too-few-public-methods
load-plugins=pylint_django,pylint.extensions.bad_builtin load-plugins=pylint_django,pylint.extensions.bad_builtin
#,pylint.extensions.docparams
extension-pkg-whitelist=lxml extension-pkg-whitelist=lxml
const-rgx=[a-zA-Z0-9_]{1,40}$ const-rgx=[a-zA-Z0-9_]{1,40}$
ignored-modules=django-otp
jobs=4
[SIMILARITIES] [SIMILARITIES]

View File

@ -8,7 +8,7 @@ from structlog import get_logger
from passbook.lib.utils.template import render_to_string from passbook.lib.utils.template import render_to_string
register = template.Library() register = template.Library()
LOGGER = get_logger(__name__) LOGGER = get_logger()
@register.simple_tag() @register.simple_tag()
def get_links(model_instance): def get_links(model_instance):

View File

@ -10,7 +10,7 @@ from structlog import get_logger
from passbook.lib.models import UUIDModel from passbook.lib.models import UUIDModel
LOGGER = get_logger(__name__) LOGGER = get_logger()
class AuditEntry(UUIDModel): class AuditEntry(UUIDModel):
"""An individual audit log entry""" """An individual audit log entry"""

View File

@ -6,7 +6,7 @@ from structlog import get_logger
from passbook.lib.config import CONFIG from passbook.lib.config import CONFIG
LOGGER = get_logger(__name__) LOGGER = get_logger()
class PassbookCoreConfig(AppConfig): class PassbookCoreConfig(AppConfig):
"""passbook core app config""" """passbook core app config"""

View File

@ -3,7 +3,7 @@ from structlog import get_logger
from passbook.core.auth.factor import AuthenticationFactor from passbook.core.auth.factor import AuthenticationFactor
LOGGER = get_logger(__name__) LOGGER = get_logger()
class DummyFactor(AuthenticationFactor): class DummyFactor(AuthenticationFactor):

View File

@ -19,7 +19,7 @@ from passbook.core.tasks import send_email
from passbook.lib.config import CONFIG from passbook.lib.config import CONFIG
from passbook.lib.utils.reflection import path_to_class from passbook.lib.utils.reflection import path_to_class
LOGGER = get_logger(__name__) LOGGER = get_logger()
def authenticate(request, backends, **credentials): def authenticate(request, backends, **credentials):

View File

@ -14,7 +14,7 @@ from passbook.lib.utils.reflection import class_to_path, path_to_class
from passbook.lib.utils.urls import is_url_absolute from passbook.lib.utils.urls import is_url_absolute
from passbook.policy.engine import PolicyEngine from passbook.policy.engine import PolicyEngine
LOGGER = get_logger(__name__) LOGGER = get_logger()
def _redirect_with_qs(view, get_query_set=None): def _redirect_with_qs(view, get_query_set=None):
"""Wrapper to redirect whilst keeping GET Parameters""" """Wrapper to redirect whilst keeping GET Parameters"""

View File

@ -9,7 +9,7 @@ from passbook.core.models import User
from passbook.lib.config import CONFIG from passbook.lib.config import CONFIG
from passbook.lib.utils.ui import human_list from passbook.lib.utils.ui import human_list
LOGGER = get_logger(__name__) LOGGER = get_logger()
class LoginForm(forms.Form): class LoginForm(forms.Form):
"""Allow users to login""" """Allow users to login"""

View File

@ -7,7 +7,7 @@ from structlog import get_logger
from passbook.core.models import User from passbook.core.models import User
LOGGER = get_logger(__name__) LOGGER = get_logger()
class Command(BaseCommand): class Command(BaseCommand):
"""Import users from CSV file""" """Import users from CSV file"""

View File

@ -8,7 +8,7 @@ from structlog import get_logger
from passbook.lib.config import CONFIG from passbook.lib.config import CONFIG
from passbook.root.wsgi import application from passbook.root.wsgi import application
LOGGER = get_logger(__name__) LOGGER = get_logger()
class Command(BaseCommand): class Command(BaseCommand):

View File

@ -6,7 +6,7 @@ from structlog import get_logger
from passbook.root.celery import CELERY_APP from passbook.root.celery import CELERY_APP
LOGGER = get_logger(__name__) LOGGER = get_logger()
class Command(BaseCommand): class Command(BaseCommand):

View File

@ -19,7 +19,7 @@ from passbook.lib.models import CreatedUpdatedModel, UUIDModel
from passbook.policy.exceptions import PolicyException from passbook.policy.exceptions import PolicyException
from passbook.policy.struct import PolicyRequest, PolicyResult from passbook.policy.struct import PolicyRequest, PolicyResult
LOGGER = get_logger(__name__) LOGGER = get_logger()
def default_nonce_duration(): def default_nonce_duration():

View File

@ -7,7 +7,7 @@ from structlog import get_logger
from passbook.core.exceptions import PasswordPolicyInvalid from passbook.core.exceptions import PasswordPolicyInvalid
LOGGER = get_logger(__name__) LOGGER = get_logger()
user_signed_up = Signal(providing_args=['request', 'user']) user_signed_up = Signal(providing_args=['request', 'user'])
invitation_created = Signal(providing_args=['request', 'invitation']) invitation_created = Signal(providing_args=['request', 'invitation'])

View File

@ -10,7 +10,7 @@ from passbook.core.models import Nonce
from passbook.lib.config import CONFIG from passbook.lib.config import CONFIG
from passbook.root.celery import CELERY_APP from passbook.root.celery import CELERY_APP
LOGGER = get_logger(__name__) LOGGER = get_logger()
@CELERY_APP.task() @CELERY_APP.task()
def send_email(to_address, subject, template, context): def send_email(to_address, subject, template, context):

View File

@ -5,7 +5,7 @@ from structlog import get_logger
from passbook.core.auth import view from passbook.core.auth import view
from passbook.core.views import authentication, overview, user from passbook.core.views import authentication, overview, user
LOGGER = get_logger(__name__) LOGGER = get_logger()
urlpatterns = [ urlpatterns = [
# Authentication views # Authentication views

View File

@ -6,7 +6,7 @@ from structlog import get_logger
from passbook.core.models import Application from passbook.core.models import Application
from passbook.policy.engine import PolicyEngine from passbook.policy.engine import PolicyEngine
LOGGER = get_logger(__name__) LOGGER = get_logger()
class AccessMixin: class AccessMixin:
"""Mixin class for usage in Authorization views. """Mixin class for usage in Authorization views.

View File

@ -20,7 +20,7 @@ from passbook.core.signals import invitation_used, user_signed_up
from passbook.core.tasks import send_email from passbook.core.tasks import send_email
from passbook.lib.config import CONFIG from passbook.lib.config import CONFIG
LOGGER = get_logger(__name__) LOGGER = get_logger()
class LoginView(UserPassesTestMixin, FormView): class LoginView(UserPassesTestMixin, FormView):

View File

@ -8,7 +8,7 @@ from structlog import get_logger
from passbook.core.models import Policy, PolicyResult, User from passbook.core.models import Policy, PolicyResult, User
LOGGER = get_logger(__name__) LOGGER = get_logger()
class HaveIBeenPwendPolicy(Policy): class HaveIBeenPwendPolicy(Policy):
"""Check if password is on HaveIBeenPwned's list by upload the first """Check if password is on HaveIBeenPwned's list by upload the first

View File

@ -5,7 +5,7 @@ from structlog import get_logger
from passbook.ldap.ldap_connector import LDAPConnector from passbook.ldap.ldap_connector import LDAPConnector
from passbook.ldap.models import LDAPSource from passbook.ldap.models import LDAPSource
LOGGER = get_logger(__name__) LOGGER = get_logger()
class LDAPBackend(ModelBackend): class LDAPBackend(ModelBackend):

View File

@ -9,7 +9,7 @@ from passbook.core.models import User
from passbook.ldap.models import LDAPSource from passbook.ldap.models import LDAPSource
from passbook.lib.config import CONFIG from passbook.lib.config import CONFIG
LOGGER = get_logger(__name__) LOGGER = get_logger()
USERNAME_FIELD = CONFIG.y('ldap.username_field', 'sAMAccountName') USERNAME_FIELD = CONFIG.y('ldap.username_field', 'sAMAccountName')
LOGIN_FIELD = CONFIG.y('ldap.login_field', 'userPrincipalName') LOGIN_FIELD = CONFIG.y('ldap.login_field', 'userPrincipalName')

View File

@ -1,7 +1,7 @@
"""passbook sentry integration""" """passbook sentry integration"""
from structlog import get_logger from structlog import get_logger
LOGGER = get_logger(__name__) LOGGER = get_logger()
def before_send(event, hint): def before_send(event, hint):

View File

@ -5,7 +5,7 @@ from structlog import get_logger
register = template.Library() register = template.Library()
LOGGER = get_logger(__name__) LOGGER = get_logger()
@register.simple_tag(takes_context=True) @register.simple_tag(takes_context=True)

View File

@ -3,7 +3,7 @@ from django import template
from structlog import get_logger from structlog import get_logger
register = template.Library() register = template.Library()
LOGGER = get_logger(__name__) LOGGER = get_logger()
def get_key_unique(context): def get_key_unique(context):

View File

@ -6,7 +6,7 @@ from structlog import get_logger
from passbook.lib.config import CONFIG from passbook.lib.config import CONFIG
LOGGER = get_logger(__name__) LOGGER = get_logger()
class PassbookOAuthClientConfig(AppConfig): class PassbookOAuthClientConfig(AppConfig):
"""passbook oauth_client config""" """passbook oauth_client config"""

View File

@ -11,7 +11,7 @@ from requests.exceptions import RequestException
from requests_oauthlib import OAuth1 from requests_oauthlib import OAuth1
from structlog import get_logger from structlog import get_logger
LOGGER = get_logger(__name__) LOGGER = get_logger()
class BaseOAuthClient: class BaseOAuthClient:

View File

@ -10,7 +10,7 @@ from passbook.oauth_client.source_types.manager import MANAGER, RequestKind
from passbook.oauth_client.utils import user_get_or_create from passbook.oauth_client.utils import user_get_or_create
from passbook.oauth_client.views.core import OAuthCallback from passbook.oauth_client.views.core import OAuthCallback
LOGGER = get_logger(__name__) LOGGER = get_logger()
class AzureADOAuth2Client(OAuth2Client): class AzureADOAuth2Client(OAuth2Client):

View File

@ -9,7 +9,7 @@ from passbook.oauth_client.source_types.manager import MANAGER, RequestKind
from passbook.oauth_client.utils import user_get_or_create from passbook.oauth_client.utils import user_get_or_create
from passbook.oauth_client.views.core import OAuthCallback, OAuthRedirect from passbook.oauth_client.views.core import OAuthCallback, OAuthRedirect
LOGGER = get_logger(__name__) LOGGER = get_logger()
@MANAGER.source(kind=RequestKind.redirect, name='Discord') @MANAGER.source(kind=RequestKind.redirect, name='Discord')

View File

@ -5,7 +5,7 @@ from structlog import get_logger
from passbook.oauth_client.views.core import OAuthCallback, OAuthRedirect from passbook.oauth_client.views.core import OAuthCallback, OAuthRedirect
LOGGER = get_logger(__name__) LOGGER = get_logger()
class RequestKind(Enum): class RequestKind(Enum):
"""Enum of OAuth Request types""" """Enum of OAuth Request types"""

View File

@ -10,7 +10,7 @@ from passbook.oauth_client.source_types.manager import MANAGER, RequestKind
from passbook.oauth_client.utils import user_get_or_create from passbook.oauth_client.utils import user_get_or_create
from passbook.oauth_client.views.core import OAuthCallback, OAuthRedirect from passbook.oauth_client.views.core import OAuthCallback, OAuthRedirect
LOGGER = get_logger(__name__) LOGGER = get_logger()
@MANAGER.source(kind=RequestKind.redirect, name='reddit') @MANAGER.source(kind=RequestKind.redirect, name='reddit')

View File

@ -10,7 +10,7 @@ from passbook.oauth_client.source_types.manager import MANAGER, RequestKind
from passbook.oauth_client.utils import user_get_or_create from passbook.oauth_client.utils import user_get_or_create
from passbook.oauth_client.views.core import OAuthCallback from passbook.oauth_client.views.core import OAuthCallback
LOGGER = get_logger(__name__) LOGGER = get_logger()
class SupervisrOAuth2Client(OAuth2Client): class SupervisrOAuth2Client(OAuth2Client):

View File

@ -8,7 +8,7 @@ from passbook.oauth_client.source_types.manager import MANAGER, RequestKind
from passbook.oauth_client.utils import user_get_or_create from passbook.oauth_client.utils import user_get_or_create
from passbook.oauth_client.views.core import OAuthCallback from passbook.oauth_client.views.core import OAuthCallback
LOGGER = get_logger(__name__) LOGGER = get_logger()
class TwitterOAuthClient(OAuthClient): class TwitterOAuthClient(OAuthClient):

View File

@ -16,7 +16,7 @@ from passbook.lib.utils.reflection import app
from passbook.oauth_client.clients import get_client from passbook.oauth_client.clients import get_client
from passbook.oauth_client.models import OAuthSource, UserOAuthSourceConnection from passbook.oauth_client.models import OAuthSource, UserOAuthSourceConnection
LOGGER = get_logger(__name__) LOGGER = get_logger()
# pylint: disable=too-few-public-methods # pylint: disable=too-few-public-methods

View File

@ -14,7 +14,7 @@ from passbook.core.views.access import AccessMixin
from passbook.core.views.utils import LoadingView, PermissionDeniedView from passbook.core.views.utils import LoadingView, PermissionDeniedView
from passbook.oauth_provider.models import OAuth2Provider from passbook.oauth_provider.models import OAuth2Provider
LOGGER = get_logger(__name__) LOGGER = get_logger()
class PassbookAuthorizationLoadingView(LoginRequiredMixin, LoadingView): class PassbookAuthorizationLoadingView(LoginRequiredMixin, LoadingView):

View File

@ -4,7 +4,7 @@ from django.db.utils import InternalError, OperationalError, ProgrammingError
from django.urls import include, path from django.urls import include, path
from structlog import get_logger from structlog import get_logger
LOGGER = get_logger(__name__) LOGGER = get_logger()
class PassbookOIDCProviderConfig(AppConfig): class PassbookOIDCProviderConfig(AppConfig):
"""passbook auth oidc provider app config""" """passbook auth oidc provider app config"""

View File

@ -6,7 +6,7 @@ from structlog import get_logger
from passbook.core.models import Application from passbook.core.models import Application
from passbook.policy.engine import PolicyEngine from passbook.policy.engine import PolicyEngine
LOGGER = get_logger(__name__) LOGGER = get_logger()
def check_permissions(request, user, client): def check_permissions(request, user, client):
"""Check permissions, used for """Check permissions, used for

View File

@ -9,7 +9,7 @@ from passbook.core.auth.factor import AuthenticationFactor
from passbook.otp.forms import OTPVerifyForm from passbook.otp.forms import OTPVerifyForm
from passbook.otp.views import OTP_SETTING_UP_KEY, EnableView from passbook.otp.views import OTP_SETTING_UP_KEY, EnableView
LOGGER = get_logger(__name__) LOGGER = get_logger()
class OTPFactor(FormView, AuthenticationFactor): class OTPFactor(FormView, AuthenticationFactor):
"""OTP Factor View""" """OTP Factor View"""

View File

@ -23,7 +23,7 @@ from passbook.otp.utils import otpauth_url
OTP_SESSION_KEY = 'passbook_otp_key' OTP_SESSION_KEY = 'passbook_otp_key'
OTP_SETTING_UP_KEY = 'passbook_otp_setup' OTP_SETTING_UP_KEY = 'passbook_otp_setup'
LOGGER = get_logger(__name__) LOGGER = get_logger()
class UserSettingsView(LoginRequiredMixin, TemplateView): class UserSettingsView(LoginRequiredMixin, TemplateView):
"""View for user settings to control OTP""" """View for user settings to control OTP"""

View File

@ -9,7 +9,7 @@ from structlog import get_logger
from passbook.core.models import Policy from passbook.core.models import Policy
from passbook.policy.struct import PolicyRequest, PolicyResult from passbook.policy.struct import PolicyRequest, PolicyResult
LOGGER = get_logger(__name__) LOGGER = get_logger()
class PasswordExpiryPolicy(Policy): class PasswordExpiryPolicy(Policy):

View File

@ -9,7 +9,7 @@ from structlog import get_logger
# set the default Django settings module for the 'celery' program. # set the default Django settings module for the 'celery' program.
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "passbook.root.settings") os.environ.setdefault("DJANGO_SETTINGS_MODULE", "passbook.root.settings")
LOGGER = get_logger(__name__) LOGGER = get_logger()
CELERY_APP = Celery('passbook') CELERY_APP = Celery('passbook')

View File

@ -8,7 +8,7 @@ from structlog import get_logger
from passbook.core.views import error from passbook.core.views import error
from passbook.lib.utils.reflection import get_apps from passbook.lib.utils.reflection import get_apps
LOGGER = get_logger(__name__) LOGGER = get_logger()
admin.autodiscover() admin.autodiscover()
admin.site.login = RedirectView.as_view(pattern_name='passbook_core:auth-login') admin.site.login = RedirectView.as_view(pattern_name='passbook_core:auth-login')

View File

@ -6,7 +6,7 @@ from structlog import get_logger
from passbook.lib.config import CONFIG from passbook.lib.config import CONFIG
LOGGER = get_logger(__name__) LOGGER = get_logger()
class PassbookSAMLIDPConfig(AppConfig): class PassbookSAMLIDPConfig(AppConfig):
"""passbook saml_idp app config""" """passbook saml_idp app config"""

View File

@ -65,7 +65,7 @@ class Processor:
def __init__(self, remote): def __init__(self, remote):
self.name = remote.name self.name = remote.name
self._remote = remote self._remote = remote
self._logger = get_logger(__name__) self._logger = get_logger()
self._system_params['ISSUER'] = self._remote.issuer self._system_params['ISSUER'] = self._remote.issuer
self._logger.debug('processor configured') self._logger.debug('processor configured')

View File

@ -9,7 +9,7 @@ from passbook.core.models import PropertyMapping, Provider
from passbook.lib.utils.reflection import class_to_path, path_to_class from passbook.lib.utils.reflection import class_to_path, path_to_class
from passbook.saml_idp.base import Processor from passbook.saml_idp.base import Processor
LOGGER = get_logger(__name__) LOGGER = get_logger()
class SAMLProvider(Provider): class SAMLProvider(Provider):

View File

@ -21,7 +21,7 @@ from passbook.policy.engine import PolicyEngine
from passbook.saml_idp import exceptions from passbook.saml_idp import exceptions
from passbook.saml_idp.models import SAMLProvider from passbook.saml_idp.models import SAMLProvider
LOGGER = get_logger(__name__) LOGGER = get_logger()
URL_VALIDATOR = URLValidator(schemes=('http', 'https')) URL_VALIDATOR = URLValidator(schemes=('http', 'https'))

View File

@ -5,7 +5,7 @@ from structlog import get_logger
from passbook.lib.utils.template import render_to_string from passbook.lib.utils.template import render_to_string
from passbook.saml_idp.xml_signing import get_signature_xml, sign_with_signxml from passbook.saml_idp.xml_signing import get_signature_xml, sign_with_signxml
LOGGER = get_logger(__name__) LOGGER = get_logger()
def _get_attribute_statement(params): def _get_attribute_statement(params):

View File

@ -7,7 +7,7 @@ from structlog import get_logger
from passbook.lib.utils.template import render_to_string from passbook.lib.utils.template import render_to_string
LOGGER = get_logger(__name__) LOGGER = get_logger()
def sign_with_signxml(private_key, data, cert, reference_uri=None): def sign_with_signxml(private_key, data, cert, reference_uri=None):

View File

@ -7,7 +7,7 @@ from structlog import get_logger
from passbook.core.models import User from passbook.core.models import User
from passbook.suspicious_policy.models import IPScore, UserScore from passbook.suspicious_policy.models import IPScore, UserScore
LOGGER = get_logger(__name__) LOGGER = get_logger()
def get_remote_ip(request): def get_remote_ip(request):