本文整理汇总了Python中pyaid.ArgsUtils.ArgsUtils.extract方法的典型用法代码示例。如果您正苦于以下问题:Python ArgsUtils.extract方法的具体用法?Python ArgsUtils.extract怎么用?Python ArgsUtils.extract使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyaid.ArgsUtils.ArgsUtils
的用法示例。
在下文中一共展示了ArgsUtils.extract方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from pyaid.ArgsUtils import ArgsUtils [as 别名]
# 或者: from pyaid.ArgsUtils.ArgsUtils import extract [as 别名]
def __init__(self, parent =None, **kwargs):
"""Creates a new instance of PySideGui."""
flags = ArgsUtils.extract('flags', None, kwargs)
if flags is None:
# By default the close button is hidden (only title shows)
flags = QtCore.Qt.CustomizeWindowHint | QtCore.Qt.WindowTitleHint
title = ArgsUtils.extract('title', 'Dialog', kwargs)
modal = ArgsUtils.extract('modal', True, kwargs)
widgetClass = ArgsUtils.extract('widget', None, kwargs)
self._callback = ArgsUtils.extract('callback', None, kwargs)
self._canceled = True
QtGui.QDialog.__init__(self, parent, flags)
self.setStyleSheet(self.owner.styleSheetPath)
if widgetClass is None:
self._widget = None
else:
layout = self._getLayout(self)
self._widget = widgetClass(parent=self, **kwargs)
layout.addWidget(self._widget)
self.setModal(modal)
self.setWindowTitle(title)
示例2: __init__
# 需要导入模块: from pyaid.ArgsUtils import ArgsUtils [as 别名]
# 或者: from pyaid.ArgsUtils.ArgsUtils import extract [as 别名]
def __init__(self, parent, path, session=None, **kwargs):
"""Creates a new instance of TrackImporterRemoteThread."""
self._pretty = ArgsUtils.extract("pretty", False, kwargs)
self._gzipped = ArgsUtils.extract("compressed", True, kwargs)
self._difference = ArgsUtils.extract("difference", True, kwargs)
RemoteExecutionThread.__init__(self, parent, **kwargs)
self._path = path
self._session = session
示例3: __init__
# 需要导入模块: from pyaid.ArgsUtils import ArgsUtils [as 别名]
# 或者: from pyaid.ArgsUtils.ArgsUtils import extract [as 别名]
def __init__(self, source, **kwargs):
self.footerDom = u''
self.page = ArgsUtils.get('page', None, kwargs)
self.site = ArgsUtils.get('site', None, kwargs)
self.filePath = ArgsUtils.get('path', None, kwargs)
self.filename = ArgsUtils.get(
'filename',
os.path.basename(self.filePath) if self.filePath else None,
kwargs)
debugData = ArgsUtils.extract('debugData', None, kwargs)
blocks = {
'root':[
MarkupTextBlockUtils.createMarkupCommentDef(BlockDefinition.BLOCKED),
MarkupTextBlockUtils.createMarkupOpenDef('quote'),
MarkupTextBlockUtils.createMarkupCloseDef(BlockDefinition.BLOCKED) ],
'quote':[
BlockDefinition.createQuoteDef(BlockDefinition.BLOCKED),
BlockDefinition.createLiteralDef(BlockDefinition.BLOCKED) ]}
self._renderErrors = []
self._tagIndex = -1
super(MarkupProcessor, self).__init__(
source,
ArgsUtils.extract('debug', False, kwargs),
blocks,
debugData,
stripSource=False,
**kwargs)
self.logger.trace = True
self._result = None
self._anchors = []
self._tags = []
self._id = StringUtils.getRandomString(8)
self._css = []
self._js = []
self._radioArrays = dict()
self._patterns = dict()
self._groups = dict()
self._metadata = ArgsUtils.getAsDict('metadata', kwargs)
self._libraryIDs = []
self._autoTitle = u''
self._autoDescription = u''
self._allowModelCaching = False
self.privateView = False
示例4: __init__
# 需要导入模块: from pyaid.ArgsUtils import ArgsUtils [as 别名]
# 或者: from pyaid.ArgsUtils.ArgsUtils import extract [as 别名]
def __init__(self, parent, **kwargs):
RemoteExecutionThread.__init__(self, parent, explicitComplete=True, **kwargs)
self._pausePackageSteps = ArgsUtils.extract('pausePackageSteps', False, kwargs)
self._uploadAfterPackage = ArgsUtils.extract('uploadAfterPackage', False, kwargs)
self._flexData = FlexProjectData(**kwargs)
self._queue = []
self._isProcessingQueue = False
self._isAbortingQueue = False
self._bucket = None
self._output = dict()
if self._uploadAfterPackage:
self._output['urls'] = dict()
self._bucket = self._flexData.createBucket()
示例5: __init__
# 需要导入模块: from pyaid.ArgsUtils import ArgsUtils [as 别名]
# 或者: from pyaid.ArgsUtils.ArgsUtils import extract [as 别名]
def __init__(self, parent, url, args =None, **kwargs):
"""Creates a new instance of Request."""
self._localData = ArgsUtils.extract('localData', None, kwargs)
self._dead = ArgsUtils.extract('dead', False, kwargs)
QObject.__init__(self, parent, **kwargs)
self._url = url
self._owner = parent
self._log = parent.log if parent else Logger(self)
self._callback = None
self._args = args
self._request = None
self._result = None
self._sent = False
self._async = False
示例6: __init__
# 需要导入模块: from pyaid.ArgsUtils import ArgsUtils [as 别名]
# 或者: from pyaid.ArgsUtils.ArgsUtils import extract [as 别名]
def __init__(self, **kwargs):
"""Creates a new instance of MarkupTagError."""
self._errorAtEnd = ArgsUtils.extract("errorAtEnd", False, kwargs)
ArgsUtils.addIfMissing("errorDef", self.READ_FAILURE, kwargs, True)
MarkupError.__init__(self, **kwargs)
示例7: __init__
# 需要导入模块: from pyaid.ArgsUtils import ArgsUtils [as 别名]
# 或者: from pyaid.ArgsUtils.ArgsUtils import extract [as 别名]
def __init__(self, *args, **kwargs):
"""Creates a new instance of ListDataOrganizer."""
root = ArgsUtils.extract('root', None, kwargs, args, 0)
if isinstance(root, basestring):
root = [root]
super(ListDataOrganizer, self).__init__(list, root, **kwargs)
示例8: runPythonExec
# 需要导入模块: from pyaid.ArgsUtils import ArgsUtils [as 别名]
# 或者: from pyaid.ArgsUtils.ArgsUtils import extract [as 别名]
def runPythonExec(script, kwargs =None):
from nimble.NimbleEnvironment import NimbleEnvironment
from nimble.data.NimbleResponseData import NimbleResponseData
from nimble.data.enum.DataKindEnum import DataKindEnum
try:
nimble.cmds.undoInfo(openChunk=True)
except Exception as err:
return False
try:
# Create a new, temporary module in which to run the script
module = imp.new_module('runExecTempModule')
# Initialize the script with script inputs
setattr(module, NimbleEnvironment.REMOTE_KWARGS_KEY, kwargs if kwargs is not None else dict())
setattr(module, NimbleEnvironment.REMOTE_RESULT_KEY, dict())
# Executes the script in the new module
exec_(script, module.__dict__)
# Find a NimbleScriptBase derived class definition and if it exists, run it to populate the
# results
for name,value in Reflection.getReflectionDict(module).iteritems():
if not inspect.isclass(value):
continue
if NimbleScriptBase in value.__bases__:
getattr(module, name)().run()
break
# Retrieve the results object that contains all results set by the execution of the script
result = getattr(module, NimbleEnvironment.REMOTE_RESULT_KEY)
except Exception as err:
logger = Logger('runPythonExec', printOut=True)
logger.writeError('ERROR: Failed Remote Script Execution', err)
result = NimbleResponseData(
kind=DataKindEnum.PYTHON_SCRIPT,
response=NimbleResponseData.FAILED_RESPONSE,
error=str(err) )
# If a result dictionary contains an error key format the response as a failure
try:
errorMessage = ArgsUtils.extract(
NimbleEnvironment.REMOTE_RESULT_ERROR_KEY, None, result)
if errorMessage:
return NimbleResponseData(
kind=DataKindEnum.PYTHON_SCRIPT,
response=NimbleResponseData.FAILED_RESPONSE,
error=errorMessage,
payload=result)
except Exception as err:
pass
try:
nimble.cmds.undoInfo(closeChunk=True)
except Exception as err:
return False
return result
示例9: send
# 需要导入模块: from pyaid.ArgsUtils import ArgsUtils [as 别名]
# 或者: from pyaid.ArgsUtils.ArgsUtils import extract [as 别名]
def send(self, cls, *args, **kwargs):
""" Sends an API request to the cloud servers and handles the response. This can be sent
either synchronously or asynchronously depending on whether or not a callback argument
is included in the request. Asynchronous requests must be handled within the context
of a running PySide application loop, as the threading is managed by PySide. """
callback = ArgsUtils.extract('callback', None, kwargs, args, 0)
if self:
return self._sendRequest(callback=callback, **kwargs)
return cls._createAndSend(callback=callback, **kwargs)
示例10: __init__
# 需要导入模块: from pyaid.ArgsUtils import ArgsUtils [as 别名]
# 或者: from pyaid.ArgsUtils.ArgsUtils import extract [as 别名]
def __init__(self, parent, path, importType, session =None, analysisSession =None, **kwargs):
"""Creates a new instance of TrackImporterRemoteThread."""
self._compressed = ArgsUtils.extract('compressed', False, kwargs)
RemoteExecutionThread.__init__(self, parent, **kwargs)
self._path = path
self._session = session
self._analysisSession = analysisSession
self._importType = importType
self._verbose = ArgsUtils.get('verbose', True, kwargs)
示例11: __init__
# 需要导入模块: from pyaid.ArgsUtils import ArgsUtils [as 别名]
# 或者: from pyaid.ArgsUtils.ArgsUtils import extract [as 别名]
def __init__(self, parent=None, **kwargs):
"""Creates a new instance of PyGlassWebKitWidget."""
self._communicator = ArgsUtils.extract("communicator", None, kwargs)
self._debug = ArgsUtils.extract("debug", False, kwargs)
url = ArgsUtils.extract("url", None, kwargs)
localUrl = ArgsUtils.extract("localUrl", None, kwargs)
PyGlassWidget.__init__(self, parent, widgetFile=False, **kwargs)
layout = self._getLayout(self, QtGui.QVBoxLayout)
layout.setContentsMargins(0, 0, 0, 0)
self._webView = PyGlassWebView(self, communicator=self._communicator, debug=self._debug)
layout.addWidget(self._webView)
self.setLayout(layout)
if url:
self._webView.openUrl(url)
elif localUrl:
self._webView.openLocalWebUrl(url)
示例12: __init__
# 需要导入模块: from pyaid.ArgsUtils import ArgsUtils [as 别名]
# 或者: from pyaid.ArgsUtils.ArgsUtils import extract [as 别名]
def __init__(self, parent =None, *args, **kwargs):
"""Creates a new instance of StyledLabel."""
self._fontFamily = ArgsUtils.extract('fontFamily', None, kwargs)
self._fontSize = ArgsUtils.extract('fontSize', None, kwargs)
self._color = ArgsUtils.extract('color', None, kwargs)
self._fontWeight = ArgsUtils.extract('fontWeight', None, kwargs)
self._isItalic = ArgsUtils.extract('isItalic', None, kwargs)
self._isBold = ArgsUtils.extract('isBold', None, kwargs)
self._isBorderless = ArgsUtils.extract('isBorderless', True, kwargs)
super(StyledLabel, self).__init__(parent, *args, **kwargs)
示例13: __init__
# 需要导入模块: from pyaid.ArgsUtils import ArgsUtils [as 别名]
# 或者: from pyaid.ArgsUtils.ArgsUtils import extract [as 别名]
def __init__(self, parent, toggles =False, clickOn =False, **kwargs):
"""Creates a new instance of InteractiveElement."""
self._clickCallback = ArgsUtils.extract('callback', None, kwargs)
super(InteractiveElement, self).__init__(parent, **kwargs)
self._toggles = toggles
self._clickOn = clickOn
self._checked = False
self._mode = InteractionStatesEnum.NORMAL_MODE
self._mouseEnabled = True
c = QtGui.QCursor()
c.setShape(QtCore.Qt.PointingHandCursor)
self.setCursor(c)
示例14: createReply
# 需要导入模块: from pyaid.ArgsUtils import ArgsUtils [as 别名]
# 或者: from pyaid.ArgsUtils.ArgsUtils import extract [as 别名]
def createReply(cls, kind, result, errorMessage=None):
payload = result if isinstance(result, dict) else {"result": result}
warnings = ArgsUtils.extract(NimbleEnvironment.REMOTE_RESULT_WARNING_KEY, None, payload)
if errorMessage:
return NimbleResponseData(
kind=kind,
response=NimbleResponseData.FAILED_RESPONSE,
warnings=warnings,
error=errorMessage,
payload=payload,
)
return NimbleResponseData(
kind=kind, warnings=warnings, response=NimbleResponseData.SUCCESS_RESPONSE, payload=payload
)
示例15: _deployWalker
# 需要导入模块: from pyaid.ArgsUtils import ArgsUtils [as 别名]
# 或者: from pyaid.ArgsUtils.ArgsUtils import extract [as 别名]
def _deployWalker(self, args, path, names):
"""Doc..."""
# Skip CDN file uploads when not walking the CDN root path explicitly
if not args['cdn'] and path.find(StaticFlowEnvironment.CDN_ROOT_PREFIX) != -1:
return
for name in names:
namePath = FileUtils.createPath(path, name)
if os.path.isdir(namePath) or StringUtils.ends(name, self._SKIP_EXTENSIONS):
continue
headersPath = namePath + '.headers'
if os.path.exists(headersPath):
headers = JSON.fromFile(headersPath)
else:
headers = dict()
if self._forceAll:
lastModified = None
elif self._forceHtml and StringUtils.ends(name, self._FORCE_HTML_EXTENSIONS):
lastModified = None
else:
lastModified = ArgsUtils.extract('_LAST_MODIFIED', None, headers)
if lastModified:
lastModified = TimeUtils.webTimestampToDateTime(lastModified)
kwargs = dict(
key=u'/' + namePath[len(self._localRootPath):].replace(u'\\', u'/').strip(u'/'),
maxAge=headers.get('max-age', -1),
eTag=headers.get('eTag', None),
expires=headers.get('Expires'),
newerThanDate=lastModified,
policy=S3Bucket.PUBLIC_READ)
if StringUtils.ends(name, self._STRING_EXTENSIONS):
result = self._bucket.put(
contents=FileUtils.getContents(namePath),
zipContents=True,
**kwargs)
else:
result = self._bucket.putFile(filename=namePath, **kwargs)
if result:
self._logger.write(u'DEPLOYED: ' + unicode(namePath) + u'->' + unicode(kwargs['key']))