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


Python Project.find_pitzdir方法代码示例

本文整理汇总了Python中pitz.project.Project.find_pitzdir方法的典型用法代码示例。如果您正苦于以下问题:Python Project.find_pitzdir方法的具体用法?Python Project.find_pitzdir怎么用?Python Project.find_pitzdir使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pitz.project.Project的用法示例。


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

示例1: pitz_destroy

# 需要导入模块: from pitz.project import Project [as 别名]
# 或者: from pitz.project.Project import find_pitzdir [as 别名]
def pitz_destroy():

    p = setup_options()
    p.add_option('-t', '--title', help='Status title')

    options, args = p.parse_args()

    if options.version:
        print_version()
        return

    pitzdir = Project.find_pitzdir(options.pitzdir)

    proj = Project.from_pitzdir(pitzdir)
    proj.find_me()

    e = proj[args[0]]

    if isinstance(e, Entity):

        e.self_destruct(proj)

    print("""%(frag)s: "%(title)s" is no longer part of the project."""
        % e)

    proj.save_entities_to_yaml_files()
开发者ID:nstinus,项目名称:pitz,代码行数:28,代码来源:__init__.py

示例2: pitz_estimate_task

# 需要导入模块: from pitz.project import Project [as 别名]
# 或者: from pitz.project.Project import find_pitzdir [as 别名]
def pitz_estimate_task():

    # Start of code to set up project.
    p = setup_options()
    p.set_usage("%prog task [estimate]")

    options, args = p.parse_args()

    if not args:
        p.print_usage()
        return

    if options.version:
        print_version()
        return

    pitzdir = Project.find_pitzdir(options.pitzdir)

    proj = Project.from_pitzdir(pitzdir)
    proj.find_me()

    # end of code to set up project.

    t = proj[args[0]]

    if len(args) == 2:
        est = proj[args[1]]

    else:
        est = Estimate.choose_from_already_instantiated()

    t['estimate'] = est

    # Save the project.
    proj.save_entities_to_yaml_files()
开发者ID:nstinus,项目名称:pitz,代码行数:37,代码来源:__init__.py

示例3: pitz_add_status

# 需要导入模块: from pitz.project import Project [as 别名]
# 或者: from pitz.project.Project import find_pitzdir [as 别名]
def pitz_add_status():

    p = setup_options()
    p.add_option('-t', '--title', help='Status title')

    options, args = p.parse_args()

    if options.version:
        print_version()
        return

    pitzdir = Project.find_pitzdir(options.pitzdir)

    proj = Project.from_pitzdir(pitzdir)
    proj.find_me()

    s = Status(
        proj,
        title=options.title or raw_input("Status title: ").strip(),
        description=clepy.edit_with_editor('# Status description goes here'),
    )

    proj.append(s)
    print("Added %s to the project." % s.summarized_view)
    proj.save_entities_to_yaml_files()
开发者ID:nstinus,项目名称:pitz,代码行数:27,代码来源:__init__.py

示例4: test_1

# 需要导入模块: from pitz.project import Project [as 别名]
# 或者: from pitz.project.Project import find_pitzdir [as 别名]
    def test_1(self):
        """
        Verify we can use the parameter
        """

        assert Project.find_pitzdir('/tmp/walkup/pitzdir') \
        == '/tmp/walkup/pitzdir'
开发者ID:gitmob,项目名称:pitz,代码行数:9,代码来源:test_project.py

示例5: pitz_claim_task

# 需要导入模块: from pitz.project import Project [as 别名]
# 或者: from pitz.project.Project import find_pitzdir [as 别名]
def pitz_claim_task():

    p = setup_options()
    p.set_usage("%prog task")

    options, args = p.parse_args()

    if not args:
        p.print_usage()
        return

    if options.version:
        print_version()
        return

    pitzdir = Project.find_pitzdir(options.pitzdir)

    proj = Project.from_pitzdir(pitzdir)
    proj.find_me()

    if not proj.me:
        print("Sorry, I don't know who you are.")
        print("Use pitz-me to add yourself to the project.")
        return

    t = proj[args[0]]
    t.assign(proj.me)
    proj.save_entities_to_yaml_files()
开发者ID:nstinus,项目名称:pitz,代码行数:30,代码来源:__init__.py

示例6: pitz_attach_file

