V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
PyPog
V2EX  ›  Python

Python fabric 重写方法

  •  
  •   PyPog · 2015-11-10 10:30:13 +08:00 · 2404 次点击
    这是一个创建于 3112 天前的主题,其中的信息可能已经有所发展或是发生改变。

    遇到一个问题,想请教一下大家。

    Python fabric 中能重写方法吗,我找了好久都没有找到。

    谢谢。

    6 条回复    2015-11-13 16:42:54 +08:00
    lins05
        1
    lins05  
       2015-11-10 16:31:05 +08:00
    没明白“重写”是指什么
    SmiteChow
        2
    SmiteChow  
       2015-11-10 18:28:17 +08:00
    mock
    PyPog
        3
    PyPog  
    OP
       2015-11-12 14:41:54 +08:00
    @lins05 我的情况是这样的,我写了一个 fabric 的 module ,我在其他的 fabric 脚本里边导入了这个 module ,但是 module 里边有个方法不能实现,而我又不能改 module 里的方法,所以我问一下,在我写的 fabric 的脚本里边能不能重写 module 里边存在的方法。
    PyPog
        4
    PyPog  
    OP
       2015-11-12 14:42:16 +08:00
    @SmiteChow 我去查查
    PyPog
        5
    PyPog  
    OP
       2015-11-13 16:42:21 +08:00
    已经找到

    ```python
    @task(alias = 'method name)'
    def ...
    ```

    这时再`fab -l`就能看到了
    PyPog
        6
    PyPog  
    OP
       2015-11-13 16:42:54 +08:00
    这回复不支持 markdown 的呀
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   917 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 20:15 · PVG 04:15 · LAX 13:15 · JFK 16:15
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.