Changes Demag GUI's current WD to new_WD if possible

        Parameters
        ----------
        new_WD : WD to change to current GUI's WD
436266
def change_WD(self, new_WD, meas_file=""):
        
        new_WD = os.path.abspath(new_WD)
        if not os.path.isdir(new_WD):
            return
        self.WD = new_WD
        if not meas_file:
            if self.data_model == None:
                if os.path.isfile(os.path.join(self.WD, "measurements.txt")) and os.path.isfile(os.path.join(self.WD, "magic_measurements.txt")):
                    ui_dialog = demag_dialogs.user_input(self, ['data_model'], parse_funcs=[
                                                         float], heading="More than one measurement file found in CWD with different data models please input prefered data model (2.5,3.0)", values=[3])
                    self.show_dlg(ui_dialog)
                    ui_data = ui_dialog.get_values()
                    self.data_model = ui_data[1]['data_model']
                elif os.path.isfile(os.path.join(self.WD, "measurements.txt")):
                    self.data_model = 3.0
                elif os.path.isfile(os.path.join(self.WD, "magic_measurements.txt")):
                    self.data_model = 2.5
                else:
                    self.user_warning(
                        "No measurement file found in chosen directory")
                    self.data_model = 3
            try:
                self.data_model = float(self.data_model)
                if int(self.data_model) == 3:
                    meas_file = os.path.join(self.WD, "measurements.txt")
                elif int(self.data_model) == 2:
                    meas_file = os.path.join(self.WD, "magic_measurements.txt")
                else:
                    meas_file = ''
                    self.data_model = 3
            except (ValueError, TypeError) as e:
                self.user_warning(
                    "Provided data model is unrecognized or invalid, assuming you want data model 3")
                self.data_model = 3

        if os.path.isfile(meas_file):
            self.magic_file = meas_file
        else:
            self.magic_file = self.choose_meas_file()

        if not self.data_model:
            self.data_model = 3
959578
def cwd(self, newdir):
        
        logger.debug('Sending FTP cwd command. New Workding Directory: {}'.format(newdir))
        self.client.cwd(newdir)
        self.state['current_dir'] = self.client.pwd()
509439
def new_dir(self, name):
        # type: (bytes) -> None
        '''
        
        '''
        if self._initialized:
            raise pycdlibexception.PyCdlibInternalError('Path Table Record already initialized')

        # Zero for the parent dir num is bogus, but that will get fixed later.
        self._new(name, 0)
512361
def change_directory(self, directory):
        
        self._process.write(('cd %s\n' % directory).encode())
        if sys.platform == 'win32':
            self._process.write((os.path.splitdrive(directory)[0] + '\r\n').encode())
            self.clear()
        else:
            self._process.write(b'\x0C')
650377
def new(options)
      if options.has_key? :directory
        dir = self[options.delete(:directory)]
        FileUtils.mkdir_p dir.path
      else
        file = self[options.delete(:file)]
        if (binary_content = options.delete(:with_binary_content) || options.delete(:with_binary_contents))
          file.binary_content = binary_content
        else
          file.content = (options.delete(:with_content) || options.delete(:with_contents) || '')
        end
      end

      raise "unexpected keys '#{options.keys.join(', ')}'" unless options.empty?

      dir || file
    end
681385
def change_directory(self, path, *args, **kwargs):
		
		client = self.dav_client()
		previous_path = self.session_path()
		try:
			if client.is_dir(self.session_path(path)) is False:
				raise ValueError('Unable to change current working directory to non-directory entry')
		except Exception:
			self.session_path(previous_path)
			raise
1370317
def rename(self, new, parents=False):
        
        if parents:
            os.renames(self.path, self._to_backend(new))
        else:
            os.rename(self.path, self._to_backend(new))
839754
def rename(self, dn: str, new_rdn: str, new_base_dn: Optional[str] = None) -> None:
        

        _debug("rename", self, dn, new_rdn, new_base_dn)

        # split up the parameters
        split_dn = tldap.dn.str2dn(dn)
        split_newrdn = tldap.dn.str2dn(new_rdn)
        assert(len(split_newrdn) == 1)

        # make dn unqualified
        rdn = tldap.dn.dn2str(split_dn[0:1])

        # make newrdn fully qualified dn
        tmplist = [split_newrdn[0]]
        if new_base_dn is not None:
            tmplist.extend(tldap.dn.str2dn(new_base_dn))
            old_base_dn = tldap.dn.dn2str(split_dn[1:])
        else:
            tmplist.extend(split_dn[1:])
            old_base_dn = None
        newdn = tldap.dn.dn2str(tmplist)

        _debug("--> commit  ", self, dn, new_rdn, new_base_dn)
        _debug("--> rollback", self, newdn, rdn, old_base_dn)

        # on commit carry out action; on rollback reverse rename
        def on_commit(obj):
            obj.modify_dn(dn, new_rdn, new_superior=new_base_dn)

        def on_rollback(obj):
            obj.modify_dn(newdn, rdn, new_superior=old_base_dn)

        return self._process(on_commit, on_rollback)
