# Path: pypet/pypetlogging.py
# class HasLogger(HasSlots):
#     """Abstract super class that automatically adds a logger to a class.
# 
#     To add a logger to a sub-class of yours simply call ``myobj._set_logger(name)``.
#     If ``name=None`` the logger is chosen as follows:
# 
#         ``self._logger = logging.getLogger(self.__class.__.__module__ + '.' + self.__class__.__name__)``
# 
#     The logger can be accessed via ``myobj._logger``.
# 
#     """
# 
#     __slots__ = ('_logger',)
# 
#     def __getstate__(self):
#         """Called for pickling.
# 
#         Removes the logger to allow pickling and returns a copy of `__dict__`.
# 
#         """
#         state_dict = super(HasLogger, self).__getstate__()
#         if '_logger' in state_dict:
#             # Pickling does not work with loggers objects,
#             # so we just keep the logger's name:
#             state_dict['_logger'] = self._logger.name
#         return state_dict
# 
#     def __setstate__(self, statedict):
#         """Called after loading a pickle dump.
# 
#         Restores `__dict__` from `statedict` and adds a new logger.
# 
#         """
#         super(HasLogger, self).__setstate__(statedict)
#         if '_logger' in statedict:
#             # If we re-instantiate the component the
#             # logger attribute only contains a name,
#             # so we also need to re-create the logger:
#             self._set_logger(statedict['_logger'])
# 
#     def _set_logger(self, name=None):
#         """Adds a logger with a given `name`.
# 
#         If no name is given, name is constructed as
#         `type(self).__name__`.
# 
#         """
#         if name is None:
#             cls = self.__class__
#             name = '%s.%s' % (cls.__module__, cls.__name__)
#         self._logger = logging.getLogger(name)


from brian2 import Network, second
from pypet.pypetlogging import HasLogger

            # 4. Run the network
            self._logger.info('STARTING subrun `%s` (#%d) lasting %s.' %
                             (current_subrun.v_name, subrun_number, str(current_subrun.f_get())))
            network.run(duration=current_subrun.f_get(), report=self._report,
                              report_period=self._report_period)

            # 5. Call `analyse` of all analyser components
            for analyser in analyser_list:
                analyser.analyse(traj, network, current_subrun, subrun_list,
                                 network_dict)

            # 6. Call `remove` of the network runner itself
            self.remove_from_network(traj, network, current_subrun, subrun_list,
                                     network_dict)

            # 7. Call `remove` for all analyser components
            for analyser in analyser_list:
                analyser.remove_from_network(traj, network, current_subrun, subrun_list,
                                             network_dict)

            # 8. Call `remove` for all normal components
            for component in component_list:
                component.remove_from_network(traj, network, current_subrun, subrun_list,
                                              network_dict)


            subrun_number += 1



# Path: pypet/pypetlogging.py
# class HasLogger(HasSlots):
#     """Abstract super class that automatically adds a logger to a class.
# 
#     To add a logger to a sub-class of yours simply call ``myobj._set_logger(name)``.
#     If ``name=None`` the logger is chosen as follows:
# 
#         ``self._logger = logging.getLogger(self.__class.__.__module__ + '.' + self.__class__.__name__)``
# 
#     The logger can be accessed via ``myobj._logger``.
# 
#     """
# 
#     __slots__ = ('_logger',)
# 
#     def __getstate__(self):
#         """Called for pickling.
# 
#         Removes the logger to allow pickling and returns a copy of `__dict__`.
# 
#         """
#         state_dict = super(HasLogger, self).__getstate__()
#         if '_logger' in state_dict:
#             # Pickling does not work with loggers objects,
#             # so we just keep the logger's name:
#             state_dict['_logger'] = self._logger.name
#         return state_dict
# 
#     def __setstate__(self, statedict):
#         """Called after loading a pickle dump.
# 
#         Restores `__dict__` from `statedict` and adds a new logger.
# 
#         """
#         super(HasLogger, self).__setstate__(statedict)
#         if '_logger' in statedict:
#             # If we re-instantiate the component the
#             # logger attribute only contains a name,
#             # so we also need to re-create the logger:
#             self._set_logger(statedict['_logger'])
# 
#     def _set_logger(self, name=None):
#         """Adds a logger with a given `name`.
# 
#         If no name is given, name is constructed as
#         `type(self).__name__`.
# 
#         """
#         if name is None:
#             cls = self.__class__
#             name = '%s.%s' % (cls.__module__, cls.__name__)
#         self._logger = logging.getLogger(name)


# Path: pypet/brian2/network.py
from brian2 import Network, second
from pypet.pypetlogging import HasLogger


            # 4. Run the network
            self._logger.info('STARTING subrun `%s` (#%d) lasting %s.' %
                             (current_subrun.v_name, subrun_number, str(current_subrun.f_get())))
            network.run(duration=current_subrun.f_get(), report=self._report,
                              report_period=self._report_period)

            # 5. Call `analyse` of all analyser components
            for analyser in analyser_list:
                analyser.analyse(traj, network, current_subrun, subrun_list,
                                 network_dict)

            # 6. Call `remove` of the network runner itself
            self.remove_from_network(traj, network, current_subrun, subrun_list,
                                     network_dict)

            # 7. Call `remove` for all analyser components
            for analyser in analyser_list:
                analyser.remove_from_network(traj, network, current_subrun, subrun_list,
                                             network_dict)

            # 8. Call `remove` for all normal components
            for component in component_list:
                component.remove_from_network(traj, network, current_subrun, subrun_list,
                                              network_dict)


            subrun_number += 1



class NetworkManager(HasLogger):