Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SM: clean post_fill function #2863

Merged
merged 4 commits into from
Apr 18, 2024
Merged

Conversation

beauxq
Copy link
Collaborator

@beauxq beauxq commented Feb 25, 2024

What is this fixing or adding?

make this function easier to read and understand

How was this tested?

run this:
a = """
def get_player_ItemLocation(progression_only: bool):
        return [
                ItemLocation(copy.copy(ItemManager.Items[
                    itemLoc.item.type if isinstance(itemLoc.item, SMItem) and itemLoc.item.type in ItemManager.Items else
                    'ArchipelagoItem']),
                    copy.copy(locationsDict[itemLoc.name] if itemLoc.game == self.game else
                                locationsDict[first_local_collected_loc.name]),
                    itemLoc.item.player,
                    True)
                    for itemLoc in spheres if itemLoc.item.player == self.player and (not progression_only or itemLoc.item.advancement)
                ]
"""

b = """
def get_player_ItemLocation(progression_only: bool):
        return [
            ItemLocation(
                copy.copy(
                    ItemManager.Items[
                        itemLoc.item.type
                        if isinstance(itemLoc.item, SMItem) and itemLoc.item.type in ItemManager.Items
                        else 'ArchipelagoItem'
                    ]
                ),
                copy.copy(
                    locationsDict[itemLoc.name]
                    if itemLoc.game == self.game
                    else locationsDict[first_local_collected_loc.name]
                ),
                itemLoc.item.player,
                True
            )
            for itemLoc in spheres
            if itemLoc.item.player == self.player and (not progression_only or itemLoc.item.advancement)
        ]
"""
a_c = compile(a, "test", "single")
b_c = compile(b, "test", "single")

print(a_c == b_c)

@github-actions github-actions bot added the waiting-on: peer-review Issue/PR has not been reviewed by enough people yet. label Feb 25, 2024
@beauxq
Copy link
Collaborator Author

beauxq commented Feb 25, 2024

@lordlou

@ScipioWright ScipioWright added the is: refactor/cleanup Improvements to code/output readability or organizization. label Feb 26, 2024
@alwaysintreble alwaysintreble added the waiting-on: world-maintainer Issue/PR is waiting for feedback or approval by the maintainer of a world. label Feb 26, 2024
Copy link
Contributor

@lordlou lordlou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All better, thank you!

@Exempt-Medic Exempt-Medic added waiting-on: core-review Issue/PR has been peer-reviewed and is ready to be merged or needs input from a core maintainer. and removed waiting-on: world-maintainer Issue/PR is waiting for feedback or approval by the maintainer of a world. waiting-on: peer-review Issue/PR has not been reviewed by enough people yet. labels Mar 28, 2024
Copy link
Member

@Exempt-Medic Exempt-Medic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Compared the two formats with a parser.

@Berserker66 Berserker66 merged commit 3343d4e into ArchipelagoMW:main Apr 18, 2024
15 checks passed
qwint pushed a commit to qwint/Archipelago that referenced this pull request Jun 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
is: refactor/cleanup Improvements to code/output readability or organizization. waiting-on: core-review Issue/PR has been peer-reviewed and is ready to be merged or needs input from a core maintainer.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants