当前位置: 首页>>代码示例>>Python>>正文


Python ArgsUtils.ArgsUtils类代码示例

本文整理汇总了Python中pyaid.ArgsUtils.ArgsUtils的典型用法代码示例。如果您正苦于以下问题:Python ArgsUtils类的具体用法?Python ArgsUtils怎么用?Python ArgsUtils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ArgsUtils类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _listPath

    def _listPath(cls, rootPath, recursive, **kwargs):
        listDirs        = ArgsUtils.get('listDirs', False, kwargs)
        skipSVN         = ArgsUtils.get('skipSVN', True, kwargs)
        skips           = ArgsUtils.get('skips', None, kwargs)
        allowExtensions = ArgsUtils.getAsList('allowExtensions', kwargs)
        skipExtensions  = ArgsUtils.getAsList('skipExtensions', kwargs)

        out = []
        for item in os.listdir(rootPath):
            if (skipSVN and item == '.svn') or (skips and item in skips):
                continue
            absItem = os.path.join(rootPath, item)
            if os.path.isdir(absItem):
                path = (absItem + os.sep)
                if listDirs:
                    out.append(path)
                absItem = None

                if recursive:
                    out += cls._listPath(path, recursive, **kwargs)

            elif os.path.isfile(absItem):
                if skipExtensions and StringUtils.ends(item, skipExtensions):
                    continue

                if allowExtensions and not StringUtils.ends(item, allowExtensions):
                    continue

            if absItem:
                out.append(absItem)

        return out
开发者ID:hannahp,项目名称:PyAid,代码行数:32,代码来源:FileUtils.py

示例2: __init__

    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)
开发者ID:sernst,项目名称:StaticFlow,代码行数:7,代码来源:MarkupTagError.py

示例3: createPath

    def createPath(cls, *args, **kwargs):
        """Doc..."""
        if not args or args[0] is None:
            return None

        src = []
        for item in args:
            if isinstance(item, list):
                src.extend(item)
            else:
                src.append(item)
        out = os.path.join(*src)

        if out.endswith(os.sep) or ArgsUtils.get('isFile', False, kwargs):
            return cls._getAbsolutePath(out)

        noTail = ArgsUtils.get('noTail', False, kwargs)
        if ArgsUtils.get('isDir', False, kwargs):
            return cls._getAbsolutePath(out) if noTail else (cls._getAbsolutePath(out) + os.sep)

        if os.path.exists(out):
            if os.path.isfile(out):
                return cls._getAbsolutePath(out)

            if os.path.isdir(out) and not noTail and not out.endswith(os.sep):
                out += os.sep
        elif out.endswith('..'):
            out += os.sep
        elif src[-1].find('.') == -1:
            out += os.sep

        return cls._getAbsolutePath(out)
开发者ID:hannahp,项目名称:PyAid,代码行数:32,代码来源:FileUtils.py

示例4: __init__

    def __init__(self, containerPath, isRemoteDeploy =False, sourceRootFolder ='src', **kwargs):
        """Creates a new instance of Site."""
        super(Site, self).__init__()

        self.errorCount     = 0
        self.warningCount   = 0
        self._staticPaths   = []

        self._logger = ArgsUtils.getLogger(self, kwargs)
        self._sourceRootFolderName = sourceRootFolder

        # NGinx root path in which all files reside
        self._containerPath = FileUtils.cleanupPath(containerPath, isDir=True)

        # Location of the source files used to create the website
        self._sourceWebRootPath = FileUtils.createPath(containerPath, sourceRootFolder, isDir=True)

        # Locations where files should be deployed. If the target root path is None, which is the
        # default value, the local web root path is used in its place.

        if isRemoteDeploy:
            self._targetWebRootPath = FileUtils.cleanupPath(
                tempfile.mkdtemp(prefix='staticFlow_'), isDir=True)
        else:
            self._targetWebRootPath = None

        self._localWebRootPath  = FileUtils.createPath(
            containerPath, ArgsUtils.get('localRootFolder', 'root', kwargs), isDir=True)

        path = FileUtils.createPath(self.sourceWebRootPath, '__site__.def', isFile=True)
        try:
            self._data.data = JSON.fromFile(path, throwError=True)
        except Exception, err:
            self.writeLogError(u'Unable to load site definition file: "%s"' % path, error=err)
            pass
