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

sched.py kwargs addition and default time functions #57454

Closed
clach04 mannequin opened this issue Oct 22, 2011 · 6 comments
Closed

sched.py kwargs addition and default time functions #57454

clach04 mannequin opened this issue Oct 22, 2011 · 6 comments
Labels
stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@clach04
Copy link
Mannequin

clach04 mannequin commented Oct 22, 2011

BPO 13245
Nosy @mdickinson, @giampaolo, @ezio-melotti
Files
  • kwargs_def_timer.patch
  • issue13245.patch
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2011-11-22.12:40:12.809>
    created_at = <Date 2011-10-22.19:05:53.970>
    labels = ['type-feature', 'library']
    title = 'sched.py kwargs addition and default time functions'
    updated_at = <Date 2011-11-22.12:40:12.807>
    user = 'https://bugs.python.org/clach04'

    bugs.python.org fields:

    activity = <Date 2011-11-22.12:40:12.807>
    actor = 'giampaolo.rodola'
    assignee = 'none'
    closed = True
    closed_date = <Date 2011-11-22.12:40:12.809>
    closer = 'giampaolo.rodola'
    components = ['Library (Lib)']
    creation = <Date 2011-10-22.19:05:53.970>
    creator = 'clach04'
    dependencies = []
    files = ['23496', '23745']
    hgrepos = []
    issue_num = 13245
    keywords = ['patch']
    message_count = 6.0
    messages = ['146180', '146181', '148093', '148094', '148109', '148112']
    nosy_count = 4.0
    nosy_names = ['mark.dickinson', 'giampaolo.rodola', 'ezio.melotti', 'clach04']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'patch review'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue13245'
    versions = ['Python 3.3']

    @clach04
    Copy link
    Mannequin Author

    clach04 mannequin commented Oct 22, 2011

    I ended up implementing my own sched.py equivalent as I needed kwargs support. This is my attempt to improve the stdlib, so I can throw my module way ;-)

    Added kwargs support, and made "argument" optional. "argument" is still named argument, I would like to rename this args but I'm unclear on the backwards compat rules for stdlib, in theory it should be fine unless someone has code that treats argument as a keyword arg).

    The scheduler init no long requires timer functions to be provided, it defaults to time.time, time.sleep as a helper to reduce repeated code for callers. This still allows callers to provide custom timer routines.

    I added a few (non exhaustive) tests for the new additions.

    It looks like there are a few PEP-8 improvements could be made to sched.py but I've not done that to reduce diffs and make it easier to see what I changed. Similar doc strings could be made more clear.

    I snuck in a hack to the test so that the full test suite isn't needed, I do not expect that to be accepted :-) I don't have enough network bandwidth to pull the whole hg repo so I ended up pulling the tip version for 2.7 of sched and its test (as of 2011-10-22 this is 5110d723fbb1)

    @clach04 clach04 mannequin added stdlib Python modules in the Lib dir type-feature A feature request or enhancement labels Oct 22, 2011
    @ezio-melotti
    Copy link
    Member

    Hi, thanks for the patch!
    2.7 receives only bug fixes, so your patch can't be applied to 2.7.
    If the feature is accepted it can go to 3.3 though.

    @giampaolo
    Copy link
    Contributor

    I think this should go in.
    I'm going to provide a slighly modified version of the attached patch which includes document changes and get rid of some unit tests which are not really necessary in my opinion.

    @giampaolo
    Copy link
    Contributor

    Updated patch in attachment.

    @mdickinson
    Copy link
    Member

    +1 to kwargs support in sched. I've also ended up modifying sched.py to support this in the past.

    @giampaolo
    Copy link
    Contributor

    Checked in as f1a21f2e3bec and dc52db0fa2e5.
    Thanks.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    stdlib Python modules in the Lib dir type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants