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

Sourcery Starbot ⭐ refactored ryneandal/pokeapi #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

SourceryAI
Copy link

Thanks for starring sourcery-ai/sourcery ✨ 🌟 ✨

Here's your pull request refactoring your most popular Python repo.

If you want Sourcery to refactor all your Python repos and incoming pull requests install our bot.

Review changes via command line

To manually merge these changes, make sure you're on the master branch, then run:

git fetch https://github.com/sourcery-ai-bot/pokeapi master
git merge --ff-only FETCH_HEAD
git reset HEAD^

Copy link
Author

@SourceryAI SourceryAI left a comment

Choose a reason for hiding this comment

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

Due to GitHub API limits, only the first 60 comments can be shown.

bind = "0.0.0.0:{}".format(os.environ.get("SERVER_PORT", "80"))
bind = f'0.0.0.0:{os.environ.get("SERVER_PORT", "80")}'
Copy link
Author

Choose a reason for hiding this comment

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

Lines 4-4 refactored with the following changes:

IMAGE_DIR = os.getcwd() + "/data/v2/sprites/sprites/"
IMAGE_DIR = f"{os.getcwd()}/data/v2/sprites/sprites/"
Copy link
Author

Choose a reason for hiding this comment

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

Lines 34-34 refactored with the following changes:

for value in iterable:
yield value
yield from iterable
Copy link
Author

Choose a reason for hiding this comment

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

Function with_iter refactored with the following changes:

  • Replace yield inside for loop with yield from (yield-from)

Comment on lines -66 to +65
print("building " + table_name)
print(f"building {table_name}")
Copy link
Author

Choose a reason for hiding this comment

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

Function clear_table refactored with the following changes:

Comment on lines -122 to +121
if len(sub) >= 2:
sub = sub[1]
else:
sub = sub[0]
sub = sub[1] if len(sub) >= 2 else sub[0]
Copy link
Author

Choose a reason for hiding this comment

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

Function scrub_str refactored with the following changes:

Comment on lines -3095 to -3098
past_obj = {}
past_obj = {"generation": poke_past_type["generation"]}

# create past types object for this generation
past_obj["generation"] = poke_past_type["generation"]
Copy link
Author

Choose a reason for hiding this comment

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

Function PokemonDetailSerializer.get_past_pokemon_types refactored with the following changes:

This removes the following comments ( why? ):

# create past types object for this generation

Comment on lines -3288 to +3271
groups = []
for group in data:
groups.append(group["egg_group"])

return groups
return [group["egg_group"] for group in data]
Copy link
Author

Choose a reason for hiding this comment

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

Function PokemonSpeciesDetailSerializer.get_pokemon_egg_groups refactored with the following changes:

Comment on lines -3391 to +3370
# serialize chain recursively from tree
chain = self.build_chain_link_entry(evolution_tree, summary_data)

return chain
return self.build_chain_link_entry(evolution_tree, summary_data)
Copy link
Author

Choose a reason for hiding this comment

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

Function EvolutionChainDetailSerializer.build_chain refactored with the following changes:

This removes the following comments ( why? ):

# serialize chain recursively from tree

Comment on lines -3413 to +3389
while len(search_stack) > 0:
while search_stack:
Copy link
Author

Choose a reason for hiding this comment

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

Function EvolutionChainDetailSerializer.build_evolution_tree refactored with the following changes:

Comment on lines -3574 to +3550
results = []

for dex_group in dex_groups:
results.append(dex_group["version_group"])

return results
return [dex_group["version_group"] for dex_group in dex_groups]
Copy link
Author

Choose a reason for hiding this comment

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

Function PokedexDetailSerializer.get_pokedex_version_groups refactored with the following changes:

Comment on lines -3636 to +3607
regions = []

for region in data:
regions.append(region["region"])

return regions
return [region["region"] for region in data]
Copy link
Author

Choose a reason for hiding this comment

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

Function VersionGroupDetailSerializer.get_version_group_regions refactored with the following changes:

Comment on lines -3651 to +3617
methods = []

for method in learn_method_data:
methods.append(method["move_learn_method"])

return methods
return [method["move_learn_method"] for method in learn_method_data]
Copy link
Author

Choose a reason for hiding this comment

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

Function VersionGroupDetailSerializer.get_learn_methods refactored with the following changes:

Comment on lines -3664 to +3625
results = []

for dex_group in dex_groups:
results.append(dex_group["pokedex"])

return results
return [dex_group["pokedex"] for dex_group in dex_groups]
Copy link
Author

Choose a reason for hiding this comment

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

Function VersionGroupDetailSerializer.get_version_groups_pokedexes refactored with the following changes:

local_language = cls.setup_language_data(name="lang for " + name)
local_language = cls.setup_language_data(name=f"lang for {name}")
Copy link
Author

