|
def | __init__ (self, ns_globals={}, ns_locals={}) |
|
def | namespace (self) |
|
def | is_balanced (self, line) |
|
def | complete (self, line) |
|
def | eval (self, console) |
|
def | execute (self, console) |
|
|
| completer |
|
| command |
|
| globals |
|
| locals |
|
| complete_sep |
|
| prompt |
|
Definition at line 40 of file shell.py.
◆ __init__()
def pycons.shell.Shell.__init__ |
( |
|
self, |
|
|
|
ns_globals = {} , |
|
|
|
ns_locals = {} |
|
) |
| |
Definition at line 43 of file shell.py.
43 def __init__(self, ns_globals={}, ns_locals={}):
46 self.completer = rlcompleter.Completer (ns_globals)
48 self.globals = ns_globals
49 self.locals = ns_locals
50 self.complete_sep = re.compile(
r'[\s\{\}\[\]\(\)]')
◆ is_balanced()
def pycons.shell.Shell.is_balanced |
( |
|
self, |
|
|
|
line |
|
) |
| |
Checks line balance for brace, bracket, parentheses and string quote
This helper function checks for the balance of brace, bracket,
parentheses and string quote. Any unbalanced line means to wait until
some other lines are fed to the console.
Definition at line 57 of file shell.py.
57 def is_balanced (self, line):
58 """ Checks line balance for brace, bracket, parentheses and string quote 60 This helper function checks for the balance of brace, bracket, 61 parentheses and string quote. Any unbalanced line means to wait until 62 some other lines are fed to the console. 66 s = list(filter(
lambda x: x
in '()[]{}"\'', s))
70 brackets = {
'(':
')',
'[':
']',
'{':
'}',
'"':
'"',
'\'':
'\''}
75 if stack
and brackets[stack[-1]] == s[0]:
80 if stack
and brackets[stack[-1]] == s[0]:
89 if s[0]
in '"\'' and stack
and brackets[stack[-1]] == s[0]:
93 return len(stack) == 0
The documentation for this class was generated from the following file: