Skip to content

Commit cbf001c

Browse files
Jan200101abitrolly
authored andcommitted
move nested function outside scope
1 parent 5a79c76 commit cbf001c

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

lib/cheat_wrapper.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,24 @@
1919
import frontend.html
2020
import frontend.ansi
2121

22+
def _add_section_name(query):
23+
# temporary solution before we don't find a fixed one
24+
if ' ' not in query and '+' not in query:
25+
return query
26+
if '/' in query:
27+
return query
28+
if ' ' in query:
29+
# for standalone queries only that may contain ' '
30+
return "%s/%s" % tuple(query.split(' ', 1))
31+
return "%s/%s" % tuple(query.split('+', 1))
32+
2233
def cheat_wrapper(query, request_options=None, output_format='ansi'):
2334
"""
2435
Function that delivers cheat sheet for `query`.
2536
If `html` is True, the answer is formatted as HTML.
2637
Additional request options specified in `request_options`.
2738
"""
2839

29-
def _add_section_name(query):
30-
# temporary solution before we don't find a fixed one
31-
if ' ' not in query and '+' not in query:
32-
return query
33-
if '/' in query:
34-
return query
35-
if ' ' in query:
36-
# for standalone queries only that may contain ' '
37-
return "%s/%s" % tuple(query.split(' ', 1))
38-
return "%s/%s" % tuple(query.split('+', 1))
3940

4041
def _rewrite_aliases(word):
4142
if word == ':bash.completion':

0 commit comments

Comments
 (0)