Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix pep8 errors #49

Merged
merged 1 commit into from
Jul 4, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
325 changes: 163 additions & 162 deletions data/em.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,38 +92,39 @@
# Usage info.
OPTION_INFO = [
("-V --version", "Print version and exit"),
("-h --help", "Print usage and exit"),
("-H --extended-help", "Print extended usage and exit"),
("-k --suppress-errors", "Do not exit on errors; go interactive"),
("-p --prefix=<char>", "Change prefix to something other than @"),
(" --no-prefix", "Do not do any markup processing at all"),
("-m --module=<name>", "Change the internal pseudomodule name"),
("-f --flatten", "Flatten the members of pseudmodule to start"),
("-r --raw-errors", "Show raw Python errors"),
("-i --interactive", "Go into interactive mode after processing"),
("-n --no-override-stdout", "Do not override sys.stdout with proxy"),
("-o --output=<filename>", "Specify file for output as write"),
("-a --append=<filename>", "Specify file for output as append"),
("-b --buffered-output", "Fully buffer output including open"),
(" --binary", "Treat the file as a binary"),
(" --chunk-size=<chunk>", "Use this chunk size for reading binaries"),
("-P --preprocess=<filename>", "Interpret EmPy file before main processing"),
("-I --import=<modules>", "Import Python modules before processing"),
("-D --define=<definition>", "Execute Python assignment statement"),
("-E --execute=<statement>", "Execute Python statement before processing"),
("-F --execute-file=<filename>", "Execute Python file before processing"),
(" --pause-at-end", "Prompt at the ending of processing"),
(" --relative-path", "Add path of EmPy script to sys.path"),
(" --no-callback-error", "Custom markup without callback is error"),
(" --no-bangpath-processing", "Suppress bangpaths as comments"),
("-u --unicode", "Enable Unicode subsystem (Python 2+ only)"),
(" --unicode-encoding=<e>", "Set both input and output encodings"),
(" --unicode-input-encoding=<e>", "Set input encoding"),
(" --unicode-output-encoding=<e>", "Set output encoding"),
(" --unicode-errors=<E>", "Set both input and output error handler"),
(" --unicode-input-errors=<E>", "Set input error handler"),
(" --unicode-output-errors=<E>", "Set output error handler"),
]
("-h --help", "Print usage and exit"),
("-H --extended-help", "Print extended usage and exit"),
("-k --suppress-errors", "Do not exit on errors; go interactive"),
("-p --prefix=<char>", "Change prefix to something other than @"),
(" --no-prefix", "Do not do any markup processing at all"),
("-m --module=<name>", "Change the internal pseudomodule name"),
("-f --flatten", "Flatten the members of pseudmodule to start"),
("-r --raw-errors", "Show raw Python errors"),
("-i --interactive", "Go into interactive mode after processing"),
("-n --no-override-stdout", "Do not override sys.stdout with proxy"),
("-o --output=<filename>", "Specify file for output as write"),
("-a --append=<filename>", "Specify file for output as append"),
("-b --buffered-output", "Fully buffer output including open"),
(" --binary", "Treat the file as a binary"),
(" --chunk-size=<chunk>", "Use this chunk size for reading binaries"),
("-P --preprocess=<filename>",
"Interpret EmPy file before main processing"),
("-I --import=<modules>", "Import Python modules before processing"),
("-D --define=<definition>", "Execute Python assignment statement"),
("-E --execute=<statement>", "Execute Python statement before processing"),
("-F --execute-file=<filename>", "Execute Python file before processing"),
(" --pause-at-end", "Prompt at the ending of processing"),
(" --relative-path", "Add path of EmPy script to sys.path"),
(" --no-callback-error", "Custom markup without callback is error"),
(" --no-bangpath-processing", "Suppress bangpaths as comments"),
("-u --unicode", "Enable Unicode subsystem (Python 2+ only)"),
(" --unicode-encoding=<e>", "Set both input and output encodings"),
(" --unicode-input-encoding=<e>", "Set input encoding"),
(" --unicode-output-encoding=<e>", "Set output encoding"),
(" --unicode-errors=<E>", "Set both input and output error handler"),
(" --unicode-input-errors=<E>", "Set input error handler"),
(" --unicode-output-errors=<E>", "Set output error handler"),
]

