Will inout ports used only as in or out be optimized?
In all likelihood, yes, the inout will be optimised away.

In fact in almost all devices there are no internal tri-state buffers on routing, so inout ports usually get converted into a series of multiplexers. 

If you have an inout port always being driven inside a module, then the logic will simplify down.

However, if you connect two inout ports together, and both of them are using it as an output, it may or may not result in a compiler error. If you are lucky the synthesiser will see that a net being driven by two drivers and error out. If you are unlucky, you will infer logic that optimises one of the drivers away and then you'll have a debugging headache on your hands.

If you have a port which is output only, stick to using an output type. If it is input only, then you can safely use inout or input, but better stick to input to make things easier to follow.