Commits

Nikolaj Sjujskij committed 94cc459

ino_watch: move action-related imports into action functions

Comments (0)

Files changed (1)

inotify_watcher.py

 import time
 
 import inotifyx
-import docutils.core
-from pygments import highlight
-from pygments.lexers import guess_lexer_for_filename
-from pygments.formatters import TerminalFormatter
 
 implemented_actions = {}
 
 @page_output
 def highlight_watched(filename):
     ''' File contents highlighter '''
+    from pygments import highlight
+    from pygments.lexers import guess_lexer_for_filename
+    from pygments.formatters import TerminalFormatter
     with open(filename, 'r') as file_to_read:
         content = file_to_read.read()
     content = highlight(content,
 @register_action('rsthtml', is_firsttimer=True)
 def view_rst_as_html(filename, first_time=False):
     ''' Function converting reStructuredText to HTML for display in browser '''
+    import docutils.core
     htmlfile = '/tmp/%s.html' % os.path.basename(filename)
     if first_time:
         print('file://%s' % htmlfile)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.