开发者ID:sernst,项目名称:StaticFlow,代码行数:35,代码来源:Site.py

示例5: __init__

    def __init__(self, **kwargs):
        """Creates a new instance of MarkupError."""

        self._thrown     = Logger.getFormattedStackTrace(2, 3)
        self._definition = ArgsUtils.get('errorDef', None, kwargs)
        self._tag        = ArgsUtils.get('tag', None, kwargs)
        self._block      = ArgsUtils.get('block', self._tag.block if self._tag else None, kwargs)
        self._processor  = ArgsUtils.get('processor', self._tag.processor if self._tag else None, kwargs)
        self._code       = ArgsUtils.get('code', self._definition.code, kwargs, allowNone=False)
        self.label       = ArgsUtils.get('label', self._definition.label, kwargs, allowNone=False)
        self.message     = ArgsUtils.get('message', self._definition.message, kwargs, allowNone=False)
        self._critical   = ArgsUtils.get('critical', False, kwargs)

        replacements = ArgsUtils.getAsList('replacements', kwargs)
        replacements.append([u'#TAG#', unicode(self._tag.tagName if self._tag else u'???')])

        for r in replacements:
            if self.message:
                self.message = self.message.replace(unicode(r[0]), unicode(r[1]))

            if self.label:
                self.label = self.label.replace(unicode(r[0]), unicode(r[1]))

        self._verbose   = ArgsUtils.get('verbose', False, kwargs)
        self._line      = None
        self._character = None
        self._source    = None
        self._logSource = None
        self._populateData()
开发者ID:sernst,项目名称:StaticFlow,代码行数:29,代码来源:MarkupError.py

示例6: add

    def add(self, *args, **kwargs):
        """Adds value to the existing item, replacing existing entries.

        @@@param value:string
            The value argument can be a single value.

        @@@param group:string
            The name of the group in which to add the value. Default of None adds the value to the
            root group.
        """

        value = ArgsUtils.get('value', None, kwargs, args, 0)
        if value is None:
            value = u''
        elif isinstance(value, dict) or isinstance(value, list):
            value = JSON.asString(value)
        else:
            value = unicode(value)

        group = ArgsUtils.get('group', None, kwargs, args, 1)
        once  = ArgsUtils.get('once', False, kwargs)

        if group:
            target        = self._tempSubs if once else self._subs
            target[group] = value
        else:
            if once:
                self._tempRoot = value
            else:
                self._root = value
开发者ID:sernst,项目名称:StaticFlow,代码行数:30,代码来源:SingleValuedDataOrganizer.py

示例7: _renderImpl

    def _renderImpl(self, **kwargs):
        a = self.attrs

        LayoutAttributeParser.parseScale(a, True, kwargs)
        LayoutAttributeParser.parseAlignment(a, True, kwargs)
        LayoutAttributeParser.parsePadding(a, True, kwargs, group=a.styleGroup, defaultValue=GeneralSizeEnum.xsmall[0])

        color = a.getAsColorValue(TagAttributesEnum.COLOR, ArgsUtils.get("colorDef", None, kwargs), kwargs)

        if not ArgsUtils.get("skipBorder", False, kwargs):
            LayoutAttributeParser.parseBorder(
                a,
                True,
                kwargs,
                group=a.styleGroup,
                defaultColor=ArgsUtils.get("borderColorDef", color.shiftColors[1] if color else None, kwargs),
            )

        # -------------------------------------------------------------------------------------------
        # BACKGROUND COLOR
        if not ArgsUtils.get("skipBackground", False, kwargs):
            if isinstance(color, ColorValue):
                a.styles.add("background-color", color.web, a.styleGroup)
            elif a.explicitAccent or a.themeChanged:
                self.useBackground()

        a.classes.add("sfml-push", a.styleGroup)
开发者ID:sernst,项目名称:StaticFlow,代码行数:27,代码来源:FooterTag.py

示例8: __init__

    def __init__(self, **kwargs):
        """Creates a new instance of ConfigReader."""
        self._configs     = ArgsUtils.get('configs', dict(), kwargs)
        self._filenames   = ArgsUtils.get('filenames', None, kwargs)
        self._configPath  = ArgsUtils.get(
            'rootConfigPath',
            CadenceEnvironment.getConfigPath(),
            kwargs
        )

        if self._filenames:
            for n,v in self._filenames.iteritems():
                if not v:
                    continue

                path = os.path.join(self._configPath, v)
                if not path.endswith('.cfg'):
                    path += '.cfg'

                parser = ConfigParser.ConfigParser()
                if os.path.exists(path):
                    parser.read(path)
                else:
                    raise Exception, path + ' config file does not exist!'

                self._configs[n] = self._configParserToDict(parser)

        self._overrides = dict()
        self.setOverrides(ArgsUtils.get('overrides', None, kwargs))
开发者ID:JenLM,项目名称:Cadence,代码行数:29,代码来源:ConfigReader.py

示例9: add

    def add(self, *args, **kwargs):
        """Adds item(s) to the existing list of items, ignoring duplicates.

        @@@param items:mixed,list
            The items argument can be a single item or a list of items.

        @@@param group:string
            The name of the group in which to add the items. Default of None adds the items to the
            root group.
        """

        items = ArgsUtils.get('items', None, kwargs, args, 0)
        if items is None or not items:
            return

        group = ArgsUtils.get('group', None, kwargs, args, 1)
        once  = ArgsUtils.get('once', False, kwargs)

        if group:
            target = self._tempSubs if once else self._subs
            if not group in target:
                target[group] = []
            for n in items:
                if not n in target[group]:
                    target[group].append(n)
        else:
            target = self._tempRoot if once else self._root
            for n in items:
                if not n in target:
                    target.append(n)
开发者ID:sernst,项目名称:StaticFlow,代码行数:30,代码来源:ListDataOrganizer.py

示例10: __init__

    def __init__(self, src ='', debug =False, blockDefs =None, debugData =None, **kwargs):
        """Creates a new instance of ClassTemplate."""
        self._log = ArgsUtils.getLogger(self, kwargs)

        self._debugData = debugData
        self._debug     = debug

        src = StringUtils.toUnicode(src)

        self._raw = src.replace('\r','')
        if ArgsUtils.get('stripSource', True, kwargs):
            self._raw = self._raw.strip('\n')

        self._analyzed  = False
        self._errors    = []
        self._blocks    = []
        self._bookmarks = []
        self._initialBlock = ArgsUtils.get('initialBlock', None, kwargs)

        if isinstance(blockDefs, BlockDefinition):
            self._blockDefs = {'root':blockDefs}
        elif isinstance(blockDefs, dict):
            self._blockDefs = blockDefs
        elif isinstance(blockDefs, list):
            self._blockDefs = {'root':blockDefs}
        else:
            self._blockDefs = {
                'root':[
                    BlockDefinition.createQuoteDef(BlockDefinition.BLOCKED),
                    BlockDefinition.createLiteralDef(BlockDefinition.BLOCKED),
                    BlockDefinition.createParensDef(),
                    BlockDefinition.createBracketsDef(),
                    BlockDefinition.createBracesDef(),
                    ],
                }
开发者ID:sernst,项目名称:PyAid,代码行数:35,代码来源:TextAnalyzer.py

示例11: write

    def write(self, *args, **kwargs):
        group  = ArgsUtils.get('group', None, kwargs, args, 0)
        skipID = ArgsUtils.get('skipID', False, kwargs)
        items  = None if len(args) < 2 else args[1:]

        s   = []
        out = None
        if items and len(items):
            for a in items:
                out = a.write(group=group, **kwargs)
                if out and len(out) > 0:
                    s.append(out)
        else:
            writes = self._writes + DomRenderData._WRITES
            for w in writes:
                if skipID and w == 'id':
                    continue

                try:
                    out = getattr(self, w).write(group=group, **kwargs)
                    if out and len(out) > 0:
                        s.append(out)
                except Exception, err:
                    DomRenderData._LOGGER.writeError(['Organizer write failure',
                                                      'organizer: ' + str(out),
                                                      'renderData: ' + str(self)], err)
                    pass
