Python tempfile.tempdir() Examples

The following are 30 code examples for showing how to use tempfile.tempdir(). These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example.

You may want to check out the right sidebar which shows the related API usage.

You may also want to check out all available functions/classes of the module tempfile , or try the search function .

Example 1
Project: me-ica   Author: ME-ICA   File: test_image_repositoy.py    License: GNU Lesser General Public License v2.1 6 votes vote down vote up
def test_module_scope_is_updated_on_patch(expected_attrs):
  '''
  Patch should update the module's globals() on success
  '''
  from gooey.gui import image_repository
  testing_icons = ('config_icon.png', 'success_icon.png')
  try:
    # setup
    make_user_files(*testing_icons)
    old_icon = image_repository.config_icon
    # load up our new icon(s)
    image_repository.patch_images(tempfile.tempdir)
    new_icon = image_repository.config_icon
    assert old_icon != new_icon
  finally:
    cleanup_temp(*testing_icons)


# helpers 
Example 2
Project: yatsm   Author: ceholden   File: test_cache.py    License: MIT License 6 votes vote down vote up
def test_test_cache(mkdir_permissions):
    # Test when cache dir exists already
    path = mkdir_permissions(read=False, write=False)
    assert (False, False) == cache.test_cache(dict(cache_line_dir=path))

    path = mkdir_permissions(read=False, write=True)
    assert (False, True) == cache.test_cache(dict(cache_line_dir=path))

    path = mkdir_permissions(read=True, write=False)
    assert (True, False) == cache.test_cache(dict(cache_line_dir=path))

    path = mkdir_permissions(read=True, write=True)
    assert (True, True) == cache.test_cache(dict(cache_line_dir=path))

    # Test when cache dir doesn't exist
    tmp = os.path.join(tempfile.tempdir,
                       next(tempfile._get_candidate_names()) + '_yatsm')
    read_write = cache.test_cache(dict(cache_line_dir=tmp))
    os.removedirs(tmp)

    assert (True, True) == read_write 
Example 3
Project: ironpython2   Author: IronLanguages   File: test_tempfile.py    License: Apache License 2.0 6 votes vote down vote up
def test_exports(self):
        # There are no surprising symbols in the tempfile module
        dict = tempfile.__dict__

        expected = {
            "NamedTemporaryFile" : 1,
            "TemporaryFile" : 1,
            "mkstemp" : 1,
            "mkdtemp" : 1,
            "mktemp" : 1,
            "TMP_MAX" : 1,
            "gettempprefix" : 1,
            "gettempdir" : 1,
            "tempdir" : 1,
            "template" : 1,
            "SpooledTemporaryFile" : 1
        }

        unexp = []
        for key in dict:
            if key[0] != '_' and key not in expected:
                unexp.append(key)
        self.assertTrue(len(unexp) == 0,
                        "unexpected keys: %s" % unexp) 
Example 4
Project: pulsar   Author: galaxyproject   File: core.py    License: Apache License 2.0 6 votes vote down vote up
def __setup_object_store(self, conf):
        if "object_store_config_file" not in conf and "object_store_config" not in conf:
            self.object_store = None
            return

        config_obj_kwds = dict(
            file_path=conf.get("object_store_file_path", None),
            object_store_check_old_style=False,
            job_working_directory=conf.get("object_store_job_working_directory", None),
            new_file_path=conf.get("object_store_new_file_path", tempdir),
            umask=int(conf.get("object_store_umask", "0000")),
            jobs_directory=None,
        )
        config_dict = None
        if conf.get("object_store_config_file"):
            config_obj_kwds["object_store_config_file"] = conf['object_store_config_file']
        else:
            config_dict = conf["object_store_config"]

        object_store_config = Bunch(**config_obj_kwds)
        self.object_store = build_object_store_from_config(object_store_config, config_dict=config_dict) 
Example 5
Project: pylink   Author: square   File: jlock.py    License: Apache License 2.0 6 votes vote down vote up
def __init__(self, serial_no):
        """Creates an instance of a ``JLock`` and populates the name.

        Note:
          This method may fail if there is no temporary directory in which to
          have the lockfile placed.

        Args:
          self (JLock): the ``JLock`` instance
          serial_no (int): the serial number of the J-Link

        Returns:
          ``None``
        """
        self.name = self.SERIAL_NAME_FMT.format(serial_no)
        self.acquired = False
        self.fd = None
        self.path = None
        self.path = os.path.join(tempfile.tempdir, self.name) 
Example 6
Project: ironpython3   Author: IronLanguages   File: test_tempfile.py    License: Apache License 2.0 6 votes vote down vote up
def test_exports(self):
        # There are no surprising symbols in the tempfile module
        dict = tempfile.__dict__

        expected = {
            "NamedTemporaryFile" : 1,
            "TemporaryFile" : 1,
            "mkstemp" : 1,
            "mkdtemp" : 1,
            "mktemp" : 1,
            "TMP_MAX" : 1,
            "gettempprefix" : 1,
            "gettempdir" : 1,
            "tempdir" : 1,
            "template" : 1,
            "SpooledTemporaryFile" : 1,
            "TemporaryDirectory" : 1,
        }

        unexp = []
        for key in dict:
            if key[0] != '_' and key not in expected:
                unexp.append(key)
        self.assertTrue(len(unexp) == 0,
                        "unexpected keys: %s" % unexp) 
Example 7
Project: calmjs   Author: calmjs   File: test_testing.py    License: GNU General Public License v2.0 5 votes vote down vote up
def setUp(self):
        self.tmpdir = realpath(tempfile.mkdtemp())
        tempfile.tempdir = self.tmpdir 
Example 8
Project: calmjs   Author: calmjs   File: test_testing.py    License: GNU General Public License v2.0 5 votes vote down vote up
def tearDown(self):
        # This is safe - the module will just call gettempdir() again
        tempfile.tempdir = None
        rmtree(self.tmpdir) 
Example 9
Project: misp42splunk   Author: remg427   File: search_command.py    License: GNU Lesser General Public License v3.0 5 votes vote down vote up
def _prepare_protocol_v1(self, argv, ifile, ofile):

        debug = environment.splunklib_logger.debug

        # Provide as much context as possible in advance of parsing the command line and preparing for execution

        self._input_header.read(ifile)
        self._protocol_version = 1
        self._map_metadata(argv)

        debug('  metadata=%r, input_header=%r', self._metadata, self._input_header)

        try:
            tempfile.tempdir = self._metadata.searchinfo.dispatch_dir
        except AttributeError:
            raise RuntimeError('{}.metadata.searchinfo.dispatch_dir is undefined'.format(self.__class__.__name__))

        debug('  tempfile.tempdir=%r', tempfile.tempdir)

        CommandLineParser.parse(self, argv[2:])
        self.prepare()

        if self.record:
            self.record = False

            record_argv = [argv[0], argv[1], str(self._options), ' '.join(self.fieldnames)]
            ifile, ofile = self._prepare_recording(record_argv, ifile, ofile)
            self._record_writer.ofile = ofile
            ifile.record(str(self._input_header), '\n\n')

        if self.show_configuration:
            self.write_info(self.name + ' command configuration: ' + str(self._configuration))

        return ifile  # wrapped, if self.record is True 
Example 10
Project: misp42splunk   Author: remg427   File: search_command.py    License: GNU Lesser General Public License v3.0 5 votes vote down vote up
def _prepare_protocol_v1(self, argv, ifile, ofile):

        debug = environment.splunklib_logger.debug

        # Provide as much context as possible in advance of parsing the command line and preparing for execution

        self._input_header.read(ifile)
        self._protocol_version = 1
        self._map_metadata(argv)

        debug('  metadata=%r, input_header=%r', self._metadata, self._input_header)

        try:
            tempfile.tempdir = self._metadata.searchinfo.dispatch_dir
        except AttributeError:
            raise RuntimeError('{}.metadata.searchinfo.dispatch_dir is undefined'.format(self.__class__.__name__))

        debug('  tempfile.tempdir=%r', tempfile.tempdir)

        CommandLineParser.parse(self, argv[2:])
        self.prepare()

        if self.record:
            self.record = False

            record_argv = [argv[0], argv[1], str(self._options), ' '.join(self.fieldnames)]
            ifile, ofile = self._prepare_recording(record_argv, ifile, ofile)
            self._record_writer.ofile = ofile
            ifile.record(str(self._input_header), '\n\n')

        if self.show_configuration:
            self.write_info(self.name + ' command configuration: ' + str(self._configuration))

        return ifile  # wrapped, if self.record is True 
