| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,14 +1,14 @@ | |||
| 1 | 1 | """A lexical analyzer class for simple shell-like syntaxes.""" | |
| 2 | 2 | ||
| 3 | - # Module and documentation by Eric S. Raymond, 21 Dec 1998 | ||
| 3 | + # Module and documentation by Eric S. Raymond, 21 Dec 1998 | ||
| 4 | 4 | # Input stacking and error message cleanup added by ESR, March 2000 | |
| 5 | - # push_source() and pop_source() made explicit by ESR, January 2001. | ||
| 5 | + # push_source() and pop_source() made explicit by ESR, January 2001. | ||
| 6 | 6 | ||
| 7 | 7 | import os.path | |
| 8 | 8 | import sys | |
| 9 | 9 | ||
| 10 | 10 | class shlex: | |
| 11 | - "A lexical analyzer class for simple shell-like syntaxes." | ||
| 11 | + "A lexical analyzer class for simple shell-like syntaxes." | ||
| 12 | 12 | def __init__(self, instream=None, infile=None): | |
| 13 | 13 | if instream: | |
| 14 | 14 | self.instream = instream | |
@@ -101,7 +101,7 @@ def read_token(self): | |||
| 101 | 101 | self.lineno = self.lineno + 1 | |
| 102 | 102 | if self.debug >= 3: | |
| 103 | 103 | print "shlex: in state", repr(self.state), \ | |
| 104 | - "I see character:", repr(nextchar) | ||
| 104 | + "I see character:", repr(nextchar) | ||
| 105 | 105 | if self.state is None: | |
| 106 | 106 | self.token = '' # past end of file | |
| 107 | 107 | break | |
@@ -136,14 +136,14 @@ def read_token(self): | |||
| 136 | 136 | if nextchar == self.state: | |
| 137 | 137 | self.state = ' ' | |
| 138 | 138 | break | |
| 139 | - elif not nextchar: # end of file | ||
| 139 | + elif not nextchar: # end of file | ||
| 140 | 140 | if self.debug >= 2: | |
| 141 | 141 | print "shlex: I see EOF in quotes state" | |
| 142 | 142 | # XXX what error should be raised here? | |
| 143 | 143 | raise ValueError, "No closing quotation" | |
| 144 | 144 | elif self.state == 'a': | |
| 145 | 145 | if not nextchar: | |
| 146 | - self.state = None # end of file | ||
| 146 | + self.state = None # end of file | ||
| 147 | 147 | break | |
| 148 | 148 | elif nextchar in self.whitespace: | |
| 149 | 149 | if self.debug >= 2: | |
@@ -194,7 +194,7 @@ def error_leader(self, infile=None, lineno=None): | |||
| 194 | 194 | return "\"%s\", line %d: " % (infile, lineno) | |
| 195 | 195 | ||
| 196 | 196 | ||
| 197 | - if __name__ == '__main__': | ||
| 197 | + if __name__ == '__main__': | ||
| 198 | 198 | if len(sys.argv) == 1: | |
| 199 | 199 | lexer = shlex() | |
| 200 | 200 | else: | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -28,7 +28,7 @@ def showtip(self, text): | |||
| 28 | 28 | background="#ffffe0", relief=SOLID, borderwidth=1, | |
| 29 | 29 | font = self.widget['font']) | |
| 30 | 30 | label.pack() | |
| 31 | - | ||
| 31 | + | ||
| 32 | 32 | def hidetip(self): | |
| 33 | 33 | tw = self.tipwindow | |
| 34 | 34 | self.tipwindow = None | |
@@ -53,7 +53,7 @@ def __init__(self): | |||
| 53 | 53 | text.event_add("<<calltip-hide>>", ")") | |
| 54 | 54 | text.bind("<<calltip-show>>", self.calltip_show) | |
| 55 | 55 | text.bind("<<calltip-hide>>", self.calltip_hide) | |
| 56 | - | ||
| 56 | + | ||
| 57 | 57 | text.focus_set() | |
| 58 | 58 | # root.mainloop() # not in idle | |
| 59 | 59 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -45,7 +45,7 @@ def _remove_calltip_window(self): | |||
| 45 | 45 | if self.calltip: | |
| 46 | 46 | self.calltip.hidetip() | |
| 47 | 47 | self.calltip = None | |
| 48 | - | ||
| 48 | + | ||
| 49 | 49 | def paren_open_event(self, event): | |
| 50 | 50 | self._remove_calltip_window() | |
| 51 | 51 | arg_text = get_arg_text(self.get_object_at_cursor()) | |
@@ -91,9 +91,9 @@ def get_object_at_cursor(self, | |||
| 91 | 91 | namespace = sys.modules.copy() | |
| 92 | 92 | namespace.update(__main__.__dict__) | |
| 93 | 93 | try: | |
| 94 | - return eval(word, namespace) | ||
| 94 | + return eval(word, namespace) | ||
| 95 | 95 | except: | |
| 96 | - pass | ||
| 96 | + pass | ||
| 97 | 97 | return None # Can't find an object. | |
| 98 | 98 | ||
| 99 | 99 | def _find_constructor(class_ob): | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -92,7 +92,7 @@ def OnDoubleClick(self): | |||
| 92 | 92 | ||
| 93 | 93 | def IsExpandable(self): | |
| 94 | 94 | return os.path.normcase(self.file[-3:]) == ".py" | |
| 95 | - | ||
| 95 | + | ||
| 96 | 96 | def listclasses(self): | |
| 97 | 97 | dir, file = os.path.split(self.file) | |
| 98 | 98 | name, ext = os.path.splitext(file) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -17,7 +17,7 @@ def __init__(self, pyshell): | |||
| 17 | 17 | bdb.Bdb.__init__(self) | |
| 18 | 18 | self.pyshell = pyshell | |
| 19 | 19 | self.make_gui() | |
| 20 | - | ||
| 20 | + | ||
| 21 | 21 | def canonic(self, filename): | |
| 22 | 22 | # Canonicalize filename -- called by Bdb | |
| 23 | 23 | return os.path.normcase(os.path.abspath(filename)) | |
@@ -299,10 +299,10 @@ def set_break(self, filename, lineno, temporary=0, cond = None): | |||
| 299 | 299 | import linecache # Import as late as possible | |
| 300 | 300 | line = linecache.getline(filename, lineno) | |
| 301 | 301 | if not line: | |
| 302 | - return 'That line does not exist!' | ||
| 302 | + return 'That line does not exist!' | ||
| 303 | 303 | if not self.breaks.has_key(filename): | |
| 304 | - self.breaks[filename] = [] | ||
| 304 | + self.breaks[filename] = [] | ||
| 305 | 305 | list = self.breaks[filename] | |
| 306 | 306 | if not lineno in list: | |
| 307 | - list.append(lineno) | ||
| 307 | + list.append(lineno) | ||
| 308 | 308 | bp = bdb.Breakpoint(filename, lineno, temporary, cond) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,4 +1,3 @@ | |||
| 1 | - | ||
| 2 | 1 | class Delegator: | |
| 3 | 2 | ||
| 4 | 3 | # The cache is only used to be able to change delegates! | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -26,12 +26,12 @@ def __init__(self, root): | |||
| 26 | 26 | ||
| 27 | 27 | ||
| 28 | 28 | def goodname(self, filename): | |
| 29 | - filename = self.canonize(filename) | ||
| 30 | - key = os.path.normcase(filename) | ||
| 31 | - if self.dict.has_key(key): | ||
| 32 | - edit = self.dict[key] | ||
| 33 | - filename = edit.io.filename or filename | ||
| 34 | - return filename | ||
| 29 | + filename = self.canonize(filename) | ||
| 30 | + key = os.path.normcase(filename) | ||
| 31 | + if self.dict.has_key(key): | ||
| 32 | + edit = self.dict[key] | ||
| 33 | + filename = edit.io.filename or filename | ||
| 34 | + return filename | ||
| 35 | 35 | ||
| 36 | 36 | def open(self, filename): | |
| 37 | 37 | assert filename | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -28,10 +28,10 @@ class FormatParagraph: | |||
| 28 | 28 | keydefs = { | |
| 29 | 29 | '<<format-paragraph>>': ['<Alt-q>'], | |
| 30 | 30 | } | |
| 31 | - | ||
| 31 | + | ||
| 32 | 32 | unix_keydefs = { | |
| 33 | 33 | '<<format-paragraph>>': ['<Meta-q>'], | |
| 34 | - } | ||
| 34 | + } | ||
| 35 | 35 | ||
| 36 | 36 | def __init__(self, editwin): | |
| 37 | 37 | self.editwin = editwin | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -10,24 +10,24 @@ class IdleConfParser(ConfigParser): | |||
| 10 | 10 | builtin_sections = {} | |
| 11 | 11 | for section in ('EditorWindow', 'Colors'): | |
| 12 | 12 | builtin_sections[section] = section | |
| 13 | - | ||
| 13 | + | ||
| 14 | 14 | def getcolor(self, sec, name): | |
| 15 | 15 | """Return a dictionary with foreground and background colors | |
| 16 | 16 | ||
| 17 | 17 | The return value is appropriate for passing to Tkinter in, e.g., | |
| 18 | 18 | a tag_config call. | |
| 19 | 19 | """ | |
| 20 | - fore = self.getdef(sec, name + "-foreground") | ||
| 21 | - back = self.getdef(sec, name + "-background") | ||
| 20 | + fore = self.getdef(sec, name + "-foreground") | ||
| 21 | + back = self.getdef(sec, name + "-background") | ||
| 22 | 22 | return {"foreground": fore, | |
| 23 | 23 | "background": back} | |
| 24 | 24 | ||
| 25 | 25 | def getdef(self, sec, options, raw=0, vars=None, default=None): | |
| 26 | 26 | """Get an option value for given section or return default""" | |
| 27 | - try: | ||
| 27 | + try: | ||
| 28 | 28 | return self.get(sec, options, raw, vars) | |
| 29 | - except (NoSectionError, NoOptionError): | ||
| 30 | - return default | ||
| 29 | + except (NoSectionError, NoOptionError): | ||
| 30 | + return default | ||
| 31 | 31 | ||
| 32 | 32 | def getsection(self, section): | |
| 33 | 33 | """Return a SectionConfigParser object""" | |
@@ -37,10 +37,10 @@ def getextensions(self): | |||
| 37 | 37 | exts = [] | |
| 38 | 38 | for sec in self.sections(): | |
| 39 | 39 | if self.builtin_sections.has_key(sec): | |
| 40 | - continue | ||
| 41 | - # enable is a bool, but it may not be defined | ||
| 42 | - if self.getdef(sec, 'enable') != '0': | ||
| 43 | - exts.append(sec) | ||
| 40 | + continue | ||
| 41 | + # enable is a bool, but it may not be defined | ||
| 42 | + if self.getdef(sec, 'enable') != '0': | ||
| 43 | + exts.append(sec) | ||
| 44 | 44 | return exts | |
| 45 | 45 | ||
| 46 | 46 | def reload(self): | |
@@ -69,10 +69,10 @@ def getdef(self, options, raw=0, vars=None, default=None): | |||
| 69 | 69 | ||
| 70 | 70 | def getint(self, option): | |
| 71 | 71 | return self.config.getint(self.section, option) | |
| 72 | - | ||
| 72 | + | ||
| 73 | 73 | def getfloat(self, option): | |
| 74 | 74 | return self.config.getint(self.section, option) | |
| 75 | - | ||
| 75 | + | ||
| 76 | 76 | def getboolean(self, option): | |
| 77 | 77 | return self.config.getint(self.section, option) | |
| 78 | 78 | ||
@@ -98,7 +98,7 @@ def load(dir): | |||
| 98 | 98 | genplatfile = os.path.join(dir, "config-mac.txt") | |
| 99 | 99 | else: | |
| 100 | 100 | genplatfile = os.path.join(dir, "config-unix.txt") | |
| 101 | - | ||
| 101 | + | ||
| 102 | 102 | platfile = os.path.join(dir, "config-%s.txt" % sys.platform) | |
| 103 | 103 | ||
| 104 | 104 | try: | |
@@ -110,4 +110,3 @@ def load(dir): | |||
| 110 | 110 | os.path.join(homedir, ".idle"))) | |
| 111 | 111 | ||
| 112 | 112 | idleconf = IdleConfParser() | |
| 113 | - | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -86,4 +86,3 @@ def recall(self, s): | |||
| 86 | 86 | self.text.mark_set("insert", "end-1c") | |
| 87 | 87 | self.text.insert("insert", s) | |
| 88 | 88 | self.text.see("insert") | |
| 89 | - | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments