當前位置: 首頁>>代碼示例>>Python>>正文


Python path.py方法代碼示例

本文整理匯總了Python中os.path.py方法的典型用法代碼示例。如果您正苦於以下問題:Python path.py方法的具體用法?Python path.py怎麽用?Python path.py使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在os.path的用法示例。


在下文中一共展示了path.py方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: launch_ping

# 需要導入模塊: from os import path [as 別名]
# 或者: from os.path import py [as 別名]
def launch_ping(src_ip, dst_ip, username, passwd, count, timeout, qrouter, filename):
    cmd = 'sudo ip netns exec ' + str(qrouter)
    cmd += ' python ping.py --src_ip %s --dst_ip %s --username "%s" --passwd "%s" --count %d --timeout %d' % \
        (src_ip, dst_ip, username, passwd, count, timeout)
    cmd += ' > %s 2>&1' % filename

    p = subprocess.Popen(cmd, shell=True)

    return p 
開發者ID:CiscoSystems,項目名稱:don,代碼行數:11,代碼來源:path.py

示例2: __init__

# 需要導入模塊: from os import path [as 別名]
# 或者: from os.path import py [as 別名]
def __init__(self, what, options, path="", buf="", parent=None):
        QDialog.__init__(self, parent)
        self.__cancelRequest = False
        self.__inProgress = False

        self.__what = what
        self.__options = options
        self.__path = path          # could be a dir or a file
        self.__buf = buf            # content in case of a modified file

        # Working process data
        self.__participantFiles = []    # Collected list of files
        self.__projectImportDirs = []
        self.__projectImportsCache = {} # utils.settings -> /full/path/to.py
        self.__dirsToImportsCache = {}  # /dir/path -> { my.mod: path.py, ... }

        self.dataModel = ImportDiagramModel()
        self.scene = QGraphicsScene()

        # Avoid pylint complains
        self.progressBar = None
        self.infoLabel = None

        self.__createLayout()
        self.setWindowTitle('Imports/dependencies diagram generator')
        QTimer.singleShot(0, self.__process) 
開發者ID:SergeySatskiy,項目名稱:codimension,代碼行數:28,代碼來源:importsdgm.py

示例3: need_vendor_bundles

# 需要導入模塊: from os import path [as 別名]
# 或者: from os.path import py [as 別名]
def need_vendor_bundles(invoke_minversion=None):
    invoke_minversion = invoke_minversion or "0.0.0"
    need_vendor_answers = []
    need_vendor_answers.append(need_vendor_bundle_invoke(invoke_minversion))
    # -- REQUIRE: path.py
    try:
        import path
        need_bundle = False
    except ImportError:
        need_bundle = True
    need_vendor_answers.append(need_bundle)

    # -- DIAG: print("INVOKE: need_bundle=%s" % need_bundle1)
    # return need_bundle1 or need_bundle2
    return any(need_vendor_answers) 
開發者ID:click-contrib,項目名稱:click-configfile,代碼行數:17,代碼來源:_setup.py

示例4: get_next_hop

# 需要導入模塊: from os import path [as 別名]
# 或者: from os.path import py [as 別名]
def get_next_hop(src_info, dst_info, qrouter, params):
    next_hop_list = []
    next_hop = None

    username = params['username']
    passwd = params['passwd']
    src_ip = src_info['ip']
    dst_ip = dst_info['ip']

    remote_cmd = ' ip route get %s' % dst_ip

    cmd = 'sudo ip netns exec ' + qrouter
    cmd += ' python run_nms_cmd.py --host_ip %s --username "%s" --passwd "%s" --cmd "%s" ' % \
        (src_ip, username, passwd, remote_cmd)

    output = run_remote_cmd(cmd)
    a = json.loads(output)

    if not a['pass']:
        return []

    json_file = params['json_file']
    info = load_json(json_file)

    next_hop = {}
    for cmd in a['command_list']:
        if re.search('ip route get', cmd['cmd']):
            m = re.search('\S+\s+via\s+(\S+)', cmd['output'][0])
            if m:
                next_hop['ip'] = m.group(1)
                next_hop['dev'] = 'qr-' + ip_to_intf(info, next_hop['ip'])
                next_hop['nms'] = intf_to_namespace(info, next_hop['dev'])
                break

    next_hop_list.append(next_hop)

    cmd = 'sudo ip netns exec ' + next_hop['nms']
    cmd += remote_cmd

    output = run_remote_cmd(cmd).split('\n')

    prev_nms = next_hop['nms']
    next_hop = {}
    m = re.search('\S+\s+dev\s+(\S+)', output[0])
    if m:
        next_hop['dev'] = m.group(1)
        next_hop['nms'] = prev_nms

    next_hop_list.append(next_hop)
    return next_hop_list 
開發者ID:CiscoSystems,項目名稱:don,代碼行數:52,代碼來源:path.py


注:本文中的os.path.py方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。