Example 11
Project: misp42splunk   Author: remg427   File: search_command.py    License: GNU Lesser General Public License v3.0 5 votes vote down vote up
def _prepare_protocol_v1(self, argv, ifile, ofile):

        debug = environment.splunklib_logger.debug

        # Provide as much context as possible in advance of parsing the command line and preparing for execution

        self._input_header.read(ifile)
        self._protocol_version = 1
        self._map_metadata(argv)

        debug('  metadata=%r, input_header=%r', self._metadata, self._input_header)

        try:
            tempfile.tempdir = self._metadata.searchinfo.dispatch_dir
        except AttributeError:
            raise RuntimeError('{}.metadata.searchinfo.dispatch_dir is undefined'.format(self.__class__.__name__))

        debug('  tempfile.tempdir=%r', tempfile.tempdir)

        CommandLineParser.parse(self, argv[2:])
        self.prepare()

        if self.record:
            self.record = False

            record_argv = [argv[0], argv[1], str(self._options), ' '.join(self.fieldnames)]
            ifile, ofile = self._prepare_recording(record_argv, ifile, ofile)
            self._record_writer.ofile = ofile
            ifile.record(str(self._input_header), '\n\n')

        if self.show_configuration:
            self.write_info(self.name + ' command configuration: ' + str(self._configuration))

        return ifile  # wrapped, if self.record is True 
Example 12
Project: misp42splunk   Author: remg427   File: search_command.py    License: GNU Lesser General Public License v3.0 5 votes vote down vote up
def _prepare_protocol_v1(self, argv, ifile, ofile):

        debug = environment.splunklib_logger.debug

        # Provide as much context as possible in advance of parsing the command line and preparing for execution

        self._input_header.read(ifile)
        self._protocol_version = 1
        self._map_metadata(argv)

        debug('  metadata=%r, input_header=%r', self._metadata, self._input_header)

        try:
            tempfile.tempdir = self._metadata.searchinfo.dispatch_dir
        except AttributeError:
            raise RuntimeError('{}.metadata.searchinfo.dispatch_dir is undefined'.format(self.__class__.__name__))

        debug('  tempfile.tempdir=%r', tempfile.tempdir)

        CommandLineParser.parse(self, argv[2:])
        self.prepare()

        if self.record:
            self.record = False

            record_argv = [argv[0], argv[1], str(self._options), ' '.join(self.fieldnames)]
            ifile, ofile = self._prepare_recording(record_argv, ifile, ofile)
            self._record_writer.ofile = ofile
            ifile.record(str(self._input_header), '\n\n')

        if self.show_configuration:
            self.write_info(self.name + ' command configuration: ' + str(self._configuration))

        return ifile  # wrapped, if self.record is True 
Example 13
Project: misp42splunk   Author: remg427   File: search_command.py    License: GNU Lesser General Public License v3.0 5 votes vote down vote up
def _prepare_protocol_v1(self, argv, ifile, ofile):

        debug = environment.splunklib_logger.debug

        # Provide as much context as possible in advance of parsing the command line and preparing for execution

        self._input_header.read(ifile)
        self._protocol_version = 1
        self._map_metadata(argv)

        debug('  metadata=%r, input_header=%r', self._metadata, self._input_header)

        try:
            tempfile.tempdir = self._metadata.searchinfo.dispatch_dir
        except AttributeError:
            raise RuntimeError('{}.metadata.searchinfo.dispatch_dir is undefined'.format(self.__class__.__name__))

        debug('  tempfile.tempdir=%r', tempfile.tempdir)

        CommandLineParser.parse(self, argv[2:])
        self.prepare()

        if self.record:
            self.record = False

            record_argv = [argv[0], argv[1], str(self._options), ' '.join(self.fieldnames)]
            ifile, ofile = self._prepare_recording(record_argv, ifile, ofile)
            self._record_writer.ofile = ofile
            ifile.record(str(self._input_header), '\n\n')

        if self.show_configuration:
            self.write_info(self.name + ' command configuration: ' + str(self._configuration))

        return ifile  # wrapped, if self.record is True 
