pytime-manager


Namepytime-manager JSON
Version 1.7 PyPI version JSON
download
home_pagehttps://github.com/xzripper/time_manager
SummaryImproves work with time in Python.
upload_time2023-11-04 15:51:11
maintainer
docs_urlNone
authorIvan Perzhinsky.
requires_python
licenseMIT
keywords utility
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ====================
Time_Manager. [v1.7]
====================

**Improves work with time.**

.. code:: python

   # Time Manager.
   from pytime_manager import *
   from pytime_manager.uc import *


   # Translate one year into days.
   print(translate_time(1, YEAR, DAY)) # => 365

   # Or...
   print(translate_time_y(1, DAY)) # => 365

   # Make sure to add this line so everything will work!
   set_translate_time(translate_time) # translate_time is located in time_manager.uc.

   # Print 'Hello!' after three seconds.
   time_thread(
      call_after(
         lambda: print('Hello!'),
         3 # or Delay((3, SECOND))
      )
   )

   # Print 'Hello!' and after three seconds print 'Bye!'.
   time_thread(
      call_after2(
         lambda: print('Hello!'),
         lambda: print('Bye!'),
         3 # or Delay((3, SECOND))
      )
   )

   # Print message for three seconds.
   time_thread(
      do_for(
         lambda: print('Print me for three seconds.'),
         3 # or Delay((3, SECOND))
      )
   )

   # Print message three times with one second delay.
   time_thread(
      do(
         lambda: print('print me 3 times with one second delay'), 1, 3
      )
   )

   # Print message and wait three seconds.
   do_and_wait(lambda: print('Hi!'), 3)

   # Blocking Time Thread VS Time Thread.
   blocking_time_thread(do(lambda: print('Hello 1'), 1, 5)) # Uses virtual 'main' thread.

   print('Application thread is unblocked but still unable to call blocking another time thread.')

   blocking_time_thread(do(lambda: print('Hello 2 (Not going to print because its blocked for me)'), 1, 5)) # Uses virtual 'main' thread.

   blocking_time_thread(do(lambda: print('Hello 3 (I\'m from another thread so I don\'t care.)'), 1, 5), thread='other_thread') # Uses virtual 'other_thread' thread.

   time_thread(do(lambda: print('I\'m going to be printed because i\'m free time thread.'), 1, 5))

   # Schedule function calling.
   time_thread(
      do_every(
         lambda: print('Hello!'),

         Delay((1, MINUTE), (30, SECOND), (2.5, SECOND)), # 1min 32.5s (92.5s) [example: [(1, DAY), (12, HOUR)] => 1 day, 12 hours] : OR : 60 + 30 + 2.5 = 32.5s (32.5 [float]).

         False # Once?
      )
   )

Adds more than 15 functions to improve work with time, and a lot more things.

`TimeManager Cheatsheet <https://github.com/xzripper/time_manager/blob/main/time_manager/__init__.py>`_.