开发者ID:sernst,项目名称:StaticFlow,代码行数:27,代码来源:DomRenderData.py

示例12: __init__

    def __init__(self, **kwargs):
        """Creates a new instance of ClassTemplate."""
        self._content  = ArgsUtils.get('content', '', kwargs)

        SVADO          = SingleValuedAttributeDataOrganizer
        self._id       = self._createOrganizer('id', kwargs, SVADO, name='id')
        self._renderID = self._createOrganizer(['renderID', 'rid'], kwargs, SVADO, name='data-v-rid')
        self._dataID   = self._createOrganizer(['dataID', 'did'], kwargs, SVADO, name='data-v-did')
        self._styleID  = self._createOrganizer(['themeID', 'sid'], kwargs, SVADO, name='data-v-sid')

        ADO            = AttributeDataOrganizer
        self._vdata    = self._createOrganizer('vdata', kwargs, ADO, prefix='data-v-')
        self._data     = self._createOrganizer('data', kwargs, ADO, prefix='data-')
        self._attrs    = self._createOrganizer('attrs', kwargs, ADO, prefix='')

        SADO            = SingleAttributeDataOrganizer
        self._dataState = self._createOrganizer('dataState', kwargs, SADO, name='data-v-data')
        self._inits     = self._createOrganizer('inits', kwargs, SADO, name='data-v-ini')
        self._events    = self._createOrganizer('events', kwargs, SADO, name='data-v-evt')
        self._settings  = self._createOrganizer('settings', kwargs, SADO, name='data-v-sets')
        self._icon      = self._createOrganizer('icons', kwargs, SADO, name='data-v-icon')

        self._styles   = self._createOrganizer('styles', kwargs, Stylesheet)
        self._classes  = self._createOrganizer('classes', kwargs, Classes)

        self._render   = ArgsUtils.get('render', {}, kwargs)
        self._doms     = ArgsUtils.get('doms', {}, kwargs)
        self._writes   = ArgsUtils.get('writes', [], kwargs)
开发者ID:sernst,项目名称:StaticFlow,代码行数:28,代码来源:DomRenderData.py

示例13: __init__

    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)
开发者ID:hannahp,项目名称:PyGlass,代码行数:25,代码来源:PyGlassDialog.py

示例14: _activateWidgetDisplayImpl

 def _activateWidgetDisplayImpl(self, **kwargs):
     super(LoadingWidget, self)._activateWidgetDisplayImpl(**kwargs)
     self.target     = ArgsUtils.get('target', None, kwargs)
     self.header     = ArgsUtils.get('header', None, kwargs)
     self.info       = ArgsUtils.get('info', None, kwargs)
     self.isShowing  = True
     self._animatedIcon.start()
开发者ID:sernst,项目名称:Cadence,代码行数:7,代码来源:LoadingWidget.py

示例15: getPrefix

    def getPrefix(self, *args, **kwargs):
        if self._locationPrefix:
            item = self.getStackData()[-1]
            loc  = ' -> %s #%s]' % (item['file'], StringUtils.toUnicode(item['line']))
        else:
            loc = ']'

        if self._app and self._app.pyramidApp:
            wsgi     = self._app.environ
            initials = self._INITIALS_RX.sub('', ArgsUtils.get('REMOTE_USER', '', wsgi))
            if initials:
                initials += ' | '

            domainName  = ArgsUtils.get('SERVER_NAME', '', wsgi)
            uriPath = ArgsUtils.get(
                'REQUEST_URI',
                ArgsUtils.get('HTTP_REQUEST_URI', '', wsgi), wsgi)

            info = ' <' + initials + domainName + uriPath + '>'
        else:
            info = ''

        threadID = ThreadUtils.getCurrentID()
        return StringUtils.toUnicode(
            TimeUtils.toFormat('[%a %H:%M <%S.%f>') + '<' + threadID + '>' + info + loc)
开发者ID:sernst,项目名称:Ziggurat,代码行数:25,代码来源:ServerLogger.py


注:本文中的pyaid.ArgsUtils.ArgsUtils类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。