USAGE_NOTES = """\
Notes: Whitespace immediately inside parentheses of @(...) are
Expand All @@ -135,128 +136,128 @@

MARKUP_INFO = [
("@# ... NL", "Comment; remove everything up to newline"),
("@? NAME NL", "Set the current context name"),
("@! INTEGER NL", "Set the current context line number"),
("@ WHITESPACE", "Remove following whitespace; line continuation"),
("@\\ ESCAPE_CODE", "A C-style escape sequence"),
("@@", "Literal @; @ is escaped (duplicated prefix)"),
("@), @], @}", "Literal close parenthesis, bracket, brace"),
("@ STRING_LITERAL", "Replace with string literal contents"),
("@( EXPRESSION )", "Evaluate expression and substitute with str"),
("@( TEST [? THEN [! ELSE]] )",
"If test is true, evaluate then, otherwise else"),
("@( TRY $ CATCH )", "Expand try expression, or catch if it raises"),
("@ SIMPLE_EXPRESSION", "Evaluate simple expression and substitute;\n"
"e.g., @x, @x.y, @f(a, b), @l[i], etc."),
("@` EXPRESSION `", "Evaluate expression and substitute with repr"),
("@: EXPRESSION : [DUMMY] :", "Evaluates to @:...:expansion:"),
("@{ STATEMENTS }", "Statements are executed for side effects"),
("@[ CONTROL ]", "Control markups: if E; elif E; for N in E;\n"
"while E; try; except E, N; finally; continue;\n"
"break; end X"),
("@%% KEY WHITESPACE VALUE NL", "Significator form of __KEY__ = VALUE"),
("@< CONTENTS >", "Custom markup; meaning provided by user"),
]
("@? NAME NL", "Set the current context name"),
("@! INTEGER NL", "Set the current context line number"),
("@ WHITESPACE", "Remove following whitespace; line continuation"),
("@\\ ESCAPE_CODE", "A C-style escape sequence"),
("@@", "Literal @; @ is escaped (duplicated prefix)"),
("@), @], @}", "Literal close parenthesis, bracket, brace"),
("@ STRING_LITERAL", "Replace with string literal contents"),
("@( EXPRESSION )", "Evaluate expression and substitute with str"),
("@( TEST [? THEN [! ELSE]] )",
"If test is true, evaluate then, otherwise else"),
("@( TRY $ CATCH )", "Expand try expression, or catch if it raises"),
("@ SIMPLE_EXPRESSION", "Evaluate simple expression and substitute;\n"
"e.g., @x, @x.y, @f(a, b), @l[i], etc."),
("@` EXPRESSION `", "Evaluate expression and substitute with repr"),
("@: EXPRESSION : [DUMMY] :", "Evaluates to @:...:expansion:"),
("@{ STATEMENTS }", "Statements are executed for side effects"),
("@[ CONTROL ]", "Control markups: if E; elif E; for N in E;\n"
"while E; try; except E, N; finally; continue;\n"
"break; end X"),
("@%% KEY WHITESPACE VALUE NL", "Significator form of __KEY__ = VALUE"),
("@< CONTENTS >", "Custom markup; meaning provided by user"),
]

ESCAPE_INFO = [
("@\\0", "NUL, null"),
("@\\a", "BEL, bell"),
("@\\b", "BS, backspace"),
("@\\dDDD", "three-digit decimal code DDD"),
("@\\e", "ESC, escape"),
("@\\f", "FF, form feed"),
("@\\h", "DEL, delete"),
("@\\n", "LF, linefeed, newline"),
("@\\N{NAME}", "Unicode character named NAME"),
("@\\oOOO", "three-digit octal code OOO"),
("@\\qQQQQ", "four-digit quaternary code QQQQ"),
("@\\r", "CR, carriage return"),
("@\\s", "SP, space"),
("@\\t", "HT, horizontal tab"),
("@\\uHHHH", "16-bit hexadecimal Unicode HHHH"),
("@\\UHHHHHHHH", "32-bit hexadecimal Unicode HHHHHHHH"),
("@\\v", "VT, vertical tab"),
("@\\xHH", "two-digit hexadecimal code HH"),
("@\\z", "EOT, end of transmission"),
]
("@\\a", "BEL, bell"),
("@\\b", "BS, backspace"),
("@\\dDDD", "three-digit decimal code DDD"),
("@\\e", "ESC, escape"),
("@\\f", "FF, form feed"),
("@\\h", "DEL, delete"),
("@\\n", "LF, linefeed, newline"),
("@\\N{NAME}", "Unicode character named NAME"),
("@\\oOOO", "three-digit octal code OOO"),
("@\\qQQQQ", "four-digit quaternary code QQQQ"),
("@\\r", "CR, carriage return"),
("@\\s", "SP, space"),
("@\\t", "HT, horizontal tab"),
("@\\uHHHH", "16-bit hexadecimal Unicode HHHH"),
("@\\UHHHHHHHH", "32-bit hexadecimal Unicode HHHHHHHH"),
("@\\v", "VT, vertical tab"),
("@\\xHH", "two-digit hexadecimal code HH"),
("@\\z", "EOT, end of transmission"),
]

PSEUDOMODULE_INFO = [
("VERSION", "String representing EmPy version"),
("SIGNIFICATOR_RE_STRING", "Regular expression matching significators"),
("SIGNIFICATOR_RE_SUFFIX", "The above stub, lacking the prefix"),
("interpreter", "Currently-executing interpreter instance"),
("argv", "The EmPy script name and command line arguments"),
("args", "The command line arguments only"),
("identify()", "Identify top context as name, line"),
("setContextName(name)", "Set the name of the current context"),
("setContextLine(line)", "Set the line number of the current context"),
("atExit(callable)", "Invoke no-argument function at shutdown"),
("getGlobals()", "Retrieve this interpreter's globals"),
("setGlobals(dict)", "Set this interpreter's globals"),
("updateGlobals(dict)", "Merge dictionary into interpreter's globals"),
("clearGlobals()", "Start globals over anew"),
("saveGlobals([deep])", "Save a copy of the globals"),
("restoreGlobals([pop])", "Restore the most recently saved globals"),
("defined(name, [loc])", "Find if the name is defined"),
("evaluate(expression, [loc])", "Evaluate the expression"),
("serialize(expression, [loc])", "Evaluate and serialize the expression"),
("execute(statements, [loc])", "Execute the statements"),
("single(source, [loc])", "Execute the 'single' object"),
("atomic(name, value, [loc])", "Perform an atomic assignment"),
("assign(name, value, [loc])", "Perform an arbitrary assignment"),
("significate(key, [value])", "Significate the given key, value pair"),
("include(file, [loc])", "Include filename or file-like object"),
("expand(string, [loc])", "Explicitly expand string and return"),
("string(data, [name], [loc])", "Process string-like object"),
("quote(string)", "Quote prefixes in provided string and return"),
("flatten([keys])", "Flatten module contents into globals namespace"),
("getPrefix()", "Get current prefix"),
("setPrefix(char)", "Set new prefix"),
("stopDiverting()", "Stop diverting; data sent directly to output"),
("createDiversion(name)", "Create a diversion but do not divert to it"),
("retrieveDiversion(name)", "Retrieve the actual named diversion object"),
("startDiversion(name)", "Start diverting to given diversion"),
("playDiversion(name)", "Recall diversion and then eliminate it"),
("replayDiversion(name)", "Recall diversion but retain it"),
("purgeDiversion(name)", "Erase diversion"),
("playAllDiversions()", "Stop diverting and play all diversions in order"),
("replayAllDiversions()", "Stop diverting and replay all diversions"),
("purgeAllDiversions()", "Stop diverting and purge all diversions"),
("getFilter()", "Get current filter"),
("resetFilter()", "Reset filter; no filtering"),
("nullFilter()", "Install null filter"),
("setFilter(shortcut)", "Install new filter or filter chain"),
("attachFilter(shortcut)", "Attach single filter to end of current chain"),
("areHooksEnabled()", "Return whether or not hooks are enabled"),
("enableHooks()", "Enable hooks (default)"),
("disableHooks()", "Disable hook invocation"),
("getHooks()", "Get all the hooks"),
("clearHooks()", "Clear all hooks"),
("addHook(hook, [i])", "Register the hook (optionally insert)"),
("removeHook(hook)", "Remove an already-registered hook from name"),
("invokeHook(name_, ...)", "Manually invoke hook"),
("getCallback()", "Get interpreter callback"),
("registerCallback(callback)", "Register callback with interpreter"),
("deregisterCallback()", "Deregister callback from interpreter"),
("invokeCallback(contents)", "Invoke the callback directly"),
("Interpreter", "The interpreter class"),
]
("SIGNIFICATOR_RE_STRING", "Regular expression matching significators"),
("SIGNIFICATOR_RE_SUFFIX", "The above stub, lacking the prefix"),
("interpreter", "Currently-executing interpreter instance"),
("argv", "The EmPy script name and command line arguments"),
("args", "The command line arguments only"),
("identify()", "Identify top context as name, line"),
("setContextName(name)", "Set the name of the current context"),
("setContextLine(line)", "Set the line number of the current context"),
("atExit(callable)", "Invoke no-argument function at shutdown"),
("getGlobals()", "Retrieve this interpreter's globals"),
("setGlobals(dict)", "Set this interpreter's globals"),
("updateGlobals(dict)", "Merge dictionary into interpreter's globals"),
("clearGlobals()", "Start globals over anew"),
("saveGlobals([deep])", "Save a copy of the globals"),
("restoreGlobals([pop])", "Restore the most recently saved globals"),
("defined(name, [loc])", "Find if the name is defined"),
("evaluate(expression, [loc])", "Evaluate the expression"),
("serialize(expression, [loc])", "Evaluate and serialize the expression"),
("execute(statements, [loc])", "Execute the statements"),
("single(source, [loc])", "Execute the 'single' object"),
("atomic(name, value, [loc])", "Perform an atomic assignment"),
("assign(name, value, [loc])", "Perform an arbitrary assignment"),
("significate(key, [value])", "Significate the given key, value pair"),
("include(file, [loc])", "Include filename or file-like object"),
("expand(string, [loc])", "Explicitly expand string and return"),
("string(data, [name], [loc])", "Process string-like object"),
("quote(string)", "Quote prefixes in provided string and return"),
("flatten([keys])", "Flatten module contents into globals namespace"),
("getPrefix()", "Get current prefix"),
("setPrefix(char)", "Set new prefix"),
("stopDiverting()", "Stop diverting; data sent directly to output"),
("createDiversion(name)", "Create a diversion but do not divert to it"),
("retrieveDiversion(name)", "Retrieve the actual named diversion object"),
("startDiversion(name)", "Start diverting to given diversion"),
("playDiversion(name)", "Recall diversion and then eliminate it"),
("replayDiversion(name)", "Recall diversion but retain it"),
("purgeDiversion(name)", "Erase diversion"),
("playAllDiversions()", "Stop diverting and play all diversions in order"),
("replayAllDiversions()", "Stop diverting and replay all diversions"),
("purgeAllDiversions()", "Stop diverting and purge all diversions"),
("getFilter()", "Get current filter"),
("resetFilter()", "Reset filter; no filtering"),
("nullFilter()", "Install null filter"),
("setFilter(shortcut)", "Install new filter or filter chain"),
("attachFilter(shortcut)", "Attach single filter to end of current chain"),
("areHooksEnabled()", "Return whether or not hooks are enabled"),
("enableHooks()", "Enable hooks (default)"),
("disableHooks()", "Disable hook invocation"),
("getHooks()", "Get all the hooks"),
("clearHooks()", "Clear all hooks"),
("addHook(hook, [i])", "Register the hook (optionally insert)"),
("removeHook(hook)", "Remove an already-registered hook from name"),
("invokeHook(name_, ...)", "Manually invoke hook"),
("getCallback()", "Get interpreter callback"),
("registerCallback(callback)", "Register callback with interpreter"),
("deregisterCallback()", "Deregister callback from interpreter"),
("invokeCallback(contents)", "Invoke the callback directly"),
("Interpreter", "The interpreter class"),
]

ENVIRONMENT_INFO = [
(OPTIONS_ENV, "Specified options will be included"),
(PREFIX_ENV, "Specify the default prefix: -p <value>"),
(PSEUDO_ENV, "Specify name of pseudomodule: -m <value>"),
(FLATTEN_ENV, "Flatten empy pseudomodule if defined: -f"),
(RAW_ENV, "Show raw errors if defined: -r"),
(INTERACTIVE_ENV, "Enter interactive mode if defined: -i"),
(BUFFERED_ENV, "Fully buffered output if defined: -b"),
(NO_OVERRIDE_ENV, "Do not override sys.stdout if defined: -n"),
(UNICODE_ENV, "Enable Unicode subsystem: -n"),
(INPUT_ENCODING_ENV, "Unicode input encoding"),
(OUTPUT_ENCODING_ENV, "Unicode output encoding"),
(INPUT_ERRORS_ENV, "Unicode input error handler"),
(OUTPUT_ERRORS_ENV, "Unicode output error handler"),
]
(PREFIX_ENV, "Specify the default prefix: -p <value>"),
(PSEUDO_ENV, "Specify name of pseudomodule: -m <value>"),
(FLATTEN_ENV, "Flatten empy pseudomodule if defined: -f"),
(RAW_ENV, "Show raw errors if defined: -r"),
(INTERACTIVE_ENV, "Enter interactive mode if defined: -i"),
(BUFFERED_ENV, "Fully buffered output if defined: -b"),
(NO_OVERRIDE_ENV, "Do not override sys.stdout if defined: -n"),
(UNICODE_ENV, "Enable Unicode subsystem: -n"),
(INPUT_ENCODING_ENV, "Unicode input encoding"),
(OUTPUT_ENCODING_ENV, "Unicode output encoding"),
(INPUT_ERRORS_ENV, "Unicode input error handler"),
(OUTPUT_ERRORS_ENV, "Unicode output error handler"),
]


class Error(Exception):
Expand Down Expand Up @@ -3270,23 +3271,23 @@ def invoke(args):
args,
'VhHvkp:m:frino:a:buBP:I:D:E:F:',
['version',
'help',
'extended-help',
'verbose',
'null-hook',
'suppress-errors',
'prefix=',
'no-prefix',
'module=',
'flatten',
'raw-errors',
'interactive',
'no-override-stdout',
'binary',
'chunk-size=',
'output='
'append=',
'preprocess=',
'help',
'extended-help',
'verbose',
'null-hook',
'suppress-errors',
'prefix=',
'no-prefix',
'module=',
'flatten',
'raw-errors',
'interactive',
'no-override-stdout',
'binary',
'chunk-size=',
'output='
'append=',
'preprocess=',
'import=',
'define=',
'execute=',
Expand Down
4 changes: 2 additions & 2 deletions src/jarabe/frame/activitiestray.py
Original file line number Diff line number Diff line change
Expand Up @@ -689,9 +689,9 @@ def __accept_activate_cb(self, menu_item):
extension = '.bin'
fd, file_path = tempfile.mkstemp(suffix=extension,
prefix=self._sanitize(
self.file_transfer.title),
self.file_transfer.title),
dir=os.path.join(
env.get_profile_path(), 'data'))
env.get_profile_path(), 'data'))
os.close(fd)
os.unlink(file_path)

Expand Down
6 changes: 3 additions & 3 deletions src/jarabe/journal/listview.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,9 +289,9 @@ def update_with_query(self, query_dict):
cell_text = self.sort_column.get_cells()[0]
self.sort_column.set_attributes(cell_text,
text=getattr(
ListModel, 'COLUMN_' +
property_.upper(),
ListModel.COLUMN_TIMESTAMP))
ListModel, 'COLUMN_' +
property_.upper(),
ListModel.COLUMN_TIMESTAMP))
self._query = query_dict

self.refresh()
Expand Down