`UnitConverter Cheatsheet <https://github.com/xzripper/time_manager/blob/main/time_manager/uc.py>`_.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/xzripper/time_manager",
    "name": "pytime-manager",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "utility",
    "author": "Ivan Perzhinsky.",
    "author_email": "name1not1found.com@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/66/fe/881156dc53cfc07a02d62104d8cb261be57d3cb0bf4e93a5444c0adfa721/pytime_manager-1.7.tar.gz",
    "platform": null,
    "description": "====================\r\nTime_Manager. [v1.7]\r\n====================\r\n\r\n**Improves work with time.**\r\n\r\n.. code:: python\r\n\r\n   # Time Manager.\r\n   from pytime_manager import *\r\n   from pytime_manager.uc import *\r\n\r\n\r\n   # Translate one year into days.\r\n   print(translate_time(1, YEAR, DAY)) # => 365\r\n\r\n   # Or...\r\n   print(translate_time_y(1, DAY)) # => 365\r\n\r\n   # Make sure to add this line so everything will work!\r\n   set_translate_time(translate_time) # translate_time is located in time_manager.uc.\r\n\r\n   # Print 'Hello!' after three seconds.\r\n   time_thread(\r\n      call_after(\r\n         lambda: print('Hello!'),\r\n         3 # or Delay((3, SECOND))\r\n      )\r\n   )\r\n\r\n   # Print 'Hello!' and after three seconds print 'Bye!'.\r\n   time_thread(\r\n      call_after2(\r\n         lambda: print('Hello!'),\r\n         lambda: print('Bye!'),\r\n         3 # or Delay((3, SECOND))\r\n      )\r\n   )\r\n\r\n   # Print message for three seconds.\r\n   time_thread(\r\n      do_for(\r\n         lambda: print('Print me for three seconds.'),\r\n         3 # or Delay((3, SECOND))\r\n      )\r\n   )\r\n\r\n   # Print message three times with one second delay.\r\n   time_thread(\r\n      do(\r\n         lambda: print('print me 3 times with one second delay'), 1, 3\r\n      )\r\n   )\r\n\r\n   # Print message and wait three seconds.\r\n   do_and_wait(lambda: print('Hi!'), 3)\r\n\r\n   # Blocking Time Thread VS Time Thread.\r\n   blocking_time_thread(do(lambda: print('Hello 1'), 1, 5)) # Uses virtual 'main' thread.\r\n\r\n   print('Application thread is unblocked but still unable to call blocking another time thread.')\r\n\r\n   blocking_time_thread(do(lambda: print('Hello 2 (Not going to print because its blocked for me)'), 1, 5)) # Uses virtual 'main' thread.\r\n\r\n   blocking_time_thread(do(lambda: print('Hello 3 (I\\'m from another thread so I don\\'t care.)'), 1, 5), thread='other_thread') # Uses virtual 'other_thread' thread.\r\n\r\n   time_thread(do(lambda: print('I\\'m going to be printed because i\\'m free time thread.'), 1, 5))\r\n\r\n   # Schedule function calling.\r\n   time_thread(\r\n      do_every(\r\n         lambda: print('Hello!'),\r\n\r\n         Delay((1, MINUTE), (30, SECOND), (2.5, SECOND)), # 1min 32.5s (92.5s) [example: [(1, DAY), (12, HOUR)] => 1 day, 12 hours] : OR : 60 + 30 + 2.5 = 32.5s (32.5 [float]).\r\n\r\n         False # Once?\r\n      )\r\n   )\r\n\r\nAdds more than 15 functions to improve work with time, and a lot more things.\r\n\r\n`TimeManager Cheatsheet <https://github.com/xzripper/time_manager/blob/main/time_manager/__init__.py>`_.\r\n\r\n`UnitConverter Cheatsheet <https://github.com/xzripper/time_manager/blob/main/time_manager/uc.py>`_.\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Improves work with time in Python.",
    "version": "1.7",
    "project_urls": {
        "Download": "https://github.com/xzripper/time_manager/archive/refs/tags/v1.7.tar.gz",
        "Homepage": "https://github.com/xzripper/time_manager"
    },
    "split_keywords": [
        "utility"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "66fe881156dc53cfc07a02d62104d8cb261be57d3cb0bf4e93a5444c0adfa721",
                "md5": "55fd9936f05e05d9a005320cd7191d55",
                "sha256": "90119d51d15ce1bbc13ea4d22ba8fa966941cbef8a0bf151a084a3e8f0e526b3"
            },
            "downloads": -1,
            "filename": "pytime_manager-1.7.tar.gz",
            "has_sig": false,
            "md5_digest": "55fd9936f05e05d9a005320cd7191d55",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 5431,
            "upload_time": "2023-11-04T15:51:11",
            "upload_time_iso_8601": "2023-11-04T15:51:11.822885Z",
            "url": "https://files.pythonhosted.org/packages/66/fe/881156dc53cfc07a02d62104d8cb261be57d3cb0bf4e93a5444c0adfa721/pytime_manager-1.7.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-11-04 15:51:11",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "xzripper",
    "github_project": "time_manager",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "pytime-manager"
}
        
Elapsed time: 0.44857s