Example 14
Project: qgis-cartodb   Author: gkudos   File: Utils.py    License: GNU General Public License v2.0 5 votes vote down vote up
def zipLayer(layer):
    """Compress layer to zip file"""
    file_path = layer.dataProvider().dataSourceUri()
    if file_path.find('|') != -1:
        file_path = file_path[0:file_path.find('|')]

    if file_path.startswith('/vsizip/'):
        file_path = file_path.replace('/vsizip/', '')
        if layer.storageType() in ['ESRI Shapefile', 'GPX', 'GeoJSON', 'LIBKML']:
            return file_path
    _file = QFile(file_path)
    file_info = QFileInfo(_file)

    dirname = file_info.dir().absolutePath()
    filename = stripAccents(file_info.completeBaseName())
    layername = stripAccents(layer.name())

    tempdir = checkTempDir()

    zip_path = os.path.join(tempdir, layername + '.zip')
    zip_file = zipfile.ZipFile(zip_path, 'w')


    if layer.storageType() == 'ESRI Shapefile':
        for suffix in ['.shp', '.dbf', '.prj', '.shx']:
            if os.path.exists(os.path.join(dirname, filename + suffix)):
                zip_file.write(os.path.join(dirname, filename + suffix), layername + suffix, zipfile.ZIP_DEFLATED)
    elif layer.storageType() == 'GeoJSON':
        zip_file.write(file_path, layername + '.geojson', zipfile.ZIP_DEFLATED)
    elif layer.storageType() == 'GPX':
        zip_file.write(file_path, layername + '.gpx', zipfile.ZIP_DEFLATED)
    elif layer.storageType() == 'LIBKML':
        zip_file.write(file_path, layername + '.kml', zipfile.ZIP_DEFLATED)
    else:
        geo_json_name = os.path.join(tempfile.tempdir, layername)
        error = QgsVectorFileWriter.writeAsVectorFormat(layer, geo_json_name, "utf-8", None, "GeoJSON")
        if error == QgsVectorFileWriter.NoError:
            zip_file.write(geo_json_name + '.geojson', layername + '.geojson', zipfile.ZIP_DEFLATED)
    zip_file.close()
    return zip_path 
Example 15
Project: qgis-cartodb   Author: gkudos   File: Utils.py    License: GNU General Public License v2.0 5 votes vote down vote up
def checkTempDir():
    """Check temporar dir"""
    tempdir = tempfile.tempdir
    if tempdir is None:
        tempdir = tempfile.mkdtemp()
    return tempdir 
Example 16
Project: qgis-cartodb   Author: gkudos   File: cartodbapi.py    License: GNU General Public License v2.0 5 votes vote down vote up
def download(self, sql):
        apiUrl = 'http://{}.{}/api/v2/sql?api_key={}&format=spatialite&q={}'.format(self.cartodbUser, self.hostname, self.apiKey, sql)
        url = QUrl(apiUrl)
        request = self._getRequest(url)

        def finished(reply):
            tempdir = tempfile.tempdir
            if tempdir is None:
                tempdir = tempfile.mkdtemp()

            tf = tempfile.NamedTemporaryFile(delete=False)
            sqlite = QFile(tf.name)
            tf.close()
            if(sqlite.open(QIODevice.WriteOnly)):
                sqlite.write(reply.readAll())
                sqlite.close()
                self.fetchContent.emit(tf.name)
            else:
                self.error.emit('Error saving downloaded file')

        manager = QNetworkAccessManager()
        manager.finished.connect(finished)

        reply = manager.get(request)
        loop = QEventLoop()
        reply.downloadProgress.connect(self.progressCB)
        reply.error.connect(self._error)
        reply.finished.connect(loop.exit)
        loop.exec_() 
Example 17
Project: jbox   Author: jpush   File: sandbox.py    License: MIT License 5 votes vote down vote up
def override_temp(replacement):
    """
    Monkey-patch tempfile.tempdir with replacement, ensuring it exists
    """
    if not os.path.isdir(replacement):
        os.makedirs(replacement)

    saved = tempfile.tempdir

    tempfile.tempdir = replacement

    try:
        yield
    finally:
        tempfile.tempdir = saved 
