本文整理汇总了Python中Project.Project类的典型用法代码示例。如果您正苦于以下问题:Python Project类的具体用法?Python Project怎么用?Python Project使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Project类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: adminProjectsMoveSprintsPost
def adminProjectsMoveSprintsPost(handler, id, p_newproject, p_sprintid = None):
handler.title('Move Sprints')
requirePriv(handler, 'Admin')
project = Project.load(int(id))
if not project:
ErrorBox.die('Invalid Project', "No project with ID <b>%d</b>" % int(id))
p_newproject = to_int(p_newproject, 'newproject', ErrorBox.die)
target = Project.load(p_newproject)
if not p_sprintid:
delay(handler, WarningBox("No sprints to move", close = True))
redirect("/admin/projects/%d" % project.id)
sprintids = [to_int(id, 'sprintid', ErrorBox.die) for id in p_sprintid]
sprints = [Sprint.load(id) for id in sprintids]
if not all(sprints):
ErrorBox.die("Invalid sprint ID(s)")
for sprint in sprints:
sprint.project = target
sprint.save()
delay(handler, SuccessBox("%s moved" % pluralize(len(sprints), 'sprint', 'sprints'), close = True))
redirect("/admin/projects/%d" % project.id)
示例2: __init__
def __init__(self):
Project.__init__(self)
self.cardtype = 'project'
self.base = 'renaissance'
self.desc = "At the start of your turn, +1 Action."
self.name = "Barracks"
self.cost = 6
示例3: __init__
def __init__(self):
Project.__init__(self)
self.cardtype = 'project'
self.base = 'renaissance'
self.desc = "At the end of your Buy phase, if you didn't buy any cards, +1 Coffers and +1 Villager."
self.name = "Exploration"
self.cost = 4
示例4: test_addTwoFilesAddsOnlyNewIncludesTwoObjectFile
def test_addTwoFilesAddsOnlyNewIncludesTwoObjectFile(self):
p = Project(None, None, None)
parser = CompilerParser(None)
ret = ['system/media/audio/include',
'hardware/libhardware/include',
'hardware/libhardware_legacy/include',
'hardware/ril/include',
'libnativehelper/include',
'frameworks/native/include',
'frameworks/native/opengl/include',
'frameworks/av/include',
'frameworks/base/include',
'out/target/product/maxwell10/obj/include',
'device/fsl/common/kernel-headers',
'bionic/libc/arch-arm/include',
'bionic/libc/include',
'bionic/libc/kernel/uapi',
'bionic/libc/kernel/common',
'bionic/libc/kernel/uapi/asm-arm',
'bionic/libm/include',
'bionic/libm/include/arm']
p.addFile(parser.parseLine(object1))
p.addFile(parser.parseLine(object2))
self.assertEqual(ret, p.globalSystemIncludes)
self.assertEqual(1, len(p.objectFiles))
self.assertTrue('bionic/libm/include/arm2' in p.objectFiles[0].systemIncludes)
示例5: __init__
def __init__(self):
Project.__init__(self)
self.cardtype = 'project'
self.base = 'renaissance'
self.desc = "When you gain a Treasure, +1 Coffers."
self.name = "Guildhall"
self.cost = 5
示例6: find_imports
def find_imports():
print "test hello"
fname=lisp.buffer_file_name()
print "remember:" + lisp.buffer_name()
os.environ['BUFFER'] = lisp.buffer_name()
remember_where = lisp.point()
try:
fname=lisp.buffer_file_name()
project = Project(fname)
thing, start = thing_at_point_regex("\W", "\W")
print "thing:"+thing
imports = project.find_file_for_import(thing)
if (len(imports) > 1):
ready_output()
lisp.insert("\n")
for item in imports:
lisp.insert(item)
lisp.insert("\n")
elif (len(imports) == 1):
put_import(fname, imports[0])
elif (len(imports) == 0):
lisp.message("No import found for " + imports[0])
lisp.goto_char(remember_where)
except Exception, e:
lisp.message(e)
示例7: find_public_methods
def find_public_methods():
"""
retrieves all public methods of class
"""
try:
fname=lisp.buffer_file_name()
print "remember:" + lisp.buffer_name()
os.environ['BUFFER'] = lisp.buffer_name()
project = Project(fname)
thing, start = thing_at_point(RIGHT3, LEFT3)
thing = thing.replace(".","")
print "thing:"+thing
pos = lisp.point()
type, foundpos = project.find_declaration_type(thing, fname, pos)
typefile = project.find_file_for_thing(type, fname)
c = Class(project, typefile)
public_methods = c.list_all_public()
if (len(public_methods) == 0):
lisp.message("No public methods found")
else:
ready_output()
lisp.insert("\n")
for item in public_methods:
lisp.insert(item)
lisp.insert("\n")
except Exception, e:
lisp.message(e)
示例8: test_calculate_new_keywords
def test_calculate_new_keywords(self):
mock_db = riak.RiakClient()
mock_bucket = mock_db.bucket("message")
project = Project("Sample", ["test1", "test2", ], mock_bucket)
def sample_algorithm(keyword_counts, total):
return [k for (k,v) in keyword_counts.iteritems() if v / total >= 1]
self.assertEqual(project.calculate_new_keywords(sample_algorithm), ["test1", "test2",])
示例9: __init__
def __init__(self):
Project.__init__(self)
self.cardtype = 'project'
self.base = 'renaissance'
self.desc = "The first time you play an Action card during each of your turns, play it again afterward."
self.name = "Citadel"
self.cost = 8
示例10: test_getGradle
def test_getGradle(self):
p = Project(26, 22, "../../")
self.assertEqual("""apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
minSdkVersion 22
targetSdkVersion 22
externalNativeBuild {
cmake {
cppFlags "-std=c++11"
arguments "-DAOSP=../../"
}
}
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
}
}
externalNativeBuild {
cmake {
path "CMakeLists.txt"
}
}
}""", p.getGradle())
示例11: __init__
def __init__(self):
Project.__init__(self)
self.cardtype = 'project'
self.base = 'renaissance'
self.desc = "At the start of your turn, reveal the top card of your deck. If it's an Action, play it."
self.name = "Piazza"
self.cost = 5
示例12: __init__
def __init__(self):
Project.__init__(self)
self.cardtype = 'project'
self.base = 'renaissance'
self.desc = "At the start of your turn, +1 Card, then put a card from your hand onto your deck."
self.name = "City Gate"
self.cost = 3
示例13: __init__
def __init__(self):
Project.__init__(self)
self.cardtype = 'project'
self.base = 'renaissance'
self.desc = "At the start of your turn, add a token here, or remove your tokens here for +1 Card each."
self.name = "Sinister Plot"
self.cost = 4
self._token = defaultdict(int)
示例14: newProject
def newProject( choice ):
if ( choice == '1' or choice == 'cablebay') :
project = Project()
project.name = Constant.CableBay
else :
myprint( 'no such project, system exit' )
exit()
return project
示例15: adminProjectsManage
def adminProjectsManage(handler, id):
handler.title('Manage Project')
requirePriv(handler, 'Admin')
project = Project.load(int(id))
if not project:
ErrorBox.die('Invalid Project', "No project with ID <b>%d</b>" % int(id))
undelay(handler)
sprints = project.getSprints()
otherProjects = sorted((p for p in Project.loadAll() if p != project), key = lambda p: p.name)
for sprint in sprints:
if 'deleted' in sprint.flags:
print "<form method=\"post\" action=\"/admin/projects/%d/cancel-deletion/%d\">" % (project.id, sprint.id)
print WarningBox("%s is flagged for deletion during nightly cleanup. %s" % (sprint.link(handler.session['user']), Button('Cancel').mini().post()))
print "</form>"
print "<a name=\"sprints\"></a>"
print "<h3>Sprints</h3>"
if len(sprints) > 0:
print "<form method=\"post\" action=\"/admin/projects/%d/sprints\">" % project.id
for sprint in sprints:
print "<input type=\"checkbox\" name=\"sprintid[]\" value=\"%d\"> %s<br>" % (sprint.id, sprint.link(handler.session['user']))
print "<br>"
print "Move to project: <select name=\"newproject\">"
for p in otherProjects:
print "<option value=\"%d\">%s</option>" % (p.id, p.safe.name)
print "</select>"
print Button('Move').post('move').positive()
print "<br><br>"
print "Delete sprints (irreversible once finalized):"
print Button('Delete').post('delete').negative()
print "</form>"
else:
print "No sprints"
print "<a name=\"rename\"></a>"
print "<h3>Rename</h3>"
print "<form method=\"post\" action=\"/admin/projects/%d/edit\">" % project.id
print "Name: <input type=\"text\" name=\"name\" value=\"%s\">" % project.safe.name
print Button('Rename', type = 'submit').positive()
print "</form>"
print "<a name=\"delete\"></a>"
print "<h3>Delete</h3>"
print "<form method=\"post\" action=\"/admin/projects/%d/delete\">" % project.id
if len(project.getSprints()) > 0:
if len(otherProjects) > 0:
print "Delete <b>%s</b> and move all sprints to <select name=\"newproject\">" % project.safe.name
for p in otherProjects:
print "<option value=\"%d\">%s</option>" % (p.id, p.safe.name)
print "</select>"
print Button('Delete', type = 'submit').negative()
else:
print "Unable to remove the only project if it has sprints"
else:
print Button("Delete %s" % project.safe.name, type = 'submit').negative()
print "</form><br>"