Skip to main content

Subscription library for Python Coders

Project description

ksubscribe

Python-Event-Based-Programming-Methodology

Ksubscribe library for Python Coders



This is a library that help python coder to run event-based methodology.

You can subscribe an event from object to another object. Ksubscribe library is designed with Singleton design pattern. So, if you create more that one Ksubscribe object, the all object is actually same object.

!!!!


Firstly, subscriber can subscribe an any event that is created before. After this operation, subscriber class must have inform functions.

You can see the inform function in below. Subscribed classc can send only one parameter that can be list, dict etc.

    def inform(self,eventName,parameters=None)

You can publish the event from subscriber like this from subscribed class

    self.slaveEventObject = Ksubscribe()
    def eventTwoSecond(self):
        self.slaveEventObject._publish(eventName="everyTwoSecond")

The ksubscribe library has these function that is mentioned in below.

    def _subscribeForAnEvent(self,subscriber,eventName:str)
       If this function returns True, subsciption is built.
       If this function returns False, subscription is not built.


    def _createAnEvent(self, eventName:str)
       If this function returns True, event is created.
       If this function returns False, event is not created.


    def _publish(self,eventName:str,parameters=None)
        This function does not return any value.


    def _removeAnEvent(self,eventName:str)
        If this function returns True, event is removed from event list.
        If this function returns False, event is not removed from event list


    def _removeAllEvents(self)
        If this function returns True, all events are removed.
        If this function returns False, all events are not removed.
    

    def _removeSubscriberFromEvent(self,subscriber, eventName:str)
        If this function returns True, subscriber is removed from event's subscriber list.
        If this function returns False, subscriber is not removed from event's subscriber list.



You can check example usage



If you have any question, send mail to me

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ksubscribe-1.0.8.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ksubscribe-1.0.8-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

Details for the file ksubscribe-1.0.8.tar.gz.

File metadata

  • Download URL: ksubscribe-1.0.8.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.9

File hashes

Hashes for ksubscribe-1.0.8.tar.gz
Algorithm Hash digest
SHA256 c887d4f4e5b12a0aca2f757b17a2012d1560b0a0d584fe0323ead8d151bff7e0
MD5 ea69c3278ea283980161be716cfa933d
BLAKE2b-256 a5e44346a75263052a2435383f59d6da89d1ba4ad16a602bd6d40af62756c63c

See more details on using hashes here.

File details

Details for the file ksubscribe-1.0.8-py3-none-any.whl.

File metadata

  • Download URL: ksubscribe-1.0.8-py3-none-any.whl
  • Upload date:
  • Size: 4.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.9

File hashes

Hashes for ksubscribe-1.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 cf1f2ac1e9386648ecbc712325ab3f409c7619499a9b37a79e8b51f078fefaf0
MD5 681a6f5490174afb52ed26fab320ef74
BLAKE2b-256 b84004dee678be865c3fb6715e4b57cc01dcb64e6b9dd3259a73f3275666d9f9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page