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


Python actor.Actor类代码示例

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


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

示例1: loadActors

        def loadActors(self, count=100):
                """function to read actors data and create a relationship between actors and movie."""

                actors = self.readArtists("actor", count)
                self.filePointerActors = self.fileHandleActors.tell()

                objActor = Actor("", 0)
                objMovie = Movie("", "", 0)

                for actor in actors:
                        name, title, year = actor
                        
                        # check if actor does not exist else create ID
                        if objActor.getArtistByName(name, self.actorsList) == None:
                                self.artistCounter += 1
                                actorId = self.artistCounter
                                newActor = Actor(actorId, name)
                                self.actorsList.append(newActor)
                                
                                # searches the movie list to check if movies have not been already visualized
                                if not objMovie.doesMovieExist(title, self.moviesList) and \
                                   objMovie.getMovieByName(title, self.moviesList) == None:
                                        self.movieCounter += 1
                                        movieId = self.movieCounter
                                        movie = Movie(movieId, title, year)
                                        self.moviesList.append(movie)

                                        # create relation between actor and  movie
                                        relation = ArtistMovieRelation(actorId, movieId)
                                        self.relationsList.append(relation)
开发者ID:rusheel,项目名称:imdb-data-visualizer,代码行数:30,代码来源:main.py

示例2: test_get_full_attack_returns_list_of_modifiers

 def test_get_full_attack_returns_list_of_modifiers(self):
     fighter = Fighter(2)
     rogue = Rogue(19)
     actor = Actor('Rogue Fighter', [], [rogue, fighter])
     full_attack = actor.get_full_attack()
     self.assertEqual(4, len(full_attack))
     self.assertEqual(16, full_attack[0].value)
     self.assertEqual(
         '+14 from level 19 Rogue. +2 from level 2 Fighter. +0, Strength ability score of 10. ',
         full_attack[0].audit_explanation
     )
     self.assertEqual(full_attack[1].value, 11)
     self.assertEqual(
         'Additional attack split from base BAB at a +5 breakpoint. See first attack for full audit trail.',
         full_attack[1].audit_explanation
     )
     self.assertEqual(full_attack[2].value, 6)
     self.assertEqual(
         'Additional attack split from base BAB at a +5 breakpoint. See first attack for full audit trail.',
         full_attack[2].audit_explanation
     )
     self.assertEqual(full_attack[3].value, 1)
     self.assertEqual(
         'Additional attack split from base BAB at a +5 breakpoint. See first attack for full audit trail.',
         full_attack[3].audit_explanation
     )
开发者ID:sadinar,项目名称:houston_pathfinder,代码行数:26,代码来源:test_actor.py

示例3: test_get_full_attack_adds_requested_attributes

 def test_get_full_attack_adds_requested_attributes(self):
     fighter = Fighter(5)
     rogue = Rogue(16)
     strength = Attribute(Attribute.STRENGTH, 16)
     dexterity = Attribute(Attribute.DEXTERITY, 14)
     actor = Actor('Rogue Fighter', [strength, dexterity], [rogue, fighter])
     full_attack = actor.get_full_attack()
     self.assertEqual(len(full_attack), 4)
     self.assertEqual(full_attack[0].value, 20)
     self.assertEqual(
         '+12 from level 16 Rogue. +5 from level 5 Fighter. +3, Strength ability score of 16. ',
         full_attack[0].audit_explanation
     )
     self.assertEqual(full_attack[1].value, 15)
     self.assertEqual(
         'Additional attack split from base BAB at a +5 breakpoint. See first attack for full audit trail.',
         full_attack[1].audit_explanation
     )
     self.assertEqual(full_attack[2].value, 10)
     self.assertEqual(
         'Additional attack split from base BAB at a +5 breakpoint. See first attack for full audit trail.',
         full_attack[2].audit_explanation
     )
     self.assertEqual(full_attack[3].value, 5)
     self.assertEqual(
         'Additional attack split from base BAB at a +5 breakpoint. See first attack for full audit trail.',
         full_attack[3].audit_explanation
     )
开发者ID:sadinar,项目名称:houston_pathfinder,代码行数:28,代码来源:test_actor.py