# 需要导入模块: from pitz.project import Project [as 别名]
# 或者: from pitz.project.Project import find_pitzdir [as 别名]
def pitz_attach_file():

    # Generic.
    p = setup_options()

    # Every script may have a slightly different usage.
    p.set_usage("%prog entity file-to-attach")

    # This is generic.
    options, args = p.parse_args()

    if options.version:
        print_version()
        return
    # End of generic stuff.

    # Every script may have different required args.
    if len(args) != 2:
        p.print_usage()
        return

    # Generic code to build the project.
    pitzdir = Project.find_pitzdir(options.pitzdir)

    proj = Project.from_pitzdir(pitzdir)
    proj.find_me()

    # Start of interesting stuff that is specific just for this script.
    e, filepath = proj[args[0]], args[1]

    e.save_attachment(filepath)

    # Save the project. (This could also be generic).
    proj.save_entities_to_yaml_files()
开发者ID:nstinus,项目名称:pitz,代码行数:36,代码来源:__init__.py

示例7: pitz_add_person

# 需要导入模块: from pitz.project import Project [as 别名]
# 或者: from pitz.project.Project import find_pitzdir [as 别名]
def pitz_add_person():

    p = setup_options()
    p.add_option('-t', '--title', help='Person title')

    options, args = p.parse_args()

    if options.version:
        print_version()
        return

    pitzdir = Project.find_pitzdir(options.pitzdir)

    proj = Project.from_pitzdir(pitzdir)
    proj.find_me()

    person = Person(
        proj,
        title=options.title or raw_input("Person title: ").strip(),
        description=clepy.edit_with_editor('# Person description goes here'),
    )

    proj.append(person)
    print("Added %s to the project." % person.summarized_view)
    proj.save_entities_to_yaml_files()

    if raw_input("Should I identify you as %(title)s? (y/N)" % person)\
    .strip().lower().startswith('y'):

        person.save_as_me_yaml()
        print("OK, I'll recognize you as %(title)s from now on.")
开发者ID:nstinus,项目名称:pitz,代码行数:33,代码来源:__init__.py

示例8: pitz_add_milestone

# 需要导入模块: from pitz.project import Project [as 别名]
# 或者: from pitz.project.Project import find_pitzdir [as 别名]
def pitz_add_milestone():

    p = setup_options()
    p.add_option('-t', '--title', help='Milestone title')

    options, args = p.parse_args()

    if options.version:
        print_version()
        return

    pitzdir = Project.find_pitzdir(options.pitzdir)

    pidfile = write_pidfile_or_die(pitzdir)

    proj = Project.from_pitzdir(pitzdir)
    proj.find_me()

    m = Milestone(
        proj,
        title=options.title or raw_input("Milestone title: ").strip(),
        description=clepy.edit_with_editor(
            '# Milestone description goes here'),
        reached=Milestone.choose_from_allowed_values('reached', False),
    )

    proj.append(m)
    print("Added %s to the project." % m.summarized_view)
    proj.save_entities_to_yaml_files()

    os.remove(pidfile)
开发者ID:nstinus,项目名称:pitz,代码行数:33,代码来源:__init__.py

示例9: test_4

# 需要导入模块: from pitz.project import Project [as 别名]
# 或者: from pitz.project.Project import find_pitzdir [as 别名]
    def test_4(self):
        """
        Verify we can walk up and find pitzdir.
        """

        os.chdir('/tmp/walkup/pitzdir/foo')
        assert Project.find_pitzdir() == '/tmp/walkup/pitzdir'
开发者ID:gitmob,项目名称:pitz,代码行数:9,代码来源:test_project.py

示例10: test_2

# 需要导入模块: from pitz.project import Project [as 别名]
# 或者: from pitz.project.Project import find_pitzdir [as 别名]
    def test_2(self):
        """
        Verify we check os.environ.
        """

        os.environ['PITZDIR'] = '/tmp/walkup/pitzdir'

        assert Project.find_pitzdir() == '/tmp/walkup/pitzdir'
开发者ID:gitmob,项目名称:pitz,代码行数:10,代码来源:test_project.py

示例11: test_5

# 需要导入模块: from pitz.project import Project [as 别名]
# 或者: from pitz.project.Project import find_pitzdir [as 别名]
    def test_5(self):
        """
        Verify we can walk down and find the pitzdir.
        """

        os.chdir('/tmp/walkdown')

        pitzdir_location = Project.find_pitzdir(walkdown=True)

        assert pitzdir_location == '/tmp/walkdown/foo/bar/baz/pitzdir', \
        pitzdir_location
开发者ID:gitmob,项目名称:pitz,代码行数:13,代码来源:test_project.py

示例12: setup_proj

# 需要导入模块: from pitz.project import Project [as 别名]
# 或者: from pitz.project.Project import find_pitzdir [as 别名]
    def setup_proj(self, p, options, args):

        pitzdir = Project.find_pitzdir(options.pitzdir)
        pidfile = write_pidfile_or_die(pitzdir)
        proj = Project.from_pitzdir(pitzdir)

        log.debug("Loaded project from %s" % proj.loaded_from)

        proj.pidfile = pidfile
        proj.find_me()

        return proj