Example 18
Project: SplunkForPCAP   Author: DanielSchwartz1   File: search_command.py    License: MIT License 5 votes vote down vote up
def _prepare_protocol_v1(self, argv, ifile, ofile):

        debug = environment.splunklib_logger.debug

        # Provide as much context as possible in advance of parsing the command line and preparing for execution

        self._input_header.read(ifile)
        self._protocol_version = 1
        self._map_metadata(argv)

        debug('  metadata=%r, input_header=%r', self._metadata, self._input_header)

        try:
            tempfile.tempdir = self._metadata.searchinfo.dispatch_dir
        except AttributeError:
            raise RuntimeError('{}.metadata.searchinfo.dispatch_dir is undefined'.format(self.__class__.__name__))

        debug('  tempfile.tempdir=%r', tempfile.tempdir)

        CommandLineParser.parse(self, argv[2:])
        self.prepare()

        if self.record:
            self.record = False

            record_argv = [argv[0], argv[1], str(self._options), ' '.join(self.fieldnames)]
            ifile, ofile = self._prepare_recording(record_argv, ifile, ofile)
            self._record_writer.ofile = ofile
            ifile.record(str(self._input_header), '\n\n')

        if self.show_configuration:
            self.write_info(self.name + ' command configuration: ' + str(self._configuration))

        return ifile  # wrapped, if self.record is True 
Example 19
Project: pyquarkchain   Author: QuarkChain   File: bootnode_health_check.py    License: MIT License 5 votes vote down vote up
def main():
    if "EMAIL_FROM_ADDRESS" not in os.environ:
        raise ValueError("EMAIL_FROM_ADDRESS not found in environment variables")
    if "PASSWORD" not in os.environ:
        raise ValueError("PASSWORD not found in environment variables")
    if "EMAIL_TO_ADDRESS" not in os.environ:
        raise ValueError("EMAIL_TO_ADDRESS not found in environment variables")

    os.chdir(os.path.dirname("../../quarkchain/cluster/"))
    parser = argparse.ArgumentParser()
    ClusterConfig.attach_arguments(parser)
    args = parser.parse_args()
    config = ClusterConfig.create_from_args(args)

    # creat a config tempfile for health check, which is a copy of the original config file
    tempfile.tempdir = "../../mainnet/singularity/"
    fd, config.json_filepath = tempfile.mkstemp()
    with os.fdopen(fd, "w") as tmp:
        tmp.write(config.to_json())
    print("Cluster config file: {}".format(config.json_filepath))
    print(config.to_json())

    cluster = HealthCheckCluster(config)
    bootstrap_nodes = config.P2P.BOOT_NODES.split(",")
    count = 0

    while True:
        bash_command_revised_config = (
            "QKC_CONFIG="
            + config.json_filepath
            + " python3 ../../quarkchain/tools/config_p2p.py --bootnodes "
            + bootstrap_nodes[count]
        )
        os.system(bash_command_revised_config)
        print("Start Bootstrap With " + bootstrap_nodes[count])
        cluster.start_and_loop()
        time.sleep(100)
        count = (count + 1) % len(bootstrap_nodes) 
Example 20
Project: python-netsurv   Author: sofia-netsurv   File: sandbox.py    License: MIT License 5 votes vote down vote up
def override_temp(replacement):
    """
    Monkey-patch tempfile.tempdir with replacement, ensuring it exists
    """
    if not os.path.isdir(replacement):
        os.makedirs(replacement)

    saved = tempfile.tempdir

    tempfile.tempdir = replacement

    try:
        yield
    finally:
        tempfile.tempdir = saved 
Example 21
Project: python-netsurv   Author: sofia-netsurv   File: sandbox.py    License: MIT License 5 votes vote down vote up
def override_temp(replacement):
    """
    Monkey-patch tempfile.tempdir with replacement, ensuring it exists
    """
    if not os.path.isdir(replacement):
        os.makedirs(replacement)

    saved = tempfile.tempdir

    tempfile.tempdir = replacement

    try:
        yield
    finally:
        tempfile.tempdir = saved 
Example 22
Project: lambda-packs   Author: ryfeus   File: sandbox.py    License: MIT License 5 votes vote down vote up
def override_temp(replacement):
    """
    Monkey-patch tempfile.tempdir with replacement, ensuring it exists
    """
    pkg_resources.py31compat.makedirs(replacement, exist_ok=True)

    saved = tempfile.tempdir

    tempfile.tempdir = replacement

    try:
        yield
    finally:
        tempfile.tempdir = saved 
