-
Notifications
You must be signed in to change notification settings - Fork 261
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ARELLE 348 - plug ins, add examples, test subdirectories, test packag…
…e relative imports
- Loading branch information
Herm Fischer
authored and
Herm Fischer
committed
Apr 26, 2015
1 parent
c12347e
commit 5e72e01
Showing
17 changed files
with
309 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
''' | ||
pluginPackages test case | ||
(c) Copyright 2012 Mark V Systems Limited, All rights reserved. | ||
''' | ||
# this module would raise system error due to PEP 366 after python 3.4.3 | ||
from . import importTestImported11 | ||
|
||
def foo(): | ||
print ("imported unpackaged plug-in relative imported 1") | ||
|
||
__pluginInfo__ = { | ||
'name': 'Unpackaged Relative Import 1', | ||
'version': '0.9', | ||
'description': "This is a unpackaged relative imported plugin.", | ||
'license': 'Apache-2', | ||
'author': 'Mark V Systems', | ||
'copyright': '(c) Copyright 2015 Mark V Systems Limited, All rights reserved.', | ||
# classes of mount points (required) | ||
'Import.Unpackaged.Entry6': foo, | ||
# imported plugins | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
''' | ||
pluginPackages test case | ||
(c) Copyright 2012 Mark V Systems Limited, All rights reserved. | ||
''' | ||
# this module would raise system error due to PEP 366 after python 3.4.3 | ||
|
||
def foo(): | ||
print ("imported unpackaged plug-in imported relative 1.1") | ||
|
||
__pluginInfo__ = { | ||
'name': 'Unpackaged Relative Import 1.1', | ||
'version': '0.9', | ||
'description': "This is a packages-containing unpackaged imported plugin.", | ||
'license': 'Apache-2', | ||
'author': 'Mark V Systems', | ||
'copyright': '(c) Copyright 2015 Mark V Systems Limited, All rights reserved.', | ||
# classes of mount points (required) | ||
'Import.Unpackaged.Entry7': foo, | ||
# imported plugins | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
''' | ||
pluginPackages test case | ||
(c) Copyright 2012 Mark V Systems Limited, All rights reserved. | ||
''' | ||
from os import path | ||
from arelle.PluginManager import pluginClassMethods | ||
from . import importTestImported1 | ||
from .importTestImported1 import foo | ||
|
||
def parentMenuEntender(cntlr, menu): | ||
menu.add_command(label="Packaged Parent exercise descendants", underline=0, command=lambda: parentMenuCommand(cntlr) ) | ||
|
||
def parentMenuCommand(cntl): | ||
for i in range(1,100): | ||
for pluginMethod in pluginClassMethods("Import.Packaged.Entry{}".format(i)): | ||
pluginMethod() | ||
|
||
def parentCommandLineOptionExtender(parser): | ||
parser.add_option("--packagedParentImportExample", | ||
action="store_true", | ||
dest="packagedParentImportExample", | ||
help=_('Test that imported plug-ins were actually loaded and activated"')) | ||
|
||
def parentCommandLineUtilityRun(cntlr, options, **kwargs): | ||
if options.packagedParentImportExample: | ||
parentMenuCommand(cntlr) | ||
|
||
def foo(): | ||
print ("parent (__init__) of imported packaged plug-ins") | ||
|
||
__pluginInfo__ = { | ||
'name': 'Import Test Package Parent', | ||
'version': '0.9', | ||
'description': "This is a imports-containing packaged (__init__) plugin.", | ||
'license': 'Apache-2', | ||
'author': 'Mark V Systems', | ||
'copyright': '(c) Copyright 2015 Mark V Systems Limited, All rights reserved.', | ||
# classes of mount points (required) | ||
'CntlrWinMain.Menu.Tools': parentMenuEntender, | ||
'CntlrCmdLine.Options': parentCommandLineOptionExtender, | ||
'CntlrCmdLine.Utility.Run': parentCommandLineUtilityRun, | ||
'Import.Packaged.Entry1': foo, | ||
# imported plugins | ||
'import': ('importTestChild1.py', 'importTestChild2.py', "module_import_subtree") | ||
} |
20 changes: 20 additions & 0 deletions
20
arelle/examples/plugin/packagedImportTest/importTestChild1.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
''' | ||
pluginPackages test case | ||
(c) Copyright 2012 Mark V Systems Limited, All rights reserved. | ||
''' | ||
|
||
def foo(): | ||
print ("imported packaged plug-in child 1") | ||
|
||
__pluginInfo__ = { | ||
'name': 'Package Listed Import Child 1', | ||
'version': '0.9', | ||
'description': "This is a packaged child plugin.", | ||
'license': 'Apache-2', | ||
'author': 'Mark V Systems', | ||
'copyright': '(c) Copyright 2015 Mark V Systems Limited, All rights reserved.', | ||
# classes of mount points (required) | ||
'Import.Packaged.Entry2': foo, | ||
# imported plugins | ||
} |
21 changes: 21 additions & 0 deletions
21
arelle/examples/plugin/packagedImportTest/importTestChild2.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
''' | ||
pluginPackages test case | ||
(c) Copyright 2012 Mark V Systems Limited, All rights reserved. | ||
''' | ||
|
||
def foo(): | ||
print ("imported packaged plug-in child 2") | ||
|
||
__pluginInfo__ = { | ||
'name': 'Package Listed Import Child 2', | ||
'version': '0.9', | ||
'description': "This is a packaged child plugin.", | ||
'license': 'Apache-2', | ||
'author': 'Mark V Systems', | ||
'copyright': '(c) Copyright 2015 Mark V Systems Limited, All rights reserved.', | ||
# classes of mount points (required) | ||
'Import.Packaged.Entry3': foo, | ||
# import plugins | ||
'import': ('importTestGrandchild1.py', 'importTestGrandchild2.py') | ||
} |
20 changes: 20 additions & 0 deletions
20
arelle/examples/plugin/packagedImportTest/importTestGrandchild1.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
''' | ||
pluginPackages test case | ||
(c) Copyright 2012 Mark V Systems Limited, All rights reserved. | ||
''' | ||
|
||
def foo(): | ||
print ("imported packaged plug-in grandchild 1") | ||
|
||
__pluginInfo__ = { | ||
'name': 'Package Listed Import Grandchild 1.1', | ||
'version': '0.9', | ||
'description': "This is a packaged grandchild plugin.", | ||
'license': 'Apache-2', | ||
'author': 'Mark V Systems', | ||
'copyright': '(c) Copyright 2015 Mark V Systems Limited, All rights reserved.', | ||
# classes of mount points (required) | ||
'Import.Packaged.Entry4': foo, | ||
# imported plugins | ||
} |
20 changes: 20 additions & 0 deletions
20
arelle/examples/plugin/packagedImportTest/importTestGrandchild2.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
''' | ||
pluginPackages test case | ||
(c) Copyright 2012 Mark V Systems Limited, All rights reserved. | ||
''' | ||
|
||
def foo(): | ||
print ("imported packaged plug-in grandchild 2") | ||
|
||
__pluginInfo__ = { | ||
'name': 'Package Listed Import Grandchild 1.2', | ||
'version': '0.9', | ||
'description': "This is a packaged grandchild plugin.", | ||
'license': 'Apache-2', | ||
'author': 'Mark V Systems', | ||
'copyright': '(c) Copyright 2015 Mark V Systems Limited, All rights reserved.', | ||
# classes of mount points (required) | ||
'Import.Packaged.Entry5': foo, | ||
# imported plugins | ||
} |
Oops, something went wrong.