26880
def change_existence(self, is_hidden):
        # type: (bool) -> None
        '''
        
        '''
        if not self._initialized:
            raise pycdlibexception.PyCdlibInternalError('Directory Record not yet initialized')

        if is_hidden:
            self.file_flags |= (1 << self.FILE_FLAG_EXISTENCE_BIT)
        else:
            self.file_flags &= ~(1 << self.FILE_FLAG_EXISTENCE_BIT)
410268
def update(self, old, backup_path=None):
        
        for category in old.params.keys():
            for parameter in old.params[category].keys():
                if (category in self.params and parameter in self.params[category] and
                        (old.params[category][parameter] != self.params[category][parameter]) and
                        (category != "version")):
                    print ("Config value '%s.%s' "
                           "in old configuration is different "
                           "from the new version\n"
                           "[old value] = %s\n"
                           "[new value] = %s"
                           "" % (category, parameter,
                                 old.params[category][parameter],
                                 self.params[category][parameter]))
                    answer = raw_input("Do you want to overwrite? ([y]/n) ")
                    while answer.lower() not in ['y', 'yes', 'n', 'no']:
                        answer = raw_input("Answer not recongnized. Enter 'y' or 'n'. ")

                    if answer in ['n', 'no']:
                        old_value = old.params[category][parameter]
                        self.params[category][parameter] = old_value
                elif not (category in self.params and
                          parameter in self.params[category]):
                    print ("Deprecated config option '%s.%s' has "
                           "been removed." % (category, parameter))
        if backup_path is not None:
            old.write_out_config(backup_path)
            print "Backup saved in %s." % backup_path
949905
def renames(self, new):
        
        os.renames(self, new)
        return self._next_class(new)
634159
def new(self):
        # type: () -> None
        '''
        
        '''
        if self._initialized:
            raise pycdlibexception.PyCdlibInternalError('UDF Implementation Use Volume Descriptor already initialized')

        self.desc_tag = UDFTag()
        self.desc_tag.new(4)  # FIXME: we should let the user set serial_number

        self.vol_desc_seqnum = 1

        self.impl_ident = UDFEntityID()
        self.impl_ident.new(0, b'*UDF LV Info', b'\x02\x01')

        self.impl_use = UDFImplementationUseVolumeDescriptorImplementationUse()
        self.impl_use.new()

        self._initialized = True
48415
def copy(self, new_path, replace=False):
        
        new_full_path = os.path.join(self.static_path, new_path)
        if replace or not os.path.exists(new_full_path):
            shutil.copy2(self.full_path, new_full_path)
            return True
        return False
186759
def copy_file(old, new):
    
    oldp = old.get_fullpath()
    newp = new.get_fullpath()
    log.info("Copying %s to %s", oldp, newp)
    new.create_directory()
    shutil.copy(oldp, newp)
1157348
def _reset(self, **kwargs):
        

        # there are some inconsistenciens in the API regarding these
        # note: this could be written in fancier ways, but this way is simpler

        if 'uuid' in kwargs:
            self.uuid = kwargs['uuid']
        elif 'storage' in kwargs:  # let's never use storage.storage internally
            self.uuid = kwargs['storage']

        if 'title' in kwargs:
            self.title = kwargs['title']
        elif 'storage_title' in kwargs:
            self.title = kwargs['storage_title']

        if 'size' in kwargs:
            self.size = kwargs['size']
        elif 'storage_size' in kwargs:
            self.size = kwargs['storage_size']

        # send the rest to super._reset

        filtered_kwargs = dict(
            (key, val)
            for key, val in kwargs.items()
            if key not in ['uuid', 'storage', 'title', 'storage_title', 'size', 'storage_size']
        )
        super(Storage, self)._reset(**filtered_kwargs)
1307775
def cwd(self, new_path):
        ''''''
        old_cwd = self._cwd
        self._cwd = new_path
        return old_cwd
1186249
def new(self):
        # type: () -> None
        '''
        
        '''
        if self._initialized:
            raise pycdlibexception.PyCdlibInternalError('UDF Logical Volume Implementation Use already initialized')

        self.impl_id = UDFEntityID()
        self.impl_id.new(0, b'*pycdlib')

        self.num_files = 0
        self.num_dirs = 1
        self.min_udf_read_revision = 258
        self.min_udf_write_revision = 258
        self.max_udf_write_revision = 258

        self.impl_use = b'\x00' * 378  # FIXME: let the user set this

        self._initialized = True