Example 23
Project: ironpython2   Author: IronLanguages   File: test_tempfile.py    License: Apache License 2.0 5 votes vote down vote up
def _inside_empty_temp_dir():
    dir = tempfile.mkdtemp()
    try:
        with support.swap_attr(tempfile, 'tempdir', dir):
            yield
    finally:
        support.rmtree(dir) 
Example 24
Project: ironpython2   Author: IronLanguages   File: test_tempfile.py    License: Apache License 2.0 5 votes vote down vote up
def test_read_only_directory(self):
        with _inside_empty_temp_dir():
            oldmode = mode = os.stat(tempfile.tempdir).st_mode
            mode &= ~(stat.S_IWUSR | stat.S_IWGRP | stat.S_IWOTH)
            os.chmod(tempfile.tempdir, mode)
            try:
                if os.access(tempfile.tempdir, os.W_OK):
                    self.skipTest("can't set the directory read-only")
                with self.assertRaises(OSError) as cm:
                    self.make_temp()
                self.assertIn(cm.exception.errno, (errno.EPERM, errno.EACCES))
                self.assertEqual(os.listdir(tempfile.tempdir), [])
            finally:
                os.chmod(tempfile.tempdir, oldmode) 
Example 25
Project: ironpython2   Author: IronLanguages   File: test_tempfile.py    License: Apache License 2.0 5 votes vote down vote up
def test_nonexisting_directory(self):
        with _inside_empty_temp_dir():
            tempdir = os.path.join(tempfile.tempdir, 'nonexistent')
            with support.swap_attr(tempfile, 'tempdir', tempdir):
                with self.assertRaises(OSError) as cm:
                    self.make_temp()
                self.assertEqual(cm.exception.errno, errno.ENOENT) 
Example 26
Project: ironpython2   Author: IronLanguages   File: test_tempfile.py    License: Apache License 2.0 5 votes vote down vote up
def test_non_directory(self):
        with _inside_empty_temp_dir():
            tempdir = os.path.join(tempfile.tempdir, 'file')
            open(tempdir, 'wb').close()
            with support.swap_attr(tempfile, 'tempdir', tempdir):
                with self.assertRaises(OSError) as cm:
                    self.make_temp()
                self.assertIn(cm.exception.errno, (errno.ENOTDIR, errno.ENOENT)) 
Example 27
Project: lambda-chef-node-cleanup   Author: awslabs   File: sandbox.py    License: Apache License 2.0 5 votes vote down vote up
def override_temp(replacement):
    """
    Monkey-patch tempfile.tempdir with replacement, ensuring it exists
    """
    if not os.path.isdir(replacement):
        os.makedirs(replacement)

    saved = tempfile.tempdir

    tempfile.tempdir = replacement

    try:
        yield
    finally:
        tempfile.tempdir = saved 
Example 28
Project: search-MjoLniR   Author: wikimedia   File: utils.py    License: MIT License 5 votes vote down vote up
def temp_dir():
    # Should we instead set tempfile.tempdir ? How to reliably do that for
    # all executions? Need to investigate how that works with pyspark workers.
    if 'LOCAL_DIRS' in os.environ:
        dirs = os.environ['LOCAL_DIRS'].split(',')
        return random.choice(dirs)
    return None 
Example 29
Project: kobo-predict   Author: awemulya   File: sandbox.py    License: BSD 2-Clause "Simplified" License 5 votes vote down vote up
def override_temp(replacement):
    """
    Monkey-patch tempfile.tempdir with replacement, ensuring it exists
    """
    if not os.path.isdir(replacement):
        os.makedirs(replacement)

    saved = tempfile.tempdir

    tempfile.tempdir = replacement

    try:
        yield
    finally:
        tempfile.tempdir = saved 
Example 30
Project: DCRM   Author: 82Flex   File: debian_package.py    License: GNU Affero General Public License v3.0 5 votes vote down vote up
def __init__(self, path):
        tempfile.tempdir = settings.TEMP_ROOT
        self.path = path
        self.control = {}
        self.__version = ""
        self.__size = os.path.getsize(path)
        self.__name_control = ""
        self.__offset_control = 0
        self.__length_control = 0
        self.__name_data = ""
        self.__offset_data = 0
        self.__length_data = 0
        self.__load()