开发者ID:nstinus,项目名称:pitz,代码行数:14,代码来源:__init__.py

示例13: pitz_webapp

# 需要导入模块: from pitz.project import Project [as 别名]
# 或者: from pitz.project.Project import find_pitzdir [as 别名]
def pitz_webapp():

    """
    This function gets run by the command-line script pitz-webapp.
    """

    p = setup_options()

    p.add_option('-p', '--port', help='HTTP port (default is 9876)',
       type='int', action='store', default=9876)

    options, args = p.parse_args()
    pitz.setup_logging(getattr(logging, options.log_level))

    if options.version:
        print_version()
        return

    pitzdir = Project.find_pitzdir(options.pitzdir)

    proj = Project.from_pitzdir(pitzdir)
    proj.find_me()

    app = webapp.SimpleWSGIApp(proj)

    # Remember that the order that you add handlers matters.  When a
    # request arrives, the app starts with the first handler added and
    # asks it if wants to handle that request.  So, the default handler
    # (if you make one) belongs at the end.

    # Consider this section below the same as the urls.py file in
    # django.

    static_files = os.path.join(os.path.split(
        os.path.dirname(__file__))[0], 'static')

    app.handlers.append(handlers.FaviconHandler(static_files))
    app.handlers.append(handlers.StaticHandler(static_files))
    app.handlers.append(handlers.HelpHandler(proj))
    app.handlers.append(handlers.Update(proj))
    app.handlers.append(handlers.ByFragHandler(proj))
    app.handlers.append(handlers.EditAttributes(proj))
    app.handlers.append(handlers.Project(proj))
    app.handlers.append(handlers.Team(proj))

    httpd = make_server('', options.port, app)
    print "Serving on port %d..." % options.port
    httpd.serve_forever()
开发者ID:gitmob,项目名称:pitz,代码行数:50,代码来源:webapp.py

示例14: pitz_html

# 需要导入模块: from pitz.project import Project [as 别名]
# 或者: from pitz.project.Project import find_pitzdir [as 别名]
def pitz_html():
    """
    Write out a bunch of HTML files.
    """

    with clepy.spinning_distraction():

        p = setup_options()
        p.set_usage('%prog [options] directory')
        p.add_option('--force',
            help='Ignore timestamps and regenerate all files',
            action='store_true',
            default=False)

        options, args = p.parse_args()

        if options.version:
            print_version()
            return

        if not args:
            p.print_usage()
            sys.exit()

        pitzdir = Project.find_pitzdir(options.pitzdir)

        proj = Project.from_pitzdir(pitzdir)
        proj.find_me()

        htmldir = args[0]

        proj.to_html(htmldir)

        proj.todo.to_html(htmldir)
        proj.milestones.to_html(htmldir)
        proj.tasks.to_html(htmldir)
        proj.components.to_html(htmldir)

        print("Wrote %d html files out of %d entities in project."
            % (
                len([e for e in proj
                    if e.to_html_file(htmldir, options.force)]),
                len(proj)))

        # Record that we rebuilt all the HTML files.
        proj.save_entities_to_yaml_files()
开发者ID:nstinus,项目名称:pitz,代码行数:48,代码来源:__init__.py

示例15: pitz_add_estimate

# 需要导入模块: from pitz.project import Project [as 别名]
# 或者: from pitz.project.Project import find_pitzdir [as 别名]
def pitz_add_estimate():

    p = setup_options()
    p.add_option('-t', '--title', help='Estimate title')

    p.add_option('--from-builtin-estimates',
        action='store_true',
        help='Choose from estimates I already made')

    options, args = p.parse_args()

    if options.version:
        print_version()
        raise SystemExit

    pitzdir = Project.find_pitzdir(options.pitzdir)

    proj = Project.from_pitzdir(pitzdir)
    proj.find_me()

    if options.from_builtin_estimates:

        print("Right now, you got %d estimates in your project."
            % (proj.estimates.length))

        range = Estimate.choose_estimate_range()
        if range:
            print("Adding...")
            Estimate.add_range_of_estimates_to_project(proj, range)
            proj.save_entities_to_yaml_files()

        raise SystemExit

    est = Estimate(
        proj,
        title=options.title or raw_input("Estimate title: ").strip(),
        description=clepy.edit_with_editor('# Estimate description goes here'),
        points=int(raw_input("Points: ").strip()),
    )

    proj.append(est)
    print("Added %s to the project." % est.summarized_view)
    proj.save_entities_to_yaml_files()
开发者ID:nstinus,项目名称:pitz,代码行数:45,代码来源:__init__.py


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