From 9aec5a1ccfb7a5eb429ef6aff95ac3647086ea83 Mon Sep 17 00:00:00 2001 From: David Wilson Date: Fri, 15 Sep 2017 11:54:41 +0530 Subject: [PATCH] Invert the sense of mitogen.slave --- docs/index.rst | 2 +- mitogen/__init__.py | 6 +++--- mitogen/core.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/index.rst b/docs/index.rst index c1c67299..a1b3c6fd 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -300,7 +300,7 @@ usual into the slave process. context = mitogen.ssh.connect(broker, sys.argv[1]) context.call(install_app) - if __name__ == '__main__' and not mitogen.slave: + if __name__ == '__main__' and mitogen.master: import mitogen.utils mitogen.utils.run_with_broker(main) diff --git a/mitogen/__init__.py b/mitogen/__init__.py index 11bd98e4..5324cd90 100644 --- a/mitogen/__init__.py +++ b/mitogen/__init__.py @@ -3,7 +3,7 @@ On the Mitogen master, this is imported from ``mitogen/__init__.py`` as would be expected. On the slave, it is built dynamically during startup. """ -#: This is ``True`` in slave contexts. It is used in single-file Python +#: This is ``False`` in slave contexts. It is used in single-file Python #: programs to avoid reexecuting the program's :py:func:`main` function in the #: slave. For example: #: @@ -16,11 +16,11 @@ be expected. On the slave, it is built dynamically during startup. #: context = mitogen.master.connect(broker) #: context.call(do_work) # Causes slave to import __main__. #: -#: if __name__ == '__main__' and not mitogen.slave: +#: if __name__ == '__main__' and mitogen.master: #: import mitogen.utils #: mitogen.utils.run_with_broker(main) #: -slave = False +master = True #: This is ``0`` in a master, otherwise it is a master-generated ID unique to diff --git a/mitogen/core.py b/mitogen/core.py index d22cdb19..11c6274d 100644 --- a/mitogen/core.py +++ b/mitogen/core.py @@ -1085,7 +1085,7 @@ class ExternalContext(object): mitogen.__package__ = 'mitogen' mitogen.__path__ = [] mitogen.__loader__ = self.importer - mitogen.slave = True + mitogen.master = False mitogen.context_id = context_id mitogen.parent_id = parent_id mitogen.core = sys.modules['__main__']