示例4: onObjectClick

        def onObjectClick(self, event): 
                """function to get movie details on the movie when clicked."""
                

                tempMovie = Movie(2, 4, "132")
                tempMovie = tempMovie.getMovieByOvalId(event.widget.find_closest(event.x, event.y)[0], self.moviesList)

                # get id's of the artists starring in this movie
                artistmovierelation = ArtistMovieRelation(0,0)
                artistStarring = artistmovierelation.getArtistsByMovieId(tempMovie.getMovieId(), self.relationsList)

                tempActor = Actor("","")
                tempActress = Actress("","")

                # fetches the name of the actor or actress. finds out whether it originated from tbe actor or actress class.

                artistsStartingNames = []
                for artistId in artistStarring:
                        actor = tempActor.getArtistByid(artistId, self.actorsList)
                        if actor != None:
                                artistsStartingNames.append(actor.getArtistName())
                        else:
                                actress = tempActress.getArtistByid(artistId, self.actressesList)
                                if actress != None:
                                        artistsStartingNames.append(actress.getArtistName())

                #  labels to show the film details
                self.movieDetailsVar.set('Title of the Film   : ' + tempMovie.getMovieTitle() + "\n" + "\n" 
                                         "Year Film Released : " + tempMovie.getMovieYear() + "\n"+ "\n" 
                                         "Actor/Actress Name  : " + ", ".join(artistsStartingNames))
开发者ID:rusheel,项目名称:imdb-data-visualizer,代码行数:30,代码来源:main.py

示例5: blame

    def blame(cls, repo, commit, file):
        """
        The blame information for the given file at the given commit

        Returns
            list: [git.Commit, list: [<line>]]
            A list of tuples associating a Commit object with a list of lines that 
            changed within the given commit. The Commit objects will be given in order
            of appearance.
        """
        data = repo.git.blame(commit, '--', file, p=True)
        commits = {}
        blames = []
        info = None

        for line in data.splitlines():
            parts = re.split(r'\s+', line, 1)
            if re.search(r'^[0-9A-Fa-f]{40}$', parts[0]):
                if re.search(r'^([0-9A-Fa-f]{40}) (\d+) (\d+) (\d+)$', line):
                    m = re.search(r'^([0-9A-Fa-f]{40}) (\d+) (\d+) (\d+)$', line)
                    id, origin_line, final_line, group_lines = m.groups()
                    info = {'id': id}
                    blames.append([None, []])
                elif re.search(r'^([0-9A-Fa-f]{40}) (\d+) (\d+)$', line):
                    m = re.search(r'^([0-9A-Fa-f]{40}) (\d+) (\d+)$', line)
                    id, origin_line, final_line = m.groups()
                    info = {'id': id}
            elif re.search(r'^(author|committer)', parts[0]):
                if re.search(r'^(.+)-mail$', parts[0]):
                    m = re.search(r'^(.+)-mail$', parts[0])
                    info["%s_email" % m.groups()[0]] = parts[-1]
                elif re.search(r'^(.+)-time$', parts[0]):
                    m = re.search(r'^(.+)-time$', parts[0])
                    info["%s_date" % m.groups()[0]] = time.gmtime(int(parts[-1]))
                elif re.search(r'^(author|committer)$', parts[0]):
                    m = re.search(r'^(author|committer)$', parts[0])
                    info[m.groups()[0]] = parts[-1]
            elif re.search(r'^filename', parts[0]):
                info['filename'] = parts[-1]
            elif re.search(r'^summary', parts[0]):
                info['summary'] = parts[-1]
            elif parts[0] == '':
                if info:
                    c = commits.has_key(info['id']) and commits[info['id']]
                    if not c:
                        c = Commit(repo, id=info['id'],
                                         author=Actor.from_string(info['author'] + ' ' + info['author_email']),
                                         authored_date=info['author_date'],
                                         committer=Actor.from_string(info['committer'] + ' ' + info['committer_email']),
                                         committed_date=info['committer_date'],
                                         message=info['summary'])
                        commits[info['id']] = c

                    m = re.search(r'^\t(.*)$', line)
                    text,  = m.groups()
                    blames[-1][0] = c
                    blames[-1][1].append( text )
                    info = None

        return blames
开发者ID:kergoth,项目名称:git-origin,代码行数:60,代码来源:blob.py

示例6: test_get_damage_returns_modifier_with_dice

 def test_get_damage_returns_modifier_with_dice(self):
     fighter = Fighter(5)
     rogue = Rogue(16)
     strength = Attribute(Attribute.STRENGTH, 16)
     dexterity = Attribute(Attribute.DEXTERITY, 14)
     actor = Actor('Rogue Fighter', [strength, dexterity], [rogue, fighter])
     self.assertEqual('1d3+3', actor.get_attack_damage('base_attack'))
开发者ID:sadinar,项目名称:houston_pathfinder,代码行数:7,代码来源:test_actor.py

示例7: __init__

 def __init__(self, screen, position, velocity, delay=1):
     Actor.__init__(self, screen, position, 10, velocity)
     self.image = pygame.image.load("images/fly.png").convert_alpha()
     self.image_w, self.image_h = self.image.get_size()
     self.delay = delay
     self.acc_time = 0
     self.alive = True
开发者ID:socumbersome,项目名称:frogery,代码行数:7,代码来源:fly.py

示例8: __init__

    def __init__(self, name, virtual=False):
        Actor.__init__(self)

        self.name = name
        self.faction = None
        self.living = True
        self.virtual = virtual
开发者ID:Excedrin,项目名称:mafl,代码行数:7,代码来源:player.py

示例9: main

def main():
	
	screen = pygame.display.set_mode((WIDTH, HEIGHT))
	pygame.display.set_caption("Engine RPG")

	clock = pygame.time.Clock()
	#rejilla = load_image('resources/graphics/rejilla.png', True)
	
	map_loaded = Map("pruebas.tmx")
	heroe = Actor(map_loaded)
	camara = Camera(map_loaded, heroe)
	inp = Input()
	
	while True:
		time = clock.tick(40)
		inp.update()
		salir(inp.get_key_list())
		
		id = heroe.mover(map_loaded, inp)
		heroe.update(id)
		camara.update(screen, map_loaded, heroe)
		camara.show_fps(screen, clock.get_fps())
		#screen.blit(rejilla, (0, 0))
		
		pygame.display.flip()
	return 0
开发者ID:adrigm,项目名称:Engine-RPG,代码行数:26,代码来源:main.py

示例10: __init__

	def __init__(self, screen):
		self._screen_w = screen.get_rect().width
		self._screen_h = screen.get_rect().height
		# start in dumb random place, needs changed later
		pos = (random.randint(0, self._screen_w) + self._screen_w*random.choice((-1, 1)),
			   random.randint(0, self._screen_h) + self._screen_h*random.choice((-1, 1)))	
		# Initialize an actor with these values
		Actor.__init__(self, Shooter.img[0], pos, 0)
开发者ID:a-leut,项目名称:sss,代码行数:8,代码来源:shooter.py

示例11: test_reflex_save_includes_audit

 def test_reflex_save_includes_audit(self):
     dexterity = Attribute(Attribute.DEXTERITY, 23)
     rogue = Rogue(2)
     actor = Actor('Test Rogue With Rouge', [dexterity], [rogue])
     self.assertEqual(
         '+3, Level 2 Rogue class bonus. +6, Dexterity ability score of 23. ',
         actor.get_reflex_save().audit_explanation
     )
开发者ID:sadinar,项目名称:houston_pathfinder,代码行数:8,代码来源:test_actor.py

示例12: test_will_save_includes_audit

 def test_will_save_includes_audit(self):
     wisdom = Attribute(Attribute.WISDOM, 24)
     rogue = Rogue(3)
     actor = Actor('Test Rogue With Rouge', [wisdom], [rogue])
     self.assertEqual(
         '+1, Level 3 Rogue class bonus. +7, Wisdom ability score of 24. ',
         actor.get_will_save().audit_explanation
     )
开发者ID:sadinar,项目名称:houston_pathfinder,代码行数:8,代码来源:test_actor.py

示例13: __init__

 def __init__(self, initial_position, vector_shot_from):
     self._speed = 20
     Actor.__init__(self, Bullet.img[0], initial_position, vector_shot_from.angle)
     self._vector = Vector.product(Vector(self._speed, self._angle), vector_shot_from)
     center = self.rect.center
     self.image = Bullet.img[int(2*math.degrees(- self._angle - math.pi/2))]
     self.rect = self.image.get_rect(center=center)
     self.radius = (Bullet.img[0].get_rect().width + Bullet.img[0].get_rect().height)/4
开发者ID:a-leut,项目名称:sss,代码行数:8,代码来源:playership.py

示例14: test_fortitude_save_includes_audit

 def test_fortitude_save_includes_audit(self):
     constitution = Attribute(Attribute.CONSTITUTION, 22)
     rogue = Rogue(1)
     actor = Actor('Test Rogue With Rouge', [constitution], [rogue])
     self.assertEqual(
         '+0, Level 1 Rogue class bonus. +6, Constitution ability score of 22. ',
         actor.get_fortitude_save().audit_explanation
     )
开发者ID:sadinar,项目名称:houston_pathfinder,代码行数:8,代码来源:test_actor.py

示例15: test_reflex_save_combines_dexterity_and_class_bonus

 def test_reflex_save_combines_dexterity_and_class_bonus(self):
     dexterity = Attribute(Attribute.DEXTERITY, 13)
     rogue = Rogue(17)
     actor = Actor('Test Rogue With Rouge', [dexterity], [rogue])
     self.assertEqual(
         rogue.get_reflex_save().value + dexterity.get_attribute_modifier().value,
         actor.get_reflex_save().value
     )
开发者ID:sadinar,项目名称:houston_pathfinder,代码行数:8,代码来源:test_actor.py


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