Skip to content

Small fix fix when dumping config when names are only digits but stil… #13377

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

Merged
merged 2 commits into from
Mar 30, 2018

Conversation

hAmpzter
Copy link
Contributor

…l ok according to the validation (used with tellstick sensor mappings)

Description:

Related issue (if applicable): fixes #

Pull request in home-assistant.github.io with documentation (if applicable): home-assistant/home-assistant.github.io#<home-assistant.github.io PR number goes here>

Example entry for configuration.yaml (if applicable):

Checklist:

  • The code change is tested and works locally.
  • Local tests pass with tox. Your PR cannot be merged unless tests pass

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • New dependencies have been added to the REQUIREMENTS variable (example).
  • New dependencies are only imported inside functions that use them (example).
  • New dependencies have been added to requirements_all.txt by running script/gen_requirements_all.py.
  • New files were added to .coveragerc.

If the code does not interact with devices:

  • Tests have been added to verify that the new code works.

…l ok according to the validation (used with tellstick sensor mappings)
@homeassistant
Copy link
Contributor

Hi @hAmpzter,

It seems you haven't yet signed a CLA. Please do so here.

Once you do that we will be able to review and accept this pull request.

Thanks!

@hAmpzter
Copy link
Contributor Author

CLA signed! :)

@balloob
Copy link
Member

balloob commented Mar 23, 2018

CC @kellerza

@@ -252,7 +252,7 @@ def dump_dict(layer, indent_count=3, listi=False, **kwargs):
"""
def sort_dict_key(val):
"""Return the dict key for sorting."""
key = str.lower(val[0])
key = str.lower(val[0]) if isinstance(val[0], str) else str(val[0])
Copy link
Member

Choose a reason for hiding this comment

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

Maybe just str(val[0]).lower() ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah! That would be a nicer solution, but then it will always convert even if it is a string (witch it is in 99% of the cases). This is though just a function used with testing. So depends if nice code or speed is needed? ;)

Copy link
Member

Choose a reason for hiding this comment

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

It's only for human consumption, like you say, so let go with nice code...

@kellerza kellerza self-assigned this Mar 23, 2018
@kellerza kellerza merged commit c361b0c into home-assistant:dev Mar 30, 2018
@kellerza
Copy link
Member

Thank you @hAmpzter ! 🎉

@balloob balloob mentioned this pull request Apr 13, 2018
@home-assistant home-assistant locked and limited conversation to collaborators Jul 26, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants