move to a given position in the file
328691
def slew(self, value):
        ''''''
        if float(value) != self.filepos:
            pos = float(value) * self.filesize
            self.mlog.f.seek(int(pos))
            self.find_message()
1266008
def seek( self, offset, whence=0 ):
        
        # Determine absolute target position
        if whence == 0:
            target_pos = offset
        elif whence == 1:
            target_pos = self.file_pos + offset
        elif whence == 2:
            target_pos = self.size - offset
        else:
            raise Exception( "Invalid `whence` argument: %r", whence )
        # Check if this is a noop
        if target_pos == self.file_pos:
            return    
        # Verify it is valid
        assert 0 <= target_pos < self.size, "Attempt to seek outside file"
        # Move the position
        self.file_pos = target_pos
        # Mark as dirty, the next time a read is done we need to actually
        # move the position in the bzip2 file
        self.dirty = True
1326999
public void moveThisFile(File fileSource, File fileDestDir, String strDestName)
    {
        try   {
            fileDestDir.mkdirs();
            FileInputStream fileIn = new FileInputStream(fileSource);
            InputStreamReader inStream = new InputStreamReader(fileIn);
            StreamSource source = new StreamSource(inStream);
        
            System.out.println(fileDestDir + " " + strDestName);
            File fileDest = new File(fileDestDir, strDestName);
            fileDest.createNewFile();
            FileOutputStream fileOut = new FileOutputStream(fileDest);
            PrintWriter dataOut = new PrintWriter(fileOut);
            StreamResult dest = new StreamResult(dataOut);
        
            m_transformer.transform(source, dest);
            
            dataOut.close();
            fileOut.close();
        
            inStream.close();
            fileIn.close();
        } catch (TransformerException ex)  {
            ex.printStackTrace();
        } catch (FileNotFoundException ex)  {
            ex.printStackTrace();
        } catch (IOException ex)    {
            ex.printStackTrace();
        }
    }
16268
private static void moveFile(final File fromFile, final File toFile) throws UpdateException {
        try {
            // Create parent directory structure if necessary
            FileUtils.mkParentDirs(toFile);
            Files.move(fromFile.toPath(), toFile.toPath(),
                    StandardCopyOption.REPLACE_EXISTING);
        } catch (IOException ioe) {
            throw new UpdateException("Unable to move temporary file to destination file: " +
                    fromFile + " -> " + toFile + ": " + ioe.toString());
        }
    }
1007599
def move(self, move):
        
        move = as_vec4(move, default=(0, 0, 0, 0))
        self.translate = self.translate + move
1358672
public final static void move(File fromFile, File toFile)
            throws IOException {
        // try the simple way first.
        if (fromFile.renameTo(toFile)) {
            return;
        }

        // copy to the temp file, then rename to the desired name.
        checkThatFileDoesntExist(toFile);
        File tempFile = createTempFile(toFile);
        checkThatFileDoesntExist(tempFile);
        copy(fromFile, tempFile);
        tempFile.renameTo(toFile);
        // delete the old one
        if (!fromFile.delete()) {
            throw new IOException("Failed to delete '" + fromFile.getParent()
                    + "'");
        }
    }
420281
def __move_line_or_selection(self, after_current_line=True):
        """"""
        cursor = self.textCursor()
        cursor.beginEditBlock()
        start_pos, end_pos = self.__save_selection()
        last_line = False

        # ------ Select text

        # Get selection start location
        cursor.setPosition(start_pos)
        cursor.movePosition(QTextCursor.StartOfBlock)
        start_pos = cursor.position()

        # Get selection end location
        cursor.setPosition(end_pos)
        if not cursor.atBlockStart() or end_pos == start_pos:
            cursor.movePosition(QTextCursor.EndOfBlock)
            cursor.movePosition(QTextCursor.NextBlock)
        end_pos = cursor.position()

        # Check if selection ends on the last line of the document
        if cursor.atEnd():
            if not cursor.atBlockStart() or end_pos == start_pos:
                last_line = True

        # ------ Stop if at document boundary

        cursor.setPosition(start_pos)
        if cursor.atStart() and not after_current_line:
            # Stop if selection is already at top of the file while moving up
            cursor.endEditBlock()
            self.setTextCursor(cursor)
            self.__restore_selection(start_pos, end_pos)
            return

        cursor.setPosition(end_pos, QTextCursor.KeepAnchor)
        if last_line and after_current_line:
            # Stop if selection is already at end of the file while moving down
            cursor.endEditBlock()
            self.setTextCursor(cursor)
            self.__restore_selection(start_pos, end_pos)
            return

        # ------ Move text

        sel_text = to_text_string(cursor.selectedText())
        cursor.removeSelectedText()


        if after_current_line:
            # Shift selection down
            text = to_text_string(cursor.block().text())
            sel_text = os.linesep + sel_text[0:-1]  # Move linesep at the start
            cursor.movePosition(QTextCursor.EndOfBlock)
            start_pos += len(text)+1
            end_pos += len(text)
            if not cursor.atEnd():
                end_pos += 1
        else:
            # Shift selection up
            if last_line:
                # Remove the last linesep and add it to the selected text
                cursor.deletePreviousChar()
                sel_text = sel_text + os.linesep
                cursor.movePosition(QTextCursor.StartOfBlock)
                end_pos += 1
            else:
                cursor.movePosition(QTextCursor.PreviousBlock)
            text = to_text_string(cursor.block().text())
            start_pos -= len(text)+1
            end_pos -= len(text)+1

        cursor.insertText(sel_text)

        cursor.endEditBlock()
        self.setTextCursor(cursor)
        self.__restore_selection(start_pos, end_pos)
1308288
def move_up(lines=1, file=sys.stdout):
    
    move.up(lines).write(file=file)
443295
def append_position(path, position, separator=''):
    
    filename, extension = os.path.splitext(path)
    return ''.join([filename, separator, str(position), extension])
597480
def move(self, dst, **kwargs):
        """"""
        _fs, filename = opener.parse(self.uri)
        _fs_dst, filename_dst = opener.parse(dst)
        movefile(_fs, filename, _fs_dst, filename_dst, **kwargs)
        self.uri = dst
652361
def write_position(fp, position, value, fmt='I'):
    
    current_position = fp.tell()
    fp.seek(position)
    written = write_bytes(fp, struct.pack(str('>' + fmt), value))
    fp.seek(current_position)
    return written
1179264
def move_down(lines=1, file=sys.stdout):
    
    move.down(lines).write(file=file)
312840
def __move(self, current_pos):
        '''
        
        '''
        if self.__move_range is not None:
            next_pos = np.random.randint(current_pos - self.__move_range, current_pos + self.__move_range)
            if next_pos < 0:
                next_pos = 0
            elif next_pos >= self.var_arr.shape[0] - 1:
                next_pos = self.var_arr.shape[0] - 1
            return next_pos
        else:
            next_pos = np.random.randint(self.var_arr.shape[0] - 1)
            return next_pos
894158
public void moveThisFile(LineNumberReader reader, File fileDestDir, String strDestName)
    {
        try {
            File fileDest = new File(fileDestDir, strDestName);
            fileDest.createNewFile();
            FileOutputStream fileOut = new FileOutputStream(fileDest);
            m_writer = new PrintWriter(fileOut);
        
            this.moveSourceToDest(reader, m_writer);
                    
            m_writer.close();
            fileOut.close();
                
        } catch (FileNotFoundException ex)  {
            ex.printStackTrace();
        } catch (IOException ex)    {
            ex.printStackTrace();
        }
    }
1230851
def tail(self, line_by_line=True, move_end=True):
        """"""
        try:
            self._open_file(move_end=move_end)

            while True:
                pos = self._f.tell()
                line = self._f.readline()
                if line:
                    line = line.strip(chr(0))  # a truncate may have create holes in the file
                    if self._callback(line.rstrip("\n")):
                        if line_by_line:
                            yield True
                            pos = self._f.tell()
                            self._open_file(move_end=False, pos=pos)
                        else:
                            continue
                    else:
                        continue
                else:
                    yield True
                    assert pos == self._f.tell()
                    self._open_file(move_end=False, pos=pos)

        except Exception as e:
            # log but survive
            self._log.exception(e)
            raise StopIteration(e)
648889
def move(self, delta):
        
        self.pos = (self.pos[0]+delta[0], self.pos[1]+delta[1])
469139
def move(self, pos):
        """"""

        try:
            payload = {"address":self.address, "user": self.user, "pwd": self.pswd, "pos": map_position(pos)}
            resp = requests.get(
                    "http://{address}/decoder_control.cgi?command={pos}&user={user}&pwd={pwd}".format(**payload)
            )
        except KeyError:
            raise CamException("Position must be within 1 to 16.")
        if resp.status_code != 200:
            raise CamException("Unauthorized. Wrong user or password.")
        return "ok"