Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In Python what is the significance of parentheses, in isolation, surrounding a module name?

Tags:

python

In this code what is the purpose of the statements (fix_imports) and (app)?

This is the whole file:

from ferris import fix_imports
(fix_imports)

# Import the application
from ferris.core import settings
settings.load_settings()

import ferris
import ferris.app
import ferris.deferred_app
import ferris.routes
import app.routes
import app.listeners
(app)

main_app = ferris.app.app  # Main application
deferred_app = ferris.deferred_app.app  # Deferred application

appstats_settings = settings.get('appstats', {})

if (appstats_settings.get('enabled', False) and ferris.app.debug) or appstats_settings.get('enabled_live', True):
    from google.appengine.ext.appstats import recording
    main_app = recording.appstats_wsgi_middleware(main_app)
like image 873
David Smith Avatar asked Apr 10 '14 00:04

David Smith


Video Answer


1 Answers

It could be that it was imported for side-effects.

Referencing the name like that may have been put in to prevent lint tools such as pylint or IDEs such as pycharm from generating warnings about unused imports.

like image 179
wim Avatar answered Sep 21 '22 05:09

wim