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

Add explicit signatures to some date autofunctions #554

Merged
merged 1 commit into from
Jan 30, 2018
Merged

Add explicit signatures to some date autofunctions #554

merged 1 commit into from
Jan 30, 2018

Conversation

xmo-odoo
Copy link
Contributor

@xmo-odoo xmo-odoo commented Jan 26, 2018

Because default_locale is eager, it generates misleading documentation when built (including on the site) as the doc will show the LC_TIME for the machine which built the doc.

An explicit autofunction signature fixes that and provides a more correct view of the signature.

Alternative fix: have dates.LC_TIME be a custom object with a relevant repr e.g.

class _LC(str):
    def __new__(cls, category):
        category = 'LC_' + category
        v = str.__new__(cls, default_locale(category))
        v._category = category
        return v

    def __repr__(self):
        return "default_locale('%s')" % self._category
LC_TIME = _LC('TIME')

Because default_locale is eager, it generates misleading documentation when built (including on the site) as the doc will show the LC_TIME for the machine which built the doc.

An explicit autofunction signature fixes that and provides a more correct view of the signature. 

An alternative fix would be for the LC_TIME value in the module to be a custom object with a repr of LC_TIME or something along those lines.

Fixes #542
@codecov-io
Copy link

codecov-io commented Jan 26, 2018

Codecov Report

Merging #554 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #554   +/-   ##
=======================================
  Coverage   90.22%   90.22%           
=======================================
  Files          24       24           
  Lines        4042     4042           
=======================================
  Hits         3647     3647           
  Misses        395      395

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d72eb13...57832c6. Read the comment docs.

@akx
Copy link
Member

akx commented Jan 30, 2018

Thank you! 🙇

@akx akx merged commit aba9001 into python-babel:master Jan 30, 2018
@xmo-odoo xmo-odoo deleted the patch-1 branch January 30, 2018 08:29
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.

3 participants