Choose a reason for hiding this comment

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

Function APIData.setup_language_name_data refactored with the following changes:

language = cls.setup_language_data(name="lang for " + name)
language = cls.setup_language_data(name=f"lang for {name}")
Copy link
Author

Choose a reason for hiding this comment

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

Function APIData.setup_region_name_data refactored with the following changes:

language = cls.setup_language_data(name="lang for " + description)
language = cls.setup_language_data(name=f"lang for {description}")
Copy link
Author

Choose a reason for hiding this comment

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

Function APIData.setup_item_attribute_description_data refactored with the following changes:

language = cls.setup_language_data(name="lang for " + effect)
language = cls.setup_language_data(name=f"lang for {effect}")
Copy link
Author

Choose a reason for hiding this comment

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

Function APIData.setup_item_fling_effect_effect_text_data refactored with the following changes:

language = cls.setup_language_data(name="lang for " + name)
language = cls.setup_language_data(name=f"lang for {name}")
Copy link
Author

Choose a reason for hiding this comment

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

Function APIData.setup_item_pocket_name_data refactored with the following changes:

Comment on lines -321 to 323
name="itm pkt for " + name
name=f"itm pkt for {name}"
)

Copy link
Author

Choose a reason for hiding this comment

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

Function APIData.setup_item_category_data refactored with the following changes:

Comment on lines -332 to +333
language = cls.setup_language_data(name="lang for " + name)
language = cls.setup_language_data(name=f"lang for {name}")
Copy link
Author

Choose a reason for hiding this comment

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

Function APIData.setup_item_category_name_data refactored with the following changes:

Comment on lines -381 to +382
language = cls.setup_language_data(name="lang for " + name)
language = cls.setup_language_data(name=f"lang for {name}")
Copy link
Author

Choose a reason for hiding this comment

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

Function APIData.setup_item_name_data refactored with the following changes:

Comment on lines -393 to +394
language = cls.setup_language_data(name="lang for " + effect)
language = cls.setup_language_data(name=f"lang for {effect}")
Copy link
Author

Choose a reason for hiding this comment

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

Function APIData.setup_item_effect_text_data refactored with the following changes:

Comment on lines -405 to +408
version_group = cls.setup_version_group_data(name="ver grp for " + flavor_text)
version_group = cls.setup_version_group_data(name=f"ver grp for {flavor_text}")

language = cls.setup_language_data(name="lang for " + flavor_text)
language = cls.setup_language_data(name=f"lang for {flavor_text}")
Copy link
Author

Choose a reason for hiding this comment

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

Function APIData.setup_item_flavor_text_data refactored with the following changes:

Comment on lines -445 to +446
language = cls.setup_language_data(name="lang for " + name)
language = cls.setup_language_data(name=f"lang for {name}")
Copy link
Author

Choose a reason for hiding this comment

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

Function APIData.setup_contest_type_name_data refactored with the following changes:

Comment on lines -467 to +468
language = cls.setup_language_data(name="lang for " + flavor_text)
language = cls.setup_language_data(name=f"lang for {flavor_text}")
Copy link
Author

Choose a reason for hiding this comment

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

Function APIData.setup_contest_effect_flavor_text_data refactored with the following changes:

Comment on lines -706 to +708
language = cls.setup_language_data(name="lang for " + name)
language = cls.setup_language_data(name=f"lang for {name}")
Copy link
Author

Choose a reason for hiding this comment

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

Function APIData.setup_location_area_name_data refactored with the following changes:

Comment on lines -720 to +726
name="mv dmg cls for " + name
name=f"mv dmg cls for {name}"
)

generation = generation or cls.setup_generation_data(name="rgn for " + name)

generation = generation or cls.setup_generation_data(name=f"rgn for {name}")
Copy link
Author

Choose a reason for hiding this comment

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

Function APIData.setup_type_data refactored with the following changes:

Comment on lines -735 to +738
language = cls.setup_language_data(name="lang for " + name)
language = cls.setup_language_data(name=f"lang for {name}")
Copy link
Author

Choose a reason for hiding this comment

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

Function APIData.setup_type_name_data refactored with the following changes:

Comment on lines -766 to +769
language = cls.setup_language_data(name="lang for " + name)
language = cls.setup_language_data(name=f"lang for {name}")
Copy link
Author

Choose a reason for hiding this comment

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

Function APIData.setup_move_ailment_name_data refactored with the following changes:

Comment on lines -786 to +789
language = cls.setup_language_data(name="lang for " + name)
language = cls.setup_language_data(name=f"lang for {name}")
Copy link
Author

Choose a reason for hiding this comment

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

Function APIData.setup_move_battle_style_name_data refactored with the following changes:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant