* Add a prefix to worker thread
This adds a prefix of `Bot:<id>:worker:` to the name of the worker threads.
Fixes#1332
* Also prefix other threads
* Fix test
* Fix test and remove helper method.
See https://github.com/python-telegram-bot/python-telegram-bot/wiki/Transition-guide-to-Version-11.0 under Context based callbacks and Filters in handlers for a good guide on the changes in this commit.
* Change handlers so context is supported
* Attempt to make parameter "guessing" work on py < 3.5
* Document use_context in all handlers
* Add Context to docs
* Minor fixes to context handling
* Add tests for context stuff
* Allow the signature check to work on py<3.5 with methods
* Fix order of operations
* Address most issues raised in CR
* Make CommandHandler no longer support filter lists
* Fix indent
(pycharm can be an arse sometimes)
* Improve readability in conversationhandler
* Make context have Match instead of groups & groupdict
* Remove filter list support from messagehandler too
* Small fix to StringCommandHandler
* More small fixes to handlers
* Amend CHANGES
* Fix tests and fix bugs raised by tests
* Don't allow users to ignore errors without messing with the warning filters themselves
* Ignore our own deprecation warnings when testing
* Skipping deprecationwarning test on py2
* Forgot some changes
* Handler: Improved documentation and text of deprecation warnings
* HandlerContext: Keep only dispatcher and use properties; improved doc
* Complete fixing the documentation.
- Fixes per Eldinnie's comments.
- Fixes per warnings when running sphinx.
* Some small doc fixes (interlinks and optionals)
* Change add_error_handler to use HandlerContext too
* More context based changes
Context Based Handlers -> Context Based Callbacks
No longer use_context args on every single Handler
Instead set dispatcher/updater .use_context=True to use
Works with
- Handler callbacks
- Error handler callbacks
- Job callbacks
Change examples to context based callbacks so new users are not confused
Rename and move the context object from Handlers.HandlerContext to CallbackContext, since it doesn't only apply to handlers anymore.
Fix tests by adding a new fixture `cpd` which is a dispatcher with use_context=True
* Forgot about conversationhandler
* Forgot jobqueue
* Add tests for callbackcontext & for context based callback job
* Fix as per review :)
- Fix JobQueue.jobs to obtain a lock on the internal queue object prior
to iterating over it.
- Rename JobQueue.queue to JobQueue._queue. This shouldn't be
accessible by the user directly, but rather only with sanitized
thread safe methods.
- JobQueue.interval_seconds - access self.interval only once to avoid
race conditions.
Fixes#968
- Job.job_queue is now weakref.proxy reducing the risk of cyclic
pointers preventing Job object from being deleted.
- JobQueue._put(): raise if both next_t and job.interval are None
- Don't put repeating job back to queue if user had disabled it was
disabled during the time of execution.
- New method: Job.is_removed() - promising a consistent API (instead of
access to private member Job._remove)
- Documentation fixes.
* Adding timeunit and day support to the jobqueue
* Adding tests
* Changed the file permission back to 644.
* Changed AssertEqual argument order to (actual, expectd).
* Removed the TimeUnit enum and unit param, instead use datetime.time for interval.
* Removing the TimeUnits enum and unit param in favour of optionally using a datetime.time as the interval.
* Removing the TimeUnits enumeration, forgot the remove it in the last one.
* Removed some old docstrings refering to the TimeUnits enum.
* Removed the old TimeUnits import.
* Adding some error handling for the 'days' argument (only a 'tuple' with 'Days')
* Writing the error message directly in the exception.
* Moving a debug statement wrongfully saying a job would be running on days it wouldn't.
* Writing error messages directly in the exceptions instead of making an extra variable.
* Replacing datetime.time in favour of datetime.timedelta because of the get_seconds() method.
* Adding error handling for the method .
* Splitting the tests up in multiple ones, no float test because I haven't found a reliable way to test it.
* Excluding .exrc file.
* Removing \ at EOF of ValueError.
* Replacing Enums with plain new-style classes.
* Using numbers.number to check for ints/floats instead of seperate int/float checks.
* Fixing typo, number -> Number.
* Changed lower_case Days attributes to UPPER_CASE.
* Different formatting for Days class, removed the get_days function in favour of a tuple.
* Removed redundant function get_days.
* Edited the docstring for next_t to also take datetime.timedelta.
* Removed for-loop in favour of any().
* Changed docstring for interval.
* Removed debug print.
* Changing some docstrings.
* Changing some docstrings (again).
* update sphinx source files to properly build latexpdf and improve html build
* fix docstrings and sphinx sources to get rid of warnings
* add telegram.contrib.rst
- start the jobqueue (by default) during __init__() instead of during
put()
- protect self._next_peek and self.__tick with a Lock
- rename self._start() to self._main_loop()
- stop() is now blocking until the event loop thread exits